1.5.0 • Published 10 months ago

@trully/trully-image-reader-react v1.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

TrullyImageReader

Componente pensado para ser integrado en procesos de reconocimiento de imágenes

Props

KeyDescription
isDevBoolean. Allows to handle dev and prod url
apiKeyString. Allows entering the client apiKey for each use case
endpointString. Allows to handle the endpoint for the different images analysis
user_idString. Allows matching the endpoint calls with the user. This is done to easily access the process data when need it
tagUUID String. One process could have several analysis. The tag is used to link every analysis to the same process.
If it isn't receive by prop. One will be created.
ShapeReactElement. Allows to control the shape for the type of image that the model would be analyzing
forcePortraitBoolean. Allows to declare if the user will be able to use their mobile device on landscape position
handleDataShould be a callback function receiving an ImageResponse parameter. This parameter will hold the process result.
handleErrorShould be a callback function receiving an ErrorResponse parameter. This parameter will hold an error object.
forceFrontCameraForMobileBoolean (optional). Allows to declare which camera will be open for mobile devices. Default back
isFrontBoolean (optional). If the model needs to knows which side of image will receive. Default back
timeoutNumber (optional). Allows to declare how many seconds will the user have to take the photo. Default 30
stylesStyles object (optional). Allows the user to personalize the component styles

Example

import "../../node_modules/@trully/trully-image-reader-react/dist/styles/styles.css";
import { CanvasComponent } from "./CanvasComponent";
import { TrueDeepfakeDetection } from "@trully/true-deepfake-detection";

export const LectorImagen = () => {
  return (
    <TrullyImageReader
      configuration={{
        endpoint: "ENDPOINT",
        Shape: <CanvasComponent />,
        isDev: true,
        apiKey: "API_KEY",
        user_id: "USER_ID",
        isFront: true,
        handleData(handleData) {
          console.log(handleData);
        },
        handleError(error) {
          console.log(error);
        },
        forcePortrait: true,
      }}
    />
  );
};

Types

Styles

KeyDescription
imagesImages object. Allows changing the default images
colorsColors objet. Allows changing the default colors
textsStylesTextsStyles object. Allows the default font and color font

Images object

KeyDefault value
rotate@trully/trully-helpers-react - DEFAULT_IMAGES.ROTATE

Colors object

KeyDefault value
icons@trully/trully-helpers-react - COLORS.DODGER_BLUE
primary@trully/trully-helpers-react - COLORS.DODGER_BLUE
background@trully/trully-helpers-react - COLORS.WHITE

TextsStyles object

KeyDefault value
fontFamily@trully/trully-helpers-react - DEFAULT_FONT
individualFamily?@trully/trully-helpers-react - IndividualFamily type
primaryTextColor@trully/trully-helpers-react - COLORS.SHARK

ImageResponse

The object returned through the handleData callback. It get its values from a combination of the back-end response and some values obtained during the front-end execution.

KeyDescription
tagString uuid. The one from props
session_idString uuid. backData?.identifier?.session_id
imagesImages object.
hasBackbackData?.instructions?.has_back
docTypebackData?.attributes?.doc_type
retakebackData?.instructions?.retake
retakeReasons?backData?.retake_reasons

images object

KeyDescription
imageString base64. Cropped analyzed image
image_fullString base64. Full analyzed image

retakeReasons object

This values are all booleans. Here is a list of the available keys

Key
cameraNotAllowed
constraintsError
unknownCameraOpeningError
timeout
processingImageError

ErrorResponse

The object returned through the handleError callback. It get its values from a combination of the back-end response and some values obtained during the front-end execution.

KeyDescription
typeString. One of ERROR_TYPE enum. Used to identify if it is a front-end or a back-end error
reasonsERROR_REASONS object
errorProcessError object

ERROR_REASONS object

The ERROR_REASONS object is a constant use to hold every possible error reason. Every one of the keys declared in it are set to false. To use it, create a new copy of it and change the necessary key value to true. This will mean that the jey holding the true value is the error reason. Every error will result in the process shutting down

KeyDescription
cameraNotAllowedThe user didn't allow for the camera to be used
constraintsErrorWebcam configuration didn't work
unknownCameraOpeningErrorWebcam couldn't be open
googleImageCaptureErrorImageCapture error
timeoutUser didn't take the picture before the timeout declare in props
processingImageErrorBack-end model error.
serverTimeoutFetch to back took longer than 2 minutes

ProcessError object

KeyDescription
processString. One of PROCESS_STEP enum. Used to identify where the error occur
messageString. One of ERROR_MESSAGE enum.
user_idThe user_id passed through props.
timestampUTC timezone. new Date().toUTCString().
errorObject. The error that triggered the handleError execution
1.5.0

10 months ago

1.2.0

12 months ago

1.0.19

12 months ago

1.0.2

1 year ago

1.0.18

12 months ago

1.0.1

1 year ago

1.0.17

12 months ago

1.0.0

1 year ago

1.0.16

12 months ago

1.2.7

11 months ago

1.0.9

1 year ago

1.2.6

11 months ago

1.0.8

1 year ago

1.2.5

11 months ago

1.0.7

1 year ago

1.4.2

11 months ago

1.2.4

12 months ago

1.0.6

1 year ago

1.4.1

11 months ago

1.2.3

12 months ago

1.0.5

1 year ago

1.4.0

11 months ago

1.2.2

12 months ago

1.0.4

1 year ago

1.2.1

12 months ago

1.0.3

1 year ago

1.0.22

12 months ago

1.0.21

12 months ago

1.0.20

12 months ago

1.0.26

12 months ago

1.0.25

12 months ago

1.0.24

12 months ago

1.0.23

12 months ago

1.0.29

12 months ago

1.0.28

12 months ago

1.0.27

12 months ago

1.0.30

12 months ago

1.3.3

11 months ago

1.3.2

11 months ago

1.3.1

11 months ago

1.3.0

11 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.15

12 months ago

1.0.14

12 months ago

1.0.13

12 months ago

1.0.12

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago