@apideck/vault-js
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -5,2 +5,3 @@ export interface ApideckVaultOptions { | ||
serviceId?: string; | ||
showAttribution?: boolean; | ||
onClose?: () => void; | ||
@@ -7,0 +8,0 @@ onReady?: () => void; |
{ | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
@@ -22,3 +22,4 @@ "main": "dist/index.js", | ||
"analyze": "size-limit --why", | ||
"dev": "parcel dev/index.html" | ||
"dev": "parcel dev/index.html", | ||
"release": "np --no-publish && npm publish --access public --registry https://registry.npmjs.org" | ||
}, | ||
@@ -56,2 +57,3 @@ "peerDependencies": {}, | ||
"husky": "^8.0.2", | ||
"np": "^7.6.2", | ||
"parcel": "^2.8.2", | ||
@@ -58,0 +60,0 @@ "size-limit": "^8.1.0", |
@@ -22,3 +22,3 @@ # Vault JS | ||
``` | ||
```html | ||
<script src="https://unpkg.com/@apideck/vault-js"></script> | ||
@@ -29,7 +29,7 @@ ``` | ||
Before opening the Vault modal with vault-js, you need to create a Vault session from your backend using the Vault API or one of our SDKs. Find out more [here](). | ||
Before opening the Vault modal with vault-js, you need to create a Vault session from your backend using the Vault API or one of our [SDKs](https://docs.apideck.com/sdks). Find out more in the [docs](https://docs.apideck.com/apis/vault/reference#operation/sessionsCreate). | ||
## Usage | ||
Pass the JWT you got from the Vault session to the vault-js: | ||
Pass the JWT you got from the Vault session to `vault-js`: | ||
@@ -40,23 +40,16 @@ ```js | ||
ApideckVault.open({ | ||
token: jwtSessionToken | ||
}) | ||
token: 'REPLACE_WITH_SESSION_TOKEN', | ||
}); | ||
``` | ||
If you want to scope the connection results to a single Unified API, you can do that by giving the `unifiedApi` prop. If you want to open Vault for only a single connector, you should also provide the `serviceId`. | ||
If you want to only show integrations for a single Unified API, you can do that by passing the `unifiedApi` option. If you want to open Vault for only a single integration, you can provide the `serviceId` option. | ||
```js | ||
import { Vault } from '@apideck/react-vault'; | ||
import { ApideckVault } from '@apideck/vault-js'; | ||
const MyComponent = () => { | ||
return ( | ||
<Vault | ||
token="REPLACE_WITH_SESSION_TOKEN" | ||
unifiedApi="accounting" | ||
serviceId="quickbooks" | ||
trigger={<button>Open Vault</button>} | ||
/> | ||
); | ||
}; | ||
export default MyComponent; | ||
ApideckVault.open({ | ||
token: 'REPLACE_WITH_SESSION_TOKEN', | ||
unifiedApi: 'accounting', | ||
serviceId: 'quickbooks', | ||
}); | ||
``` | ||
@@ -67,22 +60,13 @@ | ||
```jsx | ||
import { Button } from '@apideck/components'; | ||
import { Vault } from '@apideck/react-vault'; | ||
import { useState } from 'react'; | ||
import { ApideckVault } from '@apideck/vault-js'; | ||
const VaultButton = ({ token }) => { | ||
const [openVault, setOpenVault] = useState(false); | ||
const toggleVault = () => { | ||
setOpenVault(!openVault); | ||
}; | ||
return ( | ||
<div className="flex items-center space-x-3"> | ||
<Button text="Open Vault" onClick={toggleVault} /> | ||
<Vault token={token} open={openVault} onClose={toggleVault} /> | ||
</div> | ||
); | ||
}; | ||
export default VaultButton; | ||
ApideckVault.open({ | ||
token: 'REPLACE_WITH_SESSION_TOKEN', | ||
onClose: () => { | ||
console.log('closed!'); | ||
}, | ||
onReady: () => { | ||
console.log('ready!'); | ||
}, | ||
}); | ||
``` | ||
@@ -92,9 +76,9 @@ | ||
| Property | Type | Required | Default | Description | | ||
| --------------- | ------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| token | string | true | - | The JSON Web Token returned from the Create Session call | | ||
| trigger | element | false | - | The component that should trigger the Vault modal on click | | ||
| showAttribution | boolean | false | true | Show "Powered by Apideck" in the backdrop of the modal backdrop | | | ||
| onClose | event | false | - | Function that gets called when the modal is closed | | ||
| unifiedApi | string | false | - | When unifiedApi is provided it will scope the connection results to that API. If also a serviceId is provided Vault opens for a single connection | | ||
| serviceId | string | false | - | When unifiedApi and serviceId are provided Vault opens a single connection | | ||
| Property | Type | Required | Default | Description | | ||
| --------------- | ------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- | | ||
| token | string | true | - | The JSON Web Token returned from the [Create Session API](https://docs.apideck.com/apis/vault/reference#operation/sessionsCreate) | | ||
| showAttribution | boolean | false | true | Show "Powered by Apideck" in the backdrop of the modal backdrop | | ||
| onClose | event | false | - | Function that gets called when the modal is closed | | ||
| onReady | event | false | - | Function that gets called when the modal is opened | | ||
| unifiedApi | string | false | - | When unifiedApi is provided it will only show integrations from that API. | | ||
| serviceId | string | false | - | When unifiedApi and serviceId are provided Vault opens a single integration | |
@@ -5,2 +5,3 @@ export interface ApideckVaultOptions { | ||
serviceId?: string; | ||
showAttribution?: boolean; | ||
onClose?: () => void; | ||
@@ -7,0 +8,0 @@ onReady?: () => void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
253
31313
8
80
1