@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.
Files changed (125) hide show
  1. package/README.md +111 -2
  2. package/dist/ecosystem.js +45 -0
  3. package/dist/ecosystem.js.map +1 -0
  4. package/dist/elements.js +12872 -11737
  5. package/dist/elements.js.map +1 -1
  6. package/dist/index.css +469 -0
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.min.css +1 -1
  9. package/dist/index.min.css.map +1 -1
  10. package/lib/seam/SeamProvider.d.ts +10 -3
  11. package/lib/seam/SeamProvider.js +5 -3
  12. package/lib/seam/SeamProvider.js.map +1 -1
  13. package/lib/seam/components/CompatibleApps/CompatibleApps.d.ts +26 -0
  14. package/lib/seam/components/CompatibleApps/CompatibleApps.js +126 -0
  15. package/lib/seam/components/CompatibleApps/CompatibleApps.js.map +1 -0
  16. package/lib/seam/components/SupportedDevices/DeviceModelRow.d.ts +8 -0
  17. package/lib/seam/components/SupportedDevices/DeviceModelRow.js +31 -0
  18. package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +1 -0
  19. package/lib/seam/components/SupportedDevices/FilterSelect.d.ts +12 -0
  20. package/lib/seam/components/SupportedDevices/FilterSelect.js +9 -0
  21. package/lib/seam/components/SupportedDevices/FilterSelect.js.map +1 -0
  22. package/lib/seam/components/SupportedDevices/ManufacturerSection.d.ts +10 -0
  23. package/lib/seam/components/SupportedDevices/ManufacturerSection.js +35 -0
  24. package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -0
  25. package/lib/seam/components/SupportedDevices/SupportedDevices.d.ts +24 -0
  26. package/lib/seam/components/SupportedDevices/SupportedDevices.js +151 -0
  27. package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -0
  28. package/lib/seam/components/SupportedDevices/device-models.d.ts +47 -0
  29. package/lib/seam/components/SupportedDevices/device-models.js +217 -0
  30. package/lib/seam/components/SupportedDevices/device-models.js.map +1 -0
  31. package/lib/seam/components/index.d.ts +2 -0
  32. package/lib/seam/components/index.js +2 -0
  33. package/lib/seam/components/index.js.map +1 -1
  34. package/lib/seam/ecosystem/EcosystemProvider.d.ts +37 -0
  35. package/lib/seam/ecosystem/EcosystemProvider.js +56 -0
  36. package/lib/seam/ecosystem/EcosystemProvider.js.map +1 -0
  37. package/lib/seam/ecosystem/client.d.ts +28 -0
  38. package/lib/seam/ecosystem/client.js +74 -0
  39. package/lib/seam/ecosystem/client.js.map +1 -0
  40. package/lib/seam/ecosystem/index.d.ts +9 -0
  41. package/lib/seam/ecosystem/index.js +8 -0
  42. package/lib/seam/ecosystem/index.js.map +1 -0
  43. package/lib/seam/ecosystem/types.d.ts +312 -0
  44. package/lib/seam/ecosystem/types.js +10 -0
  45. package/lib/seam/ecosystem/types.js.map +1 -0
  46. package/lib/seam/ecosystem/use-compatible-partners.d.ts +21 -0
  47. package/lib/seam/ecosystem/use-compatible-partners.js +36 -0
  48. package/lib/seam/ecosystem/use-compatible-partners.js.map +1 -0
  49. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.d.ts +11 -0
  50. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js +53 -0
  51. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js.map +1 -0
  52. package/lib/seam/ecosystem/use-ecosystem-device-models.d.ts +20 -0
  53. package/lib/seam/ecosystem/use-ecosystem-device-models.js +51 -0
  54. package/lib/seam/ecosystem/use-ecosystem-device-models.js.map +1 -0
  55. package/lib/seam/ecosystem/use-ecosystem-manufacturers.d.ts +11 -0
  56. package/lib/seam/ecosystem/use-ecosystem-manufacturers.js +49 -0
  57. package/lib/seam/ecosystem/use-ecosystem-manufacturers.js.map +1 -0
  58. package/lib/seam/ecosystem/use-ecosystem-query-result.d.ts +7 -0
  59. package/lib/seam/ecosystem/use-ecosystem-query-result.js +7 -0
  60. package/lib/seam/ecosystem/use-ecosystem-query-result.js.map +1 -0
  61. package/lib/seam/ecosystem/use-embed-key-resolution.d.ts +20 -0
  62. package/lib/seam/ecosystem/use-embed-key-resolution.js +51 -0
  63. package/lib/seam/ecosystem/use-embed-key-resolution.js.map +1 -0
  64. package/lib/seam/index.d.ts +1 -0
  65. package/lib/seam/index.js +1 -0
  66. package/lib/seam/index.js.map +1 -1
  67. package/lib/seam/seam-components-class-name.d.ts +1 -0
  68. package/lib/seam/seam-components-class-name.js +2 -0
  69. package/lib/seam/seam-components-class-name.js.map +1 -0
  70. package/lib/ui/ecosystem/SearchField.d.ts +9 -0
  71. package/lib/ui/ecosystem/SearchField.js +8 -0
  72. package/lib/ui/ecosystem/SearchField.js.map +1 -0
  73. package/lib/ui/ecosystem/StateMessage.d.ts +8 -0
  74. package/lib/ui/ecosystem/StateMessage.js +5 -0
  75. package/lib/ui/ecosystem/StateMessage.js.map +1 -0
  76. package/lib/ui/ecosystem/errors.d.ts +5 -0
  77. package/lib/ui/ecosystem/errors.js +25 -0
  78. package/lib/ui/ecosystem/errors.js.map +1 -0
  79. package/lib/ui/ecosystem/storybook.d.ts +15 -0
  80. package/lib/ui/ecosystem/storybook.js +16 -0
  81. package/lib/ui/ecosystem/storybook.js.map +1 -0
  82. package/lib/ui/ecosystem/theme.d.ts +6 -0
  83. package/lib/ui/ecosystem/theme.js +11 -0
  84. package/lib/ui/ecosystem/theme.js.map +1 -0
  85. package/lib/version.d.ts +1 -1
  86. package/lib/version.js +1 -1
  87. package/package.json +11 -3
  88. package/src/ecosystem.d.ts +2 -0
  89. package/src/ecosystem.ts +12 -0
  90. package/src/elements.ts +4 -0
  91. package/src/lib/ecosystem-element.tsx +154 -0
  92. package/src/lib/element.tsx +6 -0
  93. package/src/lib/seam/SeamProvider.tsx +18 -2
  94. package/src/lib/seam/components/CompatibleApps/CompatibleApps.element.ts +19 -0
  95. package/src/lib/seam/components/CompatibleApps/CompatibleApps.tsx +344 -0
  96. package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +108 -0
  97. package/src/lib/seam/components/SupportedDevices/FilterSelect.tsx +43 -0
  98. package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +114 -0
  99. package/src/lib/seam/components/SupportedDevices/SupportedDevices.element.ts +17 -0
  100. package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +382 -0
  101. package/src/lib/seam/components/SupportedDevices/device-models.ts +326 -0
  102. package/src/lib/seam/components/ecosystem-elements.ts +2 -0
  103. package/src/lib/seam/components/index.ts +2 -0
  104. package/src/lib/seam/ecosystem/EcosystemProvider.tsx +133 -0
  105. package/src/lib/seam/ecosystem/client.ts +116 -0
  106. package/src/lib/seam/ecosystem/index.ts +19 -0
  107. package/src/lib/seam/ecosystem/types.ts +402 -0
  108. package/src/lib/seam/ecosystem/use-compatible-partners.ts +80 -0
  109. package/src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts +89 -0
  110. package/src/lib/seam/ecosystem/use-ecosystem-device-models.ts +96 -0
  111. package/src/lib/seam/ecosystem/use-ecosystem-manufacturers.ts +86 -0
  112. package/src/lib/seam/ecosystem/use-ecosystem-query-result.ts +19 -0
  113. package/src/lib/seam/ecosystem/use-embed-key-resolution.ts +80 -0
  114. package/src/lib/seam/index.ts +1 -0
  115. package/src/lib/seam/seam-components-class-name.ts +1 -0
  116. package/src/lib/ui/ecosystem/SearchField.tsx +32 -0
  117. package/src/lib/ui/ecosystem/StateMessage.tsx +29 -0
  118. package/src/lib/ui/ecosystem/errors.ts +30 -0
  119. package/src/lib/ui/ecosystem/storybook.tsx +40 -0
  120. package/src/lib/ui/ecosystem/theme.ts +14 -0
  121. package/src/lib/version.ts +1 -1
  122. package/src/styles/_compatible-apps.scss +102 -0
  123. package/src/styles/_ecosystem.scss +295 -0
  124. package/src/styles/_main.scss +6 -0
  125. 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.0.0/dist/elements.js"
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.0.0/dist/index.min.css"
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).