Salsa Js
npm install @salsa-payroll/salsa-jsThis package allows you to leverage our Salsa.js script by importing it into your project.
Use npm to install this module;
``shell`
npm install @salsa-payroll/salsa-js
This function is the entry point which returns a Promise. Once resolved you will haveSalsa
an instance of that you can then use as per our documentation
In a plain old javascript project
`javascript
import { loadSalsaJs } from '@salsa-payroll/salsa-js';
const salsa = await loadSalsaJs('ck_your-client-key');
`
In React
`javascript
import { loadSalsaJs } from '@salsa-payroll/salsa-js';
const [salsa, setSalsa] = useState();
useEffect(() => {
loadSalsaJs('ck_your-client-key', { env: 'sandbox' }).then((salsaJs) =>
setSalsa(salsaJs),
);
}, []);
``
You can try this directly in our
Example Frontend Application
We are currently only exposing ES Module. In the future we may choose to support exporting as CommonJs