@seamapi/react 5.2.4 → 5.3.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 (75) hide show
  1. package/README.md +3 -3
  2. package/dist/ecosystem.js +11 -10
  3. package/dist/ecosystem.js.map +1 -1
  4. package/dist/elements.js +12339 -11523
  5. package/dist/elements.js.map +1 -1
  6. package/dist/index.css +996 -162
  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/components/SupportedDevices/AccessoryCatalog.d.ts +9 -0
  11. package/lib/seam/components/SupportedDevices/AccessoryCatalog.js +40 -0
  12. package/lib/seam/components/SupportedDevices/AccessoryCatalog.js.map +1 -0
  13. package/lib/seam/components/SupportedDevices/BrandMark.d.ts +7 -0
  14. package/lib/seam/components/SupportedDevices/BrandMark.js +23 -0
  15. package/lib/seam/components/SupportedDevices/BrandMark.js.map +1 -0
  16. package/lib/seam/components/SupportedDevices/CapabilityFilter.d.ts +7 -0
  17. package/lib/seam/components/SupportedDevices/CapabilityFilter.js +58 -0
  18. package/lib/seam/components/SupportedDevices/CapabilityFilter.js.map +1 -0
  19. package/lib/seam/components/SupportedDevices/DeviceRow.d.ts +6 -0
  20. package/lib/seam/components/SupportedDevices/DeviceRow.js +20 -0
  21. package/lib/seam/components/SupportedDevices/DeviceRow.js.map +1 -0
  22. package/lib/seam/components/SupportedDevices/HardwareGallery.d.ts +6 -0
  23. package/lib/seam/components/SupportedDevices/HardwareGallery.js +108 -0
  24. package/lib/seam/components/SupportedDevices/HardwareGallery.js.map +1 -0
  25. package/lib/seam/components/SupportedDevices/HardwareInformation.d.ts +5 -0
  26. package/lib/seam/components/SupportedDevices/HardwareInformation.js +50 -0
  27. package/lib/seam/components/SupportedDevices/HardwareInformation.js.map +1 -0
  28. package/lib/seam/components/SupportedDevices/ManufacturerSection.d.ts +3 -3
  29. package/lib/seam/components/SupportedDevices/ManufacturerSection.js +10 -13
  30. package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -1
  31. package/lib/seam/components/SupportedDevices/ProviderRequirements.d.ts +5 -0
  32. package/lib/seam/components/SupportedDevices/ProviderRequirements.js +20 -0
  33. package/lib/seam/components/SupportedDevices/ProviderRequirements.js.map +1 -0
  34. package/lib/seam/components/SupportedDevices/RequirementIcon.js +1 -1
  35. package/lib/seam/components/SupportedDevices/RequirementIcon.js.map +1 -1
  36. package/lib/seam/components/SupportedDevices/StatusMarks.d.ts +3 -0
  37. package/lib/seam/components/SupportedDevices/StatusMarks.js +8 -0
  38. package/lib/seam/components/SupportedDevices/StatusMarks.js.map +1 -0
  39. package/lib/seam/components/SupportedDevices/SupportedDevices.d.ts +2 -2
  40. package/lib/seam/components/SupportedDevices/SupportedDevices.js +53 -30
  41. package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -1
  42. package/lib/seam/components/SupportedDevices/presentation.d.ts +34 -0
  43. package/lib/seam/components/SupportedDevices/presentation.js +142 -0
  44. package/lib/seam/components/SupportedDevices/presentation.js.map +1 -0
  45. package/lib/seam/ecosystem/types.d.ts +5 -1
  46. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.d.ts +5 -2
  47. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js +4 -1
  48. package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js.map +1 -1
  49. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.d.ts +1 -1
  50. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js +1 -1
  51. package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js.map +1 -1
  52. package/lib/version.d.ts +1 -1
  53. package/lib/version.js +1 -1
  54. package/package.json +1 -1
  55. package/src/lib/seam/components/SupportedDevices/AccessoryCatalog.tsx +138 -0
  56. package/src/lib/seam/components/SupportedDevices/BrandMark.tsx +61 -0
  57. package/src/lib/seam/components/SupportedDevices/CapabilityFilter.tsx +142 -0
  58. package/src/lib/seam/components/SupportedDevices/DeviceRow.tsx +163 -0
  59. package/src/lib/seam/components/SupportedDevices/HardwareGallery.tsx +284 -0
  60. package/src/lib/seam/components/SupportedDevices/HardwareInformation.tsx +103 -0
  61. package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +22 -32
  62. package/src/lib/seam/components/SupportedDevices/ProviderRequirements.tsx +127 -0
  63. package/src/lib/seam/components/SupportedDevices/RequirementIcon.tsx +8 -1
  64. package/src/lib/seam/components/SupportedDevices/StatusMarks.tsx +32 -0
  65. package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +120 -91
  66. package/src/lib/seam/components/SupportedDevices/presentation.ts +234 -0
  67. package/src/lib/seam/ecosystem/types.ts +5 -1
  68. package/src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts +8 -1
  69. package/src/lib/seam/ecosystem/use-ecosystem-provider-requirements.ts +1 -1
  70. package/src/lib/version.ts +1 -1
  71. package/src/styles/_supported-devices.scss +1183 -174
  72. package/lib/seam/components/SupportedDevices/DeviceModelRow.d.ts +0 -8
  73. package/lib/seam/components/SupportedDevices/DeviceModelRow.js +0 -49
  74. package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +0 -1
  75. package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +0 -197
@@ -0,0 +1,284 @@
1
+ import { useEffect, useId, useRef, useState } from 'react'
2
+
3
+ import type {
4
+ DeviceImage,
5
+ DeviceModelSummary,
6
+ } from 'lib/seam/ecosystem/types.js'
7
+
8
+ interface GalleryImage {
9
+ image: DeviceImage
10
+ label: string
11
+ }
12
+
13
+ export function HardwareGallery({
14
+ source,
15
+ name,
16
+ }: {
17
+ source: DeviceModelSummary
18
+ name: string
19
+ }): JSX.Element {
20
+ const seen = new Set<string>()
21
+ const photos: GalleryImage[] = []
22
+ for (const variant of source.variants)
23
+ for (const image of variant.images) {
24
+ if (seen.has(image.url)) continue
25
+ seen.add(image.url)
26
+ photos.push({
27
+ image,
28
+ label: [variant.color_name, variant.style_name]
29
+ .filter(Boolean)
30
+ .join(' · '),
31
+ })
32
+ }
33
+ if (photos.length === 0 && source.featured_image != null)
34
+ photos.push({ image: source.featured_image, label: name })
35
+ const swatches = source.variants
36
+ .filter(
37
+ (variant) =>
38
+ variant.color_name != null || variant.primary_color_hex != null
39
+ )
40
+ .map((variant) => ({
41
+ label: variant.color_name ?? 'Color not specified',
42
+ color: variant.primary_color_hex,
43
+ index: photos.findIndex((photo) =>
44
+ variant.images.some((image) => image.url === photo.image.url)
45
+ ),
46
+ }))
47
+ .filter(
48
+ (swatch, index, all) =>
49
+ all.findIndex(
50
+ (entry) =>
51
+ entry.label === swatch.label && entry.color === swatch.color
52
+ ) === index
53
+ )
54
+
55
+ const [selected, setSelected] = useState<number | null>(null)
56
+ const [hovered, setHovered] = useState<{
57
+ index: number
58
+ left: number
59
+ top: number
60
+ } | null>(null)
61
+ const dialog = useRef<HTMLDialogElement>(null)
62
+ const titleId = useId()
63
+ const current = selected == null ? null : photos[selected]
64
+ const hoverPhoto = hovered == null ? null : photos[hovered.index]
65
+
66
+ useEffect(() => {
67
+ if (selected != null && dialog.current != null && !dialog.current.open)
68
+ dialog.current.showModal()
69
+ }, [selected])
70
+
71
+ useEffect(() => {
72
+ if (hovered == null) return
73
+ const dismiss = (): void => {
74
+ setHovered(null)
75
+ }
76
+ window.addEventListener('scroll', dismiss, true)
77
+ window.addEventListener('resize', dismiss)
78
+ return () => {
79
+ window.removeEventListener('scroll', dismiss, true)
80
+ window.removeEventListener('resize', dismiss)
81
+ }
82
+ }, [hovered])
83
+
84
+ const move = (direction: number): void => {
85
+ setSelected((index) =>
86
+ index == null ? null : (index + direction + photos.length) % photos.length
87
+ )
88
+ }
89
+
90
+ return (
91
+ <div className='seam-supported-device-gallery'>
92
+ {swatches.length > 0 ? (
93
+ <div
94
+ className='seam-supported-device-gallery-swatches'
95
+ role='group'
96
+ aria-label={`${name} colors and photos`}
97
+ >
98
+ {swatches.map(({ color, label, index }) => (
99
+ <button
100
+ key={`${color ?? ''}-${label}`}
101
+ type='button'
102
+ className='seam-supported-device-gallery-swatch'
103
+ aria-label={`View ${name} in ${label}`}
104
+ title={`${label} · ${index < 0 ? 'Photos unavailable' : 'View photos'}`}
105
+ disabled={index < 0}
106
+ onPointerEnter={(event) => {
107
+ if (
108
+ index < 0 ||
109
+ event.pointerType !== 'mouse' ||
110
+ window.innerWidth <= 600
111
+ )
112
+ return
113
+ const rect = event.currentTarget.getBoundingClientRect()
114
+ const style = getComputedStyle(document.documentElement)
115
+ const measuredTop = parseFloat(
116
+ style.getPropertyValue('--seam-supported-device-viewport-top')
117
+ )
118
+ const measuredHeight = parseFloat(
119
+ style.getPropertyValue(
120
+ '--seam-supported-device-viewport-height'
121
+ )
122
+ )
123
+ const viewportTop = Number.isFinite(measuredTop)
124
+ ? measuredTop
125
+ : 0
126
+ const viewportHeight =
127
+ Number.isFinite(measuredHeight) && measuredHeight > 0
128
+ ? measuredHeight
129
+ : window.innerHeight
130
+ const size = 280
131
+ const nextTo =
132
+ rect.right + 12 + size < window.innerWidth - 16
133
+ ? rect.right + 12
134
+ : rect.left - size - 12
135
+ setHovered({
136
+ index,
137
+ left: Math.max(16, nextTo),
138
+ top: Math.max(
139
+ viewportTop + 16,
140
+ Math.min(
141
+ rect.top - 100,
142
+ viewportTop + viewportHeight - size - 56
143
+ )
144
+ ),
145
+ })
146
+ }}
147
+ onPointerLeave={() => {
148
+ setHovered(null)
149
+ }}
150
+ onClick={() => {
151
+ setHovered(null)
152
+ setSelected(index)
153
+ }}
154
+ >
155
+ <span
156
+ className='seam-supported-device-gallery-color'
157
+ style={{ backgroundColor: color ?? undefined }}
158
+ data-unknown={color == null ? '' : undefined}
159
+ />
160
+ </button>
161
+ ))}
162
+ {photos.length > 0 && swatches.every(({ index }) => index < 0) && (
163
+ <button
164
+ type='button'
165
+ className='seam-supported-device-gallery-photos'
166
+ onClick={() => {
167
+ setSelected(0)
168
+ }}
169
+ >
170
+ View photos
171
+ </button>
172
+ )}
173
+ </div>
174
+ ) : photos.length > 0 ? (
175
+ <button
176
+ type='button'
177
+ className='seam-supported-device-gallery-photos'
178
+ onClick={() => {
179
+ setSelected(0)
180
+ }}
181
+ >
182
+ View photos
183
+ </button>
184
+ ) : (
185
+ <span className='seam-supported-device-muted'>Not listed</span>
186
+ )}
187
+ {hovered != null && hoverPhoto != null && (
188
+ <div
189
+ className='seam-supported-device-gallery-hover'
190
+ style={{ left: hovered.left, top: hovered.top }}
191
+ aria-hidden
192
+ >
193
+ <img
194
+ src={largeImage(hoverPhoto.image)}
195
+ alt=''
196
+ width='280'
197
+ height='280'
198
+ />
199
+ <span>{hoverPhoto.label === '' ? name : hoverPhoto.label}</span>
200
+ </div>
201
+ )}
202
+ <dialog
203
+ ref={dialog}
204
+ className='seam-supported-device-gallery-dialog'
205
+ aria-labelledby={titleId}
206
+ onClose={() => {
207
+ setSelected(null)
208
+ setHovered(null)
209
+ }}
210
+ onClick={(event) => {
211
+ if (event.target === event.currentTarget) event.currentTarget.close()
212
+ }}
213
+ onKeyDown={(event) => {
214
+ event.stopPropagation()
215
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
216
+ event.preventDefault()
217
+ move(event.key === 'ArrowLeft' ? -1 : 1)
218
+ }
219
+ }}
220
+ >
221
+ {current != null && (
222
+ <>
223
+ <header>
224
+ <h4 id={titleId}>{name}</h4>
225
+ <button
226
+ type='button'
227
+ aria-label='Close image'
228
+ onClick={() => dialog.current?.close()}
229
+ >
230
+ <svg
231
+ aria-hidden
232
+ width='18'
233
+ height='18'
234
+ viewBox='0 0 20 20'
235
+ fill='none'
236
+ stroke='currentColor'
237
+ strokeWidth='1.5'
238
+ >
239
+ <path d='m5 5 10 10M15 5 5 15' strokeLinecap='round' />
240
+ </svg>
241
+ </button>
242
+ </header>
243
+
244
+ <img
245
+ className='seam-supported-device-gallery-large-image'
246
+ src={largeImage(current.image)}
247
+ alt={`${name}${current.label === '' ? '' : ` · ${current.label}`}`}
248
+ />
249
+ <footer>
250
+ <button
251
+ type='button'
252
+ aria-label='Previous image'
253
+ disabled={photos.length < 2}
254
+ onClick={() => {
255
+ move(-1)
256
+ }}
257
+ >
258
+ ←
259
+ </button>
260
+ <span>
261
+ {current.label === '' ? name : current.label} ·{' '}
262
+ {(selected ?? 0) + 1} / {photos.length}
263
+ </span>
264
+ <button
265
+ type='button'
266
+ aria-label='Next image'
267
+ disabled={photos.length < 2}
268
+ onClick={() => {
269
+ move(1)
270
+ }}
271
+ >
272
+ →
273
+ </button>
274
+ </footer>
275
+ </>
276
+ )}
277
+ </dialog>
278
+ </div>
279
+ )
280
+ }
281
+
282
+ function largeImage(image: DeviceImage): string {
283
+ return image.formats.large?.url ?? image.formats.medium?.url ?? image.url
284
+ }
@@ -0,0 +1,103 @@
1
+ import type { DeviceModelSummary } from 'lib/seam/ecosystem/types.js'
2
+
3
+ import { HardwareGallery } from './HardwareGallery.js'
4
+ import type { PresentedDevice } from './presentation.js'
5
+
6
+ export function HardwareInformation({
7
+ device,
8
+ }: {
9
+ device: PresentedDevice
10
+ }): JSX.Element {
11
+ const { source, name } = device
12
+ const facts = hardwareFacts(source)
13
+ return (
14
+ <section
15
+ className='seam-supported-device-hardware'
16
+ aria-label='Hardware information'
17
+ >
18
+ <h4 className='seam-supported-device-sr-only'>Hardware information</h4>
19
+ <dl className='seam-supported-device-hardware-facts'>
20
+ {facts.map(({ label, value }) => (
21
+ <div
22
+ key={label}
23
+ className={
24
+ label === 'Model numbers'
25
+ ? 'seam-supported-device-model-numbers'
26
+ : undefined
27
+ }
28
+ >
29
+ <dt>
30
+ {label}
31
+ {label === 'Model numbers' && source.manufacturer != null && (
32
+ <a
33
+ href={`https://www.seam.co/${encodeURIComponent(source.device_type?.slug ?? 'smartlock')}s/${encodeURIComponent(source.manufacturer.slug)}_${encodeURIComponent(source.slug)}`}
34
+ target='_blank'
35
+ rel='noreferrer'
36
+ aria-label='Full device page'
37
+ title='Full device page'
38
+ >
39
+ ↗
40
+ </a>
41
+ )}
42
+ </dt>
43
+ <dd>{value}</dd>
44
+ </div>
45
+ ))}
46
+ <div className='seam-supported-device-hardware-colors'>
47
+ <dt>Colors</dt>
48
+ <dd>
49
+ <HardwareGallery source={source} name={name} />
50
+ </dd>
51
+ </div>
52
+ </dl>
53
+ </section>
54
+ )
55
+ }
56
+
57
+ function hardwareFacts(
58
+ source: DeviceModelSummary
59
+ ): Array<{ label: string; value: string }> {
60
+ const facts: Array<{ label: string; value: string }> = []
61
+ const numbers = [
62
+ ...new Set(
63
+ source.variants
64
+ .map((variant) => variant.manufacturer_model_id)
65
+ .filter((id): id is string => id != null && id !== '')
66
+ ),
67
+ ]
68
+ facts.push({
69
+ label: 'Model numbers',
70
+ value: numbers.length > 0 ? numbers.join(', ') : 'Not listed',
71
+ })
72
+ const properties =
73
+ typeof source.device_type_properties === 'object' &&
74
+ source.device_type_properties != null
75
+ ? (source.device_type_properties as Record<string, unknown>)
76
+ : {}
77
+ const lockType = properties['lock_type']
78
+ if (typeof lockType === 'string' && lockType !== '')
79
+ facts.push({
80
+ label: 'Lock type',
81
+ value:
82
+ lockType.charAt(0).toUpperCase() +
83
+ lockType.slice(1).replaceAll('_', ' '),
84
+ })
85
+ const batteryType = properties['battery_type']
86
+ const batteryCount = properties['battery_count']
87
+ if (typeof batteryType === 'string' && batteryType !== '')
88
+ facts.push({
89
+ label: 'Batteries',
90
+ value:
91
+ typeof batteryCount === 'number' && batteryCount > 0
92
+ ? `${batteryCount} × ${batteryType}`
93
+ : batteryType,
94
+ })
95
+ else if (typeof properties['is_battery_powered'] === 'boolean')
96
+ facts.push({
97
+ label: 'Power',
98
+ value: properties['is_battery_powered']
99
+ ? 'Battery powered'
100
+ : 'Not battery powered',
101
+ })
102
+ return facts
103
+ }
@@ -1,69 +1,59 @@
1
1
  import { useState } from 'react'
2
2
 
3
- import {
4
- getManufacturerLogoUrl,
5
- getManufacturerName,
6
- type ManufacturerGroup,
7
- } from 'lib/seam/components/SupportedDevices/device-models.js'
8
- import { DeviceModelRow } from 'lib/seam/components/SupportedDevices/DeviceModelRow.js'
3
+ import { getManufacturerName } from 'lib/seam/components/SupportedDevices/device-models.js'
9
4
  import type { Manufacturer } from 'lib/seam/ecosystem/types.js'
10
5
 
6
+ import { BrandMark } from './BrandMark.js'
7
+ import { DeviceRow } from './DeviceRow.js'
8
+ import type { PresentedDevice } from './presentation.js'
9
+
11
10
  /** Device models shown per manufacturer before the show all button. */
12
11
  const collapsedCount = 5
13
12
 
14
13
  interface ManufacturerSectionProps {
15
- group: ManufacturerGroup
14
+ devices: PresentedDevice[]
16
15
  manufacturer: Manufacturer | null
17
16
  collapsible: boolean
18
17
  }
19
18
 
20
19
  export function ManufacturerSection({
21
- group,
20
+ devices,
22
21
  manufacturer,
23
22
  collapsible,
24
23
  }: ManufacturerSectionProps): JSX.Element {
25
24
  const [expanded, setExpanded] = useState(false)
26
25
 
27
- const { deviceModels } = group
28
- const canExpand = collapsible && deviceModels.length > collapsedCount
26
+ const canExpand = collapsible && devices.length > collapsedCount
29
27
  const visibleDeviceModels =
30
- canExpand && !expanded
31
- ? deviceModels.slice(0, collapsedCount)
32
- : deviceModels
28
+ canExpand && !expanded ? devices.slice(0, collapsedCount) : devices
33
29
 
34
30
  const name =
35
31
  manufacturer != null
36
32
  ? getManufacturerName(manufacturer)
37
- : group.manufacturer != null
38
- ? getManufacturerName(group.manufacturer)
33
+ : devices[0]?.source.manufacturer != null
34
+ ? getManufacturerName(devices[0].source.manufacturer)
39
35
  : t.other
40
36
 
41
- const logoUrl = getManufacturerLogoUrl(manufacturer)
42
-
43
37
  return (
44
38
  <section className='seam-supported-devices-section'>
45
39
  <div className='seam-supported-devices-section-header'>
46
- <div className='seam-supported-devices-logo'>
47
- {logoUrl == null ? (
48
- <span aria-hidden>{name.slice(0, 1)}</span>
49
- ) : (
50
- <img loading='lazy' src={logoUrl} alt='' width={40} height={40} />
51
- )}
52
- </div>
40
+ <BrandMark name={name} logos={manufacturer?.logos} />
53
41
  <h3 className='seam-supported-devices-section-title'>{name}</h3>
54
42
  <span className='seam-supported-devices-count'>
55
- {t.count(deviceModels.length)}
43
+ {t.count(devices.length)}
56
44
  </span>
57
45
  </div>
58
- <ul className='seam-supported-devices-rows'>
46
+ <div className='seam-supported-device-list'>
47
+ <div className='seam-supported-device-list-heading'>
48
+ Device & supported capabilities
49
+ </div>
59
50
  {visibleDeviceModels.map((deviceModel) => (
60
- <DeviceModelRow
61
- key={deviceModel.device_model_id}
62
- deviceModel={deviceModel}
63
- manufacturer={manufacturer}
51
+ <DeviceRow
52
+ key={deviceModel.source.device_model_id}
53
+ device={deviceModel}
64
54
  />
65
55
  ))}
66
- </ul>
56
+ </div>
67
57
  {canExpand && (
68
58
  <div className='seam-supported-devices-section-footer'>
69
59
  <button
@@ -74,7 +64,7 @@ export function ManufacturerSection({
74
64
  setExpanded((expanded) => !expanded)
75
65
  }}
76
66
  >
77
- {expanded ? t.showLess : t.showAll(name, deviceModels.length)}
67
+ {expanded ? t.showLess : t.showAll(name, devices.length)}
78
68
  </button>
79
69
  </div>
80
70
  )}
@@ -0,0 +1,127 @@
1
+ import { AccessoryLinks } from './AccessoryCatalog.js'
2
+ import {
3
+ getRequirementKinds,
4
+ type PresentedDevice,
5
+ type RequirementKind,
6
+ } from './presentation.js'
7
+ import { RequirementIcon } from './RequirementIcon.js'
8
+ import { CheckMark } from './StatusMarks.js'
9
+
10
+ const columns: Array<{ kind: RequirementKind; label: string }> = [
11
+ { kind: 'subscription', label: 'Subscription' },
12
+ { kind: 'bridge', label: 'Bridge' },
13
+ { kind: 'keypad', label: 'Keypad' },
14
+ { kind: 'legal', label: 'Legal' },
15
+ { kind: 'other', label: 'Other' },
16
+ ]
17
+
18
+ export function ProviderRequirements({
19
+ provider,
20
+ }: {
21
+ provider: PresentedDevice['providers'][number]
22
+ }): JSX.Element {
23
+ if (provider.integrationStatus === 'unsupported')
24
+ return (
25
+ <a
26
+ className='seam-supported-device-request-integration'
27
+ href='https://www.seam.co/request-new-integration'
28
+ target='_blank'
29
+ rel='noopener noreferrer'
30
+ aria-label={`Request Integration with ${provider.display_name ?? provider.slug} (opens in a new tab)`}
31
+ >
32
+ Request Integration <span aria-hidden>→</span>
33
+ </a>
34
+ )
35
+ return (
36
+ <>
37
+ {provider.capabilities.length === 0 ? (
38
+ <p className='seam-supported-device-provider-empty'>
39
+ Capabilities not confirmed.
40
+ </p>
41
+ ) : (
42
+ <table className='seam-supported-device-capability-requirements'>
43
+ <caption className='seam-supported-device-sr-only'>
44
+ Supported capabilities and their additional requirements
45
+ </caption>
46
+ <colgroup>
47
+ <col className='seam-supported-device-capability-name-column' />
48
+ <col className='seam-supported-device-capability-supported-column' />
49
+ <col />
50
+ </colgroup>
51
+ <thead>
52
+ <tr>
53
+ <th scope='col'>Capability</th>
54
+ <th
55
+ scope='col'
56
+ className='seam-supported-device-capability-support-cell'
57
+ >
58
+ Supported
59
+ </th>
60
+ <th scope='col'>Requirements</th>
61
+ </tr>
62
+ </thead>
63
+ <tbody>
64
+ {provider.capabilities.map((capability) => (
65
+ <tr key={capability.name}>
66
+ <th scope='row'>{capability.label}</th>
67
+ <td className='seam-supported-device-capability-support-cell'>
68
+ <span
69
+ className='seam-supported-device-capability-supported'
70
+ role='img'
71
+ aria-label='Supported'
72
+ >
73
+ <CheckMark />
74
+ </span>
75
+ </td>
76
+ <td>
77
+ <div className='seam-supported-device-capability-pills'>
78
+ {columns
79
+ .filter(({ kind }) =>
80
+ capability.messages.some((message) =>
81
+ getRequirementKinds(message).includes(kind)
82
+ )
83
+ )
84
+ .map(({ kind, label }) => (
85
+ <span
86
+ className='seam-supported-device-inline-requirement'
87
+ key={kind}
88
+ >
89
+ <RequirementIcon message={kind} />
90
+ {label}
91
+ </span>
92
+ ))}
93
+ {capability.messages.length === 0 && (
94
+ <span
95
+ className='seam-supported-device-no-requirements'
96
+ role='img'
97
+ aria-label='No additional requirements listed'
98
+ >
99
+ —
100
+ </span>
101
+ )}
102
+ </div>
103
+ </td>
104
+ </tr>
105
+ ))}
106
+ </tbody>
107
+ </table>
108
+ )}
109
+ {provider.requirements.length > 0 && (
110
+ <ul
111
+ className='seam-supported-device-requirements'
112
+ aria-label='Requirement details'
113
+ >
114
+ {provider.requirements.map(({ message, deviceSlugs }) => (
115
+ <li key={message}>
116
+ <RequirementIcon message={message} />
117
+ <div className='seam-supported-device-requirement-body'>
118
+ <p>{message}</p>
119
+ <AccessoryLinks message={message} slugs={deviceSlugs} />
120
+ </div>
121
+ </li>
122
+ ))}
123
+ </ul>
124
+ )}
125
+ </>
126
+ )
127
+ }
@@ -13,7 +13,14 @@ export function RequirementIcon({ message }: { message: string }): JSX.Element {
13
13
  strokeLinecap='round'
14
14
  strokeLinejoin='round'
15
15
  >
16
- {/subscription|licen[sc]e|paying|paid|fees?/i.test(message) ? (
16
+ {/\b(?:legal|eula|waiver|end[- ]user licen[cs]e agreement)\b/i.test(
17
+ message
18
+ ) ? (
19
+ <>
20
+ <path d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z' />
21
+ <path d='M14 2v6h6M8 15l2 2 5-5' />
22
+ </>
23
+ ) : /subscription|licen[sc]e|paying|paid|fees?/i.test(message) ? (
17
24
  <>
18
25
  <rect x='2' y='4' width='20' height='16' rx='3' />
19
26
  <path d='M2 9h20M6 15h4m4 0h4' />
@@ -0,0 +1,32 @@
1
+ export function InfoMark(): JSX.Element {
2
+ return (
3
+ <svg
4
+ aria-hidden
5
+ width='14'
6
+ height='14'
7
+ viewBox='0 0 20 20'
8
+ fill='none'
9
+ stroke='currentColor'
10
+ strokeWidth='1.5'
11
+ >
12
+ <circle cx='10' cy='10' r='7.25' />
13
+ <path d='M10 9v5M10 6v.1' strokeLinecap='round' />
14
+ </svg>
15
+ )
16
+ }
17
+
18
+ export function CheckMark(): JSX.Element {
19
+ return (
20
+ <svg
21
+ aria-hidden
22
+ width='14'
23
+ height='14'
24
+ viewBox='0 0 20 20'
25
+ fill='none'
26
+ stroke='currentColor'
27
+ strokeWidth='1.7'
28
+ >
29
+ <path d='m4 10 4 4 8-8' strokeLinecap='round' strokeLinejoin='round' />
30
+ </svg>
31
+ )
32
+ }