npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@trully/trully-image-reader-react

v1.5.0

Published

Image reader with dynamic element recognition support for Trully react components

Downloads

374

Readme

TrullyImageReader

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

Props

| Key | Description | | --------------------------- | --------------------------------------------------------------------------------------------------------------------- | | isDev | Boolean. Allows to handle dev and prod url | | apiKey | String. Allows entering the client apiKey for each use case | | endpoint | String. Allows to handle the endpoint for the different images analysis | | user_id | String. Allows matching the endpoint calls with the user. This is done to easily access the process data when need it | | tag | UUID 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. | | Shape | ReactElement. Allows to control the shape for the type of image that the model would be analyzing | | forcePortrait | Boolean. Allows to declare if the user will be able to use their mobile device on landscape position | | handleData | Should be a callback function receiving an ImageResponse parameter. This parameter will hold the process result. | | handleError | Should be a callback function receiving an ErrorResponse parameter. This parameter will hold an error object. | | forceFrontCameraForMobile | Boolean (optional). Allows to declare which camera will be open for mobile devices. Default back | | isFront | Boolean (optional). If the model needs to knows which side of image will receive. Default back | | timeout | Number (optional). Allows to declare how many seconds will the user have to take the photo. Default 30 | | styles | Styles 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

| Key | Description | | ------------- | ---------------------------------------------------------- | | images | Images object. Allows changing the default images | | colors | Colors objet. Allows changing the default colors | | textsStyles | TextsStyles object. Allows the default font and color font |

Images object

| Key | Default value | | -------- | ---------------------------------------------------- | | rotate | @trully/trully-helpers-react - DEFAULT_IMAGES.ROTATE |

Colors object

| Key | Default 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

| Key | Default 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.

| Key | Description | | ---------------- | --------------------------------------------- | | tag | String uuid. The one from props | | session_id | String uuid. backData?.identifier?.session_id | | images | Images object. | | hasBack | backData?.instructions?.has_back | | docType | backData?.attributes?.doc_type | | retake | backData?.instructions?.retake | | retakeReasons? | backData?.retake_reasons |

images object

| Key | Description | | ------------ | ------------------------------------- | | image | String base64. Cropped analyzed image | | image_full | String 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.

| Key | Description | | --------- | ----------------------------------------------------------------------------------------- | | type | String. One of ERROR_TYPE enum. Used to identify if it is a front-end or a back-end error | | reasons | ERROR_REASONS object | | error | ProcessError 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

| Key | Description | | --------------------------- | ---------------------------------------------------------------- | | cameraNotAllowed | The user didn't allow for the camera to be used | | constraintsError | Webcam configuration didn't work | | unknownCameraOpeningError | Webcam couldn't be open | | googleImageCaptureError | ImageCapture error | | timeout | User didn't take the picture before the timeout declare in props | | processingImageError | Back-end model error. | | serverTimeout | Fetch to back took longer than 2 minutes |

ProcessError object

| Key | Description | | ----------- | ------------------------------------------------------------------------ | | process | String. One of PROCESS_STEP enum. Used to identify where the error occur | | message | String. One of ERROR_MESSAGE enum. | | user_id | The user_id passed through props. | | timestamp | UTC timezone. new Date().toUTCString(). | | error | Object. The error that triggered the handleError execution |