0.0.62 • Published 8 months ago

borisous-lib v0.0.62

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

INSTRUCTIONS FOR IMPLEMENTATION

npm i @fad-producto/argentinian-dni-capture@latest --legacy-peer-deps Pre-instalation: - https://github.com/lgeronimov/fad-modules-install

1 - add skipLibCheck configuration (tsconfig.json)

{ "compilerOptions": { "skipLibCheck": true, ...

2 - import library assets (angular.json)

 "architect": {
    "build": {
      "options": {
        "assets": [
            {
                "glob": "**/*",
                "input": "node_modules/@fad-producto/argentinian-dni-capture/assets/tf-models",
                "output": "./assets/tf-models"
            },
            {
                "glob": "**/*",
                "input": "node_modules/@fad-producto/argentinian-dni-capture/assets/tfLite",
                "output": "./"
            }
        ],
        "scripts": [
            "node_modules/@fad-producto/argentinian-dni-capture/assets/opencv.js"
        ]    
        ...

3 - Import component - app.module.ts

import { ArgentinianDniCaptureModule } from '@fad-producto/argentinian-dni-capture';

@NgModule({ imports: [ ArgentinianDniCaptureModule,

4 - Component Inputs & Outputs

Inputs

<argentinian-dni-capture 
    [title]="title"
    [debugMode]="false"
    [darkMode]="false"
    [tfModelPath]="'/assets/tf-models/'"
    (onStart)="onStart($event)"
    (cameraAccepted)="cameraAccepted()"
    (getData)="getData($event)"
    (getError)="getError($event)"
    (getCloseScanner)="getCloseScanner($event)"
    ...

| Name         | Type    | Required | Default | Description                                       |
| ------------ | ------- | -------- | ------- | ------------------------------------------------- |
| title        | string  | true     |         | Legend to display before capture                  |
| debugMode    | boolean | false    | false   | Show capture on display for development reasons   |
| darkMode     | boolean | false    | false   | background color screen, dark or light            |
| tfModelPath  | string  | false    | null    | model path, configure if your href is not default |

Outputs

onStart($event) {
    console.log('Scanner onStart ' + $event);
}

cameraAccepted() {
    console.log('Scanner acceptCamera event');
}

getData($event) {
    console.log('Scanner result: ', $event);
}

getError($event) {
    console.log('Scanner error: ', $event);
}

getCloseScanner($event) {
    console.log('Cerrando Scanner ' + $event);
}

| Name             |  Return                            | Description                                        |
| ---------------- | ---------------------------------- | -------------------------------------------------- |
| onStart          | void                               | Fires when the component is ready                  |
| cameraAccepted   | void                               | Fires when the user accepts the camera permissions |
| getData          | Value of type "DataResponseModel"  | Fires when scanning was completed                  |
| getError         | Value of type "ResponseErrorModel" | Fires when an error happens                        |
| getCloseScanner  | void                               | Fires when the scanner closes                      |

Data Structure

DataResponseModel
    className: string;
    probability: number;
    innerText: string;
    imageBase64 : string;
    imageFixed : string;
    croppedPhoto : string;
    blurred: number;

ResponseErrorModel
    error: string; (*ErrorMessages enum)
    message: string; (Error string detail)
    code: number; (*ErrorCodes enum)

export enum ErrorMessages {
    BROWSER_NOT_SUPPORTED =  'Navegador no soportado',
    NOT_ACCEPT_CAMERA_PERMISSION = 'No tienes permisos para acceder a la cámara',
    MAX_TIME_LIMIT =  'Tiempo máximo superado',
    ORIENTATION_TITLE = 'Por favor coloca tu dispositivo de forma vertical',
    ORIENTATION_INSTRUCTIONS = 'Te sugerimos bloquear el giro automático en tu dispositivo para una mejor experiencia',
    NOT_SUPPORTED_TITLE = 'Atención',
    NOT_SUPPORTED_INSTRUCTIONS = 'Este es un navegador no soportado',
    NOT_DETECTED = 'No se puede identificar el documento',
    NOT_CREATED = 'No fue posible iniciar el componente',
    MODEL_ERROR = 'Se presento un error al cargar el modelo de predicción',
    PERSPECTIVE_ERROR = 'Se presento un error al interpretar la perspectiva',
}

export enum ErrorCodes {
    BROWSER_NOT_SUPPORTED= -1,
    NOT_ACCEPT_CAMERA_PERMISSION = -2,
    MAX_TIME_LIMIT = -3,
    ORIENTATION = -4,
    NOT_SUPPORTED = -5,
    NOT_DETECTED = -6,
    NOT_CREATED = -7,
    MODEL_ERROR = -8,
    PERSPECTIVE_ERROR = -9
}

Error in project: global is not defined

Add in polyfills.ts
    (window as any).global = window;
0.0.46

9 months ago

0.0.47

9 months ago

0.0.62

8 months ago

0.0.60

9 months ago

0.0.61

9 months ago

0.0.59

9 months ago

0.0.51

9 months ago

0.0.52

9 months ago

0.0.53

9 months ago

0.0.54

9 months ago

0.0.55

9 months ago

0.0.56

9 months ago

0.0.57

9 months ago

0.0.58

9 months ago

0.0.50

9 months ago

0.0.48

9 months ago

0.0.49

9 months ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.37

1 year ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago