|
1 | 1 | --- |
2 | | -description: Use Seam Components to make a Supported Devices page |
| 2 | +description: >- |
| 3 | + Embed the Seam Custom Device Database web component to show a filterable list |
| 4 | + of compatible devices on your site |
3 | 5 | --- |
4 | 6 |
|
5 | 7 | # Make a Supported Devices Page |
6 | 8 |
|
7 | 9 | ## Overview |
8 | 10 |
|
9 | | -Seam adds supports for smart devices every week and by integrating with Seam, you get access to these new devices too! |
| 11 | +Seam adds support for new smart devices every week, and by integrating with Seam, you get access to those new devices too. |
10 | 12 |
|
11 | | -This guide will show you how to add a [supported device table](https://react.seam.co/?path=/docs/components-supporteddevicetable--docs) to your website or application. You can use plain HTML, React, or any framework that supports web components. |
| 13 | +This guide shows you how to embed a filterable list of devices on your site using the [Seam Custom Device Database web component](https://github.com/seamapi/custom-device-db-web). The component is a standard custom element served from the Seam CDN, so it works in plain HTML and any framework that supports web components. |
12 | 14 |
|
13 | | -## 1 - Get a Publishable Key from the Seam Console |
| 15 | +{% hint style="warning" %} |
| 16 | +**Migrating from the previous version?** The earlier `<seam-supported-device-table>` component has been retired and will no longer load. If your site embeds it today, replace it with `<device-list-by-capability>` as shown below. |
| 17 | +{% endhint %} |
14 | 18 |
|
15 | | -To access the Seam API, you'll need a publishable key. This key identifies your application when making requests to Seam and is safe to embed in your frontend code. |
| 19 | +## 1 — Request an API Token |
16 | 20 |
|
17 | | -Go to [console.seam.co](https://console.seam.co) and select "Client Sessions" from the sidebar. You should then see a "Publishable Key" that you can copy. |
| 21 | +The `<device-list-by-capability>` component reads from Seam's Custom Device Database, which requires an API token. Email [support@seam.co](mailto:support@seam.co) to request a token for your workspace. |
18 | 22 |
|
19 | | -## 2 — Add Seam Components |
| 23 | +## 2 — Add the Component |
20 | 24 |
|
21 | 25 | {% tabs %} |
22 | 26 | {% tab title="Plain HTML" %} |
23 | | -Seam Components are implemented in React, but may be used as native web components. |
24 | | - |
25 | | -Create a plain HTML page with the content below. You can serve this anyway you like, or even open it directly in your browser. The version in the script tag can be any [released version](https://github.com/seamapi/react/releases). |
| 27 | +Add the script tag and custom element anywhere on your page. You can serve this any way you like, or even open it directly in your browser. |
26 | 28 |
|
27 | 29 | ```html |
28 | 30 | <!DOCTYPE html> |
29 | 31 | <html lang="en"> |
30 | 32 | <head> |
31 | 33 | <meta charset="utf-8" /> |
32 | 34 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
33 | | - <title>Seam Components</title> |
| 35 | + <title>Supported Devices</title> |
34 | 36 | </head> |
35 | 37 | <body> |
36 | 38 | <main> |
37 | | - <seam-supported-device-table |
38 | | - publishable-key="your_publishable_key" |
39 | | - ></seam-supported-device-table> |
| 39 | + <device-list-by-capability |
| 40 | + capability-name="remoteunlock" |
| 41 | + token="your-api-token" |
| 42 | + ></device-list-by-capability> |
40 | 43 | </main> |
41 | 44 | <script |
42 | 45 | type="module" |
43 | | - src="https://react.seam.co/v/1.42.1/dist/elements.js" |
| 46 | + src="https://cdn.devicedb.seam.co/v/latest/DeviceListByCapability.global.js" |
44 | 47 | ></script> |
45 | 48 | </body> |
46 | 49 | </html> |
47 | 50 | ``` |
| 51 | + |
48 | 52 | {% endtab %} |
49 | 53 |
|
50 | | -{% tab title="React" %} |
51 | | -Install `@seamapi/react` in your React application |
| 54 | +{% tab title="Any JavaScript Framework" %} |
| 55 | +Because `<device-list-by-capability>` is a standard custom element, you can use it in any framework that supports web components, including React, Vue, Angular, and Svelte. |
52 | 56 |
|
53 | | -```bash |
54 | | -npm install --save @seamapi/react |
55 | | -``` |
| 57 | +Include the script tag once in your application's entrypoint (for example, `index.html`): |
56 | 58 |
|
57 | | -Add the components anywhere in your React app |
| 59 | +```html |
| 60 | +<script |
| 61 | + type="module" |
| 62 | + src="https://cdn.devicedb.seam.co/v/latest/DeviceListByCapability.global.js" |
| 63 | +></script> |
| 64 | +``` |
58 | 65 |
|
59 | | -```javascript |
60 | | -import { SupportedDeviceTable, SeamProvider } from "@seamapi/react" |
| 66 | +Then render the element wherever you need the device list: |
61 | 67 |
|
62 | | -export const App = () => { |
63 | | - return ( |
64 | | - <SeamProvider publishableKey="your_publishable_key"> |
65 | | - <main> |
66 | | - <SupportedDeviceTable /> |
67 | | - </main> |
68 | | - </SeamProvider> |
69 | | - ) |
70 | | -} |
| 68 | +```html |
| 69 | +<device-list-by-capability |
| 70 | + capability-name="remoteunlock" |
| 71 | + token="your-api-token" |
| 72 | +></device-list-by-capability> |
71 | 73 | ``` |
| 74 | + |
| 75 | +Some frameworks require additional configuration to enable web component support. See the [Angular](getting-started-with-seam-components/angular.md) and [Vue](getting-started-with-seam-components/vue.md) guides for examples. |
72 | 76 | {% endtab %} |
| 77 | +{% endtabs %} |
73 | 78 |
|
74 | | -{% tab title="Any JavaScript Framework" %} |
75 | | -Install `@seamapi/react` in your application |
| 79 | +{% hint style="warning" %} |
| 80 | +**Pin to a specific version in production.** The `/v/latest/` URL tracks the most recent release. To avoid surprise updates, pin to an immutable version such as `https://cdn.devicedb.seam.co/v/0.0.6/DeviceListByCapability.global.js`. See the [release list](https://github.com/seamapi/custom-device-db-web/releases) for available versions. |
| 81 | +{% endhint %} |
76 | 82 |
|
77 | | -```bash |
78 | | -npm install --save @seamapi/react |
79 | | -``` |
| 83 | +## 3 — Configure the Component |
80 | 84 |
|
81 | | -Then import the custom elements bundle in your application entrypoint: |
| 85 | +The `<device-list-by-capability>` element accepts the following attributes: |
82 | 86 |
|
83 | | -```javascript |
84 | | -import "@seamapi/react/elements.js" |
85 | | -``` |
| 87 | +| Attribute | Type | Default | Description | |
| 88 | +| -------------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------ | |
| 89 | +| `capability-name` | string | — | **Required.** Comma-separated capability names, for example `remoteunlock` or `remoteunlock,walletkeys`. | |
| 90 | +| `token` | string | — | **Required.** API token issued by Seam. | |
| 91 | +| `max-visible-rows` | number | `4` | Maximum device rows shown per manufacturer before a "show more" control appears. | |
| 92 | +| `hide-search` | boolean | `false` | Hide the search input. | |
| 93 | +| `manufacturers` | string | — | Comma-separated manufacturer slugs to restrict the device list. | |
| 94 | +| `initial-capability` | string | — | Which capability to display first when `capability-name` contains multiple values. | |
| 95 | + |
| 96 | +### Show multiple capabilities |
86 | 97 |
|
87 | | -Add the components where your framework renders HTML. Some frameworks may require additional configuration to enable web component support, e.g., [Angular](getting-started-with-seam-components/angular.md) or [Vue](getting-started-with-seam-components/vue.md). |
| 98 | +When you provide more than one capability, the component renders a dropdown selector. Use `initial-capability` to control which capability is active on load. |
88 | 99 |
|
89 | 100 | ```html |
90 | | -<seam-supported-device-table publishable-key="your_publishable_key"></seam-supported-device-table> |
| 101 | +<device-list-by-capability |
| 102 | + capability-name="remoteunlock,walletkeys" |
| 103 | + initial-capability="remoteunlock" |
| 104 | + token="your-api-token" |
| 105 | +></device-list-by-capability> |
91 | 106 | ``` |
92 | | -{% endtab %} |
93 | | -{% endtabs %} |
94 | 107 |
|
95 | | -You should see a list of device models like what's shown below: |
| 108 | +### Filter to specific manufacturers |
96 | 109 |
|
97 | | -<figure><img src="https://3624860916-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxnN2A67918om1UthYWsF%2Fuploads%2FyvmI7GxNyxhebqR99ZwF%2FScreen%20Shot%202023-06-30%20at%209.46.33%20AM.png?alt=media&token=18a6ad74-0f9f-4e18-8c15-57371c461044" alt=""><figcaption></figcaption></figure> |
| 110 | +```html |
| 111 | +<device-list-by-capability |
| 112 | + capability-name="remoteunlock" |
| 113 | + manufacturers="schlage,yale" |
| 114 | + token="your-api-token" |
| 115 | +></device-list-by-capability> |
| 116 | +``` |
98 | 117 |
|
99 | 118 | ## Next Steps |
100 | 119 |
|
101 | | -* View and play with other components in the [interactive storybook component library](https://react.seam.co/) |
102 | | -* Check out some [Full Example Apps](https://github.com/seamapi/react/tree/main/examples) |
| 120 | +- Browse live examples in the [interactive component storybook](https://seamapi.github.io/custom-device-db-web). |
| 121 | +- Review source, release notes, and version history in the [`custom-device-db-web` repository](https://github.com/seamapi/custom-device-db-web). |
103 | 122 |
|
104 | | -If you have any questions or want to report an issue, email us at support@seam.co. |
| 123 | +If you have any questions or want to report an issue, email us at [support@seam.co](mailto:support@seam.co). |
0 commit comments