Skip to main content
caution

This section refers to the old versions of the MonkJs SDK (version 3.X.X and below). For the v4 docs, please refer to this page.

npm latest package

🧿 Inspection Report

Package Overview

The Inspection Report package allows users to visualize and edit the results of an inspection before generating the final PDF report. This includes things such as visualizing the location, severity, and/or repair cost of damages on the car, as well as adding, editing, or removing damages in the report.

Implementation Guide

Installation​

To install the package simply run the following command in your project :

yarn add @monkvision/inspection-report

Basic Usage​

The DamageReport component exported by the package is a single page component that will automatically display the different pages of the damage report, and let the user visualize and edit it. All you need is the ID of the inspection. The only way for the user to leave this component is if he presses the "Start New Inspection" button, in which case a callback will be called, allowing you to navigate to another page.

Here is a minimal working example :

import React from 'react';
import { useNavigation } from '@react-navigation/native';
import { DamageReport } from '@monkvision/inspection-report';
import { PAGES } from '../navigation';

export default function InspectionReport({ inspectionId }) {
const navigation = useNavigation();

return (
<DamageReport
inspectionId={inspectionId}
onStartNewInspection={() => navigation.navigate(PAGES.HOME)}
/>
);
}

API

Components​

DamageReport​

Description​

import { DamageReport } from '@monkvision/inspection-report';

This component is a single page component that implements the visualizing and editing of the damage report.

Props​

PropTypeDescriptionRequiredDefault Value
elementHTMLElementThe HTML SVG element to displayβœ”
onPressPartfunctionCallback function called when a car part is pressed. The only argument is the part name() => {}
onPressPillfunctionCallback function called when a damage pill is pressed. The only argument is the associated part name() => {}
getPartAttributesfunctionCustom function used to apply custom HTML attributes to specific car parts. It should take part name as argument and return an object representing the HTML attributes() => {}
damagesobject[]The list of damages on the car. Each damage on this list will have a pill displayed on the wireframe[]
damages.partstringThe part associated with the damageβœ”
damages.idstringThe ID of the damage
damages.pricingnumberThe cost of repair of the damage
damages.severitySeverityThe severity of the damage
damages.repairOperationRepairOperationThe type of operation needed to repair the damage

CarView360 component​

Description​

import { CarView360 } from '@monkvision/inspection-report';

⚠️ This component only works on Web ⚠️

This component displays a wireframe view of a car allowing you to display damages and make the wireframes interactives.

Example of Usage​

import { CarView360, useCarOrientation } from '@monkvision/inspection-report';

export default function MyCustomCarView({ damages, width }) {
const {
orientation,
rotateLeft,
rotateRight,
setOrientation,
} = useCarOrientation();

return (
<CarView360
damages={damages}
orientation={orientation}
width={width}
/>
);
}

Props​

PropTypeDescriptionRequiredDefault Value
orientationCarOrientationThe orientation of the wireframeβœ”
vehicleTypeVehicleTypeThe type of vehicle to displayβœ”
widthnumberThe width of the wireframesundefined
heightnumberThe height of the wireframesundefined
onPressPartfunctionCallback function called when a car part is pressed. The only argument is the part name() => {}
onPressPillfunctionCallback function called when a damage pill is pressed. The only argument is the associated part name() => {}
getPartAttributesfunctionCustom function used to apply custom HTML attributes to specific car parts. It should take part name as argument and return an object representing the HTML attributes() => {}
damagesobject[]The list of damages on the car. Each damage on this list will have a pill displayed on the wireframe[]
damages.partstringThe part associated with the damageβœ”
damages.idstringThe ID of the damage
damages.pricingnumberThe cost of repair of the damage
damages.severitySeverityThe severity of the damage
damages.repairOperationRepairOperationThe type of operation needed to repair the damage

Hooks​

useCarOrientation​

Description​

import { useCarOrientation } from '@monkvision/inspection-report';

This hook provides an easy API to handle the orientation of the wireframes for the CarView360 component.

Arguments​

PropTypeDescriptionRequiredDefault Value
initialOrientationCarOrientationThe initial orientationCarOrientation.FRONT_LEFT

Return Object​

PropTypeDescription
orientationCarOrientationThe current orientation of the wireframe
setOrientationfunctionFunction used to manually set the orientation of the wireframe
rotateLeftfunctionFunction used to rotate the orientation to the left
rotateRightfunctionFunction used to rotate the orientation to the right

Types​

DamageMode​

import { DamageMode } from '@monkvision/inspection-report';

Specifies how the damages are displayed on the wireframes.

DamageModeValueDescription
SEVERITYseverityOnly display the severity of the damage
PRICINGpricingOnly display the pricing of the damage
ALLallDisplay both the severity and the pricing of the damage

Severity​

import { Severity } from '@monkvision/inspection-report';

Specifies the severity of a damage.

SeverityValueDescription
LOWlowLow severity
MEDIUMmediumMedium severity
HIGHhighHigh severity

CarOrientation​

import { CarOrientation } from '@monkvision/inspection-report';

Specifies the current orentation of a car wireframe.

SeverityValueDescription
FRONT_LEFT0Front left
REAR_LEFT1Rear left
REAR_RIGHT2Rear right
FRONT_RIGHT3Front right

VehicleType​

import { VehicleType } from '@monkvision/inspection-report';

Specifies the type of vehicle displayed in the wireframes of the report.

VehicleTypeValueDescription
SUVsuvSUV vehicle type
CUVcuvCUV vehicle type
SEDANsedanSedan vehicle type
HATCHBACKhatchbackHatchback vehicle type
VANvanVan vehicle type
MINIVANminivanMinivan vehicle type
PICKUPpickupPickup vehicle type

RepairOperation​

import { RepairOperation } from '@monkvision/inspection-report';

Specifies the type of operation needed to repair a damage.

RepairOperationValueDescription
REPAIRrepairThe damage needs to be repaired
REPLACEreplaceThe part needs to be replaced

Constants​

CarParts​

import { CarParts } from '@monkvision/inspection-report';

This constant is an array of string containing all the car parts names that are recognized and accepted by this package.

carPartLabels​

import { carPartLabels } from '@monkvision/inspection-report';

This constant is an object, mapping language keys to dictionaries that associate each car part to its label. It looks like something like this :

const carPartLabels = {
en: {
bumper_back: 'Rear Bumper',
bumper_front: 'Front Bumper',
...
},
fr: {
bumper_back: 'Pare-chocs arrière',
bumper_front: 'Pare-chocs avant',
...
},
...
};

The currently available languages are :

  • English : en
  • French : fr
  • German : de
  • Dutch : nl