1.1.8 • Published 1 year ago
@vesselapi/react-vessel-link v1.1.8
react-vessel-link
This package provides:
- A React button component that launches the Vessel connect modal.
- A Hook that can be used to launch the modal manually.
Installing:
npm:
npm install @vesselapi/react-vessel-link
yarn:
yarn add @vesselapi/react-vessel-link
Usage
The vessel-link
modal can be triggered using two methods:
- Through the
VesselConnectButton
component. - Through the
useVesselLink
hook.
Here are some example uses of each:
function App() {
return (
<VesselConnectButton
getLinkToken={async () => await api.post('link/token')}
onSuccess={(publicToken) => console.log('public token: ', publicToken)}
onClose={() => console.log('closed')}
onLoad={() => console.log('loaded')}
>
Connect your CRM!
</VesselConnectButton>
);
}
function App() {
const { open } = useVesselLink({
onSuccess: (publicToken) => console.log('public token: ', publicToken),
onClose: () => console.log('closed'),
onLoad: () => console.log('loaded'),
});
return <button onClick={() => open({ linkToken })}>Connect your CRM!</button>;
}
If you'd like to directly open to the auth flow for a specific integration without having the user go through the selection flow, you can pass an integrationId
to the open function returned by useVesselLink
. Currently, this is only supported when using the useVesselLink
hook.
Here's an example of embedding the integrations directly into your application:
function App() {
const { open } = useVesselLink({
onSuccess: (publicToken) => console.log('public token: ', publicToken),
onClose: () => console.log('closed'),
onLoad: () => console.log('loaded'),
});
return (
<div>
<button
onClick={async () =>
open({
integrationId: 'salesforce',
linkToken: await getLinkToken(),
})
}
>
Connect Salesforce
</button>
<button
onClick={async () =>
open({
integrationId: 'hubspot',
linkToken: await getLinkToken(),
})
}
>
Connect HubSpot
</button>
</div>
);
}
Issues/Questions
Contact us at support@vessel.land
.
1.1.8
1 year ago
1.1.7
1 year ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.1.2
2 years ago
1.0.11
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.10
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago