Skip to content

Commit

Permalink
feat: add fingerprint default changes, update card blueprint example …
Browse files Browse the repository at this point in the history
…to use refs, and add react deprecations page (#38)
  • Loading branch information
bsterne authored Jan 19, 2023
1 parent efebdcb commit 84d23cf
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
17 changes: 12 additions & 5 deletions docs/api/tenants/tenants.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Returns a [Tenants](#tenant-object) for the provided `BT-API-KEY`. Returns [an e
"owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21",
"name": "My Tenant",
"settings": {
"fingerprint_tokens": "false",
"deduplicate_tokens": "false"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
Expand Down Expand Up @@ -144,6 +145,7 @@ curl "https://api.basistheory.com/tenants/self" \
-d '{
"name": "My Example Tenant",
"settings": {
"fingerprint_tokens": "true",
"deduplicate_tokens": "true"
}
}'
Expand All @@ -160,6 +162,7 @@ const bt = await new BasisTheory().init("key_N88mVGsp3sCXkykyN2EFED");
const tenant = await bt.tenants.update({
name: "My Example Tenant",
settings: {
fingerprint_tokens: "true",
deduplicate_tokens: "true",
},
});
Expand All @@ -176,7 +179,8 @@ var client = new TenantClient("key_N88mVGsp3sCXkykyN2EFED");
var tenant = await client.UpdateAsync(new Tenant {
Name = "My Example Tenant"
Settings = new Dictionary<string, string> {
{ "deduplicate_tokens", "true" }
{ "fingerprint_tokens", "true" },
{ "deduplicate_tokens", "true" },
},
});
```
Expand Down Expand Up @@ -217,6 +221,7 @@ func main() {

updateTenantRequest := *basistheory.NewUpdateTenantRequest("My Example Tenant")
updateTenantRequest.SetSettings(map[string]string{
"fingerprint_tokens": "true",
"deduplicate_tokens": "true",
})

Expand Down Expand Up @@ -244,6 +249,7 @@ Returns a [tenant](#tenant-object) if the Tenant was updated. Returns [an error]
"owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21",
"name": "My Example Tenant",
"settings": {
"fingerprint_tokens": "true",
"deduplicate_tokens": "true"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
Expand Down Expand Up @@ -466,9 +472,10 @@ Returns a [Tenant Usage Report](#tenant-usage-report-object) for the provided `B

### Tenant Settings Object

| Attribute | Type | Description |
| -------------------- | -------- | -------------------------------------------------------------- |
| `deduplicate_tokens` | _string_ | (Bool) Whether tokens are deduplicated on creation and updates |
| Attribute | Type | Description |
| -------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fingerprint_tokens` | _string_ | (Bool) Whether the [default fingerprint expression](/docs/api/tokens/token-types) is applied if no fingerprint expression is provided on the token |
| `deduplicate_tokens` | _string_ | (Bool) Whether tokens are deduplicated on creation and updates |

## Tenant Usage Report Object

Expand All @@ -494,4 +501,4 @@ Returns a [Tenant Usage Report](#tenant-usage-report-object) for the provided `B
| Attribute | Type | Description |
| ----------------- | ------ | ----------------------------------------------- |
| `count` | _long_ | Number of tokens |
| `last_created_at` | _date_ | (Optional) Last created date in ISO 8601 format |
| `last_created_at` | _date_ | (Optional) Last created date in ISO 8601 format |
2 changes: 2 additions & 0 deletions docs/api/tokens/token-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Token Types define the rules around a data type such as validation requirements,
[token containers](/docs/concepts/what-are-containers),
fingerprint expressions, and mask expressions.

When [creating a token](/docs/api/tokens#create-token) and no `fingerprint_expression` is provided, the [`fingerprint_tokens`](/docs/api/tenants/#tenant-settings-object) tenant setting must be set to `true` to automatically apply the Default Fingerprint Expression associated with the token type.

## Token

The `token` type is used for general data types that don't require input validation or formatting restrictions.
Expand Down
6 changes: 4 additions & 2 deletions docs/blueprints/cards/collect-and-process-cards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,21 @@ And inside of our `<form>` tag, add the following code:
Your card component should now look like this:

```javascript showLineNumbers
import { useRef } from 'react';
import {
useBasisTheory,
CardElement
} from '@basis-theory/basis-theory-react';

export const CardForm = () => {
const { bt } = useBasisTheory();
const cardRef = useRef(null);

const submit = async () => {};

return (
<form onSubmit={submit}>
<CardElement id="card" />
<CardElement id="card" ref={cardRef} />

<button type="button" onClick={submit} >
Submit
Expand All @@ -171,7 +173,7 @@ const submit = async () => {
// Tokenize card with Basis Theory
const token = await bt.tokenize({
type: 'card',
data: bt.getElement('card'),
data: cardRef.current,
});

// Submit card token to our Next.js app's API
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/what-are-tokens.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Our token specification enables you to transform your data to optimize for stora

In some scenarios, you need your token identifier to be in a specific format. This may be because you have to pass existing validation requirements, have an existing data format or database schema that is hard to change. Aliasing provides a simple way to customize the format of your token identifier to meet your needs.

Lets assume you have a social security number you are storing and you want to alias the token identifier to match the SSN format:
Let's assume you have a social security number you are storing and you want to alias the token identifier to match the SSN format:

```json showLineNumbers title=Request
{
Expand Down Expand Up @@ -155,7 +155,7 @@ data accessible by your internal systems. [Access Controls](/docs/concepts/acces
Containers to allow some systems access to highly confidential data while restricting access to only masked or redacted
Tokens from other systems.

For example, we may want to store a customers social security number and only provide access to the last 4 digits
For example, we may want to store a customer's social security number and only provide access to the last 4 digits
of the SSN to our customer service team.

### Time to Live (TTL)
Expand Down
9 changes: 9 additions & 0 deletions docs/sdks/web/react/deprecations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deprecations

## Deprecated Features

The following table lists deprecated features and their respective shutdown date.

| Feature | Deprecated | Shutdown Date | Details |
| ------------------- | --------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `getElement` method | August 25, 2022 | November 15, 2022 | `getElement` method will be removed in an upcoming release. Instead, please use [refs](/docs/sdks/web/react#using-refs) |
5 changes: 4 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,10 @@ const sidebars = {
type: "doc",
id: "sdks/web/react/index",
},
items: ["sdks/web/react/components"],
items: [
"sdks/web/react/components",
"sdks/web/react/deprecations",
],
},
],
},
Expand Down

1 comment on commit 84d23cf

@vercel
Copy link

@vercel vercel bot commented on 84d23cf Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.