Skip to content

Commit

Permalink
feat: adds metadata property details for web elements (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
brigonzalez authored Jan 24, 2023
1 parent 97005dc commit 6016780
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/sdks/web/javascript/methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_label: Methods & Events
---

import { Alert, Alerts } from "@site/src/components/shared/Alert";
import {Alert, Alerts} from "@site/src/components/shared/Alert";

# Elements Method & Events

Expand Down Expand Up @@ -106,6 +106,17 @@ cardElement.on("change", (changeEvent) => {
<a href="mailto:info@basistheory.com">info@basistheory.com.</a>
</Alert>

#### Metadata

Instead of subscribing to events, the same properties can be accessed at any time from the `metadata` property on all elements.

Additionally, the card related event [change events](#changeevent) can be accessed from the `cardMetadata` property only on [Card](/docs/sdks/web/javascript/types#card-element) and [CardNumber](/docs/sdks/web/javascript/types#card-number-element) elements.

| Attribute | Eligible Elements | Attributes |
|----------------|----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| `metadata` | All | `complete`, `valid`, `maskSatisfied`, `empty` |
| `cardMetadata` | [card](/docs/sdks/web/javascript/types#card-element)<br/>[cardNumber](/docs/sdks/web/javascript/types#card-number-element) | `cardLast4`, `cardBin`, `cardBrand` |

#### FieldError

```json showLineNumbers
Expand Down

1 comment on commit 6016780

@vercel
Copy link

@vercel vercel bot commented on 6016780 Jan 24, 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.