@thenovaweb/druid-ogold-rn-sdk 0.0.6
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/README.md +58 -0
- package/lib/commonjs/@types/react-navigation.d.js +4 -0
- package/lib/commonjs/@types/react-navigation.d.js.map +1 -0
- package/lib/commonjs/assets/data/countries.json +802 -0
- package/lib/commonjs/assets/data/enhanced.json +119 -0
- package/lib/commonjs/assets/data/form.json +155 -0
- package/lib/commonjs/assets/images/center.jpg +0 -0
- package/lib/commonjs/assets/images/doc-outlined.png +0 -0
- package/lib/commonjs/assets/images/icons8-error-64.png +0 -0
- package/lib/commonjs/assets/images/light-off.png +0 -0
- package/lib/commonjs/assets/images/live-outlined.png +0 -0
- package/lib/commonjs/assets/images/live.png +0 -0
- package/lib/commonjs/assets/images/loader.gif +0 -0
- package/lib/commonjs/assets/images/not-live.png +0 -0
- package/lib/commonjs/assets/images/nova.png +0 -0
- package/lib/commonjs/assets/images/ogold.png +0 -0
- package/lib/commonjs/assets/images/overlay.png +0 -0
- package/lib/commonjs/assets/images/pending.png +0 -0
- package/lib/commonjs/assets/images/rejected.png +0 -0
- package/lib/commonjs/assets/images/three-dots-white.png +0 -0
- package/lib/commonjs/assets/images/verified.png +0 -0
- package/lib/commonjs/assets/themes/oGold.json +30 -0
- package/lib/commonjs/assets/themes/styles.js +94 -0
- package/lib/commonjs/assets/themes/styles.js.map +1 -0
- package/lib/commonjs/components/BasicInput.js +106 -0
- package/lib/commonjs/components/BasicInput.js.map +1 -0
- package/lib/commonjs/components/BlurBackground.js +34 -0
- package/lib/commonjs/components/BlurBackground.js.map +1 -0
- package/lib/commonjs/components/Camera.js +361 -0
- package/lib/commonjs/components/Camera.js.map +1 -0
- package/lib/commonjs/components/Checkbox.js +132 -0
- package/lib/commonjs/components/Checkbox.js.map +1 -0
- package/lib/commonjs/components/DatePicker.js +146 -0
- package/lib/commonjs/components/DatePicker.js.map +1 -0
- package/lib/commonjs/components/DropdownComponent.js +229 -0
- package/lib/commonjs/components/DropdownComponent.js.map +1 -0
- package/lib/commonjs/components/FaceOverlay.js +47 -0
- package/lib/commonjs/components/FaceOverlay.js.map +1 -0
- package/lib/commonjs/components/FadeBorder.js +53 -0
- package/lib/commonjs/components/FadeBorder.js.map +1 -0
- package/lib/commonjs/components/Field.js +58 -0
- package/lib/commonjs/components/Field.js.map +1 -0
- package/lib/commonjs/components/Loader.js +43 -0
- package/lib/commonjs/components/Loader.js.map +1 -0
- package/lib/commonjs/components/NavHeader.js +47 -0
- package/lib/commonjs/components/NavHeader.js.map +1 -0
- package/lib/commonjs/components/Navigator.js +171 -0
- package/lib/commonjs/components/Navigator.js.map +1 -0
- package/lib/commonjs/components/Section.js +43 -0
- package/lib/commonjs/components/Section.js.map +1 -0
- package/lib/commonjs/components/SelectImage.js +204 -0
- package/lib/commonjs/components/SelectImage.js.map +1 -0
- package/lib/commonjs/components/TextDivider.js +43 -0
- package/lib/commonjs/components/TextDivider.js.map +1 -0
- package/lib/commonjs/components/Toaster.js +29 -0
- package/lib/commonjs/components/Toaster.js.map +1 -0
- package/lib/commonjs/index.js +112 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/screens/DocumentsScreen.js +214 -0
- package/lib/commonjs/screens/DocumentsScreen.js.map +1 -0
- package/lib/commonjs/screens/ErrorScreen.js +47 -0
- package/lib/commonjs/screens/ErrorScreen.js.map +1 -0
- package/lib/commonjs/screens/FormScreen.js +149 -0
- package/lib/commonjs/screens/FormScreen.js.map +1 -0
- package/lib/commonjs/screens/ImageUploadScreen.js +240 -0
- package/lib/commonjs/screens/ImageUploadScreen.js.map +1 -0
- package/lib/commonjs/screens/LivenessScreen.js +268 -0
- package/lib/commonjs/screens/LivenessScreen.js.map +1 -0
- package/lib/commonjs/screens/ReportScreen.js +349 -0
- package/lib/commonjs/screens/ReportScreen.js.map +1 -0
- package/lib/commonjs/screens/SuccessScreen.js +99 -0
- package/lib/commonjs/screens/SuccessScreen.js.map +1 -0
- package/lib/commonjs/screens/WelcomeScreen.js +226 -0
- package/lib/commonjs/screens/WelcomeScreen.js.map +1 -0
- package/lib/commonjs/state/hooks.js +10 -0
- package/lib/commonjs/state/hooks.js.map +1 -0
- package/lib/commonjs/state/slices/confidenceSlice.js +67 -0
- package/lib/commonjs/state/slices/confidenceSlice.js.map +1 -0
- package/lib/commonjs/state/slices/customerSlice.js +99 -0
- package/lib/commonjs/state/slices/customerSlice.js.map +1 -0
- package/lib/commonjs/state/slices/enhancedSlice.js +27 -0
- package/lib/commonjs/state/slices/enhancedSlice.js.map +1 -0
- package/lib/commonjs/state/slices/formSlice.js +111 -0
- package/lib/commonjs/state/slices/formSlice.js.map +1 -0
- package/lib/commonjs/state/slices/immutableOcrSlice.js +51 -0
- package/lib/commonjs/state/slices/immutableOcrSlice.js.map +1 -0
- package/lib/commonjs/state/slices/livenessSlice.js +54 -0
- package/lib/commonjs/state/slices/livenessSlice.js.map +1 -0
- package/lib/commonjs/state/slices/loaderSlice.js +32 -0
- package/lib/commonjs/state/slices/loaderSlice.js.map +1 -0
- package/lib/commonjs/state/slices/ocrSlice.js +447 -0
- package/lib/commonjs/state/slices/ocrSlice.js.map +1 -0
- package/lib/commonjs/state/slices/themeSlice.js +50 -0
- package/lib/commonjs/state/slices/themeSlice.js.map +1 -0
- package/lib/commonjs/state/store.js +31 -0
- package/lib/commonjs/state/store.js.map +1 -0
- package/lib/commonjs/utils/axios.js +35 -0
- package/lib/commonjs/utils/axios.js.map +1 -0
- package/lib/commonjs/utils/constants.js +43 -0
- package/lib/commonjs/utils/constants.js.map +1 -0
- package/lib/commonjs/utils/helpers.js +147 -0
- package/lib/commonjs/utils/helpers.js.map +1 -0
- package/lib/commonjs/utils/nonSliceHelpers.js +91 -0
- package/lib/commonjs/utils/nonSliceHelpers.js.map +1 -0
- package/lib/commonjs/utils/types.js +2 -0
- package/lib/commonjs/utils/types.js.map +1 -0
- package/lib/commonjs/utils/validators.js +47 -0
- package/lib/commonjs/utils/validators.js.map +1 -0
- package/lib/commonjs/utils/widgetUtility.js +111 -0
- package/lib/commonjs/utils/widgetUtility.js.map +1 -0
- package/lib/module/@types/react-navigation.d.js +4 -0
- package/lib/module/@types/react-navigation.d.js.map +1 -0
- package/lib/module/assets/data/countries.json +802 -0
- package/lib/module/assets/data/enhanced.json +119 -0
- package/lib/module/assets/data/form.json +155 -0
- package/lib/module/assets/images/center.jpg +0 -0
- package/lib/module/assets/images/doc-outlined.png +0 -0
- package/lib/module/assets/images/icons8-error-64.png +0 -0
- package/lib/module/assets/images/light-off.png +0 -0
- package/lib/module/assets/images/live-outlined.png +0 -0
- package/lib/module/assets/images/live.png +0 -0
- package/lib/module/assets/images/loader.gif +0 -0
- package/lib/module/assets/images/not-live.png +0 -0
- package/lib/module/assets/images/nova.png +0 -0
- package/lib/module/assets/images/ogold.png +0 -0
- package/lib/module/assets/images/overlay.png +0 -0
- package/lib/module/assets/images/pending.png +0 -0
- package/lib/module/assets/images/rejected.png +0 -0
- package/lib/module/assets/images/three-dots-white.png +0 -0
- package/lib/module/assets/images/verified.png +0 -0
- package/lib/module/assets/themes/oGold.json +30 -0
- package/lib/module/assets/themes/styles.js +89 -0
- package/lib/module/assets/themes/styles.js.map +1 -0
- package/lib/module/components/BasicInput.js +102 -0
- package/lib/module/components/BasicInput.js.map +1 -0
- package/lib/module/components/BlurBackground.js +30 -0
- package/lib/module/components/BlurBackground.js.map +1 -0
- package/lib/module/components/Camera.js +356 -0
- package/lib/module/components/Camera.js.map +1 -0
- package/lib/module/components/Checkbox.js +128 -0
- package/lib/module/components/Checkbox.js.map +1 -0
- package/lib/module/components/DatePicker.js +141 -0
- package/lib/module/components/DatePicker.js.map +1 -0
- package/lib/module/components/DropdownComponent.js +224 -0
- package/lib/module/components/DropdownComponent.js.map +1 -0
- package/lib/module/components/FaceOverlay.js +41 -0
- package/lib/module/components/FaceOverlay.js.map +1 -0
- package/lib/module/components/FadeBorder.js +49 -0
- package/lib/module/components/FadeBorder.js.map +1 -0
- package/lib/module/components/Field.js +53 -0
- package/lib/module/components/Field.js.map +1 -0
- package/lib/module/components/Loader.js +39 -0
- package/lib/module/components/Loader.js.map +1 -0
- package/lib/module/components/NavHeader.js +43 -0
- package/lib/module/components/NavHeader.js.map +1 -0
- package/lib/module/components/Navigator.js +166 -0
- package/lib/module/components/Navigator.js.map +1 -0
- package/lib/module/components/Section.js +38 -0
- package/lib/module/components/Section.js.map +1 -0
- package/lib/module/components/SelectImage.js +200 -0
- package/lib/module/components/SelectImage.js.map +1 -0
- package/lib/module/components/TextDivider.js +39 -0
- package/lib/module/components/TextDivider.js.map +1 -0
- package/lib/module/components/Toaster.js +24 -0
- package/lib/module/components/Toaster.js.map +1 -0
- package/lib/module/index.js +100 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/screens/DocumentsScreen.js +208 -0
- package/lib/module/screens/DocumentsScreen.js.map +1 -0
- package/lib/module/screens/ErrorScreen.js +42 -0
- package/lib/module/screens/ErrorScreen.js.map +1 -0
- package/lib/module/screens/FormScreen.js +142 -0
- package/lib/module/screens/FormScreen.js.map +1 -0
- package/lib/module/screens/ImageUploadScreen.js +235 -0
- package/lib/module/screens/ImageUploadScreen.js.map +1 -0
- package/lib/module/screens/LivenessScreen.js +262 -0
- package/lib/module/screens/LivenessScreen.js.map +1 -0
- package/lib/module/screens/ReportScreen.js +344 -0
- package/lib/module/screens/ReportScreen.js.map +1 -0
- package/lib/module/screens/SuccessScreen.js +94 -0
- package/lib/module/screens/SuccessScreen.js.map +1 -0
- package/lib/module/screens/WelcomeScreen.js +220 -0
- package/lib/module/screens/WelcomeScreen.js.map +1 -0
- package/lib/module/state/hooks.js +6 -0
- package/lib/module/state/hooks.js.map +1 -0
- package/lib/module/state/slices/confidenceSlice.js +58 -0
- package/lib/module/state/slices/confidenceSlice.js.map +1 -0
- package/lib/module/state/slices/customerSlice.js +92 -0
- package/lib/module/state/slices/customerSlice.js.map +1 -0
- package/lib/module/state/slices/enhancedSlice.js +21 -0
- package/lib/module/state/slices/enhancedSlice.js.map +1 -0
- package/lib/module/state/slices/formSlice.js +102 -0
- package/lib/module/state/slices/formSlice.js.map +1 -0
- package/lib/module/state/slices/immutableOcrSlice.js +44 -0
- package/lib/module/state/slices/immutableOcrSlice.js.map +1 -0
- package/lib/module/state/slices/livenessSlice.js +47 -0
- package/lib/module/state/slices/livenessSlice.js.map +1 -0
- package/lib/module/state/slices/loaderSlice.js +25 -0
- package/lib/module/state/slices/loaderSlice.js.map +1 -0
- package/lib/module/state/slices/ocrSlice.js +434 -0
- package/lib/module/state/slices/ocrSlice.js.map +1 -0
- package/lib/module/state/slices/themeSlice.js +45 -0
- package/lib/module/state/slices/themeSlice.js.map +1 -0
- package/lib/module/state/store.js +26 -0
- package/lib/module/state/store.js.map +1 -0
- package/lib/module/utils/axios.js +30 -0
- package/lib/module/utils/axios.js.map +1 -0
- package/lib/module/utils/constants.js +40 -0
- package/lib/module/utils/constants.js.map +1 -0
- package/lib/module/utils/helpers.js +139 -0
- package/lib/module/utils/helpers.js.map +1 -0
- package/lib/module/utils/nonSliceHelpers.js +80 -0
- package/lib/module/utils/nonSliceHelpers.js.map +1 -0
- package/lib/module/utils/types.js +2 -0
- package/lib/module/utils/types.js.map +1 -0
- package/lib/module/utils/validators.js +41 -0
- package/lib/module/utils/validators.js.map +1 -0
- package/lib/module/utils/widgetUtility.js +103 -0
- package/lib/module/utils/widgetUtility.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/assets/themes/styles.d.ts +82 -0
- package/lib/typescript/commonjs/src/assets/themes/styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/BasicInput.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/BasicInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/BlurBackground.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/BlurBackground.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Camera.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/Camera.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Checkbox.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/Checkbox.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/DatePicker.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/DatePicker.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/DropdownComponent.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/DropdownComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/FaceOverlay.d.ts +10 -0
- package/lib/typescript/commonjs/src/components/FaceOverlay.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/FadeBorder.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/FadeBorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Field.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/Field.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Loader.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/Loader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/NavHeader.d.ts +8 -0
- package/lib/typescript/commonjs/src/components/NavHeader.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Navigator.d.ts +4 -0
- package/lib/typescript/commonjs/src/components/Navigator.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Section.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/Section.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/SelectImage.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/SelectImage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/TextDivider.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/TextDivider.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/Toaster.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/Toaster.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +29 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/DocumentsScreen.d.ts +8 -0
- package/lib/typescript/commonjs/src/screens/DocumentsScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/ErrorScreen.d.ts +4 -0
- package/lib/typescript/commonjs/src/screens/ErrorScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/FormScreen.d.ts +10 -0
- package/lib/typescript/commonjs/src/screens/FormScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/ImageUploadScreen.d.ts +4 -0
- package/lib/typescript/commonjs/src/screens/ImageUploadScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/LivenessScreen.d.ts +8 -0
- package/lib/typescript/commonjs/src/screens/LivenessScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/ReportScreen.d.ts +8 -0
- package/lib/typescript/commonjs/src/screens/ReportScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/SuccessScreen.d.ts +7 -0
- package/lib/typescript/commonjs/src/screens/SuccessScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/screens/WelcomeScreen.d.ts +9 -0
- package/lib/typescript/commonjs/src/screens/WelcomeScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/hooks.d.ts +23 -0
- package/lib/typescript/commonjs/src/state/hooks.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/confidenceSlice.d.ts +29 -0
- package/lib/typescript/commonjs/src/state/slices/confidenceSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/customerSlice.d.ts +58 -0
- package/lib/typescript/commonjs/src/state/slices/customerSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/enhancedSlice.d.ts +13 -0
- package/lib/typescript/commonjs/src/state/slices/enhancedSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/formSlice.d.ts +39 -0
- package/lib/typescript/commonjs/src/state/slices/formSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/immutableOcrSlice.d.ts +43 -0
- package/lib/typescript/commonjs/src/state/slices/immutableOcrSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/livenessSlice.d.ts +37 -0
- package/lib/typescript/commonjs/src/state/slices/livenessSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/loaderSlice.d.ts +13 -0
- package/lib/typescript/commonjs/src/state/slices/loaderSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/ocrSlice.d.ts +216 -0
- package/lib/typescript/commonjs/src/state/slices/ocrSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/slices/themeSlice.d.ts +12 -0
- package/lib/typescript/commonjs/src/state/slices/themeSlice.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/state/store.d.ts +26 -0
- package/lib/typescript/commonjs/src/state/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/axios.d.ts +3 -0
- package/lib/typescript/commonjs/src/utils/axios.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/constants.d.ts +20 -0
- package/lib/typescript/commonjs/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/helpers.d.ts +15 -0
- package/lib/typescript/commonjs/src/utils/helpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/nonSliceHelpers.d.ts +19 -0
- package/lib/typescript/commonjs/src/utils/nonSliceHelpers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/types.d.ts +52 -0
- package/lib/typescript/commonjs/src/utils/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/validators.d.ts +4 -0
- package/lib/typescript/commonjs/src/utils/validators.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/widgetUtility.d.ts +22 -0
- package/lib/typescript/commonjs/src/utils/widgetUtility.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/assets/themes/styles.d.ts +82 -0
- package/lib/typescript/module/src/assets/themes/styles.d.ts.map +1 -0
- package/lib/typescript/module/src/components/BasicInput.d.ts +3 -0
- package/lib/typescript/module/src/components/BasicInput.d.ts.map +1 -0
- package/lib/typescript/module/src/components/BlurBackground.d.ts +3 -0
- package/lib/typescript/module/src/components/BlurBackground.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Camera.d.ts +8 -0
- package/lib/typescript/module/src/components/Camera.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Checkbox.d.ts +3 -0
- package/lib/typescript/module/src/components/Checkbox.d.ts.map +1 -0
- package/lib/typescript/module/src/components/DatePicker.d.ts +3 -0
- package/lib/typescript/module/src/components/DatePicker.d.ts.map +1 -0
- package/lib/typescript/module/src/components/DropdownComponent.d.ts +3 -0
- package/lib/typescript/module/src/components/DropdownComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/components/FaceOverlay.d.ts +10 -0
- package/lib/typescript/module/src/components/FaceOverlay.d.ts.map +1 -0
- package/lib/typescript/module/src/components/FadeBorder.d.ts +3 -0
- package/lib/typescript/module/src/components/FadeBorder.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Field.d.ts +3 -0
- package/lib/typescript/module/src/components/Field.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Loader.d.ts +6 -0
- package/lib/typescript/module/src/components/Loader.d.ts.map +1 -0
- package/lib/typescript/module/src/components/NavHeader.d.ts +8 -0
- package/lib/typescript/module/src/components/NavHeader.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Navigator.d.ts +4 -0
- package/lib/typescript/module/src/components/Navigator.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Section.d.ts +3 -0
- package/lib/typescript/module/src/components/Section.d.ts.map +1 -0
- package/lib/typescript/module/src/components/SelectImage.d.ts +3 -0
- package/lib/typescript/module/src/components/SelectImage.d.ts.map +1 -0
- package/lib/typescript/module/src/components/TextDivider.d.ts +6 -0
- package/lib/typescript/module/src/components/TextDivider.d.ts.map +1 -0
- package/lib/typescript/module/src/components/Toaster.d.ts +3 -0
- package/lib/typescript/module/src/components/Toaster.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +29 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/DocumentsScreen.d.ts +8 -0
- package/lib/typescript/module/src/screens/DocumentsScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/ErrorScreen.d.ts +4 -0
- package/lib/typescript/module/src/screens/ErrorScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/FormScreen.d.ts +10 -0
- package/lib/typescript/module/src/screens/FormScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/ImageUploadScreen.d.ts +4 -0
- package/lib/typescript/module/src/screens/ImageUploadScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/LivenessScreen.d.ts +8 -0
- package/lib/typescript/module/src/screens/LivenessScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/ReportScreen.d.ts +8 -0
- package/lib/typescript/module/src/screens/ReportScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/SuccessScreen.d.ts +7 -0
- package/lib/typescript/module/src/screens/SuccessScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/screens/WelcomeScreen.d.ts +9 -0
- package/lib/typescript/module/src/screens/WelcomeScreen.d.ts.map +1 -0
- package/lib/typescript/module/src/state/hooks.d.ts +23 -0
- package/lib/typescript/module/src/state/hooks.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/confidenceSlice.d.ts +29 -0
- package/lib/typescript/module/src/state/slices/confidenceSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/customerSlice.d.ts +58 -0
- package/lib/typescript/module/src/state/slices/customerSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/enhancedSlice.d.ts +13 -0
- package/lib/typescript/module/src/state/slices/enhancedSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/formSlice.d.ts +39 -0
- package/lib/typescript/module/src/state/slices/formSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/immutableOcrSlice.d.ts +43 -0
- package/lib/typescript/module/src/state/slices/immutableOcrSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/livenessSlice.d.ts +37 -0
- package/lib/typescript/module/src/state/slices/livenessSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/loaderSlice.d.ts +13 -0
- package/lib/typescript/module/src/state/slices/loaderSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/ocrSlice.d.ts +216 -0
- package/lib/typescript/module/src/state/slices/ocrSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/slices/themeSlice.d.ts +12 -0
- package/lib/typescript/module/src/state/slices/themeSlice.d.ts.map +1 -0
- package/lib/typescript/module/src/state/store.d.ts +26 -0
- package/lib/typescript/module/src/state/store.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/axios.d.ts +3 -0
- package/lib/typescript/module/src/utils/axios.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/constants.d.ts +20 -0
- package/lib/typescript/module/src/utils/constants.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/helpers.d.ts +15 -0
- package/lib/typescript/module/src/utils/helpers.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/nonSliceHelpers.d.ts +19 -0
- package/lib/typescript/module/src/utils/nonSliceHelpers.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/types.d.ts +52 -0
- package/lib/typescript/module/src/utils/types.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/validators.d.ts +4 -0
- package/lib/typescript/module/src/utils/validators.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/widgetUtility.d.ts +22 -0
- package/lib/typescript/module/src/utils/widgetUtility.d.ts.map +1 -0
- package/package.json +130 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativePaper = require("react-native-paper");
|
|
10
|
+
var _reactNativeVisionCamera = require("react-native-vision-camera");
|
|
11
|
+
var _hooks = require("../state/hooks.js");
|
|
12
|
+
var _livenessSlice = require("../state/slices/livenessSlice.js");
|
|
13
|
+
var _expoImageManipulator = require("expo-image-manipulator");
|
|
14
|
+
var _loaderSlice = require("../state/slices/loaderSlice.js");
|
|
15
|
+
var _native = require("@react-navigation/native");
|
|
16
|
+
var _reactNativeVisionCameraFaceDetector = require("react-native-vision-camera-face-detector");
|
|
17
|
+
var _reactNativeWorkletsCore = require("react-native-worklets-core");
|
|
18
|
+
var _FaceOverlay = _interopRequireDefault(require("./FaceOverlay.js"));
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
const Camera = ({
|
|
22
|
+
setIsCameraOn,
|
|
23
|
+
Toast,
|
|
24
|
+
navigation
|
|
25
|
+
}) => {
|
|
26
|
+
const theme = (0, _reactNativePaper.useTheme)();
|
|
27
|
+
const dispatch = (0, _hooks.useAppDispatch)();
|
|
28
|
+
const camera = (0, _react.useRef)(null);
|
|
29
|
+
const isFocused = (0, _native.useIsFocused)();
|
|
30
|
+
const device = (0, _reactNativeVisionCamera.useCameraDevice)('front');
|
|
31
|
+
(0, _react.useEffect)(() => {
|
|
32
|
+
if (!device) {
|
|
33
|
+
setIsCameraOn(false);
|
|
34
|
+
Toast.error('Could not detect front camera on device', 'top');
|
|
35
|
+
}
|
|
36
|
+
}, [device]);
|
|
37
|
+
if (device == null) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const stopRecording = () => {
|
|
41
|
+
dispatch((0, _loaderSlice.removeLoader)());
|
|
42
|
+
setIsCameraOn(false);
|
|
43
|
+
};
|
|
44
|
+
const lastSnapshotTime = (0, _react.useRef)(0);
|
|
45
|
+
const capturedSnapshots = (0, _react.useRef)([]);
|
|
46
|
+
const [snapshotCount, setSnapshotCount] = (0, _react.useState)(0);
|
|
47
|
+
const snapshotInProgress = (0, _react.useRef)(false);
|
|
48
|
+
const debouncedRecord = async () => {
|
|
49
|
+
if (snapshotInProgress.current) return;
|
|
50
|
+
const now = Date.now();
|
|
51
|
+
if (now - lastSnapshotTime.current < 500) return;
|
|
52
|
+
lastSnapshotTime.current = now;
|
|
53
|
+
if (!camera) {
|
|
54
|
+
Toast.error('Error mounting camera, please try again', 'top');
|
|
55
|
+
stopRecording();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
snapshotInProgress.current = true;
|
|
59
|
+
try {
|
|
60
|
+
dispatch((0, _loaderSlice.addLoader)());
|
|
61
|
+
const snapshot = await takeSnapshot();
|
|
62
|
+
capturedSnapshots.current.push(snapshot);
|
|
63
|
+
setSnapshotCount(capturedSnapshots.current.length);
|
|
64
|
+
if (capturedSnapshots.current.length >= 3) {
|
|
65
|
+
setIsCameraOn(false);
|
|
66
|
+
dispatch((0, _livenessSlice.updateLivenessFaces)({
|
|
67
|
+
isLiveFaces: capturedSnapshots.current
|
|
68
|
+
}));
|
|
69
|
+
await dispatch((0, _livenessSlice.checkFaceLiveness)({
|
|
70
|
+
faces: capturedSnapshots.current
|
|
71
|
+
}));
|
|
72
|
+
navigation.navigate('Liveness', {
|
|
73
|
+
screen: 'Liveness'
|
|
74
|
+
});
|
|
75
|
+
capturedSnapshots.current = [];
|
|
76
|
+
}
|
|
77
|
+
} catch (err) {
|
|
78
|
+
if (typeof err === 'string') {
|
|
79
|
+
Toast.error(err, 'top');
|
|
80
|
+
} else {
|
|
81
|
+
Toast.error(err.message || 'Video feed was interrupted, please try again', 'top');
|
|
82
|
+
}
|
|
83
|
+
stopRecording();
|
|
84
|
+
} finally {
|
|
85
|
+
snapshotInProgress.current = false;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const debouncedRecordJS = _reactNativeWorkletsCore.Worklets.createRunOnJS(debouncedRecord);
|
|
89
|
+
const takeSnapshot = () => {
|
|
90
|
+
const snapshotPromise = new Promise((resolve, reject) => {
|
|
91
|
+
if (!camera.current) {
|
|
92
|
+
return reject(new Error('Video feed cancelled'));
|
|
93
|
+
}
|
|
94
|
+
camera.current.takeSnapshot().then(snapshot => {
|
|
95
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
96
|
+
snapshot.path = snapshot.path.replace('file:', '');
|
|
97
|
+
}
|
|
98
|
+
(0, _expoImageManipulator.manipulateAsync)(snapshot.path, [], {
|
|
99
|
+
base64: true
|
|
100
|
+
}).then(ImageResult => {
|
|
101
|
+
resolve(ImageResult.base64);
|
|
102
|
+
}).catch(err => {
|
|
103
|
+
reject(err);
|
|
104
|
+
});
|
|
105
|
+
}).catch(err => {
|
|
106
|
+
reject(err);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
return snapshotPromise;
|
|
110
|
+
};
|
|
111
|
+
const faceDetectionOptions = {
|
|
112
|
+
performanceMode: 'fast',
|
|
113
|
+
classificationMode: 'all',
|
|
114
|
+
landmarkMode: 'all',
|
|
115
|
+
minFaceSize: 0.3
|
|
116
|
+
};
|
|
117
|
+
const [hint, setHint] = (0, _react.useState)('Place your head in the oval shape');
|
|
118
|
+
const lastHintUpdate = (0, _react.useRef)(0);
|
|
119
|
+
const THROTTLE_DELAY = 500;
|
|
120
|
+
const updateHint = newHint => {
|
|
121
|
+
const now = Date.now();
|
|
122
|
+
if (now - lastHintUpdate.current > THROTTLE_DELAY) {
|
|
123
|
+
lastHintUpdate.current = now;
|
|
124
|
+
setHint(newHint);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const updateHintFunction = _reactNativeWorkletsCore.Worklets.createRunOnJS(updateHint);
|
|
128
|
+
const FRAME_CENTER_THRESHOLD = 0.2;
|
|
129
|
+
const MIN_FACE_WIDTH = 0.25;
|
|
130
|
+
const MIN_FACE_HEIGHT = 0.25;
|
|
131
|
+
const MAX_FACE_WIDTH = 0.5;
|
|
132
|
+
const MAX_FACE_HEIGHT = 0.5;
|
|
133
|
+
const {
|
|
134
|
+
detectFaces
|
|
135
|
+
} = (0, _reactNativeVisionCameraFaceDetector.useFaceDetector)(faceDetectionOptions);
|
|
136
|
+
const frameProcessor = (0, _reactNativeVisionCamera.useFrameProcessor)(frame => {
|
|
137
|
+
'worklet';
|
|
138
|
+
|
|
139
|
+
const faces = detectFaces(frame);
|
|
140
|
+
if (faces.length === 0) {
|
|
141
|
+
updateHintFunction('Align your face in the oval');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (faces.length > 1) {
|
|
145
|
+
updateHintFunction('Multiple faces detected, only one person should be in frame');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const face = faces[0];
|
|
149
|
+
const frameWidth = frame.width;
|
|
150
|
+
const frameHeight = frame.height;
|
|
151
|
+
const faceCenterX = face.bounds.x + face.bounds.width / 2;
|
|
152
|
+
const faceCenterY = face.bounds.y + face.bounds.height / 2;
|
|
153
|
+
const centerX = frameWidth / 2;
|
|
154
|
+
const centerY = frameHeight / 2;
|
|
155
|
+
const offsetX = Math.abs(faceCenterX - centerX) / frameWidth;
|
|
156
|
+
const offsetY = Math.abs(faceCenterY - centerY) / frameHeight;
|
|
157
|
+
const faceWidthRatio = face.bounds.width / frameWidth;
|
|
158
|
+
const faceHeightRatio = face.bounds.height / frameHeight;
|
|
159
|
+
const eyesOpen = (face.leftEyeOpenProbability ?? 0) > 0.5 && (face.rightEyeOpenProbability ?? 0) > 0.5;
|
|
160
|
+
const smiling = (face.smilingProbability ?? 0) > 0.6;
|
|
161
|
+
const turnedLeft = (face.yawAngle ?? 0) < -15;
|
|
162
|
+
const turnedRight = (face.yawAngle ?? 0) > 15;
|
|
163
|
+
const tiltedUp = (face.pitchAngle ?? 0) < -10;
|
|
164
|
+
const tiltedDown = (face.pitchAngle ?? 0) > 10;
|
|
165
|
+
const rolledLeft = (face.rollAngle ?? 0) < -10;
|
|
166
|
+
const rolledRight = (face.rollAngle ?? 0) > 10;
|
|
167
|
+
let newHint = '';
|
|
168
|
+
if (faceWidthRatio < MIN_FACE_WIDTH || faceHeightRatio < MIN_FACE_HEIGHT) {
|
|
169
|
+
newHint = 'Move closer to the camera';
|
|
170
|
+
} else if (faceWidthRatio > MAX_FACE_WIDTH || faceHeightRatio > MAX_FACE_HEIGHT) {
|
|
171
|
+
newHint = 'Move further away from the camera';
|
|
172
|
+
} else if (offsetX > FRAME_CENTER_THRESHOLD && faceCenterX < centerX) {
|
|
173
|
+
newHint = 'Move slightly left';
|
|
174
|
+
} else if (offsetY < FRAME_CENTER_THRESHOLD && faceCenterX > centerX) {
|
|
175
|
+
newHint = 'Move slightly right';
|
|
176
|
+
} else if (offsetY > FRAME_CENTER_THRESHOLD) {
|
|
177
|
+
newHint = faceCenterY < centerY ? 'Move slightly down' : 'Move slightly up';
|
|
178
|
+
} else if (turnedLeft) {
|
|
179
|
+
newHint = 'Turn your head left';
|
|
180
|
+
} else if (turnedRight) {
|
|
181
|
+
newHint = 'Turn your head right';
|
|
182
|
+
} else if (tiltedUp) {
|
|
183
|
+
newHint = 'Raise your head slightly';
|
|
184
|
+
} else if (tiltedDown) {
|
|
185
|
+
newHint = 'Lower your head slightly';
|
|
186
|
+
} else if (rolledLeft) {
|
|
187
|
+
newHint = 'Tilt your head right';
|
|
188
|
+
} else if (rolledRight) {
|
|
189
|
+
newHint = 'Tilt your head left';
|
|
190
|
+
}
|
|
191
|
+
// else if (!eyesOpen) {
|
|
192
|
+
// newHint = 'Please open your eyes'
|
|
193
|
+
// }
|
|
194
|
+
// else if (smiling) {
|
|
195
|
+
// newHint = 'Stop smiling for a moment'
|
|
196
|
+
// } -> Not needed
|
|
197
|
+
else {
|
|
198
|
+
newHint = 'Good, stay still';
|
|
199
|
+
debouncedRecordJS();
|
|
200
|
+
}
|
|
201
|
+
updateHintFunction(newHint);
|
|
202
|
+
}, [detectFaces]);
|
|
203
|
+
const getCardBackgroundColor = () => {
|
|
204
|
+
if (hint === 'Good, stay still') {
|
|
205
|
+
return '#98FB98';
|
|
206
|
+
}
|
|
207
|
+
return theme.colors.primaryContainer;
|
|
208
|
+
};
|
|
209
|
+
const getTextColor = () => {
|
|
210
|
+
if (hint === 'Good, stay still') {
|
|
211
|
+
return theme.colors.primary;
|
|
212
|
+
}
|
|
213
|
+
return theme.colors.background;
|
|
214
|
+
};
|
|
215
|
+
const {
|
|
216
|
+
width: screenWidth,
|
|
217
|
+
height: screenHeight
|
|
218
|
+
} = _reactNative.Dimensions.get('window');
|
|
219
|
+
const styles = _reactNative.StyleSheet.create({
|
|
220
|
+
camera: {
|
|
221
|
+
flex: 1,
|
|
222
|
+
display: 'flex',
|
|
223
|
+
flexDirection: 'row',
|
|
224
|
+
justifyContent: 'center'
|
|
225
|
+
},
|
|
226
|
+
cameraContainer: {
|
|
227
|
+
backgroundColor: 'transparent',
|
|
228
|
+
position: 'absolute',
|
|
229
|
+
display: 'flex',
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
alignItems: 'center',
|
|
232
|
+
alignSelf: 'center',
|
|
233
|
+
marginTop: '20%'
|
|
234
|
+
},
|
|
235
|
+
cameraGifOverlay: {
|
|
236
|
+
position: 'relative',
|
|
237
|
+
width: '130%',
|
|
238
|
+
height: 630,
|
|
239
|
+
zIndex: 999,
|
|
240
|
+
backgroundColor: 'transparent'
|
|
241
|
+
},
|
|
242
|
+
card: {
|
|
243
|
+
marginTop: 20,
|
|
244
|
+
width: 300,
|
|
245
|
+
height: 50,
|
|
246
|
+
display: 'flex',
|
|
247
|
+
borderColor: 'red',
|
|
248
|
+
justifyContent: 'center',
|
|
249
|
+
backgroundColor: theme.colors.background,
|
|
250
|
+
opacity: 0.8
|
|
251
|
+
},
|
|
252
|
+
cardBottom: {
|
|
253
|
+
bottom: 50,
|
|
254
|
+
width: 300,
|
|
255
|
+
height: 50,
|
|
256
|
+
display: 'flex',
|
|
257
|
+
borderColor: 'red',
|
|
258
|
+
justifyContent: 'center',
|
|
259
|
+
backgroundColor: theme.colors.primaryContainer,
|
|
260
|
+
opacity: 0.8
|
|
261
|
+
},
|
|
262
|
+
text: {
|
|
263
|
+
alignSelf: 'center',
|
|
264
|
+
display: 'flex',
|
|
265
|
+
color: theme.colors.background,
|
|
266
|
+
marginVertical: 5,
|
|
267
|
+
textAlign: 'center'
|
|
268
|
+
},
|
|
269
|
+
closeIcon: {
|
|
270
|
+
flex: 1,
|
|
271
|
+
flexDirection: "row",
|
|
272
|
+
marginTop: 0,
|
|
273
|
+
alignSelf: "flex-end",
|
|
274
|
+
marginRight: -30
|
|
275
|
+
},
|
|
276
|
+
progressContainer: {
|
|
277
|
+
position: 'absolute',
|
|
278
|
+
top: 20,
|
|
279
|
+
marginTop: 5,
|
|
280
|
+
alignSelf: 'center',
|
|
281
|
+
width: '80%',
|
|
282
|
+
zIndex: 1000
|
|
283
|
+
},
|
|
284
|
+
progressBar: {
|
|
285
|
+
height: 4,
|
|
286
|
+
borderRadius: 2,
|
|
287
|
+
backgroundColor: `${theme.colors.primaryContainer}20`
|
|
288
|
+
},
|
|
289
|
+
overlayContainer: {
|
|
290
|
+
..._reactNative.StyleSheet.absoluteFillObject,
|
|
291
|
+
justifyContent: 'center',
|
|
292
|
+
alignItems: 'center',
|
|
293
|
+
zIndex: 200
|
|
294
|
+
},
|
|
295
|
+
overlay: {
|
|
296
|
+
backgroundColor: 'rgba(0,0,0,0.5)'
|
|
297
|
+
},
|
|
298
|
+
cutout: {
|
|
299
|
+
width: 220,
|
|
300
|
+
height: 280,
|
|
301
|
+
borderRadius: 140,
|
|
302
|
+
borderWidth: 2,
|
|
303
|
+
borderColor: 'rgba(255,255,255,0.8)',
|
|
304
|
+
backgroundColor: 'transparent'
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
308
|
+
style: styles.camera,
|
|
309
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeVisionCamera.Camera, {
|
|
310
|
+
frameProcessor: frameProcessor,
|
|
311
|
+
ref: camera,
|
|
312
|
+
device: device,
|
|
313
|
+
isActive: isFocused,
|
|
314
|
+
video: true,
|
|
315
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
316
|
+
onError: err => {
|
|
317
|
+
Toast.error(err.message || 'Failed to mount camera', 'top');
|
|
318
|
+
stopRecording();
|
|
319
|
+
}
|
|
320
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FaceOverlay.default, {
|
|
321
|
+
width: screenWidth,
|
|
322
|
+
height: screenHeight
|
|
323
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
324
|
+
style: styles.cameraContainer,
|
|
325
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
326
|
+
style: styles.progressContainer,
|
|
327
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.ProgressBar, {
|
|
328
|
+
progress: snapshotCount / 3,
|
|
329
|
+
color: theme.colors.primaryContainer,
|
|
330
|
+
style: styles.progressBar
|
|
331
|
+
})
|
|
332
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
333
|
+
style: styles.closeIcon,
|
|
334
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.IconButton, {
|
|
335
|
+
icon: "x",
|
|
336
|
+
iconColor: theme.colors.error,
|
|
337
|
+
size: 30,
|
|
338
|
+
"sentry-label": "Cancel liveness stream",
|
|
339
|
+
onPress: () => {
|
|
340
|
+
stopRecording();
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
344
|
+
style: styles.cameraGifOverlay,
|
|
345
|
+
source: require('../assets/images/overlay.png')
|
|
346
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Card, {
|
|
347
|
+
style: [styles.cardBottom, {
|
|
348
|
+
backgroundColor: getCardBackgroundColor()
|
|
349
|
+
}],
|
|
350
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
351
|
+
style: [styles.text, {
|
|
352
|
+
color: getTextColor()
|
|
353
|
+
}],
|
|
354
|
+
children: hint
|
|
355
|
+
})
|
|
356
|
+
})]
|
|
357
|
+
})]
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
var _default = exports.default = Camera;
|
|
361
|
+
//# sourceMappingURL=Camera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativePaper","_reactNativeVisionCamera","_hooks","_livenessSlice","_expoImageManipulator","_loaderSlice","_native","_reactNativeVisionCameraFaceDetector","_reactNativeWorkletsCore","_FaceOverlay","_interopRequireDefault","_jsxRuntime","e","__esModule","default","Camera","setIsCameraOn","Toast","navigation","theme","useTheme","dispatch","useAppDispatch","camera","useRef","isFocused","useIsFocused","device","useCameraDevice","useEffect","error","stopRecording","removeLoader","lastSnapshotTime","capturedSnapshots","snapshotCount","setSnapshotCount","useState","snapshotInProgress","debouncedRecord","current","now","Date","addLoader","snapshot","takeSnapshot","push","length","updateLivenessFaces","isLiveFaces","checkFaceLiveness","faces","navigate","screen","err","message","debouncedRecordJS","Worklets","createRunOnJS","snapshotPromise","Promise","resolve","reject","Error","then","Platform","OS","path","replace","manipulateAsync","base64","ImageResult","catch","faceDetectionOptions","performanceMode","classificationMode","landmarkMode","minFaceSize","hint","setHint","lastHintUpdate","THROTTLE_DELAY","updateHint","newHint","updateHintFunction","FRAME_CENTER_THRESHOLD","MIN_FACE_WIDTH","MIN_FACE_HEIGHT","MAX_FACE_WIDTH","MAX_FACE_HEIGHT","detectFaces","useFaceDetector","frameProcessor","useFrameProcessor","frame","face","frameWidth","width","frameHeight","height","faceCenterX","bounds","x","faceCenterY","y","centerX","centerY","offsetX","Math","abs","offsetY","faceWidthRatio","faceHeightRatio","eyesOpen","leftEyeOpenProbability","rightEyeOpenProbability","smiling","smilingProbability","turnedLeft","yawAngle","turnedRight","tiltedUp","pitchAngle","tiltedDown","rolledLeft","rollAngle","rolledRight","getCardBackgroundColor","colors","primaryContainer","getTextColor","primary","background","screenWidth","screenHeight","Dimensions","get","styles","StyleSheet","create","flex","display","flexDirection","justifyContent","cameraContainer","backgroundColor","position","alignItems","alignSelf","marginTop","cameraGifOverlay","zIndex","card","borderColor","opacity","cardBottom","bottom","text","color","marginVertical","textAlign","closeIcon","marginRight","progressContainer","top","progressBar","borderRadius","overlayContainer","absoluteFillObject","overlay","cutout","borderWidth","jsxs","View","style","children","jsx","ref","isActive","video","absoluteFill","onError","ProgressBar","progress","IconButton","icon","iconColor","size","onPress","Image","source","Card","Text","_default","exports"],"sourceRoot":"..\\..\\..\\src","sources":["components/Camera.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAH,OAAA;AAQA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,oCAAA,GAAAT,OAAA;AACA,IAAAU,wBAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAC,sBAAA,CAAAZ,OAAA;AAAwC,IAAAa,WAAA,GAAAb,OAAA;AAAA,SAAAY,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQxC,MAAMG,MAA6B,GAAGA,CAAC;EAAEC,aAAa;EAAEC,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ChL,iBAAA,CAAAwL,UAAU;UACTC,IAAI,EAAE,GAAI;UACVC,SAAS,EAAEvK,KAAK,CAAC6G,MAAM,CAAClG,KAAM;UAC9B6J,IAAI,EAAE,EAAG;UACT,gBAAa,wBAAwB;UACrCC,OAAO,EAAEA,CAAA,KAAM;YACb7J,aAAa,CAAC,CAAC;UACjB;QAAE,CACH;MAAC,CACE,CAAC,eACP,IAAApB,WAAA,CAAAqK,GAAA,EAACjL,YAAA,CAAA8L,KAAK;QACJf,KAAK,EAAErC,MAAM,CAACa,gBAAiB;QAC/BwC,MAAM,EAAEhM,OAAO,CAAC,8BAA8B;MAAE,CACjD,CAAC,eACF,IAAAa,WAAA,CAAAqK,GAAA,EAAChL,iBAAA,CAAA+L,IAAI;QAACjB,KAAK,EAAE,CAACrC,MAAM,CAACkB,UAAU,EAAE;UAAEV,eAAe,EAAElB,sBAAsB,CAAC;QAAE,CAAC,CAAE;QAAAgD,QAAA,eAC9E,IAAApK,WAAA,CAAAqK,GAAA,EAAChL,iBAAA,CAAAgM,IAAI;UAAClB,KAAK,EAAE,CAACrC,MAAM,CAACoB,IAAI,EAAE;YAACC,KAAK,EAAE5B,YAAY,CAAC;UAAC,CAAC,CAAE;UAAA6C,QAAA,EAAEjG;QAAI,CAAO;MAAC,CAC9D,CAAC;IAAA,CACH,CAAC;EAAA,CACH,CAAC;AAEX,CAAC;AAAC,IAAAmH,QAAA,GAAAC,OAAA,CAAApL,OAAA,GAEaC,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativePaper = require("react-native-paper");
|
|
10
|
+
var _hooks = require("../state/hooks.js");
|
|
11
|
+
var _formSlice = require("../state/slices/formSlice.js");
|
|
12
|
+
var _nonSliceHelpers = require("../utils/nonSliceHelpers.js");
|
|
13
|
+
var _helpers = require("../utils/helpers.js");
|
|
14
|
+
var _ocrSlice = require("../state/slices/ocrSlice.js");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const CheckboxComponent = props => {
|
|
17
|
+
const theme = (0, _reactNativePaper.useTheme)();
|
|
18
|
+
const dispatch = (0, _hooks.useAppDispatch)();
|
|
19
|
+
const {
|
|
20
|
+
passport,
|
|
21
|
+
emiratesid
|
|
22
|
+
} = (0, _hooks.useAppSelector)(state => state.ocrData);
|
|
23
|
+
const {
|
|
24
|
+
field,
|
|
25
|
+
path,
|
|
26
|
+
isSubmitAttempted,
|
|
27
|
+
sectionName
|
|
28
|
+
} = props;
|
|
29
|
+
const defaultIndex = field.options.indexOf(field.answer);
|
|
30
|
+
const [selectedIndex, setIndex] = (0, _react.useState)(defaultIndex);
|
|
31
|
+
const [error, setError] = (0, _react.useState)('');
|
|
32
|
+
const [isConfidenceLow, setIsConfidenceLow] = (0, _react.useState)(false);
|
|
33
|
+
(0, _react.useEffect)(() => {
|
|
34
|
+
if ((0, _helpers.isFieldConfidenceLow)(sectionName, field.label, emiratesid.fieldsConfidence, passport.fieldsConfidence)) {
|
|
35
|
+
setIsConfidenceLow(true);
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
(0, _react.useEffect)(() => {
|
|
39
|
+
if (isSubmitAttempted && field.required && !field.answer) {
|
|
40
|
+
setError('Required *');
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const handleChange = key => {
|
|
44
|
+
setIndex(key);
|
|
45
|
+
setError('');
|
|
46
|
+
setIsConfidenceLow(false);
|
|
47
|
+
dispatch((0, _formSlice.handleFieldChange)({
|
|
48
|
+
path: path + '.answer',
|
|
49
|
+
value: field.options[key]
|
|
50
|
+
}));
|
|
51
|
+
dispatch((0, _ocrSlice.updateFieldConfidence)({
|
|
52
|
+
sectionName,
|
|
53
|
+
label: field.label
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
const isChecked = key => {
|
|
57
|
+
if (selectedIndex === key) {
|
|
58
|
+
return 'checked';
|
|
59
|
+
} else {
|
|
60
|
+
return 'unchecked';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const styles = _reactNative.StyleSheet.create({
|
|
64
|
+
field: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column'
|
|
67
|
+
},
|
|
68
|
+
input: {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
gap: 10,
|
|
73
|
+
flexWrap: 'wrap'
|
|
74
|
+
},
|
|
75
|
+
checkBoxBorder: {
|
|
76
|
+
display: 'flex',
|
|
77
|
+
borderWidth: 1,
|
|
78
|
+
borderRadius: 6,
|
|
79
|
+
marginTop: 10,
|
|
80
|
+
borderColor: theme.colors.secondary,
|
|
81
|
+
height: 35,
|
|
82
|
+
width: 35,
|
|
83
|
+
transform: [{
|
|
84
|
+
scale: 0.7
|
|
85
|
+
}]
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
89
|
+
style: styles.field,
|
|
90
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
91
|
+
style: {
|
|
92
|
+
color: theme.colors.onPrimary
|
|
93
|
+
},
|
|
94
|
+
children: field.label
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
96
|
+
style: styles.input,
|
|
97
|
+
children: field.options.map((option, key) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
98
|
+
style: styles.input,
|
|
99
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
100
|
+
style: _reactNative.Platform.OS == 'ios' ? styles.checkBoxBorder : null,
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Checkbox, {
|
|
102
|
+
status: isChecked(key),
|
|
103
|
+
onPress: () => handleChange(key),
|
|
104
|
+
color: theme.colors.secondary,
|
|
105
|
+
uncheckedColor: theme.colors.onSecondary
|
|
106
|
+
})
|
|
107
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
108
|
+
style: {
|
|
109
|
+
color: theme.colors.onPrimary
|
|
110
|
+
},
|
|
111
|
+
children: (0, _nonSliceHelpers.capitalizeWords)(option)
|
|
112
|
+
})]
|
|
113
|
+
}, key))
|
|
114
|
+
}), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
115
|
+
variant: "labelSmall",
|
|
116
|
+
style: {
|
|
117
|
+
color: 'red',
|
|
118
|
+
marginTop: 0
|
|
119
|
+
},
|
|
120
|
+
children: error
|
|
121
|
+
}), !error && isConfidenceLow && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
122
|
+
variant: "labelSmall",
|
|
123
|
+
style: {
|
|
124
|
+
color: theme.colors.secondary,
|
|
125
|
+
marginTop: 0
|
|
126
|
+
},
|
|
127
|
+
children: "Low confidence, verify."
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
var _default = exports.default = CheckboxComponent;
|
|
132
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_reactNativePaper","_hooks","_formSlice","_nonSliceHelpers","_helpers","_ocrSlice","_jsxRuntime","CheckboxComponent","props","theme","useTheme","dispatch","useAppDispatch","passport","emiratesid","useAppSelector","state","ocrData","field","path","isSubmitAttempted","sectionName","defaultIndex","options","indexOf","answer","selectedIndex","setIndex","useState","error","setError","isConfidenceLow","setIsConfidenceLow","useEffect","isFieldConfidenceLow","label","fieldsConfidence","required","handleChange","key","handleFieldChange","value","updateFieldConfidence","isChecked","styles","StyleSheet","create","display","flexDirection","input","alignItems","gap","flexWrap","checkBoxBorder","borderWidth","borderRadius","marginTop","borderColor","colors","secondary","height","width","transform","scale","jsxs","View","style","children","jsx","Text","color","onPrimary","map","option","Platform","OS","Checkbox","status","onPress","uncheckedColor","onSecondary","capitalizeWords","variant","_default","exports","default"],"sourceRoot":"..\\..\\..\\src","sources":["components/Checkbox.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAAmG,IAAAQ,WAAA,GAAAR,OAAA;AAEnG,MAAMS,iBAAiB,GAAIC,KAAU,IAAK;EACxC,MAAMC,KAAK,GAAG,IAAAC,0BAAQ,EAAC,CAAC;EACxB,MAAMC,QAAQ,GAAG,IAAAC,qBAAc,EAAC,CAAC;EACjC,MAAM;IAAEC,QAAQ;IAAEC;EAAW,CAAC,GAAG,IAAAC,qBAAc,EAACC,KAAK,IAAIA,KAAK,CAACC,OAAO,CAAC;EAEvE,MAAM;IAAEC,KAAK;IAAEC,IAAI;IAAEC,iBAAiB;IAAEC;EAAY,CAAC,GAAGb,KAAK;EAC7D,MAAMc,YAAY,GAAGJ,KAAK,CAACK,OAAO,CAACC,OAAO,CAACN,KAAK,CAACO,MAAM,CAAC;EACxD,MAAM,CAACC,aAAa,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACN,YAAY,CAAC;EACxD,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAF,eAAQ,EAAC,EAAE,CAAC;EACtC,MAAM,CAACG,eAAe,EAAEC,kBA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,QAAQ;YACPC,MAAM,EAAElC,SAAS,CAACJ,GAAG,CAAE;YACvBuC,OAAO,EAAEA,CAAA,KAAMxC,YAAY,CAACC,GAAG,CAAE;YACjC+B,KAAK,EAAE7D,KAAK,CAACiD,MAAM,CAACC,SAAU;YAC9BoB,cAAc,EAAEtE,KAAK,CAACiD,MAAM,CAACsB;UAAY,CAC1C;QAAC,CACE,CAAC,eACP,IAAA1E,WAAA,CAAA8D,GAAA,EAACpE,iBAAA,CAAAqE,IAAI;UAACH,KAAK,EAAE;YAAEI,KAAK,EAAE7D,KAAK,CAACiD,MAAM,CAACa;UAAU,CAAE;UAAAJ,QAAA,EAAE,IAAAc,gCAAe,EAACR,MAAM;QAAC,CAAO,CAAC;MAAA,GATlDlC,GAU1B,CACP;IAAC,CACE,CAAC,EACNV,KAAK,iBACJ,IAAAvB,WAAA,CAAA8D,GAAA,EAACpE,iBAAA,CAAAqE,IAAI;MAACa,OAAO,EAAC,YAAY;MAAChB,KAAK,EAAE;QAAEI,KAAK,EAAE,KAAK;QAAEd,SAAS,EAAE;MAAE,CAAE;MAAAW,QAAA,EAC9DtC;IAAK,CACF,CACP,EACA,CAACA,KAAK,IAAIE,eAAe,iBACxB,IAAAzB,WAAA,CAAA8D,GAAA,EAACpE,iBAAA,CAAAqE,IAAI;MAACa,OAAO,EAAC,YAAY;MAAChB,KAAK,EAAE;QAAEI,KAAK,EAAE7D,KAAK,CAACiD,MAAM,CAACC,SAAS;QAAEH,SAAS,EAAE;MAAE,CAAE;MAAAW,QAAA,EAC/E;IAAyB,CACtB,CACP;EAAA,CACG,CAAC;AAEX,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa9E,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNativeModalDatetimePicker = _interopRequireDefault(require("react-native-modal-datetime-picker"));
|
|
9
|
+
var _reactNativePaper = require("react-native-paper");
|
|
10
|
+
var _formSlice = require("../state/slices/formSlice.js");
|
|
11
|
+
var _reactNative = require("react-native");
|
|
12
|
+
var _hooks = require("../state/hooks.js");
|
|
13
|
+
var _helpers = require("../utils/helpers.js");
|
|
14
|
+
var _ocrSlice = require("../state/slices/ocrSlice.js");
|
|
15
|
+
var _validators = require("../utils/validators.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
const DatePicker = props => {
|
|
19
|
+
const dispatch = (0, _hooks.useAppDispatch)();
|
|
20
|
+
const theme = (0, _reactNativePaper.useTheme)();
|
|
21
|
+
const {
|
|
22
|
+
passport,
|
|
23
|
+
emiratesid
|
|
24
|
+
} = (0, _hooks.useAppSelector)(state => state.ocrData);
|
|
25
|
+
const {
|
|
26
|
+
field,
|
|
27
|
+
path,
|
|
28
|
+
isSubmitAttempted,
|
|
29
|
+
sectionName
|
|
30
|
+
} = props;
|
|
31
|
+
const [value, setValue] = (0, _react.useState)(field.answer);
|
|
32
|
+
const [error, setError] = (0, _react.useState)('');
|
|
33
|
+
const [date, setDate] = (0, _react.useState)();
|
|
34
|
+
const [isDatePickerVisible, setDatePickerVisibility] = (0, _react.useState)(false);
|
|
35
|
+
const [isConfidenceLow, setIsConfidenceLow] = (0, _react.useState)(false);
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
37
|
+
if ((0, _helpers.isFieldConfidenceLow)(sectionName, field.label, emiratesid.fieldsConfidence, passport.fieldsConfidence)) {
|
|
38
|
+
setIsConfidenceLow(true);
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
if (isSubmitAttempted && field.required && !field.answer) {
|
|
43
|
+
setError('Required *');
|
|
44
|
+
} else if (isSubmitAttempted && !(0, _validators.validateDate)(field.answer)) {
|
|
45
|
+
setError("Please enter a valid date");
|
|
46
|
+
} else {
|
|
47
|
+
setError('');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const showDatePicker = () => {
|
|
51
|
+
setDatePickerVisibility(true);
|
|
52
|
+
};
|
|
53
|
+
const hideDatePicker = () => {
|
|
54
|
+
setDatePickerVisibility(false);
|
|
55
|
+
};
|
|
56
|
+
const shouldHaveMaxDate = field.label === "Date of Birth" || field.label === "Date of Issue";
|
|
57
|
+
const shouldHaveMinDate = field.label === "Date of Expiry";
|
|
58
|
+
const handleConfirm = date => {
|
|
59
|
+
setError('');
|
|
60
|
+
hideDatePicker();
|
|
61
|
+
setDate(date);
|
|
62
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
63
|
+
// The getMonth() method of Date instances returns the month for this date according to local time,
|
|
64
|
+
// as a zero-based value (where zero indicates the first month of the year).
|
|
65
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
66
|
+
const year = date.getFullYear();
|
|
67
|
+
const formattedDate = day + '/' + month + '/' + year;
|
|
68
|
+
if (!(0, _validators.validateDate)(formattedDate)) {
|
|
69
|
+
setError("Please enter a valid date");
|
|
70
|
+
}
|
|
71
|
+
setValue(formattedDate);
|
|
72
|
+
setIsConfidenceLow(false);
|
|
73
|
+
dispatch((0, _formSlice.handleFieldChange)({
|
|
74
|
+
path: path + '.answer',
|
|
75
|
+
value: formattedDate
|
|
76
|
+
}));
|
|
77
|
+
dispatch((0, _ocrSlice.updateFieldConfidence)({
|
|
78
|
+
sectionName,
|
|
79
|
+
label: field.label
|
|
80
|
+
}));
|
|
81
|
+
};
|
|
82
|
+
const styles = _reactNative.StyleSheet.create({
|
|
83
|
+
field: {
|
|
84
|
+
display: 'flex',
|
|
85
|
+
gap: 6
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const defaultColor = isConfidenceLow ? theme.colors.secondary : theme.colors.surface;
|
|
89
|
+
const borderColor = error ? 'red' : defaultColor;
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
91
|
+
style: styles.field,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
93
|
+
style: {
|
|
94
|
+
color: theme.colors.onPrimary
|
|
95
|
+
},
|
|
96
|
+
children: field.label
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Button, {
|
|
98
|
+
icon: "calendar",
|
|
99
|
+
mode: "outlined",
|
|
100
|
+
onPress: showDatePicker,
|
|
101
|
+
labelStyle: {
|
|
102
|
+
marginHorizontal: 0
|
|
103
|
+
},
|
|
104
|
+
contentStyle: {
|
|
105
|
+
flexDirection: 'row-reverse',
|
|
106
|
+
height: 50,
|
|
107
|
+
justifyContent: 'space-between',
|
|
108
|
+
marginRight: 14,
|
|
109
|
+
marginLeft: 14
|
|
110
|
+
},
|
|
111
|
+
style: {
|
|
112
|
+
borderColor: borderColor,
|
|
113
|
+
borderRadius: 8,
|
|
114
|
+
display: 'flex',
|
|
115
|
+
backgroundColor: theme.colors.surfaceVariant,
|
|
116
|
+
height: 50
|
|
117
|
+
},
|
|
118
|
+
textColor: value ? theme.colors.onPrimary : "#918c8c",
|
|
119
|
+
children: value ? value : field.placeholder
|
|
120
|
+
}), error && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
121
|
+
variant: "labelSmall",
|
|
122
|
+
style: {
|
|
123
|
+
color: 'red',
|
|
124
|
+
marginTop: 0
|
|
125
|
+
},
|
|
126
|
+
children: error
|
|
127
|
+
}), !error && isConfidenceLow && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativePaper.Text, {
|
|
128
|
+
variant: "labelSmall",
|
|
129
|
+
style: {
|
|
130
|
+
color: theme.colors.secondary,
|
|
131
|
+
marginTop: 0
|
|
132
|
+
},
|
|
133
|
+
children: "Low confidence, verify."
|
|
134
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeModalDatetimePicker.default, {
|
|
135
|
+
isVisible: isDatePickerVisible,
|
|
136
|
+
mode: "date",
|
|
137
|
+
date: date,
|
|
138
|
+
onConfirm: handleConfirm,
|
|
139
|
+
onCancel: hideDatePicker,
|
|
140
|
+
maximumDate: shouldHaveMaxDate ? new Date() : undefined,
|
|
141
|
+
minimumDate: shouldHaveMinDate ? new Date() : undefined
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
var _default = exports.default = DatePicker;
|
|
146
|
+
//# sourceMappingURL=DatePicker.js.map
|