@seamapi/react 5.2.3 → 5.3.0
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 +3 -3
- package/dist/ecosystem.js +12 -11
- package/dist/ecosystem.js.map +1 -1
- package/dist/elements.js +12341 -11524
- package/dist/elements.js.map +1 -1
- package/dist/index.css +981 -162
- 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/components/SupportedDevices/AccessoryCatalog.d.ts +9 -0
- package/lib/seam/components/SupportedDevices/AccessoryCatalog.js +40 -0
- package/lib/seam/components/SupportedDevices/AccessoryCatalog.js.map +1 -0
- package/lib/seam/components/SupportedDevices/BrandMark.d.ts +7 -0
- package/lib/seam/components/SupportedDevices/BrandMark.js +23 -0
- package/lib/seam/components/SupportedDevices/BrandMark.js.map +1 -0
- package/lib/seam/components/SupportedDevices/CapabilityFilter.d.ts +7 -0
- package/lib/seam/components/SupportedDevices/CapabilityFilter.js +58 -0
- package/lib/seam/components/SupportedDevices/CapabilityFilter.js.map +1 -0
- package/lib/seam/components/SupportedDevices/DeviceRow.d.ts +6 -0
- package/lib/seam/components/SupportedDevices/DeviceRow.js +20 -0
- package/lib/seam/components/SupportedDevices/DeviceRow.js.map +1 -0
- package/lib/seam/components/SupportedDevices/HardwareGallery.d.ts +6 -0
- package/lib/seam/components/SupportedDevices/HardwareGallery.js +108 -0
- package/lib/seam/components/SupportedDevices/HardwareGallery.js.map +1 -0
- package/lib/seam/components/SupportedDevices/HardwareInformation.d.ts +5 -0
- package/lib/seam/components/SupportedDevices/HardwareInformation.js +50 -0
- package/lib/seam/components/SupportedDevices/HardwareInformation.js.map +1 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.d.ts +3 -3
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js +10 -13
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -1
- package/lib/seam/components/SupportedDevices/ProviderRequirements.d.ts +5 -0
- package/lib/seam/components/SupportedDevices/ProviderRequirements.js +20 -0
- package/lib/seam/components/SupportedDevices/ProviderRequirements.js.map +1 -0
- package/lib/seam/components/SupportedDevices/RequirementIcon.js +1 -1
- package/lib/seam/components/SupportedDevices/RequirementIcon.js.map +1 -1
- package/lib/seam/components/SupportedDevices/StatusMarks.d.ts +3 -0
- package/lib/seam/components/SupportedDevices/StatusMarks.js +8 -0
- package/lib/seam/components/SupportedDevices/StatusMarks.js.map +1 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.d.ts +2 -2
- package/lib/seam/components/SupportedDevices/SupportedDevices.js +53 -30
- package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -1
- package/lib/seam/components/SupportedDevices/device-models.js +2 -1
- package/lib/seam/components/SupportedDevices/device-models.js.map +1 -1
- package/lib/seam/components/SupportedDevices/presentation.d.ts +34 -0
- package/lib/seam/components/SupportedDevices/presentation.js +142 -0
- package/lib/seam/components/SupportedDevices/presentation.js.map +1 -0
- package/lib/seam/ecosystem/types.d.ts +6 -2
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.d.ts +5 -2
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js +4 -1
- package/lib/seam/ecosystem/use-ecosystem-device-model-summaries.js.map +1 -1
- package/lib/seam/ecosystem/use-ecosystem-provider-requirements.d.ts +1 -1
- package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js +1 -1
- package/lib/seam/ecosystem/use-ecosystem-provider-requirements.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/seam/components/SupportedDevices/AccessoryCatalog.tsx +138 -0
- package/src/lib/seam/components/SupportedDevices/BrandMark.tsx +61 -0
- package/src/lib/seam/components/SupportedDevices/CapabilityFilter.tsx +142 -0
- package/src/lib/seam/components/SupportedDevices/DeviceRow.tsx +163 -0
- package/src/lib/seam/components/SupportedDevices/HardwareGallery.tsx +284 -0
- package/src/lib/seam/components/SupportedDevices/HardwareInformation.tsx +103 -0
- package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +22 -32
- package/src/lib/seam/components/SupportedDevices/ProviderRequirements.tsx +127 -0
- package/src/lib/seam/components/SupportedDevices/RequirementIcon.tsx +8 -1
- package/src/lib/seam/components/SupportedDevices/StatusMarks.tsx +32 -0
- package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +120 -91
- package/src/lib/seam/components/SupportedDevices/device-models.ts +2 -1
- package/src/lib/seam/components/SupportedDevices/presentation.ts +234 -0
- package/src/lib/seam/ecosystem/types.ts +6 -1
- package/src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts +8 -1
- package/src/lib/seam/ecosystem/use-ecosystem-provider-requirements.ts +1 -1
- package/src/lib/version.ts +1 -1
- package/src/styles/_supported-devices.scss +1162 -174
- package/lib/seam/components/SupportedDevices/DeviceModelRow.d.ts +0 -8
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js +0 -49
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +0 -1
- package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +0 -197
|
@@ -136,12 +136,16 @@ export interface ProviderRef {
|
|
|
136
136
|
slug: string;
|
|
137
137
|
display_name: string | null;
|
|
138
138
|
}
|
|
139
|
-
/** Fields used from
|
|
139
|
+
/** Fields used from public `providers/list` for branding, support, and report text. */
|
|
140
140
|
export interface ProviderRequirements extends ProviderRef {
|
|
141
141
|
has_requirements: boolean | null;
|
|
142
142
|
requirements_md: string | null;
|
|
143
|
+
logos?: DeviceAsset[];
|
|
144
|
+
integrations?: Array<{
|
|
145
|
+
integration_support_level: IntegrationSupportLevel | null;
|
|
146
|
+
}>;
|
|
143
147
|
}
|
|
144
|
-
export type CapabilityName = 'device_connectivity' | 'can_program_online_access_codes' | 'can_program_offline_access_codes' | 'can_remotely_unlock' | 'can_remotely_lock' | 'can_encode_plastic_cards' | 'can_provision_mobile_keys' | 'can_provision_wallet_keys' | 'can_hvac_cool' | 'can_hvac_heat' | 'can_hvac_auto' | 'can_hvac_fan' | 'can_program_thermostat_weekly_programs' | 'can_monitor';
|
|
148
|
+
export type CapabilityName = 'device_connectivity' | 'can_program_online_access_codes' | 'can_program_offline_access_codes' | 'can_remotely_unlock' | 'can_remotely_lock' | 'can_encode_plastic_cards' | 'can_assign_plastic_cards' | 'can_provision_mobile_keys' | 'can_provision_wallet_keys' | 'can_hvac_cool' | 'can_hvac_heat' | 'can_hvac_auto' | 'can_hvac_fan' | 'can_program_thermostat_weekly_programs' | 'can_monitor';
|
|
145
149
|
export type CapabilitySupported = 'yes' | 'no' | 'conditionally';
|
|
146
150
|
export type IntegrationSupportLevel = 'inquire' | 'unavailable' | 'planned' | 'in-progress' | 'beta' | 'stable';
|
|
147
151
|
export interface CapabilityReport {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { DeviceModelSummary } from '../../../lib/seam/ecosystem/types.js';
|
|
2
2
|
import type { UseEcosystemDeviceModelsParams } from '../../../lib/seam/ecosystem/use-ecosystem-device-models.js';
|
|
3
3
|
import { type UseEcosystemQueryResult } from '../../../lib/seam/ecosystem/use-ecosystem-query-result.js';
|
|
4
|
-
export type UseEcosystemDeviceModelSummariesParams = UseEcosystemDeviceModelsParams
|
|
4
|
+
export type UseEcosystemDeviceModelSummariesParams = UseEcosystemDeviceModelsParams & {
|
|
5
|
+
/** Fetch specific models, including accessories from other manufacturers. */
|
|
6
|
+
slugs?: string[] | undefined;
|
|
7
|
+
};
|
|
5
8
|
export type UseEcosystemDeviceModelSummariesData = DeviceModelSummary[];
|
|
6
9
|
/**
|
|
7
10
|
* Published device models in the slim summary shape from Ecosystem
|
|
8
11
|
* `GET /v1/device_models/summaries/list` (no commerce data),
|
|
9
12
|
* following pagination to return every matching model.
|
|
10
13
|
*/
|
|
11
|
-
export declare function useEcosystemDeviceModelSummaries({ manufacturer, deviceType, provider, capability, enabled, }?: UseEcosystemDeviceModelSummariesParams): UseEcosystemQueryResult<'deviceModels', UseEcosystemDeviceModelSummariesData>;
|
|
14
|
+
export declare function useEcosystemDeviceModelSummaries({ manufacturer, deviceType, provider, capability, slugs, enabled, }?: UseEcosystemDeviceModelSummariesParams): UseEcosystemQueryResult<'deviceModels', UseEcosystemDeviceModelSummariesData>;
|
|
@@ -9,13 +9,16 @@ const maxPages = 20;
|
|
|
9
9
|
* `GET /v1/device_models/summaries/list` (no commerce data),
|
|
10
10
|
* following pagination to return every matching model.
|
|
11
11
|
*/
|
|
12
|
-
export function useEcosystemDeviceModelSummaries({ manufacturer = '', deviceType = '', provider = '', capability = '', enabled = true, } = {}) {
|
|
12
|
+
export function useEcosystemDeviceModelSummaries({ manufacturer = '', deviceType = '', provider = '', capability = '', slugs = [], enabled = true, } = {}) {
|
|
13
13
|
const { embedKey, endpoint } = useEcosystemContext();
|
|
14
14
|
const params = {
|
|
15
15
|
manufacturer: manufacturer.trim(),
|
|
16
16
|
device_type: deviceType.trim(),
|
|
17
17
|
provider: provider.trim(),
|
|
18
18
|
capability: capability.trim(),
|
|
19
|
+
slugs: [
|
|
20
|
+
...new Set(slugs.map((slug) => slug.trim()).filter(Boolean)),
|
|
21
|
+
].sort(),
|
|
19
22
|
};
|
|
20
23
|
const { data, ...rest } = useQuery({
|
|
21
24
|
enabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ecosystem-device-model-summaries.js","sourceRoot":"","sources":["../../../src/lib/seam/ecosystem/use-ecosystem-device-model-summaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAM7E,OAAO,EACL,mBAAmB,GAEpB,MAAM,kDAAkD,CAAA;
|
|
1
|
+
{"version":3,"file":"use-ecosystem-device-model-summaries.js","sourceRoot":"","sources":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am/ecosystem/types.js';
|
|
2
2
|
import { type UseEcosystemQueryResult } from '../../../lib/seam/ecosystem/use-ecosystem-query-result.js';
|
|
3
|
-
/**
|
|
3
|
+
/** Fetch provider branding, integration status, and legacy free-text requirements. */
|
|
4
4
|
export declare function useEcosystemProviderRequirements(slugs: string[]): UseEcosystemQueryResult<'providers', ProviderRequirements[]>;
|
|
@@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query';
|
|
|
2
2
|
import { EcosystemApiError, fetchEcosystem } from '../../../lib/seam/ecosystem/client.js';
|
|
3
3
|
import { useEcosystemContext } from '../../../lib/seam/ecosystem/EcosystemProvider.js';
|
|
4
4
|
import { retryEcosystemQuery, } from '../../../lib/seam/ecosystem/use-ecosystem-query-result.js';
|
|
5
|
-
/**
|
|
5
|
+
/** Fetch provider branding, integration status, and legacy free-text requirements. */
|
|
6
6
|
export function useEcosystemProviderRequirements(slugs) {
|
|
7
7
|
const { endpoint, embedKey } = useEcosystemContext();
|
|
8
8
|
const sortedSlugs = [...new Set(slugs)].sort();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-ecosystem-provider-requirements.js","sourceRoot":"","sources":["../../../src/lib/seam/ecosystem/use-ecosystem-provider-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAK7E,OAAO,EACL,mBAAmB,GAEpB,MAAM,kDAAkD,CAAA;AAEzD,
|
|
1
|
+
{"version":3,"file":"use-ecosystem-provider-requirements.js","sourceRoot":"","sources":["../../../src/lib/seam/ecosystem/use-ecosystem-provider-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE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I,GAAG,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAA;gBAC5C,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,MAAK;gBACzC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;gBACd,MAAM,GAAG,IAAI,CAAA;YACf,CAAC;YACD,MAAM,IAAI,iBAAiB,CAAC;gBAC1B,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,uBAAuB;gBAC7B,OAAO,EAAE,wDAAwD;aAClE,CAAC,CAAA;QACJ,CAAC;QACD,KAAK,EAAE,mBAAmB;KAC3B,CACF,CAAA;IACD,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AACrC,CAAC"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiReactVersion = "5.
|
|
1
|
+
declare const seamapiReactVersion = "5.3.0";
|
|
2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { createContext, type PropsWithChildren, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getDeviceModelImageUrl,
|
|
5
|
+
getDeviceModelName,
|
|
6
|
+
} from 'lib/seam/components/SupportedDevices/device-models.js'
|
|
7
|
+
import type { DeviceModelSummary } from 'lib/seam/ecosystem/types.js'
|
|
8
|
+
import { useEcosystemDeviceModelSummaries } from 'lib/seam/ecosystem/use-ecosystem-device-model-summaries.js'
|
|
9
|
+
|
|
10
|
+
import { getRequirementKinds } from './presentation.js'
|
|
11
|
+
|
|
12
|
+
const AccessoryContext = createContext<{
|
|
13
|
+
models: DeviceModelSummary[]
|
|
14
|
+
isLoading: boolean
|
|
15
|
+
isError: boolean
|
|
16
|
+
} | null>(null)
|
|
17
|
+
|
|
18
|
+
/** One batched lookup per catalog, shared by every expanded provider. */
|
|
19
|
+
export function AccessoryCatalog({
|
|
20
|
+
slugs,
|
|
21
|
+
children,
|
|
22
|
+
}: PropsWithChildren<{ slugs: string[] }>): JSX.Element {
|
|
23
|
+
const { deviceModels, isLoading, isError } = useEcosystemDeviceModelSummaries(
|
|
24
|
+
{
|
|
25
|
+
slugs,
|
|
26
|
+
enabled: slugs.length > 0,
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
return (
|
|
30
|
+
<AccessoryContext.Provider
|
|
31
|
+
value={{ models: deviceModels ?? [], isLoading, isError }}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
</AccessoryContext.Provider>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function AccessoryLinks({
|
|
39
|
+
message,
|
|
40
|
+
slugs = [],
|
|
41
|
+
}: {
|
|
42
|
+
message: string
|
|
43
|
+
slugs?: string[] | undefined
|
|
44
|
+
}): JSX.Element | null {
|
|
45
|
+
const catalog = useContext(AccessoryContext)
|
|
46
|
+
if (slugs.length === 0 || catalog == null) return null
|
|
47
|
+
const kinds = getRequirementKinds(message)
|
|
48
|
+
const label = kinds.includes('bridge')
|
|
49
|
+
? 'Compatible bridges'
|
|
50
|
+
: kinds.includes('keypad')
|
|
51
|
+
? 'Compatible keypads'
|
|
52
|
+
: 'Compatible accessories'
|
|
53
|
+
const models = [...new Set(slugs)].flatMap((slug) => {
|
|
54
|
+
const model = catalog.models.find((entry) => entry.slug === slug)
|
|
55
|
+
return model == null ? [] : [model]
|
|
56
|
+
})
|
|
57
|
+
return (
|
|
58
|
+
<div className='seam-supported-device-accessories'>
|
|
59
|
+
<p className='seam-supported-device-accessories-label'>{label}</p>
|
|
60
|
+
{catalog.isLoading ? (
|
|
61
|
+
<p className='seam-supported-device-accessories-state' role='status'>
|
|
62
|
+
Loading accessories…
|
|
63
|
+
</p>
|
|
64
|
+
) : (
|
|
65
|
+
<>
|
|
66
|
+
{models.length > 0 && (
|
|
67
|
+
<ul
|
|
68
|
+
className='seam-supported-device-accessory-list'
|
|
69
|
+
aria-label={label}
|
|
70
|
+
>
|
|
71
|
+
{models.map((model) => {
|
|
72
|
+
const image = getDeviceModelImageUrl(model)
|
|
73
|
+
const name = getDeviceModelName(model)
|
|
74
|
+
const manufacturer = model.manufacturer
|
|
75
|
+
const href =
|
|
76
|
+
manufacturer == null || model.device_type == null
|
|
77
|
+
? null
|
|
78
|
+
: `https://www.seam.co/${encodeURIComponent(model.device_type.slug)}s/${encodeURIComponent(manufacturer.slug)}_${encodeURIComponent(model.slug)}`
|
|
79
|
+
const content = (
|
|
80
|
+
<>
|
|
81
|
+
{image != null && (
|
|
82
|
+
<img
|
|
83
|
+
src={image}
|
|
84
|
+
alt=''
|
|
85
|
+
loading='lazy'
|
|
86
|
+
width='28'
|
|
87
|
+
height='28'
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
<div>
|
|
91
|
+
{name}
|
|
92
|
+
{manufacturer != null && (
|
|
93
|
+
<span>
|
|
94
|
+
{manufacturer.display_name ?? manufacturer.slug}
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
{href != null && (
|
|
99
|
+
<span
|
|
100
|
+
className='seam-supported-device-accessory-arrow'
|
|
101
|
+
aria-hidden
|
|
102
|
+
>
|
|
103
|
+
↗
|
|
104
|
+
</span>
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
107
|
+
)
|
|
108
|
+
return (
|
|
109
|
+
<li key={model.device_model_id}>
|
|
110
|
+
{href == null ? (
|
|
111
|
+
<div className='seam-supported-device-accessory-link'>
|
|
112
|
+
{content}
|
|
113
|
+
</div>
|
|
114
|
+
) : (
|
|
115
|
+
<a
|
|
116
|
+
className='seam-supported-device-accessory-link'
|
|
117
|
+
href={href}
|
|
118
|
+
target='_blank'
|
|
119
|
+
rel='noopener noreferrer'
|
|
120
|
+
>
|
|
121
|
+
{content}
|
|
122
|
+
</a>
|
|
123
|
+
)}
|
|
124
|
+
</li>
|
|
125
|
+
)
|
|
126
|
+
})}
|
|
127
|
+
</ul>
|
|
128
|
+
)}
|
|
129
|
+
{(catalog.isError || models.length < new Set(slugs).size) && (
|
|
130
|
+
<p className='seam-supported-device-accessories-state'>
|
|
131
|
+
Some accessory details couldn’t be loaded.
|
|
132
|
+
</p>
|
|
133
|
+
)}
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { DeviceAsset } from 'lib/seam/ecosystem/types.js'
|
|
4
|
+
|
|
5
|
+
const logoKinds = [
|
|
6
|
+
'square_logo',
|
|
7
|
+
'horizontal_logo',
|
|
8
|
+
'square_logo_mono',
|
|
9
|
+
'horizontal_logo_mono',
|
|
10
|
+
] as const
|
|
11
|
+
|
|
12
|
+
export function BrandMark({
|
|
13
|
+
name,
|
|
14
|
+
logos,
|
|
15
|
+
className = '',
|
|
16
|
+
}: {
|
|
17
|
+
name: string
|
|
18
|
+
logos?: DeviceAsset[]
|
|
19
|
+
className?: string
|
|
20
|
+
}): JSX.Element {
|
|
21
|
+
const logo = logoKinds
|
|
22
|
+
.map((kind) => logos?.find((asset) => asset.kind === kind))
|
|
23
|
+
.find((asset) => asset != null)
|
|
24
|
+
const src = logo?.formats.small?.url ?? logo?.url
|
|
25
|
+
const initial = name.slice(0, 1)
|
|
26
|
+
return (
|
|
27
|
+
<span
|
|
28
|
+
className={`seam-supported-device-brand-mark ${className}`}
|
|
29
|
+
aria-hidden
|
|
30
|
+
>
|
|
31
|
+
{src == null ? (
|
|
32
|
+
<span>{initial}</span>
|
|
33
|
+
) : (
|
|
34
|
+
<LogoImage key={src} src={src} initial={initial} />
|
|
35
|
+
)}
|
|
36
|
+
</span>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function LogoImage({
|
|
41
|
+
src,
|
|
42
|
+
initial,
|
|
43
|
+
}: {
|
|
44
|
+
src: string
|
|
45
|
+
initial: string
|
|
46
|
+
}): JSX.Element {
|
|
47
|
+
const [failed, setFailed] = useState(false)
|
|
48
|
+
return failed ? (
|
|
49
|
+
<span>{initial}</span>
|
|
50
|
+
) : (
|
|
51
|
+
<img
|
|
52
|
+
src={src}
|
|
53
|
+
alt=''
|
|
54
|
+
width='24'
|
|
55
|
+
height='24'
|
|
56
|
+
onError={() => {
|
|
57
|
+
setFailed(true)
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { useEffect, useId, useRef, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { getCapabilityLabel } from 'lib/seam/components/SupportedDevices/device-models.js'
|
|
4
|
+
|
|
5
|
+
export function CapabilityFilter({
|
|
6
|
+
capabilities,
|
|
7
|
+
selected,
|
|
8
|
+
onChange,
|
|
9
|
+
disabled = false,
|
|
10
|
+
}: {
|
|
11
|
+
capabilities: string[]
|
|
12
|
+
selected: string[]
|
|
13
|
+
onChange: (capabilities: string[]) => void
|
|
14
|
+
disabled?: boolean | undefined
|
|
15
|
+
}): JSX.Element {
|
|
16
|
+
const [open, setOpen] = useState(false)
|
|
17
|
+
const root = useRef<HTMLDivElement>(null)
|
|
18
|
+
const trigger = useRef<HTMLButtonElement>(null)
|
|
19
|
+
const id = useId()
|
|
20
|
+
const summary =
|
|
21
|
+
selected.length === 0
|
|
22
|
+
? 'All capabilities'
|
|
23
|
+
: selected.length === 1
|
|
24
|
+
? getCapabilityLabel(selected[0] ?? '')
|
|
25
|
+
: `${selected.length} selected`
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!open) return
|
|
29
|
+
root.current?.querySelector<HTMLInputElement>('input')?.focus()
|
|
30
|
+
const onPointerDown = (event: PointerEvent): void => {
|
|
31
|
+
if (
|
|
32
|
+
event.target instanceof Node &&
|
|
33
|
+
root.current?.contains(event.target) !== true
|
|
34
|
+
)
|
|
35
|
+
setOpen(false)
|
|
36
|
+
}
|
|
37
|
+
document.addEventListener('pointerdown', onPointerDown)
|
|
38
|
+
return () => {
|
|
39
|
+
document.removeEventListener('pointerdown', onPointerDown)
|
|
40
|
+
}
|
|
41
|
+
}, [open])
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
ref={root}
|
|
46
|
+
className='seam-supported-device-capability-filter'
|
|
47
|
+
onBlur={(event) => {
|
|
48
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false)
|
|
49
|
+
}}
|
|
50
|
+
onKeyDown={(event) => {
|
|
51
|
+
if (open) event.stopPropagation()
|
|
52
|
+
if (event.key === 'Escape' && open) {
|
|
53
|
+
event.preventDefault()
|
|
54
|
+
setOpen(false)
|
|
55
|
+
trigger.current?.focus()
|
|
56
|
+
} else if (
|
|
57
|
+
event.key === 'ArrowDown' &&
|
|
58
|
+
event.target === trigger.current
|
|
59
|
+
) {
|
|
60
|
+
event.preventDefault()
|
|
61
|
+
event.stopPropagation()
|
|
62
|
+
setOpen(true)
|
|
63
|
+
root.current?.querySelector<HTMLInputElement>('input')?.focus()
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<span id={`${id}-label`}>Capabilities</span>
|
|
68
|
+
<button
|
|
69
|
+
ref={trigger}
|
|
70
|
+
type='button'
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
className='seam-supported-device-capability-trigger'
|
|
73
|
+
aria-labelledby={`${id}-label ${id}-selection`}
|
|
74
|
+
aria-expanded={open}
|
|
75
|
+
aria-controls={`${id}-options`}
|
|
76
|
+
title={selected.map(getCapabilityLabel).join(', ')}
|
|
77
|
+
onClick={() => {
|
|
78
|
+
setOpen(!open)
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<span id={`${id}-selection`}>{summary}</span>
|
|
82
|
+
<svg
|
|
83
|
+
aria-hidden
|
|
84
|
+
className='seam-supported-device-filter-chevron'
|
|
85
|
+
width='14'
|
|
86
|
+
height='14'
|
|
87
|
+
viewBox='0 0 20 20'
|
|
88
|
+
fill='none'
|
|
89
|
+
stroke='currentColor'
|
|
90
|
+
strokeWidth='1.5'
|
|
91
|
+
>
|
|
92
|
+
<path d='m5 8 5 5 5-5' strokeLinecap='round' strokeLinejoin='round' />
|
|
93
|
+
</svg>
|
|
94
|
+
</button>
|
|
95
|
+
{open && (
|
|
96
|
+
<div
|
|
97
|
+
id={`${id}-options`}
|
|
98
|
+
className='seam-supported-device-capability-options'
|
|
99
|
+
>
|
|
100
|
+
<p>Show devices supporting every selected capability.</p>
|
|
101
|
+
<fieldset>
|
|
102
|
+
<legend className='seam-supported-device-sr-only'>
|
|
103
|
+
Required capabilities
|
|
104
|
+
</legend>
|
|
105
|
+
{capabilities.map((name) => (
|
|
106
|
+
<label
|
|
107
|
+
className='seam-supported-device-capability-option'
|
|
108
|
+
key={name}
|
|
109
|
+
>
|
|
110
|
+
<input
|
|
111
|
+
type='checkbox'
|
|
112
|
+
value={name}
|
|
113
|
+
checked={selected.includes(name)}
|
|
114
|
+
onChange={(event) => {
|
|
115
|
+
onChange(
|
|
116
|
+
event.target.checked
|
|
117
|
+
? [...selected, name]
|
|
118
|
+
: selected.filter((item) => item !== name)
|
|
119
|
+
)
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
<span>{getCapabilityLabel(name)}</span>
|
|
123
|
+
</label>
|
|
124
|
+
))}
|
|
125
|
+
</fieldset>
|
|
126
|
+
<button
|
|
127
|
+
type='button'
|
|
128
|
+
className='seam-supported-device-capability-clear'
|
|
129
|
+
disabled={selected.length === 0}
|
|
130
|
+
onClick={() => {
|
|
131
|
+
onChange([])
|
|
132
|
+
setOpen(false)
|
|
133
|
+
trigger.current?.focus()
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
Clear selection
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { BrandMark } from './BrandMark.js'
|
|
2
|
+
import { getDeviceModelImageUrl } from './device-models.js'
|
|
3
|
+
import { HardwareInformation } from './HardwareInformation.js'
|
|
4
|
+
import { getRequirementPills, type PresentedDevice } from './presentation.js'
|
|
5
|
+
import { ProviderRequirements } from './ProviderRequirements.js'
|
|
6
|
+
import { CheckMark, InfoMark } from './StatusMarks.js'
|
|
7
|
+
|
|
8
|
+
export function DeviceRow({
|
|
9
|
+
device,
|
|
10
|
+
}: {
|
|
11
|
+
device: PresentedDevice
|
|
12
|
+
}): JSX.Element {
|
|
13
|
+
const image = getDeviceModelImageUrl(device.source)
|
|
14
|
+
const pills = getRequirementPills(device)
|
|
15
|
+
return (
|
|
16
|
+
<details
|
|
17
|
+
className={`seam-supported-device-row seam-supported-device-stacked${pills.length > 0 ? ' seam-supported-device-with-pills' : ''}`}
|
|
18
|
+
aria-label={device.name}
|
|
19
|
+
>
|
|
20
|
+
<summary className='seam-supported-device-row-summary'>
|
|
21
|
+
<span className='seam-supported-device-identity'>
|
|
22
|
+
<span className='seam-supported-device-image'>
|
|
23
|
+
{image == null ? (
|
|
24
|
+
<span aria-hidden>{device.name.slice(0, 1)}</span>
|
|
25
|
+
) : (
|
|
26
|
+
<img src={image} alt='' loading='lazy' width='44' height='44' />
|
|
27
|
+
)}
|
|
28
|
+
</span>
|
|
29
|
+
<span className='seam-supported-device-identity-text'>
|
|
30
|
+
<span className='seam-supported-device-name'>{device.name}</span>
|
|
31
|
+
{device.source.capabilities_stale ? (
|
|
32
|
+
<span className='seam-supported-device-status'>
|
|
33
|
+
Compatibility is being refreshed.
|
|
34
|
+
</span>
|
|
35
|
+
) : device.capabilities.length === 0 ? (
|
|
36
|
+
<span className='seam-supported-device-status'>
|
|
37
|
+
Compatibility not confirmed.
|
|
38
|
+
</span>
|
|
39
|
+
) : (
|
|
40
|
+
<span
|
|
41
|
+
className='seam-supported-device-features'
|
|
42
|
+
role='list'
|
|
43
|
+
aria-label='Supported capabilities'
|
|
44
|
+
>
|
|
45
|
+
{device.capabilities.map((capability) => {
|
|
46
|
+
const conditional = capability.messages.length > 0
|
|
47
|
+
const status = conditional ? 'Requires setup' : 'Supported'
|
|
48
|
+
return (
|
|
49
|
+
<span role='listitem' key={capability.name}>
|
|
50
|
+
<span
|
|
51
|
+
className='seam-supported-device-feature seam-supported-device-status-feature'
|
|
52
|
+
data-conditional={conditional ? '' : undefined}
|
|
53
|
+
title={`${capability.label} · ${status}`}
|
|
54
|
+
>
|
|
55
|
+
{conditional ? <InfoMark /> : <CheckMark />}
|
|
56
|
+
<span>{capability.label}</span>
|
|
57
|
+
<span className='seam-supported-device-sr-only'>
|
|
58
|
+
{' '}
|
|
59
|
+
· {status}
|
|
60
|
+
</span>
|
|
61
|
+
</span>
|
|
62
|
+
</span>
|
|
63
|
+
)
|
|
64
|
+
})}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
67
|
+
</span>
|
|
68
|
+
</span>
|
|
69
|
+
<span className='seam-supported-device-pill-disclosure'>
|
|
70
|
+
{pills.length > 0 ? (
|
|
71
|
+
<span
|
|
72
|
+
className='seam-supported-device-requirement-pills'
|
|
73
|
+
role='list'
|
|
74
|
+
aria-label='Additional requirements'
|
|
75
|
+
>
|
|
76
|
+
{pills.map((pill) => (
|
|
77
|
+
<span
|
|
78
|
+
role='listitem'
|
|
79
|
+
key={pill.label}
|
|
80
|
+
className='seam-supported-device-requirement-pill'
|
|
81
|
+
title={pill.messages.join('\n')}
|
|
82
|
+
>
|
|
83
|
+
{pill.label}
|
|
84
|
+
</span>
|
|
85
|
+
))}
|
|
86
|
+
</span>
|
|
87
|
+
) : (
|
|
88
|
+
<span className='seam-supported-device-disclosure'>Details</span>
|
|
89
|
+
)}
|
|
90
|
+
<svg
|
|
91
|
+
className='seam-supported-device-chevron'
|
|
92
|
+
aria-hidden
|
|
93
|
+
width='14'
|
|
94
|
+
height='14'
|
|
95
|
+
viewBox='0 0 20 20'
|
|
96
|
+
fill='none'
|
|
97
|
+
stroke='currentColor'
|
|
98
|
+
strokeWidth='1.5'
|
|
99
|
+
>
|
|
100
|
+
<path
|
|
101
|
+
d='m5 8 5 5 5-5'
|
|
102
|
+
strokeLinecap='round'
|
|
103
|
+
strokeLinejoin='round'
|
|
104
|
+
/>
|
|
105
|
+
</svg>
|
|
106
|
+
<span className='seam-supported-device-sr-only'>
|
|
107
|
+
Open requirements and model details
|
|
108
|
+
</span>
|
|
109
|
+
</span>
|
|
110
|
+
</summary>
|
|
111
|
+
<div className='seam-supported-device-expanded'>
|
|
112
|
+
<HardwareInformation device={device} />
|
|
113
|
+
<section
|
|
114
|
+
className='seam-supported-device-providers'
|
|
115
|
+
aria-label='Available providers'
|
|
116
|
+
>
|
|
117
|
+
<h4>Available providers</h4>
|
|
118
|
+
<ul className='seam-supported-device-provider-list'>
|
|
119
|
+
{device.providers.map((provider) => (
|
|
120
|
+
<li
|
|
121
|
+
className='seam-supported-device-provider'
|
|
122
|
+
key={provider.provider_id}
|
|
123
|
+
data-integration-status={provider.integrationStatus}
|
|
124
|
+
>
|
|
125
|
+
<div className='seam-supported-device-detail-heading'>
|
|
126
|
+
<BrandMark
|
|
127
|
+
className='seam-supported-device-provider-mark'
|
|
128
|
+
name={provider.display_name ?? provider.slug}
|
|
129
|
+
logos={provider.logos}
|
|
130
|
+
/>
|
|
131
|
+
<div className='seam-supported-device-provider-name'>
|
|
132
|
+
<strong>{provider.display_name ?? provider.slug}</strong>
|
|
133
|
+
{provider.primary && <span>This guide</span>}
|
|
134
|
+
{provider.integrationStatus === 'unsupported' && (
|
|
135
|
+
<span>Not supported</span>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
<ProviderRequirements provider={provider} />
|
|
140
|
+
</li>
|
|
141
|
+
))}
|
|
142
|
+
</ul>
|
|
143
|
+
</section>
|
|
144
|
+
</div>
|
|
145
|
+
</details>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function CapabilityLegend(): JSX.Element {
|
|
150
|
+
return (
|
|
151
|
+
<div
|
|
152
|
+
className='seam-supported-device-legend'
|
|
153
|
+
aria-label='Capability status legend'
|
|
154
|
+
>
|
|
155
|
+
<span>
|
|
156
|
+
<CheckMark /> Supported
|
|
157
|
+
</span>
|
|
158
|
+
<span>
|
|
159
|
+
<InfoMark /> Requires setup · open requirements
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
)
|
|
163
|
+
}
|