@proteoapp/react-native-onboarding 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -0
- package/README.md +294 -0
- package/assets/svgs/arrow-right.tsx +13 -0
- package/assets/svgs/back-document-circle.tsx +14 -0
- package/assets/svgs/camera-error-circle.tsx +47 -0
- package/assets/svgs/camera-plus.tsx +13 -0
- package/assets/svgs/checklist-circle.tsx +93 -0
- package/assets/svgs/clock-circle.tsx +40 -0
- package/assets/svgs/document-2.tsx +31 -0
- package/assets/svgs/document-avatar.tsx +148 -0
- package/assets/svgs/document-camera-overlay.tsx +52 -0
- package/assets/svgs/document-circle.tsx +14 -0
- package/assets/svgs/document.tsx +13 -0
- package/assets/svgs/face-auth-avatar.tsx +135 -0
- package/assets/svgs/face-auth-camera-overlay.tsx +51 -0
- package/assets/svgs/face-id-circle.tsx +16 -0
- package/assets/svgs/face-id-error.tsx +40 -0
- package/assets/svgs/face-id.tsx +13 -0
- package/assets/svgs/index.ts +24 -0
- package/assets/svgs/location-error-circle.tsx +61 -0
- package/assets/svgs/process-finished.tsx +40 -0
- package/assets/svgs/refresh.tsx +13 -0
- package/assets/svgs/shield-check-circle.tsx +13 -0
- package/assets/svgs/thumb-up.tsx +37 -0
- package/assets/svgs/upload.tsx +13 -0
- package/assets/svgs/x-error-circle.tsx +40 -0
- package/assets/svgs/x.tsx +13 -0
- package/lib/module/app.js +12 -0
- package/lib/module/app.js.map +1 -0
- package/lib/module/components/button.js +43 -0
- package/lib/module/components/button.js.map +1 -0
- package/lib/module/components/centered-loading.js +17 -0
- package/lib/module/components/centered-loading.js.map +1 -0
- package/lib/module/components/default-error-fallback.js +28 -0
- package/lib/module/components/default-error-fallback.js.map +1 -0
- package/lib/module/components/default-loading.js +32 -0
- package/lib/module/components/default-loading.js.map +1 -0
- package/lib/module/components/description-loading.js +42 -0
- package/lib/module/components/description-loading.js.map +1 -0
- package/lib/module/components/error-fallback.js +57 -0
- package/lib/module/components/error-fallback.js.map +1 -0
- package/lib/module/components/identification-error.js +41 -0
- package/lib/module/components/identification-error.js.map +1 -0
- package/lib/module/components/index.js +13 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/loading.js +43 -0
- package/lib/module/components/loading.js.map +1 -0
- package/lib/module/components/progress-indicator.js +45 -0
- package/lib/module/components/progress-indicator.js.map +1 -0
- package/lib/module/components/recommended-validations.js +82 -0
- package/lib/module/components/recommended-validations.js.map +1 -0
- package/lib/module/constants/camera-error-messages.js +11 -0
- package/lib/module/constants/camera-error-messages.js.map +1 -0
- package/lib/module/constants/environments.js +35 -0
- package/lib/module/constants/environments.js.map +1 -0
- package/lib/module/constants/error-header-fields.js +31 -0
- package/lib/module/constants/error-header-fields.js.map +1 -0
- package/lib/module/constants/image-type-references.js +10 -0
- package/lib/module/constants/image-type-references.js.map +1 -0
- package/lib/module/constants/index.js +11 -0
- package/lib/module/constants/index.js.map +1 -0
- package/lib/module/constants/progress-steps.js +11 -0
- package/lib/module/constants/progress-steps.js.map +1 -0
- package/lib/module/constants/route-step-index-descriptions.js +15 -0
- package/lib/module/constants/route-step-index-descriptions.js.map +1 -0
- package/lib/module/constants/route-step-indexes.js +13 -0
- package/lib/module/constants/route-step-indexes.js.map +1 -0
- package/lib/module/constants/routes-need-alter-status.js +8 -0
- package/lib/module/constants/routes-need-alter-status.js.map +1 -0
- package/lib/module/enums/document-type.js +9 -0
- package/lib/module/enums/document-type.js.map +1 -0
- package/lib/module/enums/image-type.js +10 -0
- package/lib/module/enums/image-type.js.map +1 -0
- package/lib/module/enums/index.js +10 -0
- package/lib/module/enums/index.js.map +1 -0
- package/lib/module/enums/objective.js +8 -0
- package/lib/module/enums/objective.js.map +1 -0
- package/lib/module/enums/process-status.js +10 -0
- package/lib/module/enums/process-status.js.map +1 -0
- package/lib/module/enums/request-status.js +12 -0
- package/lib/module/enums/request-status.js.map +1 -0
- package/lib/module/enums/timeline-status.js +10 -0
- package/lib/module/enums/timeline-status.js.map +1 -0
- package/lib/module/enums/validation-status.js +9 -0
- package/lib/module/enums/validation-status.js.map +1 -0
- package/lib/module/errors/camera-permission-denied.js +9 -0
- package/lib/module/errors/camera-permission-denied.js.map +1 -0
- package/lib/module/errors/camera-problem.js +9 -0
- package/lib/module/errors/camera-problem.js.map +1 -0
- package/lib/module/errors/contact-support.js +10 -0
- package/lib/module/errors/contact-support.js.map +1 -0
- package/lib/module/errors/geolocation-permission-denied.js +9 -0
- package/lib/module/errors/geolocation-permission-denied.js.map +1 -0
- package/lib/module/errors/index.js +9 -0
- package/lib/module/errors/index.js.map +1 -0
- package/lib/module/errors/non-standard-hours.js +10 -0
- package/lib/module/errors/non-standard-hours.js.map +1 -0
- package/lib/module/errors/process-already-completed.js +10 -0
- package/lib/module/errors/process-already-completed.js.map +1 -0
- package/lib/module/hooks/index.js +16 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/use-button.js +18 -0
- package/lib/module/hooks/use-button.js.map +1 -0
- package/lib/module/hooks/use-camera.js +97 -0
- package/lib/module/hooks/use-camera.js.map +1 -0
- package/lib/module/hooks/use-description-loading.js +19 -0
- package/lib/module/hooks/use-description-loading.js.map +1 -0
- package/lib/module/hooks/use-error-fallback.js +37 -0
- package/lib/module/hooks/use-error-fallback.js.map +1 -0
- package/lib/module/hooks/use-identification-error.js +15 -0
- package/lib/module/hooks/use-identification-error.js.map +1 -0
- package/lib/module/hooks/use-loading.js +39 -0
- package/lib/module/hooks/use-loading.js.map +1 -0
- package/lib/module/hooks/use-onboarding-channel.js +78 -0
- package/lib/module/hooks/use-onboarding-channel.js.map +1 -0
- package/lib/module/hooks/use-process-status.js +69 -0
- package/lib/module/hooks/use-process-status.js.map +1 -0
- package/lib/module/hooks/use-process-timeline.js +103 -0
- package/lib/module/hooks/use-process-timeline.js.map +1 -0
- package/lib/module/hooks/use-progress-indicator.js +47 -0
- package/lib/module/hooks/use-progress-indicator.js.map +1 -0
- package/lib/module/hooks/use-recommended-validations.js +37 -0
- package/lib/module/hooks/use-recommended-validations.js.map +1 -0
- package/lib/module/hooks/use-rekognition.js +35 -0
- package/lib/module/hooks/use-rekognition.js.map +1 -0
- package/lib/module/hooks/use-s3.js +94 -0
- package/lib/module/hooks/use-s3.js.map +1 -0
- package/lib/module/index.js +25 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/layouts/index.js +4 -0
- package/lib/module/layouts/index.js.map +1 -0
- package/lib/module/layouts/root/index.js +15 -0
- package/lib/module/layouts/root/index.js.map +1 -0
- package/lib/module/layouts/root/view-model.js +14 -0
- package/lib/module/layouts/root/view-model.js.map +1 -0
- package/lib/module/layouts/root/view.js +30 -0
- package/lib/module/layouts/root/view.js.map +1 -0
- package/lib/module/navigation/index.js +50 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/screens/document/analysis/index.js +12 -0
- package/lib/module/screens/document/analysis/index.js.map +1 -0
- package/lib/module/screens/document/analysis/view-model.js +81 -0
- package/lib/module/screens/document/analysis/view-model.js.map +1 -0
- package/lib/module/screens/document/analysis/view.js +18 -0
- package/lib/module/screens/document/analysis/view.js.map +1 -0
- package/lib/module/screens/document/camera/index.js +12 -0
- package/lib/module/screens/document/camera/index.js.map +1 -0
- package/lib/module/screens/document/camera/view-model.js +377 -0
- package/lib/module/screens/document/camera/view-model.js.map +1 -0
- package/lib/module/screens/document/camera/view.js +191 -0
- package/lib/module/screens/document/camera/view.js.map +1 -0
- package/lib/module/screens/document/index.js +12 -0
- package/lib/module/screens/document/index.js.map +1 -0
- package/lib/module/screens/document/review/index.js +12 -0
- package/lib/module/screens/document/review/index.js.map +1 -0
- package/lib/module/screens/document/review/view-model.js +68 -0
- package/lib/module/screens/document/review/view-model.js.map +1 -0
- package/lib/module/screens/document/review/view.js +69 -0
- package/lib/module/screens/document/review/view.js.map +1 -0
- package/lib/module/screens/document/view-model.js +27 -0
- package/lib/module/screens/document/view-model.js.map +1 -0
- package/lib/module/screens/document/view.js +69 -0
- package/lib/module/screens/document/view.js.map +1 -0
- package/lib/module/screens/face-auth/analysis/index.js +12 -0
- package/lib/module/screens/face-auth/analysis/index.js.map +1 -0
- package/lib/module/screens/face-auth/analysis/view-model.js +147 -0
- package/lib/module/screens/face-auth/analysis/view-model.js.map +1 -0
- package/lib/module/screens/face-auth/analysis/view.js +25 -0
- package/lib/module/screens/face-auth/analysis/view.js.map +1 -0
- package/lib/module/screens/face-auth/camera/index.js +12 -0
- package/lib/module/screens/face-auth/camera/index.js.map +1 -0
- package/lib/module/screens/face-auth/camera/overlay.js +26 -0
- package/lib/module/screens/face-auth/camera/overlay.js.map +1 -0
- package/lib/module/screens/face-auth/camera/view-model.js +324 -0
- package/lib/module/screens/face-auth/camera/view-model.js.map +1 -0
- package/lib/module/screens/face-auth/camera/view.js +119 -0
- package/lib/module/screens/face-auth/camera/view.js.map +1 -0
- package/lib/module/screens/face-auth/index.js +12 -0
- package/lib/module/screens/face-auth/index.js.map +1 -0
- package/lib/module/screens/face-auth/view-model.js +23 -0
- package/lib/module/screens/face-auth/view-model.js.map +1 -0
- package/lib/module/screens/face-auth/view.js +50 -0
- package/lib/module/screens/face-auth/view.js.map +1 -0
- package/lib/module/screens/index.js +11 -0
- package/lib/module/screens/index.js.map +1 -0
- package/lib/module/screens/process-finished/index.js +12 -0
- package/lib/module/screens/process-finished/index.js.map +1 -0
- package/lib/module/screens/process-finished/view-model.js +18 -0
- package/lib/module/screens/process-finished/view-model.js.map +1 -0
- package/lib/module/screens/process-finished/view.js +32 -0
- package/lib/module/screens/process-finished/view.js.map +1 -0
- package/lib/module/services/api.js +31 -0
- package/lib/module/services/api.js.map +1 -0
- package/lib/module/services/credentials/generate.js +25 -0
- package/lib/module/services/credentials/generate.js.map +1 -0
- package/lib/module/services/credentials/index.js +4 -0
- package/lib/module/services/credentials/index.js.map +1 -0
- package/lib/module/services/documents/index.js +5 -0
- package/lib/module/services/documents/index.js.map +1 -0
- package/lib/module/services/documents/validate-pdf.js +33 -0
- package/lib/module/services/documents/validate-pdf.js.map +1 -0
- package/lib/module/services/documents/validate-picture.js +31 -0
- package/lib/module/services/documents/validate-picture.js.map +1 -0
- package/lib/module/services/index.js +8 -0
- package/lib/module/services/index.js.map +1 -0
- package/lib/module/services/location/get-from-user-ip.js +19 -0
- package/lib/module/services/location/get-from-user-ip.js.map +1 -0
- package/lib/module/services/location/index.js +4 -0
- package/lib/module/services/location/index.js.map +1 -0
- package/lib/module/services/onboarding/create-channel.js +24 -0
- package/lib/module/services/onboarding/create-channel.js.map +1 -0
- package/lib/module/services/onboarding/index.js +4 -0
- package/lib/module/services/onboarding/index.js.map +1 -0
- package/lib/module/services/process/alter-status.js +30 -0
- package/lib/module/services/process/alter-status.js.map +1 -0
- package/lib/module/services/process/create-error-log.js +21 -0
- package/lib/module/services/process/create-error-log.js.map +1 -0
- package/lib/module/services/process/create-timeline.js +41 -0
- package/lib/module/services/process/create-timeline.js.map +1 -0
- package/lib/module/services/process/done.js +54 -0
- package/lib/module/services/process/done.js.map +1 -0
- package/lib/module/services/process/generate-data.js +25 -0
- package/lib/module/services/process/generate-data.js.map +1 -0
- package/lib/module/services/process/index.js +9 -0
- package/lib/module/services/process/index.js.map +1 -0
- package/lib/module/services/process/start.js +40 -0
- package/lib/module/services/process/start.js.map +1 -0
- package/lib/module/store/env-variables.js +20 -0
- package/lib/module/store/env-variables.js.map +1 -0
- package/lib/module/store/flow.js +35 -0
- package/lib/module/store/flow.js.map +1 -0
- package/lib/module/store/index.js +7 -0
- package/lib/module/store/index.js.map +1 -0
- package/lib/module/store/process-timeline-queue.js +14 -0
- package/lib/module/store/process-timeline-queue.js.map +1 -0
- package/lib/module/store/process.js +31 -0
- package/lib/module/store/process.js.map +1 -0
- package/lib/module/theme/border-radius.js +9 -0
- package/lib/module/theme/border-radius.js.map +1 -0
- package/lib/module/theme/button-variants.js +19 -0
- package/lib/module/theme/button-variants.js.map +1 -0
- package/lib/module/theme/common-colors.js +15 -0
- package/lib/module/theme/common-colors.js.map +1 -0
- package/lib/module/theme/default-colors.js +7 -0
- package/lib/module/theme/default-colors.js.map +1 -0
- package/lib/module/theme/index.js +21 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/spacing.js +14 -0
- package/lib/module/theme/spacing.js.map +1 -0
- package/lib/module/theme/text-variants.js +17 -0
- package/lib/module/theme/text-variants.js.map +1 -0
- package/lib/module/utils/get-error-metadata.js +26 -0
- package/lib/module/utils/get-error-metadata.js.map +1 -0
- package/lib/module/utils/get-route-step.js +12 -0
- package/lib/module/utils/get-route-step.js.map +1 -0
- package/lib/module/utils/index.js +5 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/view-model.js +167 -0
- package/lib/module/view-model.js.map +1 -0
- package/lib/module/view.js +45 -0
- package/lib/module/view.js.map +1 -0
- package/lib/typescript/assets/svgs/arrow-right.d.ts +3 -0
- package/lib/typescript/assets/svgs/arrow-right.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/back-document-circle.d.ts +3 -0
- package/lib/typescript/assets/svgs/back-document-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/camera-error-circle.d.ts +7 -0
- package/lib/typescript/assets/svgs/camera-error-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/camera-plus.d.ts +3 -0
- package/lib/typescript/assets/svgs/camera-plus.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/checklist-circle.d.ts +3 -0
- package/lib/typescript/assets/svgs/checklist-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/clock-circle.d.ts +7 -0
- package/lib/typescript/assets/svgs/clock-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/document-2.d.ts +3 -0
- package/lib/typescript/assets/svgs/document-2.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/document-avatar.d.ts +3 -0
- package/lib/typescript/assets/svgs/document-avatar.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/document-camera-overlay.d.ts +11 -0
- package/lib/typescript/assets/svgs/document-camera-overlay.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/document-circle.d.ts +3 -0
- package/lib/typescript/assets/svgs/document-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/document.d.ts +3 -0
- package/lib/typescript/assets/svgs/document.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/face-auth-avatar.d.ts +3 -0
- package/lib/typescript/assets/svgs/face-auth-avatar.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/face-auth-camera-overlay.d.ts +11 -0
- package/lib/typescript/assets/svgs/face-auth-camera-overlay.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/face-id-circle.d.ts +3 -0
- package/lib/typescript/assets/svgs/face-id-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/face-id-error.d.ts +7 -0
- package/lib/typescript/assets/svgs/face-id-error.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/face-id.d.ts +3 -0
- package/lib/typescript/assets/svgs/face-id.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/index.d.ts +25 -0
- package/lib/typescript/assets/svgs/index.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/location-error-circle.d.ts +7 -0
- package/lib/typescript/assets/svgs/location-error-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/process-finished.d.ts +7 -0
- package/lib/typescript/assets/svgs/process-finished.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/refresh.d.ts +3 -0
- package/lib/typescript/assets/svgs/refresh.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/shield-check-circle.d.ts +3 -0
- package/lib/typescript/assets/svgs/shield-check-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/thumb-up.d.ts +7 -0
- package/lib/typescript/assets/svgs/thumb-up.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/upload.d.ts +3 -0
- package/lib/typescript/assets/svgs/upload.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/x-error-circle.d.ts +7 -0
- package/lib/typescript/assets/svgs/x-error-circle.d.ts.map +1 -0
- package/lib/typescript/assets/svgs/x.d.ts +3 -0
- package/lib/typescript/assets/svgs/x.d.ts.map +1 -0
- package/lib/typescript/eslint.config.d.mts +3 -0
- package/lib/typescript/eslint.config.d.mts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/app.d.ts +3 -0
- package/lib/typescript/src/app.d.ts.map +1 -0
- package/lib/typescript/src/components/button.d.ts +15 -0
- package/lib/typescript/src/components/button.d.ts.map +1 -0
- package/lib/typescript/src/components/centered-loading.d.ts +3 -0
- package/lib/typescript/src/components/centered-loading.d.ts.map +1 -0
- package/lib/typescript/src/components/default-error-fallback.d.ts +6 -0
- package/lib/typescript/src/components/default-error-fallback.d.ts.map +1 -0
- package/lib/typescript/src/components/default-loading.d.ts +7 -0
- package/lib/typescript/src/components/default-loading.d.ts.map +1 -0
- package/lib/typescript/src/components/description-loading.d.ts +10 -0
- package/lib/typescript/src/components/description-loading.d.ts.map +1 -0
- package/lib/typescript/src/components/error-fallback.d.ts +5 -0
- package/lib/typescript/src/components/error-fallback.d.ts.map +1 -0
- package/lib/typescript/src/components/identification-error.d.ts +11 -0
- package/lib/typescript/src/components/identification-error.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +11 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/loading.d.ts +7 -0
- package/lib/typescript/src/components/loading.d.ts.map +1 -0
- package/lib/typescript/src/components/progress-indicator.d.ts +8 -0
- package/lib/typescript/src/components/progress-indicator.d.ts.map +1 -0
- package/lib/typescript/src/components/recommended-validations.d.ts +18 -0
- package/lib/typescript/src/components/recommended-validations.d.ts.map +1 -0
- package/lib/typescript/src/constants/camera-error-messages.d.ts +4 -0
- package/lib/typescript/src/constants/camera-error-messages.d.ts.map +1 -0
- package/lib/typescript/src/constants/environments.d.ts +33 -0
- package/lib/typescript/src/constants/environments.d.ts.map +1 -0
- package/lib/typescript/src/constants/error-header-fields.d.ts +40 -0
- package/lib/typescript/src/constants/error-header-fields.d.ts.map +1 -0
- package/lib/typescript/src/constants/image-type-references.d.ts +3 -0
- package/lib/typescript/src/constants/image-type-references.d.ts.map +1 -0
- package/lib/typescript/src/constants/index.d.ts +9 -0
- package/lib/typescript/src/constants/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/progress-steps.d.ts +8 -0
- package/lib/typescript/src/constants/progress-steps.d.ts.map +1 -0
- package/lib/typescript/src/constants/route-step-index-descriptions.d.ts +3 -0
- package/lib/typescript/src/constants/route-step-index-descriptions.d.ts.map +1 -0
- package/lib/typescript/src/constants/route-step-indexes.d.ts +8 -0
- package/lib/typescript/src/constants/route-step-indexes.d.ts.map +1 -0
- package/lib/typescript/src/constants/routes-need-alter-status.d.ts +4 -0
- package/lib/typescript/src/constants/routes-need-alter-status.d.ts.map +1 -0
- package/lib/typescript/src/enums/document-type.d.ts +6 -0
- package/lib/typescript/src/enums/document-type.d.ts.map +1 -0
- package/lib/typescript/src/enums/image-type.d.ts +7 -0
- package/lib/typescript/src/enums/image-type.d.ts.map +1 -0
- package/lib/typescript/src/enums/index.d.ts +8 -0
- package/lib/typescript/src/enums/index.d.ts.map +1 -0
- package/lib/typescript/src/enums/objective.d.ts +5 -0
- package/lib/typescript/src/enums/objective.d.ts.map +1 -0
- package/lib/typescript/src/enums/process-status.d.ts +7 -0
- package/lib/typescript/src/enums/process-status.d.ts.map +1 -0
- package/lib/typescript/src/enums/request-status.d.ts +9 -0
- package/lib/typescript/src/enums/request-status.d.ts.map +1 -0
- package/lib/typescript/src/enums/timeline-status.d.ts +7 -0
- package/lib/typescript/src/enums/timeline-status.d.ts.map +1 -0
- package/lib/typescript/src/enums/validation-status.d.ts +6 -0
- package/lib/typescript/src/enums/validation-status.d.ts.map +1 -0
- package/lib/typescript/src/errors/camera-permission-denied.d.ts +4 -0
- package/lib/typescript/src/errors/camera-permission-denied.d.ts.map +1 -0
- package/lib/typescript/src/errors/camera-problem.d.ts +4 -0
- package/lib/typescript/src/errors/camera-problem.d.ts.map +1 -0
- package/lib/typescript/src/errors/contact-support.d.ts +5 -0
- package/lib/typescript/src/errors/contact-support.d.ts.map +1 -0
- package/lib/typescript/src/errors/geolocation-permission-denied.d.ts +4 -0
- package/lib/typescript/src/errors/geolocation-permission-denied.d.ts.map +1 -0
- package/lib/typescript/src/errors/index.d.ts +7 -0
- package/lib/typescript/src/errors/index.d.ts.map +1 -0
- package/lib/typescript/src/errors/non-standard-hours.d.ts +5 -0
- package/lib/typescript/src/errors/non-standard-hours.d.ts.map +1 -0
- package/lib/typescript/src/errors/process-already-completed.d.ts +5 -0
- package/lib/typescript/src/errors/process-already-completed.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +14 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-button.d.ts +12 -0
- package/lib/typescript/src/hooks/use-button.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-camera.d.ts +13 -0
- package/lib/typescript/src/hooks/use-camera.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-description-loading.d.ts +17 -0
- package/lib/typescript/src/hooks/use-description-loading.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-error-fallback.d.ts +35 -0
- package/lib/typescript/src/hooks/use-error-fallback.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-identification-error.d.ts +9 -0
- package/lib/typescript/src/hooks/use-identification-error.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-loading.d.ts +14 -0
- package/lib/typescript/src/hooks/use-loading.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-onboarding-channel.d.ts +9 -0
- package/lib/typescript/src/hooks/use-onboarding-channel.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-process-status.d.ts +7 -0
- package/lib/typescript/src/hooks/use-process-status.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-process-timeline.d.ts +14 -0
- package/lib/typescript/src/hooks/use-process-timeline.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-progress-indicator.d.ts +12 -0
- package/lib/typescript/src/hooks/use-progress-indicator.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-recommended-validations.d.ts +9 -0
- package/lib/typescript/src/hooks/use-recommended-validations.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-rekognition.d.ts +4 -0
- package/lib/typescript/src/hooks/use-rekognition.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-s3.d.ts +6 -0
- package/lib/typescript/src/hooks/use-s3.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +12 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/layouts/index.d.ts +2 -0
- package/lib/typescript/src/layouts/index.d.ts.map +1 -0
- package/lib/typescript/src/layouts/root/index.d.ts +6 -0
- package/lib/typescript/src/layouts/root/index.d.ts.map +1 -0
- package/lib/typescript/src/layouts/root/view-model.d.ts +16 -0
- package/lib/typescript/src/layouts/root/view-model.d.ts.map +1 -0
- package/lib/typescript/src/layouts/root/view.d.ts +7 -0
- package/lib/typescript/src/layouts/root/view.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +29 -0
- package/lib/typescript/src/navigation/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/analysis/index.d.ts +2 -0
- package/lib/typescript/src/screens/document/analysis/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/analysis/view-model.d.ts +16 -0
- package/lib/typescript/src/screens/document/analysis/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/analysis/view.d.ts +5 -0
- package/lib/typescript/src/screens/document/analysis/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/camera/index.d.ts +2 -0
- package/lib/typescript/src/screens/document/camera/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/camera/view-model.d.ts +63 -0
- package/lib/typescript/src/screens/document/camera/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/camera/view.d.ts +5 -0
- package/lib/typescript/src/screens/document/camera/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/index.d.ts +2 -0
- package/lib/typescript/src/screens/document/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/review/index.d.ts +2 -0
- package/lib/typescript/src/screens/document/review/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/review/view-model.d.ts +31 -0
- package/lib/typescript/src/screens/document/review/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/review/view.d.ts +5 -0
- package/lib/typescript/src/screens/document/review/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/view-model.d.ts +12 -0
- package/lib/typescript/src/screens/document/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/document/view.d.ts +5 -0
- package/lib/typescript/src/screens/document/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/analysis/index.d.ts +2 -0
- package/lib/typescript/src/screens/face-auth/analysis/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/analysis/view-model.d.ts +26 -0
- package/lib/typescript/src/screens/face-auth/analysis/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/analysis/view.d.ts +5 -0
- package/lib/typescript/src/screens/face-auth/analysis/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/camera/index.d.ts +2 -0
- package/lib/typescript/src/screens/face-auth/camera/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/camera/overlay.d.ts +11 -0
- package/lib/typescript/src/screens/face-auth/camera/overlay.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/camera/view-model.d.ts +56 -0
- package/lib/typescript/src/screens/face-auth/camera/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/camera/view.d.ts +5 -0
- package/lib/typescript/src/screens/face-auth/camera/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/index.d.ts +2 -0
- package/lib/typescript/src/screens/face-auth/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/view-model.d.ts +17 -0
- package/lib/typescript/src/screens/face-auth/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/face-auth/view.d.ts +5 -0
- package/lib/typescript/src/screens/face-auth/view.d.ts.map +1 -0
- package/lib/typescript/src/screens/index.d.ts +9 -0
- package/lib/typescript/src/screens/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/process-finished/index.d.ts +2 -0
- package/lib/typescript/src/screens/process-finished/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/process-finished/view-model.d.ts +4 -0
- package/lib/typescript/src/screens/process-finished/view-model.d.ts.map +1 -0
- package/lib/typescript/src/screens/process-finished/view.d.ts +5 -0
- package/lib/typescript/src/screens/process-finished/view.d.ts.map +1 -0
- package/lib/typescript/src/services/api.d.ts +5 -0
- package/lib/typescript/src/services/api.d.ts.map +1 -0
- package/lib/typescript/src/services/credentials/generate.d.ts +16 -0
- package/lib/typescript/src/services/credentials/generate.d.ts.map +1 -0
- package/lib/typescript/src/services/credentials/index.d.ts +2 -0
- package/lib/typescript/src/services/credentials/index.d.ts.map +1 -0
- package/lib/typescript/src/services/documents/index.d.ts +3 -0
- package/lib/typescript/src/services/documents/index.d.ts.map +1 -0
- package/lib/typescript/src/services/documents/validate-pdf.d.ts +10 -0
- package/lib/typescript/src/services/documents/validate-pdf.d.ts.map +1 -0
- package/lib/typescript/src/services/documents/validate-picture.d.ts +13 -0
- package/lib/typescript/src/services/documents/validate-picture.d.ts.map +1 -0
- package/lib/typescript/src/services/index.d.ts +6 -0
- package/lib/typescript/src/services/index.d.ts.map +1 -0
- package/lib/typescript/src/services/location/get-from-user-ip.d.ts +14 -0
- package/lib/typescript/src/services/location/get-from-user-ip.d.ts.map +1 -0
- package/lib/typescript/src/services/location/index.d.ts +2 -0
- package/lib/typescript/src/services/location/index.d.ts.map +1 -0
- package/lib/typescript/src/services/onboarding/create-channel.d.ts +16 -0
- package/lib/typescript/src/services/onboarding/create-channel.d.ts.map +1 -0
- package/lib/typescript/src/services/onboarding/index.d.ts +2 -0
- package/lib/typescript/src/services/onboarding/index.d.ts.map +1 -0
- package/lib/typescript/src/services/process/alter-status.d.ts +11 -0
- package/lib/typescript/src/services/process/alter-status.d.ts.map +1 -0
- package/lib/typescript/src/services/process/create-error-log.d.ts +7 -0
- package/lib/typescript/src/services/process/create-error-log.d.ts.map +1 -0
- package/lib/typescript/src/services/process/create-timeline.d.ts +23 -0
- package/lib/typescript/src/services/process/create-timeline.d.ts.map +1 -0
- package/lib/typescript/src/services/process/done.d.ts +35 -0
- package/lib/typescript/src/services/process/done.d.ts.map +1 -0
- package/lib/typescript/src/services/process/generate-data.d.ts +27 -0
- package/lib/typescript/src/services/process/generate-data.d.ts.map +1 -0
- package/lib/typescript/src/services/process/index.d.ts +7 -0
- package/lib/typescript/src/services/process/index.d.ts.map +1 -0
- package/lib/typescript/src/services/process/start.d.ts +33 -0
- package/lib/typescript/src/services/process/start.d.ts.map +1 -0
- package/lib/typescript/src/store/env-variables.d.ts +15 -0
- package/lib/typescript/src/store/env-variables.d.ts.map +1 -0
- package/lib/typescript/src/store/flow.d.ts +25 -0
- package/lib/typescript/src/store/flow.d.ts.map +1 -0
- package/lib/typescript/src/store/index.d.ts +5 -0
- package/lib/typescript/src/store/index.d.ts.map +1 -0
- package/lib/typescript/src/store/process-timeline-queue.d.ts +10 -0
- package/lib/typescript/src/store/process-timeline-queue.d.ts.map +1 -0
- package/lib/typescript/src/store/process.d.ts +26 -0
- package/lib/typescript/src/store/process.d.ts.map +1 -0
- package/lib/typescript/src/theme/border-radius.d.ts +7 -0
- package/lib/typescript/src/theme/border-radius.d.ts.map +1 -0
- package/lib/typescript/src/theme/button-variants.d.ts +17 -0
- package/lib/typescript/src/theme/button-variants.d.ts.map +1 -0
- package/lib/typescript/src/theme/common-colors.d.ts +13 -0
- package/lib/typescript/src/theme/common-colors.d.ts.map +1 -0
- package/lib/typescript/src/theme/default-colors.d.ts +5 -0
- package/lib/typescript/src/theme/default-colors.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +77 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/spacing.d.ts +12 -0
- package/lib/typescript/src/theme/spacing.d.ts.map +1 -0
- package/lib/typescript/src/theme/text-variants.d.ts +15 -0
- package/lib/typescript/src/theme/text-variants.d.ts.map +1 -0
- package/lib/typescript/src/utils/get-error-metadata.d.ts +18 -0
- package/lib/typescript/src/utils/get-error-metadata.d.ts.map +1 -0
- package/lib/typescript/src/utils/get-route-step.d.ts +9 -0
- package/lib/typescript/src/utils/get-route-step.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +3 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/view-model.d.ts +84 -0
- package/lib/typescript/src/view-model.d.ts.map +1 -0
- package/lib/typescript/src/view.d.ts +5 -0
- package/lib/typescript/src/view.d.ts.map +1 -0
- package/package.json +200 -0
- package/src/app.tsx +9 -0
- package/src/components/button.tsx +70 -0
- package/src/components/centered-loading.tsx +11 -0
- package/src/components/default-error-fallback.tsx +26 -0
- package/src/components/default-loading.tsx +29 -0
- package/src/components/description-loading.tsx +32 -0
- package/src/components/error-fallback.tsx +55 -0
- package/src/components/identification-error.tsx +37 -0
- package/src/components/index.ts +10 -0
- package/src/components/loading.tsx +50 -0
- package/src/components/progress-indicator.tsx +46 -0
- package/src/components/recommended-validations.tsx +98 -0
- package/src/constants/camera-error-messages.ts +24 -0
- package/src/constants/environments.ts +35 -0
- package/src/constants/error-header-fields.ts +41 -0
- package/src/constants/image-type-references.ts +8 -0
- package/src/constants/index.ts +8 -0
- package/src/constants/progress-steps.ts +23 -0
- package/src/constants/route-step-index-descriptions.ts +14 -0
- package/src/constants/route-step-indexes.ts +20 -0
- package/src/constants/routes-need-alter-status.ts +8 -0
- package/src/enums/document-type.ts +5 -0
- package/src/enums/image-type.ts +6 -0
- package/src/enums/index.ts +7 -0
- package/src/enums/objective.ts +4 -0
- package/src/enums/process-status.ts +6 -0
- package/src/enums/request-status.ts +8 -0
- package/src/enums/timeline-status.ts +6 -0
- package/src/enums/validation-status.ts +5 -0
- package/src/errors/camera-permission-denied.ts +9 -0
- package/src/errors/camera-problem.ts +7 -0
- package/src/errors/contact-support.ts +10 -0
- package/src/errors/geolocation-permission-denied.ts +9 -0
- package/src/errors/index.ts +6 -0
- package/src/errors/non-standard-hours.ts +11 -0
- package/src/errors/process-already-completed.ts +10 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/use-button.ts +22 -0
- package/src/hooks/use-camera.ts +131 -0
- package/src/hooks/use-description-loading.ts +19 -0
- package/src/hooks/use-error-fallback.ts +33 -0
- package/src/hooks/use-identification-error.ts +13 -0
- package/src/hooks/use-loading.ts +52 -0
- package/src/hooks/use-onboarding-channel.ts +115 -0
- package/src/hooks/use-process-status.ts +82 -0
- package/src/hooks/use-process-timeline.ts +155 -0
- package/src/hooks/use-progress-indicator.ts +51 -0
- package/src/hooks/use-recommended-validations.ts +52 -0
- package/src/hooks/use-rekognition.ts +41 -0
- package/src/hooks/use-s3.ts +113 -0
- package/src/index.tsx +31 -0
- package/src/layouts/index.ts +1 -0
- package/src/layouts/root/index.tsx +12 -0
- package/src/layouts/root/view-model.ts +13 -0
- package/src/layouts/root/view.tsx +24 -0
- package/src/navigation/index.tsx +92 -0
- package/src/screens/document/analysis/index.tsx +8 -0
- package/src/screens/document/analysis/view-model.ts +95 -0
- package/src/screens/document/analysis/view.tsx +20 -0
- package/src/screens/document/camera/index.tsx +8 -0
- package/src/screens/document/camera/view-model.ts +570 -0
- package/src/screens/document/camera/view.tsx +196 -0
- package/src/screens/document/index.tsx +8 -0
- package/src/screens/document/review/index.tsx +8 -0
- package/src/screens/document/review/view-model.ts +77 -0
- package/src/screens/document/review/view.tsx +69 -0
- package/src/screens/document/view-model.ts +29 -0
- package/src/screens/document/view.tsx +80 -0
- package/src/screens/face-auth/analysis/index.tsx +8 -0
- package/src/screens/face-auth/analysis/view-model.ts +200 -0
- package/src/screens/face-auth/analysis/view.tsx +31 -0
- package/src/screens/face-auth/camera/index.tsx +8 -0
- package/src/screens/face-auth/camera/overlay.tsx +31 -0
- package/src/screens/face-auth/camera/view-model.ts +462 -0
- package/src/screens/face-auth/camera/view.tsx +128 -0
- package/src/screens/face-auth/index.tsx +8 -0
- package/src/screens/face-auth/view-model.ts +25 -0
- package/src/screens/face-auth/view.tsx +51 -0
- package/src/screens/index.ts +8 -0
- package/src/screens/process-finished/index.tsx +8 -0
- package/src/screens/process-finished/view-model.ts +15 -0
- package/src/screens/process-finished/view.tsx +24 -0
- package/src/services/api.ts +39 -0
- package/src/services/credentials/generate.ts +37 -0
- package/src/services/credentials/index.ts +1 -0
- package/src/services/documents/index.ts +2 -0
- package/src/services/documents/validate-pdf.ts +46 -0
- package/src/services/documents/validate-picture.ts +50 -0
- package/src/services/index.ts +5 -0
- package/src/services/location/get-from-user-ip.ts +31 -0
- package/src/services/location/index.ts +1 -0
- package/src/services/onboarding/create-channel.ts +45 -0
- package/src/services/onboarding/index.ts +1 -0
- package/src/services/process/alter-status.ts +38 -0
- package/src/services/process/create-error-log.ts +28 -0
- package/src/services/process/create-timeline.ts +75 -0
- package/src/services/process/done.ts +114 -0
- package/src/services/process/generate-data.ts +54 -0
- package/src/services/process/index.ts +6 -0
- package/src/services/process/start.ts +86 -0
- package/src/store/env-variables.ts +37 -0
- package/src/store/flow.ts +54 -0
- package/src/store/index.ts +4 -0
- package/src/store/process-timeline-queue.ts +25 -0
- package/src/store/process.ts +64 -0
- package/src/theme/border-radius.ts +6 -0
- package/src/theme/button-variants.ts +16 -0
- package/src/theme/common-colors.ts +12 -0
- package/src/theme/default-colors.ts +4 -0
- package/src/theme/index.ts +31 -0
- package/src/theme/spacing.ts +11 -0
- package/src/theme/text-variants.ts +14 -0
- package/src/utils/get-error-metadata.ts +46 -0
- package/src/utils/get-route-step.ts +24 -0
- package/src/utils/index.ts +2 -0
- package/src/view-model.ts +222 -0
- package/src/view.tsx +52 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useTheme } from '@shopify/restyle';
|
|
4
|
+
import { useProcessStore } from "../store/index.js";
|
|
5
|
+
import { useButton } from "./use-button.js";
|
|
6
|
+
import { getErrorMetadata } from "../utils/index.js";
|
|
7
|
+
export const useErrorFallback = ({
|
|
8
|
+
error,
|
|
9
|
+
resetError
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
icon,
|
|
13
|
+
title,
|
|
14
|
+
message,
|
|
15
|
+
isPermissionDenied
|
|
16
|
+
} = getErrorMetadata(error);
|
|
17
|
+
const onFinish = useProcessStore(state => state.onFinish);
|
|
18
|
+
const {
|
|
19
|
+
colors
|
|
20
|
+
} = useTheme();
|
|
21
|
+
const tryAgainButtonProps = useButton();
|
|
22
|
+
const finishProcessButtonProps = useButton({
|
|
23
|
+
variant: 'outline'
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
title,
|
|
27
|
+
message,
|
|
28
|
+
icon,
|
|
29
|
+
miniIconColor: colors.secondary,
|
|
30
|
+
tryAgainButtonProps,
|
|
31
|
+
finishProcessButtonProps,
|
|
32
|
+
showFooterButtons: isPermissionDenied,
|
|
33
|
+
onTryAgainPress: resetError,
|
|
34
|
+
onFinishProcessPress: onFinish
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=use-error-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTheme","useProcessStore","useButton","getErrorMetadata","useErrorFallback","error","resetError","icon","title","message","isPermissionDenied","onFinish","state","colors","tryAgainButtonProps","finishProcessButtonProps","variant","miniIconColor","secondary","showFooterButtons","onTryAgainPress","onFinishProcessPress"],"sourceRoot":"../../../src","sources":["hooks/use-error-fallback.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,eAAe,QAAQ,mBAAU;AAC1C,SAASC,SAAS,QAAQ,iBAAc;AAExC,SAASC,gBAAgB,QAAQ,mBAAU;AAO3C,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,KAAK;EACLC;AACqB,CAAC,KAAK;EAC3B,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAmB,CAAC,GAAGP,gBAAgB,CAACE,KAAK,CAAC;EAC5E,MAAMM,QAAQ,GAAGV,eAAe,CAAEW,KAAK,IAAKA,KAAK,CAACD,QAAQ,CAAC;EAC3D,MAAM;IAAEE;EAAO,CAAC,GAAGb,QAAQ,CAAmB,CAAC;EAC/C,MAAMc,mBAAmB,GAAGZ,SAAS,CAAC,CAAC;EACvC,MAAMa,wBAAwB,GAAGb,SAAS,CAAC;IAAEc,OAAO,EAAE;EAAU,CAAC,CAAC;EAElE,OAAO;IACLR,KAAK;IACLC,OAAO;IACPF,IAAI;IACJU,aAAa,EAAEJ,MAAM,CAACK,SAAS;IAC/BJ,mBAAmB;IACnBC,wBAAwB;IACxBI,iBAAiB,EAAET,kBAAkB;IACrCU,eAAe,EAAEd,UAAU;IAC3Be,oBAAoB,EAAEV;EACxB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useTheme } from '@shopify/restyle';
|
|
4
|
+
import { useButton } from "./use-button.js";
|
|
5
|
+
export const useIdentificationError = () => {
|
|
6
|
+
const {
|
|
7
|
+
colors
|
|
8
|
+
} = useTheme();
|
|
9
|
+
const tryAgainButtonProps = useButton();
|
|
10
|
+
return {
|
|
11
|
+
miniIconColor: colors.secondary,
|
|
12
|
+
tryAgainButtonProps
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-identification-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTheme","useButton","useIdentificationError","colors","tryAgainButtonProps","miniIconColor","secondary"],"sourceRoot":"../../../src","sources":["hooks/use-identification-error.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,kBAAkB;AAE3C,SAASC,SAAS,QAAQ,iBAAc;AAExC,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EAC1C,MAAM;IAAEC;EAAO,CAAC,GAAGH,QAAQ,CAAmB,CAAC;EAC/C,MAAMI,mBAAmB,GAAGH,SAAS,CAAC,CAAC;EAEvC,OAAO;IACLI,aAAa,EAAEF,MAAM,CAACG,SAAS;IAC/BF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useTheme } from '@shopify/restyle';
|
|
5
|
+
import { cancelAnimation, Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
6
|
+
export const useLoading = ({
|
|
7
|
+
isActive
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
colors
|
|
11
|
+
} = useTheme();
|
|
12
|
+
const rotation = useSharedValue(0);
|
|
13
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
14
|
+
transform: [{
|
|
15
|
+
rotate: `${rotation.value}deg`
|
|
16
|
+
}]
|
|
17
|
+
}));
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!isActive) {
|
|
20
|
+
cancelAnimation(rotation);
|
|
21
|
+
rotation.value = 0;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
rotation.value = withRepeat(withTiming(360, {
|
|
25
|
+
duration: 1000,
|
|
26
|
+
easing: Easing.linear
|
|
27
|
+
}), -1, false);
|
|
28
|
+
return () => {
|
|
29
|
+
cancelAnimation(rotation);
|
|
30
|
+
rotation.value = 0;
|
|
31
|
+
};
|
|
32
|
+
}, [isActive, rotation]);
|
|
33
|
+
return {
|
|
34
|
+
animatedStyle,
|
|
35
|
+
backgroundColor: colors.gray,
|
|
36
|
+
color: colors.primary
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=use-loading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useTheme","cancelAnimation","Easing","useAnimatedStyle","useSharedValue","withRepeat","withTiming","useLoading","isActive","colors","rotation","animatedStyle","transform","rotate","value","duration","easing","linear","backgroundColor","gray","color","primary"],"sourceRoot":"../../../src","sources":["hooks/use-loading.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SACEC,eAAe,EACfC,MAAM,EACNC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAOhC,OAAO,MAAMC,UAAU,GAAGA,CAAC;EAAEC;AAA0B,CAAC,KAAK;EAC3D,MAAM;IAAEC;EAAO,CAAC,GAAGT,QAAQ,CAAmB,CAAC;EAC/C,MAAMU,QAAQ,GAAGN,cAAc,CAAC,CAAC,CAAC;EAClC,MAAMO,aAAa,GAAGR,gBAAgB,CAAC,OAAO;IAC5CS,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE,GAAGH,QAAQ,CAACI,KAAK;IAAM,CAAC;EAChD,CAAC,CAAC,CAAC;EAEHf,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,QAAQ,EAAE;MACbP,eAAe,CAACS,QAAQ,CAAC;MACzBA,QAAQ,CAACI,KAAK,GAAG,CAAC;MAElB;IACF;IAEAJ,QAAQ,CAACI,KAAK,GAAGT,UAAU,CACzBC,UAAU,CAAC,GAAG,EAAE;MACdS,QAAQ,EAAE,IAAI;MACdC,MAAM,EAAEd,MAAM,CAACe;IACjB,CAAC,CAAC,EACF,CAAC,CAAC,EACF,KACF,CAAC;IAED,OAAO,MAAM;MACXhB,eAAe,CAACS,QAAQ,CAAC;MACzBA,QAAQ,CAACI,KAAK,GAAG,CAAC;IACpB,CAAC;EACH,CAAC,EAAE,CAACN,QAAQ,EAAEE,QAAQ,CAAC,CAAC;EAExB,OAAO;IACLC,aAAa;IACbO,eAAe,EAAET,MAAM,CAACU,IAAI;IAC5BC,KAAK,EAAEX,MAAM,CAACY;EAChB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useNavigation } from '@react-navigation/native';
|
|
5
|
+
import { createOnboardingChannel } from "../services/index.js";
|
|
6
|
+
import { useFlowStore, useProcessStore } from "../store/index.js";
|
|
7
|
+
import { ProcessStatus, RequestStatus } from "../enums/index.js";
|
|
8
|
+
import { ContactSupportError } from "../errors/index.js";
|
|
9
|
+
export const useOnboardingChannel = props => {
|
|
10
|
+
const establishConnection = props?.establishConnection ?? true;
|
|
11
|
+
const navigation = useNavigation();
|
|
12
|
+
const [isProcessing, setIsProcessing] = useState(false);
|
|
13
|
+
const [isResourceNotFoundError, setIsResourceNotFoundError] = useState(false);
|
|
14
|
+
const [isProcessingError, setIsProcessingError] = useState(false);
|
|
15
|
+
const {
|
|
16
|
+
authToken,
|
|
17
|
+
tenant,
|
|
18
|
+
isSimplifiedMode,
|
|
19
|
+
notRequestDocument,
|
|
20
|
+
setNotRequestDocument
|
|
21
|
+
} = useProcessStore(state => ({
|
|
22
|
+
authToken: state.authToken,
|
|
23
|
+
tenant: state.tenant,
|
|
24
|
+
isSimplifiedMode: state.isSimplifiedMode,
|
|
25
|
+
notRequestDocument: state.notRequestDocument,
|
|
26
|
+
setNotRequestDocument: state.setNotRequestDocument
|
|
27
|
+
}));
|
|
28
|
+
const backgroundCheckExecutionId = useFlowStore(state => state.backgroundCheckExecutionId);
|
|
29
|
+
const notRequestDocumentRef = useRef(notRequestDocument);
|
|
30
|
+
const onReceiveData = useCallback(data => {
|
|
31
|
+
const nowProcessing = data.status === RequestStatus.PROCESSING;
|
|
32
|
+
const hasProcessingError = data.status === RequestStatus.ERROR;
|
|
33
|
+
const serverRequiresDocument = !data.not_request_document && data.status_onboarding === ProcessStatus.DOCUMENTS;
|
|
34
|
+
const shouldRequestDocument = notRequestDocumentRef.current && serverRequiresDocument;
|
|
35
|
+
const canFinish = data.status === RequestStatus.COMPLETED && data.status_onboarding === ProcessStatus.DONE;
|
|
36
|
+
if (hasProcessingError) {
|
|
37
|
+
return setIsProcessingError(true);
|
|
38
|
+
}
|
|
39
|
+
if (shouldRequestDocument) {
|
|
40
|
+
setNotRequestDocument(false);
|
|
41
|
+
if (isSimplifiedMode) {
|
|
42
|
+
return navigation.replace('DocumentCamera', {
|
|
43
|
+
side: 'front'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return navigation.replace('Document');
|
|
47
|
+
}
|
|
48
|
+
if (canFinish) {
|
|
49
|
+
return navigation.replace('ProcessFinished');
|
|
50
|
+
}
|
|
51
|
+
setIsProcessing(nowProcessing);
|
|
52
|
+
}, [isSimplifiedMode, navigation, setNotRequestDocument]);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!establishConnection) return;
|
|
55
|
+
if (!backgroundCheckExecutionId) {
|
|
56
|
+
return setIsResourceNotFoundError(true);
|
|
57
|
+
}
|
|
58
|
+
const channel = createOnboardingChannel({
|
|
59
|
+
authToken,
|
|
60
|
+
tenant,
|
|
61
|
+
backgroundCheckExecutionId,
|
|
62
|
+
onReceiveData
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
channel.unsubscribe();
|
|
66
|
+
};
|
|
67
|
+
}, [authToken, backgroundCheckExecutionId, establishConnection, onReceiveData, tenant]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
notRequestDocumentRef.current = notRequestDocument;
|
|
70
|
+
}, [notRequestDocument]);
|
|
71
|
+
if (isResourceNotFoundError) throw new ContactSupportError('0416');
|
|
72
|
+
if (isProcessingError) throw new ContactSupportError();
|
|
73
|
+
return {
|
|
74
|
+
processingMessage: 'Validando informações',
|
|
75
|
+
isProcessing
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=use-onboarding-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","useState","useNavigation","createOnboardingChannel","useFlowStore","useProcessStore","ProcessStatus","RequestStatus","ContactSupportError","useOnboardingChannel","props","establishConnection","navigation","isProcessing","setIsProcessing","isResourceNotFoundError","setIsResourceNotFoundError","isProcessingError","setIsProcessingError","authToken","tenant","isSimplifiedMode","notRequestDocument","setNotRequestDocument","state","backgroundCheckExecutionId","notRequestDocumentRef","onReceiveData","data","nowProcessing","status","PROCESSING","hasProcessingError","ERROR","serverRequiresDocument","not_request_document","status_onboarding","DOCUMENTS","shouldRequestDocument","current","canFinish","COMPLETED","DONE","replace","side","channel","unsubscribe","processingMessage"],"sourceRoot":"../../../src","sources":["hooks/use-onboarding-channel.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,aAAa,QAAQ,0BAA0B;AAGxD,SACEC,uBAAuB,QAElB,sBAAa;AACpB,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAU;AACxD,SAASC,aAAa,EAAEC,aAAa,QAAQ,mBAAU;AACvD,SAASC,mBAAmB,QAAQ,oBAAW;AAM/C,OAAO,MAAMC,oBAAoB,GAAIC,KAAiC,IAAK;EACzE,MAAMC,mBAAmB,GAAGD,KAAK,EAAEC,mBAAmB,IAAI,IAAI;EAE9D,MAAMC,UAAU,GACdV,aAAa,CAAgD,CAAC;EAChE,MAAM,CAACW,YAAY,EAAEC,eAAe,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EACvD,MAAM,CAACc,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGf,QAAQ,CAAC,KAAK,CAAC;EAC7E,MAAM,CAACgB,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGjB,QAAQ,CAAC,KAAK,CAAC;EACjE,MAAM;IACJkB,SAAS;IACTC,MAAM;IACNC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,OAAOhC,UAAU,CAAC+B,OAAO,CAAC,UAAU,CAAC;IACvC;IAEA,IAAIH,SAAS,EAAE;MACb,OAAO5B,UAAU,CAAC+B,OAAO,CAAC,iBAAiB,CAAC;IAC9C;IAEA7B,eAAe,CAACe,aAAa,CAAC;EAChC,CAAC,EACD,CAACR,gBAAgB,EAAET,UAAU,EAAEW,qBAAqB,CACtD,CAAC;EAEDxB,SAAS,CAAC,MAAM;IACd,IAAI,CAACY,mBAAmB,EAAE;IAE1B,IAAI,CAACc,0BAA0B,EAAE;MAC/B,OAAOT,0BAA0B,CAAC,IAAI,CAAC;IACzC;IAEA,MAAM6B,OAAO,GAAG1C,uBAAuB,CAAC;MACtCgB,SAAS;MACTC,MAAM;MACNK,0BAA0B;MAC1BE;IACF,CAAC,CAAC;IAEF,OAAO,MAAM;MACXkB,OAAO,CAACC,WAAW,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,CACD3B,SAAS,EACTM,0BAA0B,EAC1Bd,mBAAmB,EACnBgB,aAAa,EACbP,MAAM,CACP,CAAC;EAEFrB,SAAS,CAAC,MAAM;IACd2B,qBAAqB,CAACa,OAAO,GAAGjB,kBAAkB;EACpD,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;EAExB,IAAIP,uBAAuB,EAAE,MAAM,IAAIP,mBAAmB,CAAC,MAAM,CAAC;EAClE,IAAIS,iBAAiB,EAAE,MAAM,IAAIT,mBAAmB,CAAC,CAAC;EAEtD,OAAO;IACLuC,iBAAiB,EAAE,uBAAuB;IAC1ClC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { navigationRef } from "../navigation/index.js";
|
|
6
|
+
import { useFlowStore, useProcessStore } from "../store/index.js";
|
|
7
|
+
import { alterProcessStatus } from "../services/index.js";
|
|
8
|
+
import { routesNeedAlterStatus } from "../constants/index.js";
|
|
9
|
+
import { ProcessStatus } from "../enums/index.js";
|
|
10
|
+
import { ContactSupportError } from "../errors/index.js";
|
|
11
|
+
export const useProcessStatus = () => {
|
|
12
|
+
const [isError, setIsError] = useState(false);
|
|
13
|
+
const {
|
|
14
|
+
authToken,
|
|
15
|
+
tenant,
|
|
16
|
+
backgroundCheckId,
|
|
17
|
+
status,
|
|
18
|
+
setStatus
|
|
19
|
+
} = useProcessStore(state => ({
|
|
20
|
+
authToken: state.authToken,
|
|
21
|
+
tenant: state.tenant,
|
|
22
|
+
backgroundCheckId: state.backgroundCheckId,
|
|
23
|
+
status: state.status,
|
|
24
|
+
setStatus: state.setStatus
|
|
25
|
+
}));
|
|
26
|
+
const backgroundCheckExecutionId = useFlowStore(state => state.backgroundCheckExecutionId);
|
|
27
|
+
const {
|
|
28
|
+
mutate: alterMutate,
|
|
29
|
+
error: alterError,
|
|
30
|
+
isError: isAlterError
|
|
31
|
+
} = useMutation({
|
|
32
|
+
mutationFn: alterProcessStatus
|
|
33
|
+
});
|
|
34
|
+
const resolveThatRouteNeeds = useCallback(() => {
|
|
35
|
+
const routeName = navigationRef.current?.getCurrentRoute()?.name;
|
|
36
|
+
const requiredStatus = routeName && routesNeedAlterStatus[routeName];
|
|
37
|
+
if (!backgroundCheckExecutionId) {
|
|
38
|
+
return ProcessStatus.START;
|
|
39
|
+
}
|
|
40
|
+
return requiredStatus ?? status;
|
|
41
|
+
}, [backgroundCheckExecutionId, status]);
|
|
42
|
+
const checkIfRouteNeedsAlter = useCallback(() => {
|
|
43
|
+
const statusThatRouteNeeds = resolveThatRouteNeeds();
|
|
44
|
+
return !!backgroundCheckExecutionId && statusThatRouteNeeds !== status;
|
|
45
|
+
}, [backgroundCheckExecutionId, resolveThatRouteNeeds, status]);
|
|
46
|
+
const alterToThatRouteNeeds = useCallback(() => {
|
|
47
|
+
const routeNeedsAlter = checkIfRouteNeedsAlter();
|
|
48
|
+
if (!routeNeedsAlter || !backgroundCheckExecutionId) {
|
|
49
|
+
return setIsError(true);
|
|
50
|
+
}
|
|
51
|
+
const statusThatRouteNeeds = resolveThatRouteNeeds();
|
|
52
|
+
alterMutate({
|
|
53
|
+
authToken,
|
|
54
|
+
tenant,
|
|
55
|
+
backgroundCheckId,
|
|
56
|
+
backgroundCheckExecutionId,
|
|
57
|
+
status: statusThatRouteNeeds
|
|
58
|
+
});
|
|
59
|
+
setStatus(statusThatRouteNeeds);
|
|
60
|
+
}, [alterMutate, authToken, backgroundCheckExecutionId, backgroundCheckId, checkIfRouteNeedsAlter, resolveThatRouteNeeds, setStatus, tenant]);
|
|
61
|
+
if (isError) throw new ContactSupportError('0407');
|
|
62
|
+
if (isAlterError) throw alterError;
|
|
63
|
+
return {
|
|
64
|
+
checkIfRouteNeedsAlter,
|
|
65
|
+
alterToThatRouteNeeds,
|
|
66
|
+
resolveThatRouteNeeds
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=use-process-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useState","useMutation","navigationRef","useFlowStore","useProcessStore","alterProcessStatus","routesNeedAlterStatus","ProcessStatus","ContactSupportError","useProcessStatus","isError","setIsError","authToken","tenant","backgroundCheckId","status","setStatus","state","backgroundCheckExecutionId","mutate","alterMutate","error","alterError","isAlterError","mutationFn","resolveThatRouteNeeds","routeName","current","getCurrentRoute","name","requiredStatus","START","checkIfRouteNeedsAlter","statusThatRouteNeeds","alterToThatRouteNeeds","routeNeedsAlter"],"sourceRoot":"../../../src","sources":["hooks/use-process-status.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,aAAa,QAAQ,wBAAe;AAC7C,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAU;AACxD,SAASC,kBAAkB,QAAQ,sBAAa;AAChD,SAAS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AAoB,GAAGR,qBAAqB,CAAC,CAAC;IAEpD,OAAO,CAAC,CAACP,0BAA0B,IAAIe,oBAAoB,KAAKlB,MAAM;EACxE,CAAC,EAAE,CAACG,0BAA0B,EAAEO,qBAAqB,EAAEV,MAAM,CAAC,CAAC;EAC/D,MAAMmB,qBAAqB,GAAGnC,WAAW,CAAC,MAAM;IAC9C,MAAMoC,eAAe,GAAGH,sBAAsB,CAAC,CAAC;IAEhD,IAAI,CAACG,eAAe,IAAI,CAACjB,0BAA0B,EAAE;MACnD,OAAOP,UAAU,CAAC,IAAI,CAAC;IACzB;IAEA,MAAMsB,oBAAoB,GAAGR,qBAAqB,CAAC,CAAC;IAEpDL,WAAW,CAAC;MACVR,SAAS;MACTC,MAAM;MACNC,iBAAiB;MACjBI,0BAA0B;MAC1BH,MAAM,EAAEkB;IACV,CAAC,CAAC;IACFjB,SAAS,CAACiB,oBAAoB,CAAC;EACjC,CAAC,EAAE,CACDb,WAAW,EACXR,SAAS,EACTM,0BAA0B,EAC1BJ,iBAAiB,EACjBkB,sBAAsB,EACtBP,qBAAqB,EACrBT,SAAS,EACTH,MAAM,CACP,CAAC;EAEF,IAAIH,OAAO,EAAE,MAAM,IAAIF,mBAAmB,CAAC,MAAM,CAAC;EAClD,IAAIe,YAAY,EAAE,MAAMD,UAAU;EAElC,OAAO;IACLU,sBAAsB;IACtBE,qBAAqB;IACrBT;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
import { useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { useFlowStore, useProcessStore, useProcessTimelineQueueStore } from "../store/index.js";
|
|
6
|
+
import { createProcessTimeline } from "../services/index.js";
|
|
7
|
+
import { useProcessStatus } from "./use-process-status.js";
|
|
8
|
+
import { ContactSupportError } from "../errors/index.js";
|
|
9
|
+
export const useProcessTimeline = () => {
|
|
10
|
+
const isQueueFlushedRef = useRef(false);
|
|
11
|
+
const [isError, setIsError] = useState(false);
|
|
12
|
+
const {
|
|
13
|
+
authToken,
|
|
14
|
+
tenant,
|
|
15
|
+
backgroundCheckId,
|
|
16
|
+
status: processStatus
|
|
17
|
+
} = useProcessStore(state => ({
|
|
18
|
+
authToken: state.authToken,
|
|
19
|
+
tenant: state.tenant,
|
|
20
|
+
backgroundCheckId: state.backgroundCheckId,
|
|
21
|
+
status: state.status
|
|
22
|
+
}));
|
|
23
|
+
const backgroundCheckExecutionId = useFlowStore(state => state.backgroundCheckExecutionId);
|
|
24
|
+
const {
|
|
25
|
+
events,
|
|
26
|
+
enqueue: enqueueEvent,
|
|
27
|
+
clear: clearEvents
|
|
28
|
+
} = useProcessTimelineQueueStore(state => ({
|
|
29
|
+
events: state.events,
|
|
30
|
+
enqueue: state.enqueue,
|
|
31
|
+
clear: state.clear
|
|
32
|
+
}));
|
|
33
|
+
const {
|
|
34
|
+
mutate: createMutate,
|
|
35
|
+
error: createError,
|
|
36
|
+
isError: isCreateError
|
|
37
|
+
} = useMutation({
|
|
38
|
+
mutationFn: createProcessTimeline
|
|
39
|
+
});
|
|
40
|
+
const {
|
|
41
|
+
resolveThatRouteNeeds: resolveProcessStatusThatRouteNeeds
|
|
42
|
+
} = useProcessStatus();
|
|
43
|
+
const checkIfShouldEnqueueEvent = useCallback(() => {
|
|
44
|
+
const processStatusThatRouteNeeds = resolveProcessStatusThatRouteNeeds();
|
|
45
|
+
return !backgroundCheckExecutionId || processStatusThatRouteNeeds !== processStatus;
|
|
46
|
+
}, [backgroundCheckExecutionId, processStatus, resolveProcessStatusThatRouteNeeds]);
|
|
47
|
+
const checkIfCanFlushQueue = useCallback(() => {
|
|
48
|
+
const processStatusThatRouteNeeds = resolveProcessStatusThatRouteNeeds();
|
|
49
|
+
return !isQueueFlushedRef.current && !!backgroundCheckExecutionId && processStatusThatRouteNeeds === processStatus;
|
|
50
|
+
}, [backgroundCheckExecutionId, processStatus, resolveProcessStatusThatRouteNeeds]);
|
|
51
|
+
const create = useCallback(event => {
|
|
52
|
+
const shouldEnqueueEvent = checkIfShouldEnqueueEvent();
|
|
53
|
+
if (shouldEnqueueEvent || !backgroundCheckExecutionId) {
|
|
54
|
+
const processStatusThatRouteNeeds = resolveProcessStatusThatRouteNeeds();
|
|
55
|
+
enqueueEvent({
|
|
56
|
+
processStatus: processStatusThatRouteNeeds,
|
|
57
|
+
status: event.status,
|
|
58
|
+
message: event.message,
|
|
59
|
+
image: event.image
|
|
60
|
+
});
|
|
61
|
+
isQueueFlushedRef.current = false;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
return createMutate({
|
|
65
|
+
authToken,
|
|
66
|
+
tenant,
|
|
67
|
+
backgroundCheckId,
|
|
68
|
+
backgroundCheckExecutionId,
|
|
69
|
+
processStatus,
|
|
70
|
+
status: event.status,
|
|
71
|
+
message: event.message,
|
|
72
|
+
image: event.image
|
|
73
|
+
});
|
|
74
|
+
}, [authToken, backgroundCheckExecutionId, backgroundCheckId, checkIfShouldEnqueueEvent, createMutate, enqueueEvent, processStatus, resolveProcessStatusThatRouteNeeds, tenant]);
|
|
75
|
+
const flushQueue = useCallback(() => {
|
|
76
|
+
const canFlush = checkIfCanFlushQueue();
|
|
77
|
+
if (!canFlush || !backgroundCheckExecutionId) {
|
|
78
|
+
return setIsError(true);
|
|
79
|
+
}
|
|
80
|
+
for (const event of events) {
|
|
81
|
+
createMutate({
|
|
82
|
+
authToken,
|
|
83
|
+
tenant,
|
|
84
|
+
backgroundCheckId,
|
|
85
|
+
backgroundCheckExecutionId,
|
|
86
|
+
processStatus: event.processStatus,
|
|
87
|
+
status: event.status,
|
|
88
|
+
message: event.message,
|
|
89
|
+
image: event.image
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
clearEvents();
|
|
93
|
+
isQueueFlushedRef.current = true;
|
|
94
|
+
}, [authToken, backgroundCheckExecutionId, backgroundCheckId, checkIfCanFlushQueue, clearEvents, createMutate, events, tenant]);
|
|
95
|
+
if (isError) throw new ContactSupportError('0425');
|
|
96
|
+
if (isCreateError) throw createError;
|
|
97
|
+
return {
|
|
98
|
+
create,
|
|
99
|
+
flushQueue,
|
|
100
|
+
checkIfCanFlushQueue
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=use-process-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useState","useMutation","useFlowStore","useProcessStore","useProcessTimelineQueueStore","createProcessTimeline","useProcessStatus","ContactSupportError","useProcessTimeline","isQueueFlushedRef","isError","setIsError","authToken","tenant","backgroundCheckId","status","processStatus","state","backgroundCheckExecutionId","events","enqueue","enqueueEvent","clear","clearEvents","mutate","createMutate","error","createError","isCreateError","mutationFn","resolveThatRouteNeeds","resolveProcessStatusThatRouteNeeds","checkIfShouldEnqueueEvent","processStatusThatRouteNeeds","checkIfCanFlushQueue","current","create","event","shouldEnqueueEvent","message","image","flushQueue","canFlush"],"sourceRoot":"../../../src","sources":["hooks/use-process-timeline.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SACEC,YAAY,EACZC,eAAe,EACfC,4BAA4B,QACvB,mBAAU;AACjB,SAASC,qBAAqB,QAAQ,sBAAa;AACnD,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,mBAAmB,QAAQ,oBAAW;AAE/C,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,iBAAiB,GAAGV,MAAM,CAAC,KAAK,CAAC;EACvC,MAAM,CAACW,OAAO,EAAEC,UAAU,CAAC,GAAGX,QAAQ,CAAC,KAAK,CAAC;EAC7C,MAAM;IACJY,SAAS;IACTC,MAAM;IACNC,iBAAiB;IACjBC,MAAM,EAAEC;EACV,CAAC,GAAGb,eAAe,CAAEc,KAAK,KA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tB,MAAM;QACpBwB,OAAO,EAAEF,KAAK,CAACE,OAAO;QACtBC,KAAK,EAAEH,KAAK,CAACG;MACf,CAAC,CAAC;IACJ;IAEAjB,WAAW,CAAC,CAAC;IACbd,iBAAiB,CAAC0B,OAAO,GAAG,IAAI;EAClC,CAAC,EAAE,CACDvB,SAAS,EACTM,0BAA0B,EAC1BJ,iBAAiB,EACjBoB,oBAAoB,EACpBX,WAAW,EACXE,YAAY,EACZN,MAAM,EACNN,MAAM,CACP,CAAC;EAEF,IAAIH,OAAO,EAAE,MAAM,IAAIH,mBAAmB,CAAC,MAAM,CAAC;EAClD,IAAIqB,aAAa,EAAE,MAAMD,WAAW;EAEpC,OAAO;IACLS,MAAM;IACNK,UAAU;IACVP;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRoute } from '@react-navigation/native';
|
|
4
|
+
import { useTheme } from '@shopify/restyle';
|
|
5
|
+
import { useProcessStore } from "../store/index.js";
|
|
6
|
+
import { progressSteps } from "../constants/index.js";
|
|
7
|
+
import { Objective } from "../enums/index.js";
|
|
8
|
+
export const useProgressIndicator = () => {
|
|
9
|
+
const route = useRoute();
|
|
10
|
+
const {
|
|
11
|
+
objective,
|
|
12
|
+
notRequestDocument
|
|
13
|
+
} = useProcessStore(state => ({
|
|
14
|
+
objective: state.objective,
|
|
15
|
+
notRequestDocument: state.notRequestDocument
|
|
16
|
+
}));
|
|
17
|
+
const {
|
|
18
|
+
colors
|
|
19
|
+
} = useTheme();
|
|
20
|
+
const steps = progressSteps.filter(step => {
|
|
21
|
+
if (objective === Objective.FACE_AUTH) {
|
|
22
|
+
return step.routes.includes('FaceAuth');
|
|
23
|
+
}
|
|
24
|
+
if (notRequestDocument) {
|
|
25
|
+
return !step.routes.includes('Document');
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
const currentStepIndex = steps.findIndex(step => step.routes.includes(route.name));
|
|
30
|
+
const currentIndex = currentStepIndex === -1 ? steps.length - 1 : currentStepIndex;
|
|
31
|
+
const currentStep = currentIndex + 1;
|
|
32
|
+
const totalSteps = steps.length;
|
|
33
|
+
const bars = Array(totalSteps).fill(0).map((_, index) => ({
|
|
34
|
+
isCurrent: currentIndex === index,
|
|
35
|
+
isFirst: index === 0,
|
|
36
|
+
isLast: index === totalSteps - 1
|
|
37
|
+
}));
|
|
38
|
+
const stepIcon = steps[currentIndex].icon;
|
|
39
|
+
return {
|
|
40
|
+
currentStep,
|
|
41
|
+
totalSteps,
|
|
42
|
+
bars,
|
|
43
|
+
stepIcon,
|
|
44
|
+
stepIconColor: colors.text
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=use-progress-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRoute","useTheme","useProcessStore","progressSteps","Objective","useProgressIndicator","route","objective","notRequestDocument","state","colors","steps","filter","step","FACE_AUTH","routes","includes","currentStepIndex","findIndex","name","currentIndex","length","currentStep","totalSteps","bars","Array","fill","map","_","index","isCurrent","isFirst","isLast","stepIcon","icon","stepIconColor","text"],"sourceRoot":"../../../src","sources":["hooks/use-progress-indicator.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAwB,0BAA0B;AACnE,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SAASC,eAAe,QAAQ,mBAAU;AAC1C,SAASC,aAAa,QAAQ,uBAAc;AAC5C,SAASC,SAAS,QAAQ,mBAAU;AAGpC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACxC,MAAMC,KAAK,GAAGN,QAAQ,CAAgC,CAAC;EACvD,MAAM;IAAEO,SAAS;IAAEC;EAAmB,CAAC,GAAGN,eAAe,CAAEO,KAAK,KAAM;IACpEF,SAAS,EAAEE,KAAK,CAACF,SAAS;IAC1BC,kBAAkB,EAAEC,KAAK,CAACD;EAC5B,CAAC,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
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
export const useRecommendedValidations = () => {
|
|
5
|
+
const [bulletLayouts, setBulletLayouts] = useState([]);
|
|
6
|
+
const [titleMarginLeft, setTitleMarginLeft] = useState(0);
|
|
7
|
+
const bulletRefs = useRef([]);
|
|
8
|
+
const getConnectorHeight = useCallback(index => {
|
|
9
|
+
const current = bulletLayouts[index];
|
|
10
|
+
const next = bulletLayouts[index + 1];
|
|
11
|
+
if (!current || !next) return 0;
|
|
12
|
+
return next.y - (current.y + current.height);
|
|
13
|
+
}, [bulletLayouts]);
|
|
14
|
+
const onBulletLayout = useCallback(index => {
|
|
15
|
+
const ref = bulletRefs.current[index];
|
|
16
|
+
if (!ref) return;
|
|
17
|
+
ref.measureInWindow((x, y, width, height) => {
|
|
18
|
+
setBulletLayouts(prev => [...prev, {
|
|
19
|
+
x,
|
|
20
|
+
y,
|
|
21
|
+
width,
|
|
22
|
+
height
|
|
23
|
+
}]);
|
|
24
|
+
});
|
|
25
|
+
}, []);
|
|
26
|
+
const onRecommendationLayout = useCallback(event => {
|
|
27
|
+
setTitleMarginLeft(event.nativeEvent.layout.x);
|
|
28
|
+
}, []);
|
|
29
|
+
return {
|
|
30
|
+
bulletRefs,
|
|
31
|
+
titleMarginLeft,
|
|
32
|
+
getConnectorHeight,
|
|
33
|
+
onBulletLayout,
|
|
34
|
+
onRecommendationLayout
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=use-recommended-validations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useState","useRecommendedValidations","bulletLayouts","setBulletLayouts","titleMarginLeft","setTitleMarginLeft","bulletRefs","getConnectorHeight","index","current","next","y","height","onBulletLayout","ref","measureInWindow","x","width","prev","onRecommendationLayout","event","nativeEvent","layout"],"sourceRoot":"../../../src","sources":["hooks/use-recommended-validations.ts"],"mappings":";;AAA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C;EAEN,OAAO;IACLV,UAAU;IACVF,eAAe;IACfG,kBAAkB;IAClBM,cAAc;IACdM;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { DetectFacesCommand, RekognitionClient } from '@aws-sdk/client-rekognition';
|
|
4
|
+
import { useFlowStore, useProcessStore } from "../store/index.js";
|
|
5
|
+
import { ContactSupportError } from "../errors/index.js";
|
|
6
|
+
export const useRekognition = () => {
|
|
7
|
+
const bucket = useProcessStore(state => state.bucket);
|
|
8
|
+
const temporaryCredentials = useFlowStore(state => state.temporaryCredentials);
|
|
9
|
+
if (!bucket || !temporaryCredentials) throw new ContactSupportError('0410');
|
|
10
|
+
const client = new RekognitionClient({
|
|
11
|
+
region: bucket.region,
|
|
12
|
+
credentials: {
|
|
13
|
+
accessKeyId: temporaryCredentials.accessKeyId,
|
|
14
|
+
secretAccessKey: temporaryCredentials.secretAccessKey,
|
|
15
|
+
sessionToken: temporaryCredentials.sessionToken,
|
|
16
|
+
expiration: new Date(temporaryCredentials.expiration)
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const checkFaceConfidence = async pictureBytes => {
|
|
20
|
+
try {
|
|
21
|
+
const detectFacesOutput = await client.send(new DetectFacesCommand({
|
|
22
|
+
Image: {
|
|
23
|
+
Bytes: pictureBytes
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
return detectFacesOutput.FaceDetails?.[0]?.Confidence;
|
|
27
|
+
} catch (err) {
|
|
28
|
+
throw new ContactSupportError('0403.2');
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
checkFaceConfidence
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=use-rekognition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DetectFacesCommand","RekognitionClient","useFlowStore","useProcessStore","ContactSupportError","useRekognition","bucket","state","temporaryCredentials","client","region","credentials","accessKeyId","secretAccessKey","sessionToken","expiration","Date","checkFaceConfidence","pictureBytes","detectFacesOutput","send","Image","Bytes","FaceDetails","Confidence","err"],"sourceRoot":"../../../src","sources":["hooks/use-rekognition.ts"],"mappings":";;AAAA,SACEA,kBAAkB,EAClBC,iBAAiB,QACZ,6BAA6B;AACpC,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAU;AACxD,SAASC,mBAAmB,QAAQ,oBAAW;AAE/C,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAClC,MAAMC,MAAM,GAAGH,eAAe,CAAEI,KAAK,IAAKA,KAAK,CAACD,MAAM,CAAC;EACvD,MAAME,oBAAoB,GAAGN,YAAY,CACtCK,KAAK,IAAKA,KAAK,CAACC,oBACnB,CAAC;EAED,IAAI,CAACF,MAAM,IAAI,CAACE,oBAAoB,EAAE,MAAM,IAAIJ,mBAAmB,CAAC,MAAM,CAAC;EAE3E,MAAMK,MAAM,GAAG,IAAIR,iBAAiB,CAAC;IACnCS,MAAM,EAAEJ,MAAM,CAACI,MAAM;IACrBC,WAAW,EAAE;MACXC,WAAW,EAAEJ,oBAAoB,CAACI,WAAW;MAC7CC,eAAe,EAAEL,oBAAoB,CAACK,eAAe;MACrDC,YAAY,EAAEN,oBAAoB,CAACM,YAAY;MAC/CC,UAAU,EAAE,IAAIC,IAAI,CAACR,oBAAoB,CAACO,UAAU;IACtD;EACF,CAAC,CAAC;EAEF,MAAME,mBAAmB,GAAG,MAC1BC,YAAqC,IACL;IAChC,IAAI;MACF,MAAMC,iBAAiB,GAAG,MAAMV,MAAM,CAACW,IAAI,CACzC,IAAIpB,kBAAkB,CAAC;QAAEqB,KAAK,EAAE;UAAEC,KAAK,EAAEJ;QAAa;MAAE,CAAC,CAC3D,CAAC;MAED,OAAOC,iBAAiB,CAACI,WAAW,GAAG,CAAC,CAAC,EAAEC,UAAU;IACvD,CAAC,CAAC,OAAOC,GAAG,EAAE;MACZ,MAAM,IAAIrB,mBAAmB,CAAC,QAAQ,CAAC;IACzC;EACF,CAAC;EAED,OAAO;IAAEa;EAAoB,CAAC;AAChC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
|
+
import { readFile } from 'react-native-fs';
|
|
5
|
+
import { Image } from 'react-native-compressor';
|
|
6
|
+
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
|
7
|
+
import { ImageType } from "../enums/index.js";
|
|
8
|
+
import { imageTypeReferences } from "../constants/index.js";
|
|
9
|
+
import { useFlowStore, useProcessStore } from "../store/index.js";
|
|
10
|
+
import { ContactSupportError } from "../errors/index.js";
|
|
11
|
+
export const useS3 = imageType => {
|
|
12
|
+
const {
|
|
13
|
+
tenant,
|
|
14
|
+
bucket
|
|
15
|
+
} = useProcessStore(state => ({
|
|
16
|
+
tenant: state.tenant,
|
|
17
|
+
bucket: state.bucket
|
|
18
|
+
}));
|
|
19
|
+
const {
|
|
20
|
+
temporaryCredentials,
|
|
21
|
+
backgroundCheckExecutionId
|
|
22
|
+
} = useFlowStore(state => ({
|
|
23
|
+
temporaryCredentials: state.temporaryCredentials,
|
|
24
|
+
backgroundCheckExecutionId: state.backgroundCheckExecutionId
|
|
25
|
+
}));
|
|
26
|
+
if (!bucket || !temporaryCredentials || !backgroundCheckExecutionId) {
|
|
27
|
+
throw new ContactSupportError('0410');
|
|
28
|
+
}
|
|
29
|
+
const client = useRef(new S3Client({
|
|
30
|
+
region: bucket.region,
|
|
31
|
+
credentials: {
|
|
32
|
+
accessKeyId: temporaryCredentials.accessKeyId,
|
|
33
|
+
secretAccessKey: temporaryCredentials.secretAccessKey,
|
|
34
|
+
sessionToken: temporaryCredentials.sessionToken,
|
|
35
|
+
expiration: new Date(temporaryCredentials.expiration)
|
|
36
|
+
}
|
|
37
|
+
})).current;
|
|
38
|
+
const prepare = useCallback(async uri => {
|
|
39
|
+
try {
|
|
40
|
+
const compressed = await Image.compress(uri.replace('file://', ''));
|
|
41
|
+
const base64 = await readFile(compressed, 'base64');
|
|
42
|
+
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
|
43
|
+
} catch (err) {
|
|
44
|
+
if (imageType === ImageType.FRONT_DOCUMENT) {
|
|
45
|
+
throw new ContactSupportError('0411.1.1');
|
|
46
|
+
}
|
|
47
|
+
if (imageType === ImageType.BACK_DOCUMENT) {
|
|
48
|
+
throw new ContactSupportError('0411.1.2');
|
|
49
|
+
}
|
|
50
|
+
if (imageType === ImageType.FACE) {
|
|
51
|
+
throw new ContactSupportError('0411.1.3');
|
|
52
|
+
}
|
|
53
|
+
if (imageType === ImageType.DOCUMENT_PDF) {
|
|
54
|
+
throw new ContactSupportError('0411.1.4');
|
|
55
|
+
}
|
|
56
|
+
throw new ContactSupportError('0411.1.5');
|
|
57
|
+
}
|
|
58
|
+
}, [imageType]);
|
|
59
|
+
const upload = useCallback(async bytes => {
|
|
60
|
+
try {
|
|
61
|
+
const timestamp = Date.now().toString(36);
|
|
62
|
+
const random = Math.random().toString(36).substring(2, 10);
|
|
63
|
+
const id = `${timestamp}${random}`;
|
|
64
|
+
const reference = imageTypeReferences[imageType];
|
|
65
|
+
const key = imageType === ImageType.FACE ? `${tenant}/${reference}_${backgroundCheckExecutionId}.jpeg` : `${tenant}/logs/${reference}_${backgroundCheckExecutionId}_${id}.jpeg`;
|
|
66
|
+
await client.send(new PutObjectCommand({
|
|
67
|
+
Bucket: bucket.upload,
|
|
68
|
+
Key: key,
|
|
69
|
+
Body: bytes,
|
|
70
|
+
ContentType: 'image/jpeg'
|
|
71
|
+
}));
|
|
72
|
+
return `https://${bucket.upload}.s3.${bucket.region}.amazonaws.com/${key}`;
|
|
73
|
+
} catch (err) {
|
|
74
|
+
if (imageType === ImageType.FRONT_DOCUMENT) {
|
|
75
|
+
throw new ContactSupportError('0411.3.1');
|
|
76
|
+
}
|
|
77
|
+
if (imageType === ImageType.BACK_DOCUMENT) {
|
|
78
|
+
throw new ContactSupportError('0411.3.2');
|
|
79
|
+
}
|
|
80
|
+
if (imageType === ImageType.FACE) {
|
|
81
|
+
throw new ContactSupportError('0411.3.3');
|
|
82
|
+
}
|
|
83
|
+
if (imageType === ImageType.DOCUMENT_PDF) {
|
|
84
|
+
throw new ContactSupportError('0411.3.4');
|
|
85
|
+
}
|
|
86
|
+
throw new ContactSupportError('0411.3.5');
|
|
87
|
+
}
|
|
88
|
+
}, [backgroundCheckExecutionId, bucket, client, imageType, tenant]);
|
|
89
|
+
return {
|
|
90
|
+
prepare,
|
|
91
|
+
upload
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=use-s3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","readFile","Image","PutObjectCommand","S3Client","ImageType","imageTypeReferences","useFlowStore","useProcessStore","ContactSupportError","useS3","imageType","tenant","bucket","state","temporaryCredentials","backgroundCheckExecutionId","client","region","credentials","accessKeyId","secretAccessKey","sessionToken","expiration","Date","current","prepare","uri","compressed","compress","replace","base64","Uint8Array","from","atob","c","charCodeAt","err","FRONT_DOCUMENT","BACK_DOCUMENT","FACE","DOCUMENT_PDF","upload","bytes","timestamp","now","toString","random","Math","substring","id","reference","key","send","Bucket","Key","Body","ContentType"],"sourceRoot":"../../../src","sources":["hooks/use-s3.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC3C,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,QAAQ,yBAAyB;AAC/C,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,QAAQ,mBAAU;AACpC,SAASC,mBAAmB,QAAQ,uBAAc;AAClD,SAASC,YAAY,EAAEC,eAAe,QAAQ,mBAAU;AACxD,SAASC,mBAAmB,QAAQ,oBAAW;AAE/C,OAAO,MAAMC,K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