@seamapi/react 5.2.4 → 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 +11 -10
- package/dist/ecosystem.js.map +1 -1
- package/dist/elements.js +12339 -11523
- 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/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 +5 -1
- 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/presentation.ts +234 -0
- package/src/lib/seam/ecosystem/types.ts +5 -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
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { DeviceModelSummary, Manufacturer } from '../../../../lib/seam/ecosystem/types.js';
|
|
3
|
-
interface DeviceModelRowProps {
|
|
4
|
-
deviceModel: DeviceModelSummary;
|
|
5
|
-
manufacturer: Manufacturer | null;
|
|
6
|
-
}
|
|
7
|
-
export declare function DeviceModelRow({ deviceModel, manufacturer, }: DeviceModelRowProps): JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useState } from 'react';
|
|
3
|
-
import { CheckIcon } from '../../../../lib/icons/Check.js';
|
|
4
|
-
import { TriangleWarningOutlineIcon } from '../../../../lib/icons/TriangleWarningOutline.js';
|
|
5
|
-
import { getCapabilityLabel, getCapabilityRequirementMessages, getDeviceModelImageUrl, getDeviceModelName, getSupportedCapabilities, } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
6
|
-
import { RequirementIcon } from '../../../../lib/seam/components/SupportedDevices/RequirementIcon.js';
|
|
7
|
-
export function DeviceModelRow({ deviceModel, manufacturer, }) {
|
|
8
|
-
const detailsId = useId();
|
|
9
|
-
const [expanded, setExpanded] = useState(false);
|
|
10
|
-
const name = getDeviceModelName(deviceModel);
|
|
11
|
-
const imageUrl = getDeviceModelImageUrl(deviceModel, manufacturer);
|
|
12
|
-
const modelIds = [
|
|
13
|
-
...new Set(deviceModel.variants
|
|
14
|
-
.map((v) => v.manufacturer_model_id)
|
|
15
|
-
.filter((id) => id != null && id.length > 0)),
|
|
16
|
-
];
|
|
17
|
-
const providers = deviceModel.providers.map((p) => p.display_name ?? p.slug);
|
|
18
|
-
const capabilities = getSupportedCapabilities(deviceModel).filter((c) => c.name !== 'device_connectivity');
|
|
19
|
-
const requirements = new Map();
|
|
20
|
-
for (const capability of capabilities) {
|
|
21
|
-
const messages = getCapabilityRequirementMessages(capability);
|
|
22
|
-
for (const message of messages) {
|
|
23
|
-
const features = requirements.get(message) ?? new Set();
|
|
24
|
-
features.add(getCapabilityLabel(capability.name));
|
|
25
|
-
requirements.set(message, features);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return (_jsxs("li", { className: 'seam-supported-devices-row', children: [_jsx("div", { className: 'seam-supported-devices-image', children: imageUrl == null ? (_jsx("span", { "aria-hidden": true, children: name.slice(0, 1) })) : (_jsx("img", { loading: 'lazy', src: imageUrl, alt: '', width: 48, height: 48 })) }), _jsxs("div", { className: 'seam-supported-devices-info', children: [deviceModel.product_url == null ? (_jsx("span", { className: 'seam-supported-devices-name', children: name })) : (_jsx("a", { className: 'seam-supported-devices-name', href: deviceModel.product_url, target: '_blank', rel: 'noopener noreferrer', children: name })), deviceModel.device_type != null && (_jsx("span", { className: 'seam-supported-devices-meta', children: deviceModel.device_type.display_name }))] }), capabilities.length > 0 && (_jsxs("div", { className: 'seam-supported-devices-capabilities', children: [_jsx("span", { className: 'seam-supported-devices-capabilities-label', children: t.features }), _jsx("ul", { className: 'seam-supported-devices-features', "aria-label": t.features, children: capabilities.map((capability) => (_jsxs("li", { children: [capability.supported === 'conditionally' ? (_jsx("button", { type: 'button', className: 'seam-supported-devices-requirement-toggle', "aria-label": t.toggleRequirements(getCapabilityLabel(capability.name), name), "aria-controls": detailsId, "aria-expanded": expanded, onClick: () => {
|
|
29
|
-
setExpanded((open) => !open);
|
|
30
|
-
}, children: _jsx(TriangleWarningOutlineIcon, { "aria-hidden": true, className: 'seam-supported-devices-conditional-icon' }) })) : (_jsx(CheckIcon, { "aria-hidden": true })), _jsxs("span", { children: [getCapabilityLabel(capability.name), capability.integrationSupportLevel === 'beta' && ' (beta)', capability.supported === 'conditionally' && (_jsx("span", { className: 'seam-ecosystem-visually-hidden', children: ` (${t.requirementsDetails})` }))] })] }, capability.name))) })] })), deviceModel.capabilities_stale ? (_jsx("span", { className: 'seam-supported-devices-status', children: t.refreshing })) : capabilities.length === 0 &&
|
|
31
|
-
deviceModel.device_type?.is_accessory !== true ? (_jsx("span", { className: 'seam-supported-devices-status', children: t.unconfirmed })) : null, (requirements.size > 0 ||
|
|
32
|
-
modelIds.length > 0 ||
|
|
33
|
-
providers.length > 0) && (_jsxs("details", { id: detailsId, className: 'seam-supported-devices-details', open: expanded, onToggle: (event) => {
|
|
34
|
-
setExpanded(event.currentTarget.open);
|
|
35
|
-
}, children: [_jsx("summary", { children: t.modelDetails }), requirements.size > 0 && (_jsx("ul", { className: 'seam-supported-devices-requirements', "aria-label": t.requirements, children: [...requirements].map(([message, features]) => (_jsxs("li", { children: [_jsx(RequirementIcon, { message: message }), _jsxs("div", { children: [_jsx("span", { children: message }), _jsx("span", { className: 'seam-supported-devices-requirement-features', children: t.requiredFor([...features].join(', ')) })] })] }, message))) })), (modelIds.length > 0 || providers.length > 0) && (_jsxs("dl", { children: [modelIds.length > 0 && (_jsxs("div", { children: [_jsx("dt", { children: t.modelNumbers }), _jsx("dd", { children: modelIds.join(', ') })] })), providers.length > 0 && (_jsxs("div", { children: [_jsx("dt", { children: t.integration }), _jsx("dd", { children: providers.join(', ') })] }))] }))] }))] }));
|
|
36
|
-
}
|
|
37
|
-
const t = {
|
|
38
|
-
features: 'Supported capabilities',
|
|
39
|
-
requirements: 'Requirements',
|
|
40
|
-
requirementsDetails: 'expand model and requirements details',
|
|
41
|
-
toggleRequirements: (capability, device) => `${capability} requirements for ${device}`,
|
|
42
|
-
requiredFor: (features) => `For ${features}`,
|
|
43
|
-
modelDetails: 'Model and requirements details',
|
|
44
|
-
modelNumbers: 'Model numbers',
|
|
45
|
-
integration: 'Integration',
|
|
46
|
-
refreshing: 'Compatibility is being refreshed.',
|
|
47
|
-
unconfirmed: 'Compatibility not confirmed for this integration.',
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=DeviceModelRow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceModelRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAA;AAChF,OAAO,EACL,kBAAkB,EAClB,gCAAgC,EAChC,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,yDAAyD,CAAA;AAWzF,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,YAAY,GACQ;IACpB,MAAM,SAAS,GAAG,KAAK,EAAE,CAAA;IACzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC5C,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@
|
|
|
1
|
-
import { useId, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import { CheckIcon } from 'lib/icons/Check.js'
|
|
4
|
-
import { TriangleWarningOutlineIcon } from 'lib/icons/TriangleWarningOutline.js'
|
|
5
|
-
import {
|
|
6
|
-
getCapabilityLabel,
|
|
7
|
-
getCapabilityRequirementMessages,
|
|
8
|
-
getDeviceModelImageUrl,
|
|
9
|
-
getDeviceModelName,
|
|
10
|
-
getSupportedCapabilities,
|
|
11
|
-
} from 'lib/seam/components/SupportedDevices/device-models.js'
|
|
12
|
-
import { RequirementIcon } from 'lib/seam/components/SupportedDevices/RequirementIcon.js'
|
|
13
|
-
import type {
|
|
14
|
-
DeviceModelSummary,
|
|
15
|
-
Manufacturer,
|
|
16
|
-
} from 'lib/seam/ecosystem/types.js'
|
|
17
|
-
|
|
18
|
-
interface DeviceModelRowProps {
|
|
19
|
-
deviceModel: DeviceModelSummary
|
|
20
|
-
manufacturer: Manufacturer | null
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function DeviceModelRow({
|
|
24
|
-
deviceModel,
|
|
25
|
-
manufacturer,
|
|
26
|
-
}: DeviceModelRowProps): JSX.Element {
|
|
27
|
-
const detailsId = useId()
|
|
28
|
-
const [expanded, setExpanded] = useState(false)
|
|
29
|
-
const name = getDeviceModelName(deviceModel)
|
|
30
|
-
const imageUrl = getDeviceModelImageUrl(deviceModel, manufacturer)
|
|
31
|
-
const modelIds = [
|
|
32
|
-
...new Set(
|
|
33
|
-
deviceModel.variants
|
|
34
|
-
.map((v) => v.manufacturer_model_id)
|
|
35
|
-
.filter((id): id is string => id != null && id.length > 0)
|
|
36
|
-
),
|
|
37
|
-
]
|
|
38
|
-
const providers = deviceModel.providers.map((p) => p.display_name ?? p.slug)
|
|
39
|
-
const capabilities = getSupportedCapabilities(deviceModel).filter(
|
|
40
|
-
(c) => c.name !== 'device_connectivity'
|
|
41
|
-
)
|
|
42
|
-
const requirements = new Map<string, Set<string>>()
|
|
43
|
-
for (const capability of capabilities) {
|
|
44
|
-
const messages = getCapabilityRequirementMessages(capability)
|
|
45
|
-
for (const message of messages) {
|
|
46
|
-
const features = requirements.get(message) ?? new Set<string>()
|
|
47
|
-
features.add(getCapabilityLabel(capability.name))
|
|
48
|
-
requirements.set(message, features)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<li className='seam-supported-devices-row'>
|
|
54
|
-
<div className='seam-supported-devices-image'>
|
|
55
|
-
{imageUrl == null ? (
|
|
56
|
-
<span aria-hidden>{name.slice(0, 1)}</span>
|
|
57
|
-
) : (
|
|
58
|
-
<img loading='lazy' src={imageUrl} alt='' width={48} height={48} />
|
|
59
|
-
)}
|
|
60
|
-
</div>
|
|
61
|
-
<div className='seam-supported-devices-info'>
|
|
62
|
-
{deviceModel.product_url == null ? (
|
|
63
|
-
<span className='seam-supported-devices-name'>{name}</span>
|
|
64
|
-
) : (
|
|
65
|
-
<a
|
|
66
|
-
className='seam-supported-devices-name'
|
|
67
|
-
href={deviceModel.product_url}
|
|
68
|
-
target='_blank'
|
|
69
|
-
rel='noopener noreferrer'
|
|
70
|
-
>
|
|
71
|
-
{name}
|
|
72
|
-
</a>
|
|
73
|
-
)}
|
|
74
|
-
{deviceModel.device_type != null && (
|
|
75
|
-
<span className='seam-supported-devices-meta'>
|
|
76
|
-
{deviceModel.device_type.display_name}
|
|
77
|
-
</span>
|
|
78
|
-
)}
|
|
79
|
-
</div>
|
|
80
|
-
{capabilities.length > 0 && (
|
|
81
|
-
<div className='seam-supported-devices-capabilities'>
|
|
82
|
-
<span className='seam-supported-devices-capabilities-label'>
|
|
83
|
-
{t.features}
|
|
84
|
-
</span>
|
|
85
|
-
<ul
|
|
86
|
-
className='seam-supported-devices-features'
|
|
87
|
-
aria-label={t.features}
|
|
88
|
-
>
|
|
89
|
-
{capabilities.map((capability) => (
|
|
90
|
-
<li key={capability.name}>
|
|
91
|
-
{capability.supported === 'conditionally' ? (
|
|
92
|
-
<button
|
|
93
|
-
type='button'
|
|
94
|
-
className='seam-supported-devices-requirement-toggle'
|
|
95
|
-
aria-label={t.toggleRequirements(
|
|
96
|
-
getCapabilityLabel(capability.name),
|
|
97
|
-
name
|
|
98
|
-
)}
|
|
99
|
-
aria-controls={detailsId}
|
|
100
|
-
aria-expanded={expanded}
|
|
101
|
-
onClick={() => {
|
|
102
|
-
setExpanded((open) => !open)
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
<TriangleWarningOutlineIcon
|
|
106
|
-
aria-hidden
|
|
107
|
-
className='seam-supported-devices-conditional-icon'
|
|
108
|
-
/>
|
|
109
|
-
</button>
|
|
110
|
-
) : (
|
|
111
|
-
<CheckIcon aria-hidden />
|
|
112
|
-
)}
|
|
113
|
-
<span>
|
|
114
|
-
{getCapabilityLabel(capability.name)}
|
|
115
|
-
{capability.integrationSupportLevel === 'beta' && ' (beta)'}
|
|
116
|
-
{capability.supported === 'conditionally' && (
|
|
117
|
-
<span className='seam-ecosystem-visually-hidden'>
|
|
118
|
-
{` (${t.requirementsDetails})`}
|
|
119
|
-
</span>
|
|
120
|
-
)}
|
|
121
|
-
</span>
|
|
122
|
-
</li>
|
|
123
|
-
))}
|
|
124
|
-
</ul>
|
|
125
|
-
</div>
|
|
126
|
-
)}
|
|
127
|
-
{deviceModel.capabilities_stale ? (
|
|
128
|
-
<span className='seam-supported-devices-status'>{t.refreshing}</span>
|
|
129
|
-
) : capabilities.length === 0 &&
|
|
130
|
-
deviceModel.device_type?.is_accessory !== true ? (
|
|
131
|
-
<span className='seam-supported-devices-status'>{t.unconfirmed}</span>
|
|
132
|
-
) : null}
|
|
133
|
-
{(requirements.size > 0 ||
|
|
134
|
-
modelIds.length > 0 ||
|
|
135
|
-
providers.length > 0) && (
|
|
136
|
-
<details
|
|
137
|
-
id={detailsId}
|
|
138
|
-
className='seam-supported-devices-details'
|
|
139
|
-
open={expanded}
|
|
140
|
-
onToggle={(event) => {
|
|
141
|
-
setExpanded(event.currentTarget.open)
|
|
142
|
-
}}
|
|
143
|
-
>
|
|
144
|
-
<summary>{t.modelDetails}</summary>
|
|
145
|
-
{requirements.size > 0 && (
|
|
146
|
-
<ul
|
|
147
|
-
className='seam-supported-devices-requirements'
|
|
148
|
-
aria-label={t.requirements}
|
|
149
|
-
>
|
|
150
|
-
{[...requirements].map(([message, features]) => (
|
|
151
|
-
<li key={message}>
|
|
152
|
-
<RequirementIcon message={message} />
|
|
153
|
-
<div>
|
|
154
|
-
<span>{message}</span>
|
|
155
|
-
<span className='seam-supported-devices-requirement-features'>
|
|
156
|
-
{t.requiredFor([...features].join(', '))}
|
|
157
|
-
</span>
|
|
158
|
-
</div>
|
|
159
|
-
</li>
|
|
160
|
-
))}
|
|
161
|
-
</ul>
|
|
162
|
-
)}
|
|
163
|
-
{(modelIds.length > 0 || providers.length > 0) && (
|
|
164
|
-
<dl>
|
|
165
|
-
{modelIds.length > 0 && (
|
|
166
|
-
<div>
|
|
167
|
-
<dt>{t.modelNumbers}</dt>
|
|
168
|
-
<dd>{modelIds.join(', ')}</dd>
|
|
169
|
-
</div>
|
|
170
|
-
)}
|
|
171
|
-
{providers.length > 0 && (
|
|
172
|
-
<div>
|
|
173
|
-
<dt>{t.integration}</dt>
|
|
174
|
-
<dd>{providers.join(', ')}</dd>
|
|
175
|
-
</div>
|
|
176
|
-
)}
|
|
177
|
-
</dl>
|
|
178
|
-
)}
|
|
179
|
-
</details>
|
|
180
|
-
)}
|
|
181
|
-
</li>
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const t = {
|
|
186
|
-
features: 'Supported capabilities',
|
|
187
|
-
requirements: 'Requirements',
|
|
188
|
-
requirementsDetails: 'expand model and requirements details',
|
|
189
|
-
toggleRequirements: (capability: string, device: string) =>
|
|
190
|
-
`${capability} requirements for ${device}`,
|
|
191
|
-
requiredFor: (features: string) => `For ${features}`,
|
|
192
|
-
modelDetails: 'Model and requirements details',
|
|
193
|
-
modelNumbers: 'Model numbers',
|
|
194
|
-
integration: 'Integration',
|
|
195
|
-
refreshing: 'Compatibility is being refreshed.',
|
|
196
|
-
unconfirmed: 'Compatibility not confirmed for this integration.',
|
|
197
|
-
}
|