betagouv / cout-embauche

Estimateur de prix d'embauche - Simulate the price of hiring in France
45 stars 9 forks source link
economy france simulation social-security taxes

:warning: Attention : Les règles législatives qui font tourner ce module seront mises à jour pendant un moment, mais l'interface ne va plus évoluer. Les travaux sont continués ici.

The legal rules behind this module will be maintained for a short while, but the interface will not and no new simulation features will be added here. See this project for the new simulators.

Module Web d'estimation du prix d'une embauche en France. Ce document est technique, et donc rédigé en anglais pour favoriser la réutilisation.

A widget to estimate the price of hiring in France : social security contributions minus national exemptions.

demo.

Usage

Include this line where you want the widget to appear in your page:

<script id="script-simulateur-embauche" src="https://github.com/betagouv/cout-embauche/raw/master/dist/simulateur.js" data-couleur="#4A89DC"></script>

It will add an iframe to your page, containing the simulation interface.

Reminder: this widget is in beta and may be updated at any time. Please send an email to contact[AT]embauche.beta.gouv.fr to request being sent potentially breaking update notices.

Style

The widget's style is deliberately simple and used only one color. Set your own color as an attribute to the script tag above to blend it in your page's visual theme.

Alternative integration

For a deeper style personnalisation, or to be able to use the JS API (see its documentation at ./js-API.md) the widget can be integrated as a no-iframe script. Learn how by reading ./iframe.html page or contacting us at contact[AT]embauche.beta.gouv.fr.

Development

Run :

npm i
npm start

and open localhost:3000.

Testing

The widget is tested with Enzyme in a headless browser environment.

npm run test

This command also runs the js and css linters.

Compilation

The development version is heavy and slow. Use this in production :

npm run compile

Architecture

The app is built with React, Redux and Redux-forms. Read the Redux introduction before going further. The computations rely on the OpenFisca /formula API through a dedicated instance.

The app can be in 3 different states. The Summary component is always visible to give a live summary of the results.

When the user fills the forms :

The Conversation component handles the advanced form. The conversation is composed of form components, augmented with the formDecorator higher order component (read about it).

Browser compatibility

The widget is compatible with most recent browsers :