@seamapi/react 5.0.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -2
- package/dist/ecosystem.js +45 -0
- package/dist/ecosystem.js.map +1 -0
- package/dist/elements.js +12872 -11737
- package/dist/elements.js.map +1 -1
- package/dist/index.css +469 -0
- package/dist/index.css.map +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.css.map +1 -1
- package/lib/seam/SeamProvider.d.ts +10 -3
- package/lib/seam/SeamProvider.js +5 -3
- package/lib/seam/SeamProvider.js.map +1 -1
- package/lib/seam/components/CompatibleApps/CompatibleApps.d.ts +26 -0
- package/lib/seam/components/CompatibleApps/CompatibleApps.js +126 -0
- package/lib/seam/components/CompatibleApps/CompatibleApps.js.map +1 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.d.ts +8 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js +31 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +1 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.d.ts +12 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.js +9 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.js.map +1 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.d.ts +10 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js +35 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.d.ts +24 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.js +151 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -0
- package/lib/seam/components/SupportedDevices/device-models.d.ts +47 -0
- package/lib/seam/components/SupportedDevices/device-models.js +217 -0
- package/lib/seam/components/SupportedDevices/device-models.js.map +1 -0
- package/lib/seam/components/index.d.ts +2 -0
- package/lib/seam/components/index.js +2 -0
- package/lib/seam/components/index.js.map +1 -1
- package/lib/seam/ecosystem/EcosystemProvider.d.ts +37 -0
- package/lib/seam/ecosystem/EcosystemProvider.js +56 -0
- package/lib/seam/ecosystem/EcosystemProvider.js.map +1 -0
- package/lib/seam/ecosystem/client.d.ts +28 -0
- package/lib/seam/ecosystem/client.js +74 -0
- package/lib/seam/ecosystem/client.js.map +1 -0
- package/lib/seam/ecosystem/index.d.ts +9 -0
- package/lib/seam/ecosystem/index.js +8 -0
- package/lib/seam/ecosystem/index.js.map +1 -0
- package/lib/seam/ecosystem/types.d.ts +312 -0
- package/lib/seam/ecosystem/types.js +10 -0
- package/lib/seam/ecosystem/types.js.map +1 -0
- package/lib/seam/ecosystem/use-compatible-partners.d.ts +21 -0
- package/lib/seam/ecosystem/use-compatible-partners.js +36 -0
- package/lib/seam/ecosystem/use-compatible-partners.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.d.ts +11 -0
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js +53 -0
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.d.ts +20 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.js +51 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.d.ts +11 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.js +49 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.d.ts +7 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.js +7 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.js.map +1 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.d.ts +20 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.js +51 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.js.map +1 -0
- package/lib/seam/index.d.ts +1 -0
- package/lib/seam/index.js +1 -0
- package/lib/seam/index.js.map +1 -1
- package/lib/seam/seam-components-class-name.d.ts +1 -0
- package/lib/seam/seam-components-class-name.js +2 -0
- package/lib/seam/seam-components-class-name.js.map +1 -0
- package/lib/ui/ecosystem/SearchField.d.ts +9 -0
- package/lib/ui/ecosystem/SearchField.js +8 -0
- package/lib/ui/ecosystem/SearchField.js.map +1 -0
- package/lib/ui/ecosystem/StateMessage.d.ts +8 -0
- package/lib/ui/ecosystem/StateMessage.js +5 -0
- package/lib/ui/ecosystem/StateMessage.js.map +1 -0
- package/lib/ui/ecosystem/errors.d.ts +5 -0
- package/lib/ui/ecosystem/errors.js +25 -0
- package/lib/ui/ecosystem/errors.js.map +1 -0
- package/lib/ui/ecosystem/storybook.d.ts +15 -0
- package/lib/ui/ecosystem/storybook.js +16 -0
- package/lib/ui/ecosystem/storybook.js.map +1 -0
- package/lib/ui/ecosystem/theme.d.ts +6 -0
- package/lib/ui/ecosystem/theme.js +11 -0
- package/lib/ui/ecosystem/theme.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +11 -3
- package/src/ecosystem.d.ts +2 -0
- package/src/ecosystem.ts +12 -0
- package/src/elements.ts +4 -0
- package/src/lib/ecosystem-element.tsx +154 -0
- package/src/lib/element.tsx +6 -0
- package/src/lib/seam/SeamProvider.tsx +18 -2
- package/src/lib/seam/components/CompatibleApps/CompatibleApps.element.ts +19 -0
- package/src/lib/seam/components/CompatibleApps/CompatibleApps.tsx +344 -0
- package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +108 -0
- package/src/lib/seam/components/SupportedDevices/FilterSelect.tsx +43 -0
- package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +114 -0
- package/src/lib/seam/components/SupportedDevices/SupportedDevices.element.ts +17 -0
- package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +382 -0
- package/src/lib/seam/components/SupportedDevices/device-models.ts +326 -0
- package/src/lib/seam/components/ecosystem-elements.ts +2 -0
- package/src/lib/seam/components/index.ts +2 -0
- package/src/lib/seam/ecosystem/EcosystemProvider.tsx +133 -0
- package/src/lib/seam/ecosystem/client.ts +116 -0
- package/src/lib/seam/ecosystem/index.ts +19 -0
- package/src/lib/seam/ecosystem/types.ts +402 -0
- package/src/lib/seam/ecosystem/use-compatible-partners.ts +80 -0
- package/src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts +89 -0
- package/src/lib/seam/ecosystem/use-ecosystem-device-models.ts +96 -0
- package/src/lib/seam/ecosystem/use-ecosystem-manufacturers.ts +86 -0
- package/src/lib/seam/ecosystem/use-ecosystem-query-result.ts +19 -0
- package/src/lib/seam/ecosystem/use-embed-key-resolution.ts +80 -0
- package/src/lib/seam/index.ts +1 -0
- package/src/lib/seam/seam-components-class-name.ts +1 -0
- package/src/lib/ui/ecosystem/SearchField.tsx +32 -0
- package/src/lib/ui/ecosystem/StateMessage.tsx +29 -0
- package/src/lib/ui/ecosystem/errors.ts +30 -0
- package/src/lib/ui/ecosystem/storybook.tsx +40 -0
- package/src/lib/ui/ecosystem/theme.ts +14 -0
- package/src/lib/version.ts +1 -1
- package/src/styles/_compatible-apps.scss +102 -0
- package/src/styles/_ecosystem.scss +295 -0
- package/src/styles/_main.scss +6 -0
- package/src/styles/_supported-devices.scss +153 -0
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ export function App() {
|
|
|
86
86
|
<seam-device-table publishable-key="your_publishable_key"></seam-device-table>
|
|
87
87
|
<script
|
|
88
88
|
type="module"
|
|
89
|
-
src="https://react.seam.co/v/5.
|
|
89
|
+
src="https://react.seam.co/v/5.1.1/dist/elements.js"
|
|
90
90
|
></script>
|
|
91
91
|
</body>
|
|
92
92
|
```
|
|
@@ -140,6 +140,98 @@ globalThis.customElements.whenDefined('seam-device-table').then(() => {
|
|
|
140
140
|
|
|
141
141
|
[Seam Console]: https://console.seam.co/
|
|
142
142
|
|
|
143
|
+
### Seam Ecosystem Components
|
|
144
|
+
|
|
145
|
+
Two components show [Seam Ecosystem] data on any website,
|
|
146
|
+
e.g., a manufacturer's product page or a partner's integrations page:
|
|
147
|
+
|
|
148
|
+
- `<seam-compatible-apps>` (`CompatibleApps`):
|
|
149
|
+
the apps (Seam partners) that work with a device type, manufacturer, provider or capability through Seam.
|
|
150
|
+
A partner is listed only where Seam or the partner has declared support.
|
|
151
|
+
- `<seam-supported-devices>` (`SupportedDevices`):
|
|
152
|
+
the device models that work with Seam, grouped by manufacturer,
|
|
153
|
+
with device type and capability badges, search and filters.
|
|
154
|
+
|
|
155
|
+
These components use an Ecosystem embed key (`eco_live_…`) instead of a publishable key.
|
|
156
|
+
The page origin must be one of the key's allowed origins.
|
|
157
|
+
With a manufacturer key, `<seam-supported-devices>` defaults to that manufacturer.
|
|
158
|
+
With a partner key, it hides what the partner declared unsupported.
|
|
159
|
+
|
|
160
|
+
Load the lightweight `ecosystem.js` bundle, which only contains these two elements
|
|
161
|
+
(the full `elements.js` bundle defines them too):
|
|
162
|
+
|
|
163
|
+
```html
|
|
164
|
+
<body>
|
|
165
|
+
<seam-compatible-apps
|
|
166
|
+
embed-key="your_embed_key"
|
|
167
|
+
device-type="smartlock"
|
|
168
|
+
manufacturer="schlage"
|
|
169
|
+
></seam-compatible-apps>
|
|
170
|
+
<seam-supported-devices
|
|
171
|
+
embed-key="your_embed_key"
|
|
172
|
+
manufacturer="schlage"
|
|
173
|
+
></seam-supported-devices>
|
|
174
|
+
<script
|
|
175
|
+
type="module"
|
|
176
|
+
src="https://react.seam.co/v/5.1.1/dist/ecosystem.js"
|
|
177
|
+
></script>
|
|
178
|
+
</body>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`<seam-compatible-apps>` attributes:
|
|
182
|
+
|
|
183
|
+
| Attribute | Description |
|
|
184
|
+
| -------------- | ----------------------------------------------------------------------------------- |
|
|
185
|
+
| `device-type` | Required. Device category, e.g., `smartlock`, `thermostat`, `sensor` or `intercom`. |
|
|
186
|
+
| `manufacturer` | DeviceDB manufacturer slug, e.g., `schlage`. |
|
|
187
|
+
| `provider` | DeviceDB provider slug, e.g., `salto-ks`. Shows each app's support note. |
|
|
188
|
+
| `capability` | DeviceDB capability, e.g., `can_provision_mobile_keys`. Shows each app's note. |
|
|
189
|
+
| `industry` | Industry slug, e.g., `short-term-rental`. |
|
|
190
|
+
| `max-visible` | Apps shown before the show more button. Defaults to 24. |
|
|
191
|
+
| `hide-search` | Hide the search field. |
|
|
192
|
+
| `hide-title` | Hide the title. |
|
|
193
|
+
|
|
194
|
+
`<seam-supported-devices>` attributes:
|
|
195
|
+
|
|
196
|
+
| Attribute | Description |
|
|
197
|
+
| -------------- | ------------------------------------------------------------------------------------- |
|
|
198
|
+
| `manufacturer` | DeviceDB manufacturer slug. Defaults to the manufacturer of a manufacturer embed key. |
|
|
199
|
+
| `device-type` | DeviceDB device type slug, e.g., `smartlock` or `thermostat`. |
|
|
200
|
+
| `capability` | Only devices supporting this capability, e.g., `can_program_online_access_codes`. |
|
|
201
|
+
| `hide-search` | Hide the search field. |
|
|
202
|
+
| `hide-filters` | Hide the manufacturer, device type and capability filters. |
|
|
203
|
+
| `hide-title` | Hide the title. |
|
|
204
|
+
|
|
205
|
+
Both elements also accept `embed-key`, `theme` (`light`, `dark` or `auto` to follow the visitor's color scheme),
|
|
206
|
+
`ecosystem-endpoint` (defaults to `https://ecosystem.seam.co/v1/`),
|
|
207
|
+
`class-name`, `disable-css-injection`, `disable-font-injection` and `unminifiy-css`.
|
|
208
|
+
Boolean attributes may be set without a value, e.g., `<seam-compatible-apps hide-search>`.
|
|
209
|
+
|
|
210
|
+
With React, wrap the components in an `EcosystemProvider`,
|
|
211
|
+
or pass `embedKey` to an existing `SeamProvider`:
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import {
|
|
215
|
+
CompatibleApps,
|
|
216
|
+
EcosystemProvider,
|
|
217
|
+
SupportedDevices,
|
|
218
|
+
} from '@seamapi/react'
|
|
219
|
+
|
|
220
|
+
export function ProductPage() {
|
|
221
|
+
return (
|
|
222
|
+
<EcosystemProvider embedKey='your_embed_key'>
|
|
223
|
+
<SupportedDevices manufacturer='schlage' />
|
|
224
|
+
<CompatibleApps deviceType='smartlock' manufacturer='schlage' />
|
|
225
|
+
</EcosystemProvider>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The data is also available with the `useCompatiblePartners`, `useEcosystemDeviceModels`,
|
|
231
|
+
`useEcosystemManufacturers` and `useEmbedKeyResolution` hooks.
|
|
232
|
+
|
|
233
|
+
[Seam Ecosystem]: https://ecosystem.seam.co/
|
|
234
|
+
|
|
143
235
|
### React Hooks
|
|
144
236
|
|
|
145
237
|
All components interact with the Seam API via a set of React Hooks.
|
|
@@ -214,7 +306,7 @@ or place the following in the `<head>` tag:
|
|
|
214
306
|
```html
|
|
215
307
|
<link
|
|
216
308
|
rel="stylesheet"
|
|
217
|
-
href="https://react.seam.co/v/5.
|
|
309
|
+
href="https://react.seam.co/v/5.1.1/dist/index.min.css"
|
|
218
310
|
/>
|
|
219
311
|
```
|
|
220
312
|
|
|
@@ -339,6 +431,15 @@ When serving the CSS styles from the default CDN, extend `style-src` with
|
|
|
339
431
|
style-src https://react.seam.co
|
|
340
432
|
```
|
|
341
433
|
|
|
434
|
+
#### Seam Ecosystem Components CSP
|
|
435
|
+
|
|
436
|
+
The Ecosystem components call the Ecosystem API and show logos and device images from its media storage.
|
|
437
|
+
Extend the CSP with
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
connect-src https://ecosystem.seam.co; img-src https://seam-ecosystem-media.fly.storage.tigris.dev
|
|
441
|
+
```
|
|
442
|
+
|
|
342
443
|
### Telemetry
|
|
343
444
|
|
|
344
445
|
By default, this library reports basic usage telemetry to the Seam API.
|
|
@@ -482,6 +583,14 @@ The tests use the [default seed](https://github.com/seamapi/fake-seam-connect/bl
|
|
|
482
583
|
Edit the Storybook seed data for the fake or find relevant ids for testing components here:
|
|
483
584
|
[Storybook fake seed](./.storybook/seed-fake.js).
|
|
484
585
|
|
|
586
|
+
### Fake Seam Ecosystem
|
|
587
|
+
|
|
588
|
+
The Ecosystem components are developed and tested against a fake of the public Seam Ecosystem API
|
|
589
|
+
with fictional partners and sample device models: [.storybook/fake-ecosystem.js](./.storybook/fake-ecosystem.js).
|
|
590
|
+
Storybook serves it at `/api/ecosystem` (locally via the Storybook middleware, and on react.seam.co via `api/fake-ecosystem.ts`),
|
|
591
|
+
so neither the Storybook nor the tests use a real embed key or production data.
|
|
592
|
+
It accepts the embed keys exported from that file.
|
|
593
|
+
|
|
485
594
|
### Fake Devicedb
|
|
486
595
|
|
|
487
596
|
Fake Seam Connect optionally depends on a [fake version of the Seam Devicedb](https://github.com/seamapi/fake-devicedb).
|