@seamapi/react 5.3.2 → 5.4.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 (65) hide show
  1. package/README.md +66 -3
  2. package/dist/ecosystem.js +14 -14
  3. package/dist/ecosystem.js.map +1 -1
  4. package/dist/elements.js +21042 -19731
  5. package/dist/elements.js.map +1 -1
  6. package/ecosystem-react.d.ts +3 -0
  7. package/ecosystem-react.js +7 -0
  8. package/ecosystem-react.js.map +1 -0
  9. package/lib/seam/components/SupportedDevices/SupportedDevices.js +2 -4
  10. package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -1
  11. package/lib/seam/components/SupportedDevices/presentation.d.ts +1 -0
  12. package/lib/seam/components/SupportedDevices/presentation.js +3 -0
  13. package/lib/seam/components/SupportedDevices/presentation.js.map +1 -1
  14. package/lib/seam/ecosystem/EcosystemProvider.d.ts +4 -2
  15. package/lib/seam/ecosystem/EcosystemProvider.js +9 -6
  16. package/lib/seam/ecosystem/EcosystemProvider.js.map +1 -1
  17. package/lib/seam/ecosystem/client.d.ts +5 -1
  18. package/lib/seam/ecosystem/client.js +4 -2
  19. package/lib/seam/ecosystem/client.js.map +1 -1
  20. package/lib/seam/ecosystem/embed-resolution.d.ts +7 -0
  21. package/lib/seam/ecosystem/embed-resolution.js +18 -0
  22. package/lib/seam/ecosystem/embed-resolution.js.map +1 -0
  23. package/lib/seam/ecosystem/options.d.ts +6 -0
  24. package/lib/seam/ecosystem/options.js +13 -0
  25. package/lib/seam/ecosystem/options.js.map +1 -0
  26. package/lib/seam/ecosystem/prefetch-supported-devices.d.ts +14 -0
  27. package/lib/seam/ecosystem/prefetch-supported-devices.js +79 -0
  28. package/lib/seam/ecosystem/prefetch-supported-devices.js.map +1 -0
  29. package/lib/seam/ecosystem/queries.d.ts +17 -0
  30. package/lib/seam/ecosystem/queries.js +144 -0
  31. package/lib/seam/ecosystem/queries.js.map +1 -0
  32. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.d.ts +5 -9
  33. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js +7 -59
  34. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js.map +1 -1
  35. package/lib/seam/ecosystem/use-ecosystem-manufacturers.d.ts +3 -3
  36. package/lib/seam/ecosystem/use-ecosystem-manufacturers.js +7 -41
  37. package/lib/seam/ecosystem/use-ecosystem-manufacturers.js.map +1 -1
  38. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.d.ts +2 -2
  39. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js +6 -40
  40. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js.map +1 -1
  41. package/lib/seam/ecosystem/use-embed-key-resolution.d.ts +4 -14
  42. package/lib/seam/ecosystem/use-embed-key-resolution.js +8 -43
  43. package/lib/seam/ecosystem/use-embed-key-resolution.js.map +1 -1
  44. package/lib/version.d.ts +1 -1
  45. package/lib/version.js +1 -1
  46. package/package.json +23 -10
  47. package/server.d.ts +2 -0
  48. package/server.js +3 -0
  49. package/server.js.map +1 -0
  50. package/src/ecosystem-react.ts +17 -0
  51. package/src/lib/ecosystem-element.tsx +4 -1
  52. package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +2 -11
  53. package/src/lib/seam/components/SupportedDevices/presentation.ts +11 -0
  54. package/src/lib/seam/ecosystem/EcosystemProvider.tsx +17 -7
  55. package/src/lib/seam/ecosystem/client.ts +14 -2
  56. package/src/lib/seam/ecosystem/embed-resolution.ts +20 -0
  57. package/src/lib/seam/ecosystem/options.ts +21 -0
  58. package/src/lib/seam/ecosystem/prefetch-supported-devices.ts +150 -0
  59. package/src/lib/seam/ecosystem/queries.ts +204 -0
  60. package/src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts +10 -79
  61. package/src/lib/seam/ecosystem/use-ecosystem-manufacturers.ts +9 -60
  62. package/src/lib/seam/ecosystem/use-ecosystem-provider-requirements.ts +10 -50
  63. package/src/lib/seam/ecosystem/use-embed-key-resolution.ts +11 -57
  64. package/src/lib/version.ts +1 -1
  65. package/src/server.ts +5 -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.3.2/dist/elements.js"
89
+ src="https://react.seam.co/v/5.4.1/dist/elements.js"
90
90
  ></script>
91
91
  </body>
92
92
  ```
@@ -173,7 +173,7 @@ Load the lightweight `ecosystem.js` bundle, which only contains these two elemen
173
173
  ></seam-supported-devices>
174
174
  <script
175
175
  type="module"
176
- src="https://react.seam.co/v/5.3.2/dist/ecosystem.js"
176
+ src="https://react.seam.co/v/5.4.1/dist/ecosystem.js"
177
177
  ></script>
178
178
  </body>
179
179
  ```
@@ -233,6 +233,69 @@ The data is also available with the `useCompatiblePartners`, `useEcosystemDevice
233
233
 
234
234
  [Seam Ecosystem]: https://ecosystem.seam.co/
235
235
 
236
+ ### Pre-render supported devices in Next.js
237
+
238
+ Use the native React components from `@seamapi/react/ecosystem-react.js` and the
239
+ server loader from `@seamapi/react/server.js` (5.4.1 or newer). The React entry
240
+ declares the client boundary for App Router; Next.js can still pre-render its
241
+ HTML when data is supplied by the server.
242
+
243
+ ```tsx
244
+ // app/devices/page.tsx — Server Component
245
+ import {
246
+ EcosystemProvider,
247
+ SupportedDevices,
248
+ } from '@seamapi/react/ecosystem-react.js'
249
+ import { prefetchSupportedDevices } from '@seamapi/react/server.js'
250
+
251
+ export default async function Page() {
252
+ const embedKey = process.env.NEXT_PUBLIC_ECOSYSTEM_EMBED_KEY
253
+ const filters = {
254
+ manufacturer: 'august',
255
+ provider: 'august-access',
256
+ deviceType: 'smartlock',
257
+ }
258
+ const dehydratedState = await prefetchSupportedDevices({
259
+ ...filters,
260
+ embedKey,
261
+ origin: 'https://your-site.example',
262
+ })
263
+
264
+ return (
265
+ <EcosystemProvider
266
+ embedKey={embedKey}
267
+ dehydratedState={dehydratedState}
268
+ disableCssInjection
269
+ disableFontInjection
270
+ >
271
+ <SupportedDevices {...filters} />
272
+ </EcosystemProvider>
273
+ )
274
+ }
275
+ ```
276
+
277
+ Import `@seamapi/react/index.css` in `app/layout.tsx` so the server-rendered
278
+ content is styled before JavaScript loads. The loader resolves the key's
279
+ manufacturer scope and exclusions, paginates the catalog, and fetches provider,
280
+ manufacturer, and linked accessory details. It uses an isolated cache per call,
281
+ removes excluded records before serialization, and throws on failed or
282
+ incomplete reads. Configure the embed key's allowed origins to include the page
283
+ origin; the loader forwards that origin to Ecosystem for validation. Keep the
284
+ loader and component's key, endpoint, and filters identical.
285
+
286
+ The resulting HTML contains device names, model numbers, capabilities,
287
+ requirements, and accessory links. JavaScript hydrates the existing UI for
288
+ search, filtering, and galleries. Device disclosures and links work without
289
+ JavaScript; the unscoped catalog's per-manufacturer "Show all" button still
290
+ requires it. Server-prefetched queries remain fresh for one minute after their
291
+ fetch time before becoming eligible for background refresh.
292
+
293
+ For caching, pass a `fetch` implementation that applies your Next.js
294
+ revalidation settings. See the [working Next.js example](./examples/nextjs-supported-devices)
295
+ for hourly revalidation, configuration, and verification. This renders the
296
+ component inline in a Next.js page; it does not change the Mintlify iframe or
297
+ put iframe content into its parent page's HTML.
298
+
236
299
  ### Hosted supported-device embed
237
300
 
238
301
  The native React page at
@@ -357,7 +420,7 @@ or place the following in the `<head>` tag:
357
420
  ```html
358
421
  <link
359
422
  rel="stylesheet"
360
- href="https://react.seam.co/v/5.3.2/dist/index.min.css"
423
+ href="https://react.seam.co/v/5.4.1/dist/index.min.css"
361
424
  />
362
425
  ```
363
426