@seamapi/react 4.14.2 → 5.1.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 +111 -3
- package/dist/ecosystem.js +45 -0
- package/dist/ecosystem.js.map +1 -0
- package/dist/elements.js +11464 -11007
- package/dist/elements.js.map +1 -1
- package/dist/index.css +469 -345
- 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/SeamProvider.d.ts +10 -3
- package/lib/seam/SeamProvider.js +5 -3
- package/lib/seam/SeamProvider.js.map +1 -1
- package/lib/seam/components/CompatibleApps/CompatibleApps.d.ts +26 -0
- package/lib/seam/components/CompatibleApps/CompatibleApps.js +126 -0
- package/lib/seam/components/CompatibleApps/CompatibleApps.js.map +1 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.d.ts +8 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js +31 -0
- package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +1 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.d.ts +12 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.js +9 -0
- package/lib/seam/components/SupportedDevices/FilterSelect.js.map +1 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.d.ts +10 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js +35 -0
- package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.d.ts +24 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.js +151 -0
- package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -0
- package/lib/seam/components/SupportedDevices/device-models.d.ts +47 -0
- package/lib/seam/components/SupportedDevices/device-models.js +217 -0
- package/lib/seam/components/SupportedDevices/device-models.js.map +1 -0
- package/lib/seam/components/index.d.ts +2 -2
- package/lib/seam/components/index.js +2 -2
- package/lib/seam/components/index.js.map +1 -1
- package/lib/seam/ecosystem/EcosystemProvider.d.ts +37 -0
- package/lib/seam/ecosystem/EcosystemProvider.js +56 -0
- package/lib/seam/ecosystem/EcosystemProvider.js.map +1 -0
- package/lib/seam/ecosystem/client.d.ts +28 -0
- package/lib/seam/ecosystem/client.js +74 -0
- package/lib/seam/ecosystem/client.js.map +1 -0
- package/lib/seam/ecosystem/index.d.ts +9 -0
- package/lib/seam/ecosystem/index.js +8 -0
- package/lib/seam/ecosystem/index.js.map +1 -0
- package/lib/seam/ecosystem/types.d.ts +253 -0
- package/lib/seam/ecosystem/types.js +10 -0
- package/lib/seam/ecosystem/types.js.map +1 -0
- package/lib/seam/ecosystem/use-compatible-partners.d.ts +21 -0
- package/lib/seam/ecosystem/use-compatible-partners.js +36 -0
- package/lib/seam/ecosystem/use-compatible-partners.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.d.ts +20 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.js +51 -0
- package/lib/seam/ecosystem/use-ecosystem-device-models.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.d.ts +11 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.js +49 -0
- package/lib/seam/ecosystem/use-ecosystem-manufacturers.js.map +1 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.d.ts +7 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.js +7 -0
- package/lib/seam/ecosystem/use-ecosystem-query-result.js.map +1 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.d.ts +20 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.js +51 -0
- package/lib/seam/ecosystem/use-embed-key-resolution.js.map +1 -0
- package/lib/seam/index.d.ts +1 -0
- package/lib/seam/index.js +1 -0
- package/lib/seam/index.js.map +1 -1
- package/lib/seam/seam-components-class-name.d.ts +1 -0
- package/lib/seam/seam-components-class-name.js +2 -0
- package/lib/seam/seam-components-class-name.js.map +1 -0
- package/lib/ui/ecosystem/SearchField.d.ts +9 -0
- package/lib/ui/ecosystem/SearchField.js +8 -0
- package/lib/ui/ecosystem/SearchField.js.map +1 -0
- package/lib/ui/ecosystem/StateMessage.d.ts +8 -0
- package/lib/ui/ecosystem/StateMessage.js +5 -0
- package/lib/ui/ecosystem/StateMessage.js.map +1 -0
- package/lib/ui/ecosystem/errors.d.ts +5 -0
- package/lib/ui/ecosystem/errors.js +25 -0
- package/lib/ui/ecosystem/errors.js.map +1 -0
- package/lib/ui/ecosystem/storybook.d.ts +15 -0
- package/lib/ui/ecosystem/storybook.js +16 -0
- package/lib/ui/ecosystem/storybook.js.map +1 -0
- package/lib/ui/ecosystem/theme.d.ts +6 -0
- package/lib/ui/ecosystem/theme.js +11 -0
- package/lib/ui/ecosystem/theme.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +11 -3
- package/src/ecosystem.d.ts +2 -0
- package/src/ecosystem.ts +12 -0
- package/src/elements.ts +4 -0
- package/src/lib/ecosystem-element.tsx +154 -0
- package/src/lib/element.tsx +6 -0
- package/src/lib/seam/SeamProvider.tsx +18 -2
- package/src/lib/seam/components/CompatibleApps/CompatibleApps.element.ts +19 -0
- package/src/lib/seam/components/CompatibleApps/CompatibleApps.tsx +344 -0
- package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +105 -0
- package/src/lib/seam/components/SupportedDevices/FilterSelect.tsx +43 -0
- package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +114 -0
- package/src/lib/seam/components/SupportedDevices/SupportedDevices.element.ts +17 -0
- package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +382 -0
- package/src/lib/seam/components/SupportedDevices/device-models.ts +326 -0
- package/src/lib/seam/components/ecosystem-elements.ts +2 -0
- package/src/lib/seam/components/elements.ts +0 -2
- package/src/lib/seam/components/index.ts +2 -2
- package/src/lib/seam/ecosystem/EcosystemProvider.tsx +133 -0
- package/src/lib/seam/ecosystem/client.ts +116 -0
- package/src/lib/seam/ecosystem/index.ts +19 -0
- package/src/lib/seam/ecosystem/types.ts +334 -0
- package/src/lib/seam/ecosystem/use-compatible-partners.ts +80 -0
- package/src/lib/seam/ecosystem/use-ecosystem-device-models.ts +96 -0
- package/src/lib/seam/ecosystem/use-ecosystem-manufacturers.ts +86 -0
- package/src/lib/seam/ecosystem/use-ecosystem-query-result.ts +19 -0
- package/src/lib/seam/ecosystem/use-embed-key-resolution.ts +80 -0
- package/src/lib/seam/index.ts +1 -0
- package/src/lib/seam/seam-components-class-name.ts +1 -0
- package/src/lib/ui/ecosystem/SearchField.tsx +32 -0
- package/src/lib/ui/ecosystem/StateMessage.tsx +29 -0
- package/src/lib/ui/ecosystem/errors.ts +30 -0
- package/src/lib/ui/ecosystem/storybook.tsx +40 -0
- package/src/lib/ui/ecosystem/theme.ts +14 -0
- package/src/lib/version.ts +1 -1
- package/src/styles/_compatible-apps.scss +102 -0
- package/src/styles/_ecosystem.scss +295 -0
- package/src/styles/_main.scss +6 -4
- package/src/styles/_supported-devices.scss +153 -0
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.d.ts +0 -20
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js +0 -22
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +0 -6
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js +0 -8
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +0 -9
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js +0 -14
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +0 -13
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +0 -58
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +0 -7
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js +0 -6
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +0 -12
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js +0 -58
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.d.ts +0 -8
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js +0 -39
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +0 -10
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js +0 -35
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +0 -11
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +0 -20
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.d.ts +0 -6
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js +0 -21
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +0 -7
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js +0 -21
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-models.d.ts +0 -7
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js +0 -30
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +0 -15
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +0 -45
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.d.ts +0 -10
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.js +0 -42
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +0 -7
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +0 -17
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.d.ts +0 -7
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +0 -26
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +0 -1
- package/src/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.tsx +0 -78
- package/src/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.tsx +0 -13
- package/src/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.tsx +0 -32
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +0 -161
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +0 -22
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +0 -145
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.tsx +0 -109
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx +0 -93
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.element.ts +0 -15
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +0 -70
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.element.ts +0 -9
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.tsx +0 -64
- package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +0 -44
- package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +0 -57
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +0 -88
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.ts +0 -69
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +0 -40
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +0 -53
- package/src/styles/_supported-device-table-manufacturer-keys.scss +0 -20
- package/src/styles/_supported-device-table.scss +0 -412
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type EcosystemTheme } from '../../../../lib/ui/ecosystem/theme.js';
|
|
3
|
+
export interface CompatibleAppsProps {
|
|
4
|
+
/** Device category, e.g., `smartlock`, `thermostat`, `sensor`, `intercom`. */
|
|
5
|
+
deviceType: string;
|
|
6
|
+
/** DeviceDB manufacturer slug. Lists the apps that support this brand. */
|
|
7
|
+
manufacturer?: string | undefined;
|
|
8
|
+
/** DeviceDB provider slug, i.e., the cloud the devices connect through. */
|
|
9
|
+
provider?: string | undefined;
|
|
10
|
+
/** DeviceDB capability, e.g., `can_provision_mobile_keys`. Shows per-app notes. */
|
|
11
|
+
capability?: string | undefined;
|
|
12
|
+
/** Industry slug to restrict the apps, e.g., `short-term-rental`. */
|
|
13
|
+
industry?: string | undefined;
|
|
14
|
+
/** Apps shown before the show more button. */
|
|
15
|
+
maxVisible?: number | undefined;
|
|
16
|
+
hideSearch?: boolean | undefined;
|
|
17
|
+
hideTitle?: boolean | undefined;
|
|
18
|
+
/** Color theme. `auto` follows the visitor's color scheme. */
|
|
19
|
+
theme?: EcosystemTheme | undefined;
|
|
20
|
+
className?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The live apps (Seam partners) that work with a device category,
|
|
24
|
+
* manufacturer, provider or capability through Seam.
|
|
25
|
+
*/
|
|
26
|
+
export declare function CompatibleApps({ deviceType, manufacturer, provider, capability, industry, maxVisible, hideSearch, hideTitle, theme, className, }: CompatibleAppsProps): JSX.Element;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useDeferredValue, useMemo, useState } from 'react';
|
|
4
|
+
import { useCompatiblePartners } from '../../../../lib/seam/ecosystem/use-compatible-partners.js';
|
|
5
|
+
import { getEcosystemErrorMessage } from '../../../../lib/ui/ecosystem/errors.js';
|
|
6
|
+
import { SearchField } from '../../../../lib/ui/ecosystem/SearchField.js';
|
|
7
|
+
import { StateMessage } from '../../../../lib/ui/ecosystem/StateMessage.js';
|
|
8
|
+
import { getEcosystemThemeClassName, } from '../../../../lib/ui/ecosystem/theme.js';
|
|
9
|
+
const defaultMaxVisible = 24;
|
|
10
|
+
/**
|
|
11
|
+
* The live apps (Seam partners) that work with a device category,
|
|
12
|
+
* manufacturer, provider or capability through Seam.
|
|
13
|
+
*/
|
|
14
|
+
export function CompatibleApps({ deviceType, manufacturer = '', provider = '', capability = '', industry = '', maxVisible = defaultMaxVisible, hideSearch = false, hideTitle = false, theme = 'light', className, }) {
|
|
15
|
+
const { partners, isPending, isError, error, refetch } = useCompatiblePartners({
|
|
16
|
+
deviceType: deviceType ?? '',
|
|
17
|
+
manufacturer,
|
|
18
|
+
provider,
|
|
19
|
+
capability,
|
|
20
|
+
industry,
|
|
21
|
+
});
|
|
22
|
+
const [searchValue, setSearchValue] = useState('');
|
|
23
|
+
const [showAll, setShowAll] = useState(false);
|
|
24
|
+
const query = useDeferredValue(searchValue.toLowerCase().trim());
|
|
25
|
+
const sortedPartners = useMemo(() => [...(partners ?? [])].sort(comparePartners), [partners]);
|
|
26
|
+
const filteredPartners = useMemo(() => query.length === 0
|
|
27
|
+
? sortedPartners
|
|
28
|
+
: sortedPartners.filter((partner) => matchesSearch(partner, query)), [sortedPartners, query]);
|
|
29
|
+
const visibleCount = getVisibleCount(maxVisible);
|
|
30
|
+
const visiblePartners = showAll
|
|
31
|
+
? filteredPartners
|
|
32
|
+
: filteredPartners.slice(0, visibleCount);
|
|
33
|
+
const hiddenCount = filteredPartners.length - visiblePartners.length;
|
|
34
|
+
const showNotes = capability.length > 0 || provider.length > 0;
|
|
35
|
+
const isMissingDeviceType = (deviceType ?? '').trim().length === 0;
|
|
36
|
+
const content = (() => {
|
|
37
|
+
if (isMissingDeviceType) {
|
|
38
|
+
return _jsx(StateMessage, { role: 'alert', children: t.missingDeviceType });
|
|
39
|
+
}
|
|
40
|
+
if (isError) {
|
|
41
|
+
const { message, canRetry } = getEcosystemErrorMessage(error, t.error);
|
|
42
|
+
return (_jsx(StateMessage, { role: 'alert', ...(canRetry
|
|
43
|
+
? {
|
|
44
|
+
actionLabel: t.retry,
|
|
45
|
+
onAction: () => {
|
|
46
|
+
void refetch();
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
: {}), children: message }));
|
|
50
|
+
}
|
|
51
|
+
if (isPending) {
|
|
52
|
+
return _jsx(LoadingGrid, { count: Math.min(visibleCount, 8) });
|
|
53
|
+
}
|
|
54
|
+
if (sortedPartners.length === 0) {
|
|
55
|
+
return _jsx(StateMessage, { children: t.noApps });
|
|
56
|
+
}
|
|
57
|
+
if (filteredPartners.length === 0) {
|
|
58
|
+
return (_jsx(StateMessage, { actionLabel: t.clearSearch, onAction: () => {
|
|
59
|
+
setSearchValue('');
|
|
60
|
+
}, children: t.noSearchResults(searchValue.trim()) }));
|
|
61
|
+
}
|
|
62
|
+
return (_jsxs(_Fragment, { children: [_jsx("ul", { className: 'seam-compatible-apps-grid', children: visiblePartners.map((partner) => (_jsx(PartnerCard, { partner: partner, showNote: showNotes }, partner.partner_id))) }), hiddenCount > 0 && (_jsx("div", { className: 'seam-compatible-apps-footer', children: _jsx("button", { type: 'button', className: 'seam-ecosystem-button', onClick: () => {
|
|
63
|
+
setShowAll(true);
|
|
64
|
+
}, children: t.showMore(hiddenCount) }) }))] }));
|
|
65
|
+
})();
|
|
66
|
+
const showHeader = !hideTitle || !hideSearch;
|
|
67
|
+
return (_jsxs("div", { className: classNames('seam-ecosystem', 'seam-compatible-apps', getEcosystemThemeClassName(theme), className), children: [showHeader && (_jsxs("div", { className: 'seam-ecosystem-header', children: [!hideTitle && _jsx("h2", { className: 'seam-ecosystem-title', children: t.title }), !hideSearch && (_jsx(SearchField, { label: t.search, value: searchValue, onChange: setSearchValue, disabled: isPending || isError || isMissingDeviceType }))] })), content] }));
|
|
68
|
+
}
|
|
69
|
+
function PartnerCard({ partner, showNote, }) {
|
|
70
|
+
const logo = getPartnerLogo(partner, lightLogoKinds);
|
|
71
|
+
const darkLogo = getPartnerLogo(partner, darkLogoKinds);
|
|
72
|
+
const hasDarkLogo = darkLogo != null && darkLogo.url !== logo?.url;
|
|
73
|
+
const note = showNote ? partner.support.note : null;
|
|
74
|
+
const subtitle = partner.industries.map((i) => i.display_name).join(' · ');
|
|
75
|
+
const body = (_jsxs(_Fragment, { children: [_jsx("div", { className: 'seam-compatible-apps-logo', children: logo == null ? (_jsx("span", { className: 'seam-compatible-apps-logo-initial', "aria-hidden": true, children: partner.display_name.slice(0, 1) })) : (_jsxs(_Fragment, { children: [_jsx("img", { loading: 'lazy', src: logo.url, alt: t.logoAlt(partner.display_name), width: 48, height: 48, className: classNames({
|
|
76
|
+
'seam-ecosystem-light-only': hasDarkLogo,
|
|
77
|
+
}) }), hasDarkLogo && (_jsx("img", { loading: 'lazy', src: darkLogo.url, alt: '', width: 48, height: 48, className: 'seam-ecosystem-dark-only' }))] })) }), _jsxs("div", { className: 'seam-compatible-apps-text', children: [_jsx("span", { className: 'seam-compatible-apps-name', children: partner.display_name }), subtitle.length > 0 && (_jsx("span", { className: 'seam-compatible-apps-subtitle', children: subtitle })), note != null && note.length > 0 && (_jsx("span", { className: 'seam-compatible-apps-note', children: note }))] })] }));
|
|
78
|
+
return (_jsx("li", { className: 'seam-compatible-apps-card', children: partner.website == null ? (_jsx("div", { className: 'seam-compatible-apps-card-body', children: body })) : (_jsx("a", { href: partner.website, target: '_blank', rel: 'noopener noreferrer', className: 'seam-compatible-apps-card-body', children: body })) }));
|
|
79
|
+
}
|
|
80
|
+
function LoadingGrid({ count }) {
|
|
81
|
+
return (_jsx("ul", { className: 'seam-compatible-apps-grid', "aria-busy": 'true', children: Array.from({ length: count }, (_, index) => (_jsx("li", { className: 'seam-compatible-apps-card', children: _jsxs("div", { className: 'seam-compatible-apps-card-body', children: [_jsx("div", { className: 'seam-ecosystem-skeleton seam-compatible-apps-logo' }), _jsxs("div", { className: 'seam-compatible-apps-text', children: [_jsx("div", { className: 'seam-ecosystem-skeleton seam-ecosystem-skeleton-line' }), _jsx("div", { className: 'seam-ecosystem-skeleton seam-ecosystem-skeleton-line-short' })] })] }) }, index))) }));
|
|
82
|
+
}
|
|
83
|
+
const lightLogoKinds = [
|
|
84
|
+
'square_logo',
|
|
85
|
+
'horizontal_logo',
|
|
86
|
+
'square_logo_mono',
|
|
87
|
+
'horizontal_logo_mono',
|
|
88
|
+
];
|
|
89
|
+
const darkLogoKinds = [
|
|
90
|
+
'square_logo_mono',
|
|
91
|
+
'square_logo',
|
|
92
|
+
'horizontal_logo_mono',
|
|
93
|
+
'horizontal_logo',
|
|
94
|
+
];
|
|
95
|
+
const getPartnerLogo = (partner, kinds) => {
|
|
96
|
+
for (const kind of kinds) {
|
|
97
|
+
const asset = partner.assets.find((a) => a.kind === kind);
|
|
98
|
+
if (asset != null)
|
|
99
|
+
return asset;
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
};
|
|
103
|
+
const comparePartners = (a, b) => {
|
|
104
|
+
if (a.is_featured !== b.is_featured)
|
|
105
|
+
return a.is_featured ? -1 : 1;
|
|
106
|
+
return a.display_name.localeCompare(b.display_name);
|
|
107
|
+
};
|
|
108
|
+
const matchesSearch = (partner, query) => partner.display_name.toLowerCase().includes(query) ||
|
|
109
|
+
partner.industries.some((i) => i.display_name.toLowerCase().includes(query)) ||
|
|
110
|
+
partner.solutions.some((s) => s.display_name.toLowerCase().includes(query));
|
|
111
|
+
const getVisibleCount = (maxVisible) => Number.isFinite(maxVisible) && maxVisible > 0
|
|
112
|
+
? Math.floor(maxVisible)
|
|
113
|
+
: defaultMaxVisible;
|
|
114
|
+
const t = {
|
|
115
|
+
title: 'Works with these apps',
|
|
116
|
+
search: 'Search apps',
|
|
117
|
+
error: 'An error occurred while loading compatible apps.',
|
|
118
|
+
retry: 'Retry',
|
|
119
|
+
noApps: 'No apps are listed for this selection yet.',
|
|
120
|
+
noSearchResults: (query) => `No apps found for "${query}".`,
|
|
121
|
+
clearSearch: 'Clear search',
|
|
122
|
+
showMore: (count) => `Show ${count} more ${count === 1 ? 'app' : 'apps'}`,
|
|
123
|
+
logoAlt: (name) => `${name} logo`,
|
|
124
|
+
missingDeviceType: 'Set a device type to list compatible apps.',
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=CompatibleApps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompatibleApps.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/CompatibleApps/CompatibleApps.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAO3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAEL,0BAA0B,GAC3B,MAAM,2BAA2B,CAAA;AAsBlC,MAAM,iBAAiB,GAAG,EAAE,CAAA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AAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;AAE7E,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAU,EAAE,CACrD,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;IAC3C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IACxB,CAAC,CAAC,iBAAiB,CAAA;AAEvB,MAAM,CAAC,GAAG;IACR,KAAK,EAAE,uBAAuB;IAC9B,MAAM,EAAE,aAAa;IACrB,KAAK,EAAE,kDAAkD;IACzD,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,4CAA4C;IACpD,eAAe,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,sBAAsB,KAAK,IAAI;IACnE,WAAW,EAAE,cAAc;IAC3B,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAC1B,QAAQ,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE;IACtD,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,IAAI,OAAO;IACzC,iBAAiB,EAAE,4CAA4C;CAChE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DeviceModel, Manufacturer } from '../../../../lib/seam/ecosystem/types.js';
|
|
3
|
+
interface DeviceModelRowProps {
|
|
4
|
+
deviceModel: DeviceModel;
|
|
5
|
+
manufacturer: Manufacturer | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function DeviceModelRow({ deviceModel, manufacturer, }: DeviceModelRowProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { getCapabilityLabel, getDeviceModelImageUrl, getDeviceModelName, getSupportedCapabilities, } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
4
|
+
export function DeviceModelRow({ deviceModel, manufacturer, }) {
|
|
5
|
+
const name = getDeviceModelName(deviceModel);
|
|
6
|
+
const imageUrl = getDeviceModelImageUrl(deviceModel, manufacturer);
|
|
7
|
+
const modelIds = [
|
|
8
|
+
...new Set(deviceModel.variants
|
|
9
|
+
.map((v) => v.manufacturer_model_id)
|
|
10
|
+
.filter((id) => id != null && id.length > 0)),
|
|
11
|
+
];
|
|
12
|
+
const providers = deviceModel.providers
|
|
13
|
+
.map((p) => p.display_name ?? p.slug)
|
|
14
|
+
.join(', ');
|
|
15
|
+
const capabilities = getSupportedCapabilities(deviceModel).filter((c) => c.name !== 'device_connectivity');
|
|
16
|
+
const meta = [
|
|
17
|
+
modelIds.length > 0 ? modelIds.slice(0, 2).join(', ') : null,
|
|
18
|
+
providers.length > 0 ? t.via(providers) : null,
|
|
19
|
+
].filter((value) => value != null);
|
|
20
|
+
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 })), meta.length > 0 && (_jsx("span", { className: 'seam-supported-devices-meta', children: meta.join(' · ') }))] }), _jsxs("ul", { className: 'seam-supported-devices-badges', "aria-label": t.badges, children: [deviceModel.device_type != null && (_jsx("li", { className: 'seam-ecosystem-badge seam-ecosystem-badge-type', children: deviceModel.device_type.display_name })), capabilities.map((capability) => (_jsxs("li", { className: classNames('seam-ecosystem-badge', {
|
|
21
|
+
'seam-ecosystem-badge-conditional': capability.supported === 'conditionally',
|
|
22
|
+
}), title: capability.supported === 'conditionally'
|
|
23
|
+
? (capability.details ?? t.conditional)
|
|
24
|
+
: undefined, children: [getCapabilityLabel(capability.name), capability.supported === 'conditionally' && (_jsx("span", { className: 'seam-ecosystem-visually-hidden', children: ` (${t.conditional})` }))] }, capability.name)))] })] }));
|
|
25
|
+
}
|
|
26
|
+
const t = {
|
|
27
|
+
via: (providers) => `via ${providers}`,
|
|
28
|
+
badges: 'Device type and capabilities',
|
|
29
|
+
conditional: 'conditionally supported',
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=DeviceModelRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceModelRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,uDAAuD,CAAA;AAQ9D,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,YAAY,GACQ;IACpB,MAAM,IAAI,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC5C,MAAM,QAAQ,GAAG,sBAAsB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;IAClE,MAAM,QAAQ,GAAG;QACf,GAAG,IAAI,GAAG,CACR,WAAW,CAAC,QAAQ;aACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC;aACnC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAC7D;KACF,CAAA;IACD,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS;SACpC,GAAG,CAAC,CAAC,CAAC,E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C,QAAQ,EACf,GAAG,EAAC,qBAAqB,YAExB,IAAI,GACH,CACL,EACA,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAClB,eAAM,SAAS,EAAC,6BAA6B,YAC1C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GACZ,CACR,IACG,EACN,cAAI,SAAS,EAAC,+BAA+B,gBAAa,CAAC,CAAC,MAAM,aAC/D,WAAW,CAAC,WAAW,IAAI,IAAI,IAAI,CAClC,aAAI,SAAS,EAAC,gDAAgD,YAC3D,WAAW,CAAC,WAAW,CAAC,YAAY,GAClC,CACN,EACA,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAChC,cAEE,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE;4BAC5C,kCAAkC,EAChC,UAAU,CAAC,SAAS,KAAK,eAAe;yBAC3C,CAAC,EACF,KAAK,EACH,UAAU,CAAC,SAAS,KAAK,eAAe;4BACtC,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,WAAW,CAAC;4BACvC,CAAC,CAAC,SAAS,aAGd,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,EACnC,UAAU,CAAC,SAAS,KAAK,eAAe,IAAI,CAC3C,eAAM,SAAS,EAAC,gCAAgC,YAC7C,KAAK,CAAC,CAAC,WAAW,GAAG,GACjB,CACR,KAhBI,UAAU,CAAC,IAAI,CAiBjB,CACN,CAAC,IACC,IACF,CACN,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,GAAG,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,OAAO,SAAS,EAAE;IAC9C,MAAM,EAAE,8BAA8B;IACtC,WAAW,EAAE,yBAAyB;CACvC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FilterOption } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
3
|
+
interface FilterSelectProps {
|
|
4
|
+
label: string;
|
|
5
|
+
allLabel: string;
|
|
6
|
+
options: FilterOption[];
|
|
7
|
+
value: string | null;
|
|
8
|
+
onChange: (value: string | null) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function FilterSelect({ label, allLabel, options, value, onChange, disabled, }: FilterSelectProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDownIcon } from '../../../../lib/icons/ChevronDown.js';
|
|
3
|
+
export function FilterSelect({ label, allLabel, options, value, onChange, disabled = false, }) {
|
|
4
|
+
return (_jsxs("label", { className: 'seam-ecosystem-select', children: [_jsx("span", { className: 'seam-ecosystem-visually-hidden', children: label }), _jsxs("select", { className: 'seam-ecosystem-select-input', value: value ?? '', disabled: disabled, onChange: (event) => {
|
|
5
|
+
const { value } = event.target;
|
|
6
|
+
onChange(value.length === 0 ? null : value);
|
|
7
|
+
}, children: [_jsx("option", { value: '', children: allLabel }), options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] }), _jsx(ChevronDownIcon, { "aria-hidden": true, className: 'seam-ecosystem-select-icon' })] }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=FilterSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterSelect.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDevices/FilterSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAY1D,MAAM,UAAU,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,KAAK,GACE;IAClB,OAAO,CACL,iBAAO,SAAS,EAAC,uBAAuB,aACtC,eAAM,SAAS,EAAC,gCAAgC,YAAE,KAAK,GAAQ,EAC/D,kBACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBAClB,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,CAAA;oBAC9B,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBAC7C,CAAC,aAED,iBAAQ,KAAK,EAAC,EAAE,YAAE,QAAQ,GAAU,EACnC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,iBAA2B,KAAK,EAAE,MAAM,CAAC,KAAK,YAC3C,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC,IACK,EACT,KAAC,eAAe,yBAAa,SAAS,EAAC,4BAA4B,GAAG,IAChE,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ManufacturerGroup } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
3
|
+
import type { Manufacturer } from '../../../../lib/seam/ecosystem/types.js';
|
|
4
|
+
interface ManufacturerSectionProps {
|
|
5
|
+
group: ManufacturerGroup;
|
|
6
|
+
manufacturer: Manufacturer | null;
|
|
7
|
+
collapsible: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function ManufacturerSection({ group, manufacturer, collapsible, }: ManufacturerSectionProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { getManufacturerLogoUrl, getManufacturerName, } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
5
|
+
import { DeviceModelRow } from '../../../../lib/seam/components/SupportedDevices/DeviceModelRow.js';
|
|
6
|
+
/** Device models shown per manufacturer before the show all button. */
|
|
7
|
+
const collapsedCount = 5;
|
|
8
|
+
export function ManufacturerSection({ group, manufacturer, collapsible, }) {
|
|
9
|
+
const [expanded, setExpanded] = useState(false);
|
|
10
|
+
const { deviceModels } = group;
|
|
11
|
+
const canExpand = collapsible && deviceModels.length > collapsedCount;
|
|
12
|
+
const visibleDeviceModels = canExpand && !expanded
|
|
13
|
+
? deviceModels.slice(0, collapsedCount)
|
|
14
|
+
: deviceModels;
|
|
15
|
+
const name = manufacturer != null
|
|
16
|
+
? getManufacturerName(manufacturer)
|
|
17
|
+
: group.manufacturer != null
|
|
18
|
+
? getManufacturerName(group.manufacturer)
|
|
19
|
+
: t.other;
|
|
20
|
+
const logoUrl = getManufacturerLogoUrl(manufacturer);
|
|
21
|
+
const darkLogoUrl = getManufacturerLogoUrl(manufacturer, { mono: true });
|
|
22
|
+
const hasDarkLogo = darkLogoUrl != null && darkLogoUrl !== logoUrl;
|
|
23
|
+
return (_jsxs("section", { className: 'seam-supported-devices-section', children: [_jsxs("div", { className: 'seam-supported-devices-section-header', children: [_jsx("div", { className: 'seam-supported-devices-logo', children: logoUrl == null ? (_jsx("span", { "aria-hidden": true, children: name.slice(0, 1) })) : (_jsxs(_Fragment, { children: [_jsx("img", { loading: 'lazy', src: logoUrl, alt: '', width: 40, height: 40, className: classNames({
|
|
24
|
+
'seam-ecosystem-light-only': hasDarkLogo,
|
|
25
|
+
}) }), hasDarkLogo && (_jsx("img", { loading: 'lazy', src: darkLogoUrl, alt: '', width: 40, height: 40, className: 'seam-ecosystem-dark-only' }))] })) }), _jsx("h3", { className: 'seam-supported-devices-section-title', children: name }), _jsx("span", { className: 'seam-supported-devices-count', children: t.count(deviceModels.length) })] }), _jsx("ul", { className: 'seam-supported-devices-rows', children: visibleDeviceModels.map((deviceModel) => (_jsx(DeviceModelRow, { deviceModel: deviceModel, manufacturer: manufacturer }, deviceModel.device_model_id))) }), canExpand && (_jsx("div", { className: 'seam-supported-devices-section-footer', children: _jsx("button", { type: 'button', className: 'seam-ecosystem-button', "aria-expanded": expanded, onClick: () => {
|
|
26
|
+
setExpanded((expanded) => !expanded);
|
|
27
|
+
}, children: expanded ? t.showLess : t.showAll(name, deviceModels.length) }) }))] }));
|
|
28
|
+
}
|
|
29
|
+
const t = {
|
|
30
|
+
other: 'Other devices',
|
|
31
|
+
count: (count) => `${count} ${count === 1 ? 'device' : 'devices'}`,
|
|
32
|
+
showAll: (name, count) => `Show all ${count} ${name} devices`,
|
|
33
|
+
showLess: 'Show less',
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=ManufacturerSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManufacturerSection.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GAEpB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,wDAAwD,CAAA;AAGvF,uEAAuE;AACvE,MAAM,cAAc,GAAG,CAAC,CAAA;AAQxB,MAAM,UAAU,mBAAmB,CAAC,EAClC,KAAK,EACL,YAAY,EACZ,WAAW,GACc;IACzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE/C,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAA;IAC9B,MAAM,SAAS,GAAG,WAAW,IAAI,YAAY,CAAC,MAAM,GAAG,cAAc,CAAA;IACrE,MAAM,mBAAmB,GACvB,SAAS,IAAI,CAAC,QAAQ;QACpB,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,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C,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,GACxB,IACH,EACN,aAAI,SAAS,EAAC,6BAA6B,YACxC,mBAAmB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CACxC,KAAC,cAAc,IAEb,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,IAFrB,WAAW,CAAC,eAAe,CAGhC,CACH,CAAC,GACC,EACJ,SAAS,IAAI,CACZ,cAAK,SAAS,EAAC,uCAAuC,YACpD,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,uBAAuB,mBAClB,QAAQ,EACvB,OAAO,EAAE,GAAG,EAAE;wBACZ,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;oBACtC,CAAC,YAEA,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GACtD,GACL,CACP,IACO,CACX,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE;IAC1E,OAAO,EAAE,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,YAAY,KAAK,IAAI,IAAI,UAAU;IAC7E,QAAQ,EAAE,WAAW;CACtB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type EcosystemTheme } from '../../../../lib/ui/ecosystem/theme.js';
|
|
3
|
+
export interface SupportedDevicesProps {
|
|
4
|
+
/**
|
|
5
|
+
* DeviceDB manufacturer slug, e.g., `schlage`.
|
|
6
|
+
* Defaults to the manufacturer of a manufacturer embed key.
|
|
7
|
+
*/
|
|
8
|
+
manufacturer?: string | undefined;
|
|
9
|
+
/** DeviceDB device type slug, e.g., `smartlock` or `thermostat`. */
|
|
10
|
+
deviceType?: string | undefined;
|
|
11
|
+
/** Only devices supporting this capability, e.g., `can_program_online_access_codes`. */
|
|
12
|
+
capability?: string | undefined;
|
|
13
|
+
hideSearch?: boolean | undefined;
|
|
14
|
+
hideFilters?: boolean | undefined;
|
|
15
|
+
hideTitle?: boolean | undefined;
|
|
16
|
+
/** Color theme. `auto` follows the visitor's color scheme. */
|
|
17
|
+
theme?: EcosystemTheme | undefined;
|
|
18
|
+
className?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Device models that work with Seam, grouped by manufacturer,
|
|
22
|
+
* with device type and capability badges.
|
|
23
|
+
*/
|
|
24
|
+
export declare function SupportedDevices({ manufacturer, deviceType, capability, hideSearch, hideFilters, hideTitle, theme, className, }: SupportedDevicesProps): JSX.Element;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { useDeferredValue, useMemo, useState } from 'react';
|
|
4
|
+
import { applyEmbedExclusions, capabilityLabels, filterDeviceModels, getCapabilityOptions, getDeviceTypeOptions, getManufacturerName, getManufacturerOptions, groupDeviceModelsByManufacturer, } from '../../../../lib/seam/components/SupportedDevices/device-models.js';
|
|
5
|
+
import { FilterSelect } from '../../../../lib/seam/components/SupportedDevices/FilterSelect.js';
|
|
6
|
+
import { ManufacturerSection } from '../../../../lib/seam/components/SupportedDevices/ManufacturerSection.js';
|
|
7
|
+
import { useEcosystemContext } from '../../../../lib/seam/ecosystem/EcosystemProvider.js';
|
|
8
|
+
import { useEcosystemDeviceModels } from '../../../../lib/seam/ecosystem/use-ecosystem-device-models.js';
|
|
9
|
+
import { useEcosystemManufacturers } from '../../../../lib/seam/ecosystem/use-ecosystem-manufacturers.js';
|
|
10
|
+
import { getEmbedKeyManufacturer, useEmbedKeyResolution, } from '../../../../lib/seam/ecosystem/use-embed-key-resolution.js';
|
|
11
|
+
import { getEcosystemErrorMessage } from '../../../../lib/ui/ecosystem/errors.js';
|
|
12
|
+
import { SearchField } from '../../../../lib/ui/ecosystem/SearchField.js';
|
|
13
|
+
import { StateMessage } from '../../../../lib/ui/ecosystem/StateMessage.js';
|
|
14
|
+
import { getEcosystemThemeClassName, } from '../../../../lib/ui/ecosystem/theme.js';
|
|
15
|
+
/**
|
|
16
|
+
* Device models that work with Seam, grouped by manufacturer,
|
|
17
|
+
* with device type and capability badges.
|
|
18
|
+
*/
|
|
19
|
+
export function SupportedDevices({ manufacturer, deviceType, capability, hideSearch = false, hideFilters = false, hideTitle = false, theme = 'light', className, }) {
|
|
20
|
+
const { embedKey } = useEcosystemContext();
|
|
21
|
+
const explicitManufacturer = normalizeSlug(manufacturer);
|
|
22
|
+
const fixedDeviceType = normalizeSlug(deviceType);
|
|
23
|
+
const fixedCapability = normalizeSlug(capability);
|
|
24
|
+
const { embedResolution, isError: isResolutionError, error: resolutionError, refetch: refetchResolution, } = useEmbedKeyResolution({ capability: fixedCapability ?? '' });
|
|
25
|
+
const isResolved = embedKey == null || embedResolution != null;
|
|
26
|
+
const scopeManufacturer = explicitManufacturer ?? getEmbedKeyManufacturer(embedResolution);
|
|
27
|
+
const { deviceModels, isError: isDeviceModelsError, error: deviceModelsError, refetch: refetchDeviceModels, } = useEcosystemDeviceModels({
|
|
28
|
+
manufacturer: scopeManufacturer ?? '',
|
|
29
|
+
deviceType: fixedDeviceType ?? '',
|
|
30
|
+
capability: fixedCapability != null && fixedCapability in capabilityLabels
|
|
31
|
+
? fixedCapability
|
|
32
|
+
: '',
|
|
33
|
+
enabled: (explicitManufacturer != null || isResolved) && !isResolutionError,
|
|
34
|
+
});
|
|
35
|
+
const availableDeviceModels = useMemo(() => applyEmbedExclusions(deviceModels ?? [], embedResolution?.exclusions), [deviceModels, embedResolution]);
|
|
36
|
+
const manufacturerSlugs = useMemo(() => availableDeviceModels
|
|
37
|
+
.map((m) => m.manufacturer?.slug)
|
|
38
|
+
.filter((slug) => slug != null), [availableDeviceModels]);
|
|
39
|
+
const { manufacturers } = useEcosystemManufacturers({
|
|
40
|
+
slugs: manufacturerSlugs,
|
|
41
|
+
enabled: manufacturerSlugs.length > 0,
|
|
42
|
+
});
|
|
43
|
+
const manufacturersBySlug = useMemo(() => new Map((manufacturers ?? []).map((m) => [m.slug, m])), [manufacturers]);
|
|
44
|
+
const [searchValue, setSearchValue] = useState('');
|
|
45
|
+
const [selectedManufacturer, setSelectedManufacturer] = useState(null);
|
|
46
|
+
const [selectedDeviceType, setSelectedDeviceType] = useState(null);
|
|
47
|
+
const [selectedCapability, setSelectedCapability] = useState(null);
|
|
48
|
+
const search = useDeferredValue(searchValue);
|
|
49
|
+
const filteredDeviceModels = useMemo(() => filterDeviceModels(availableDeviceModels, {
|
|
50
|
+
manufacturer: scopeManufacturer ?? selectedManufacturer,
|
|
51
|
+
deviceType: fixedDeviceType ?? selectedDeviceType,
|
|
52
|
+
capability: fixedCapability ?? selectedCapability,
|
|
53
|
+
search,
|
|
54
|
+
}), [
|
|
55
|
+
availableDeviceModels,
|
|
56
|
+
scopeManufacturer,
|
|
57
|
+
selectedManufacturer,
|
|
58
|
+
fixedDeviceType,
|
|
59
|
+
selectedDeviceType,
|
|
60
|
+
fixedCapability,
|
|
61
|
+
selectedCapability,
|
|
62
|
+
search,
|
|
63
|
+
]);
|
|
64
|
+
const groups = useMemo(() => groupDeviceModelsByManufacturer(filteredDeviceModels), [filteredDeviceModels]);
|
|
65
|
+
const manufacturerOptions = useMemo(() => getManufacturerOptions(availableDeviceModels), [availableDeviceModels]);
|
|
66
|
+
const deviceTypeOptions = useMemo(() => getDeviceTypeOptions(availableDeviceModels), [availableDeviceModels]);
|
|
67
|
+
const capabilityOptions = useMemo(() => getCapabilityOptions(availableDeviceModels), [availableDeviceModels]);
|
|
68
|
+
const showManufacturerFilter = scopeManufacturer == null && manufacturerOptions.length > 1;
|
|
69
|
+
const showDeviceTypeFilter = fixedDeviceType == null && deviceTypeOptions.length > 1;
|
|
70
|
+
const showCapabilityFilter = fixedCapability == null && capabilityOptions.length > 1;
|
|
71
|
+
const hasUserFilters = searchValue.trim().length > 0 ||
|
|
72
|
+
selectedManufacturer != null ||
|
|
73
|
+
selectedDeviceType != null ||
|
|
74
|
+
selectedCapability != null;
|
|
75
|
+
const resetFilters = () => {
|
|
76
|
+
setSearchValue('');
|
|
77
|
+
setSelectedManufacturer(null);
|
|
78
|
+
setSelectedDeviceType(null);
|
|
79
|
+
setSelectedCapability(null);
|
|
80
|
+
};
|
|
81
|
+
const isError = isResolutionError || isDeviceModelsError;
|
|
82
|
+
const isLoading = !isError && (!isResolved || deviceModels == null);
|
|
83
|
+
const scopedManufacturerName = scopeManufacturer == null
|
|
84
|
+
? null
|
|
85
|
+
: getScopedManufacturerName(scopeManufacturer, manufacturersBySlug.get(scopeManufacturer), availableDeviceModels[0]?.manufacturer?.display_name);
|
|
86
|
+
const title = scopedManufacturerName == null
|
|
87
|
+
? t.title
|
|
88
|
+
: t.manufacturerTitle(scopedManufacturerName);
|
|
89
|
+
const content = (() => {
|
|
90
|
+
if (isError) {
|
|
91
|
+
const { message, canRetry } = getEcosystemErrorMessage(isResolutionError ? resolutionError : deviceModelsError, t.error);
|
|
92
|
+
return (_jsx(StateMessage, { role: 'alert', ...(canRetry
|
|
93
|
+
? {
|
|
94
|
+
actionLabel: t.retry,
|
|
95
|
+
onAction: () => {
|
|
96
|
+
if (isResolutionError)
|
|
97
|
+
void refetchResolution();
|
|
98
|
+
if (isDeviceModelsError)
|
|
99
|
+
void refetchDeviceModels();
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
: {}), children: message }));
|
|
103
|
+
}
|
|
104
|
+
if (isLoading)
|
|
105
|
+
return _jsx(LoadingRows, {});
|
|
106
|
+
if (availableDeviceModels.length === 0) {
|
|
107
|
+
return _jsx(StateMessage, { children: t.noDevices });
|
|
108
|
+
}
|
|
109
|
+
if (filteredDeviceModels.length === 0) {
|
|
110
|
+
return (_jsx(StateMessage, { ...(hasUserFilters
|
|
111
|
+
? { actionLabel: t.clearFilters, onAction: resetFilters }
|
|
112
|
+
: {}), children: hasUserFilters ? t.noMatches : t.noDevices }));
|
|
113
|
+
}
|
|
114
|
+
return (_jsx("div", { className: 'seam-supported-devices-sections', children: groups.map((group) => (_jsx(ManufacturerSection, { group: group, manufacturer: manufacturersBySlug.get(group.key) ?? null, collapsible: groups.length > 1 }, group.key))) }));
|
|
115
|
+
})();
|
|
116
|
+
const showFilters = !hideFilters &&
|
|
117
|
+
(showManufacturerFilter || showDeviceTypeFilter || showCapabilityFilter);
|
|
118
|
+
const controlsDisabled = isLoading || isError;
|
|
119
|
+
return (_jsxs("div", { className: classNames('seam-ecosystem', 'seam-supported-devices', getEcosystemThemeClassName(theme), className), children: [(!hideTitle || !hideSearch || showFilters) && (_jsxs("div", { className: 'seam-ecosystem-header', children: [!hideTitle && _jsx("h2", { className: 'seam-ecosystem-title', children: title }), _jsxs("div", { className: 'seam-ecosystem-controls', children: [showFilters && showManufacturerFilter && (_jsx(FilterSelect, { label: t.manufacturer, allLabel: t.allManufacturers, options: manufacturerOptions, value: selectedManufacturer, onChange: setSelectedManufacturer, disabled: controlsDisabled })), showFilters && showDeviceTypeFilter && (_jsx(FilterSelect, { label: t.deviceType, allLabel: t.allDeviceTypes, options: deviceTypeOptions, value: selectedDeviceType, onChange: setSelectedDeviceType, disabled: controlsDisabled })), showFilters && showCapabilityFilter && (_jsx(FilterSelect, { label: t.capability, allLabel: t.allCapabilities, options: capabilityOptions, value: selectedCapability, onChange: setSelectedCapability, disabled: controlsDisabled })), !hideSearch && (_jsx(SearchField, { label: t.search, value: searchValue, onChange: setSearchValue, disabled: controlsDisabled }))] })] })), content] }));
|
|
120
|
+
}
|
|
121
|
+
function LoadingRows() {
|
|
122
|
+
return (_jsx("div", { className: 'seam-supported-devices-sections', "aria-busy": 'true', children: _jsxs("section", { className: 'seam-supported-devices-section', children: [_jsxs("div", { className: 'seam-supported-devices-section-header', children: [_jsx("div", { className: 'seam-ecosystem-skeleton seam-supported-devices-logo' }), _jsx("div", { className: 'seam-ecosystem-skeleton seam-ecosystem-skeleton-line-short' })] }), _jsx("ul", { className: 'seam-supported-devices-rows', children: Array.from({ length: 3 }, (_, index) => (_jsxs("li", { className: 'seam-supported-devices-row', children: [_jsx("div", { className: 'seam-ecosystem-skeleton seam-supported-devices-image' }), _jsxs("div", { className: 'seam-supported-devices-info', children: [_jsx("div", { className: 'seam-ecosystem-skeleton seam-ecosystem-skeleton-line' }), _jsx("div", { className: 'seam-ecosystem-skeleton seam-ecosystem-skeleton-line-short' })] })] }, index))) })] }) }));
|
|
123
|
+
}
|
|
124
|
+
const normalizeSlug = (value) => {
|
|
125
|
+
const slug = value?.trim();
|
|
126
|
+
if (slug == null || slug.length === 0)
|
|
127
|
+
return null;
|
|
128
|
+
return slug;
|
|
129
|
+
};
|
|
130
|
+
const getScopedManufacturerName = (slug, manufacturer, fallback) => {
|
|
131
|
+
if (manufacturer != null)
|
|
132
|
+
return getManufacturerName(manufacturer);
|
|
133
|
+
return fallback ?? slug;
|
|
134
|
+
};
|
|
135
|
+
const t = {
|
|
136
|
+
title: 'Supported devices',
|
|
137
|
+
manufacturerTitle: (name) => `Supported ${name} devices`,
|
|
138
|
+
search: 'Search devices',
|
|
139
|
+
manufacturer: 'Manufacturer',
|
|
140
|
+
allManufacturers: 'All manufacturers',
|
|
141
|
+
deviceType: 'Device type',
|
|
142
|
+
allDeviceTypes: 'All device types',
|
|
143
|
+
capability: 'Capability',
|
|
144
|
+
allCapabilities: 'All capabilities',
|
|
145
|
+
error: 'An error occurred while loading supported devices.',
|
|
146
|
+
retry: 'Retry',
|
|
147
|
+
noDevices: 'No supported devices found.',
|
|
148
|
+
noMatches: 'No devices match your search or filters.',
|
|
149
|
+
clearFilters: 'Clear filters',
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=SupportedDevices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDevices.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDevices/SupportedDevices.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,uDAAuD,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAA;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAE7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mDAAmD,CAAA;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAA;AAC7F,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAEL,0BAA0B,GAC3B,MAAM,2BAA2B,CAAA;AAoBlC;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,OAAO,EACf,SAAS,GACa;IACtB,MAAM,EAAE,QAAQ,EAAE,GAAG,mBAAmB,EAAE,C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seam/ecosystem/types.js';
|
|
2
|
+
export interface DeviceModelFilters {
|
|
3
|
+
manufacturer?: string | null;
|
|
4
|
+
deviceType?: string | null;
|
|
5
|
+
capability?: string | null;
|
|
6
|
+
search?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SupportedCapability {
|
|
9
|
+
name: CapabilityName;
|
|
10
|
+
supported: 'yes' | 'conditionally';
|
|
11
|
+
details: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ManufacturerGroup {
|
|
14
|
+
key: string;
|
|
15
|
+
manufacturer: ManufacturerRef | null;
|
|
16
|
+
deviceModels: DeviceModel[];
|
|
17
|
+
}
|
|
18
|
+
export interface FilterOption {
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}
|
|
22
|
+
/** Capabilities shown as badges, in display order. */
|
|
23
|
+
export declare const capabilityLabels: Partial<Record<CapabilityName, string>>;
|
|
24
|
+
export declare const getCapabilityLabel: (name: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Removes what a partner's embed key says its widgets must not show
|
|
27
|
+
* (Ecosystem `embed/resolve`): excluded manufacturers and device types,
|
|
28
|
+
* unsupported providers, and the provider combinations excluded for the
|
|
29
|
+
* resolved capability. A model left with no provider is removed.
|
|
30
|
+
*/
|
|
31
|
+
export declare const applyEmbedExclusions: (deviceModels: DeviceModel[], exclusions: EmbedExclusions | null | undefined) => DeviceModel[];
|
|
32
|
+
/** The best support for each capability across the model's providers. */
|
|
33
|
+
export declare const getSupportedCapabilities: (deviceModel: DeviceModel) => SupportedCapability[];
|
|
34
|
+
export declare const supportsCapability: (deviceModel: DeviceModel, capability: string) => boolean;
|
|
35
|
+
export declare const filterDeviceModels: (deviceModels: DeviceModel[], { manufacturer, deviceType, capability, search }: DeviceModelFilters) => DeviceModel[];
|
|
36
|
+
export declare const groupDeviceModelsByManufacturer: (deviceModels: DeviceModel[]) => ManufacturerGroup[];
|
|
37
|
+
export declare const getManufacturerOptions: (deviceModels: DeviceModel[]) => FilterOption[];
|
|
38
|
+
export declare const getDeviceTypeOptions: (deviceModels: DeviceModel[]) => FilterOption[];
|
|
39
|
+
export declare const getCapabilityOptions: (deviceModels: DeviceModel[]) => FilterOption[];
|
|
40
|
+
export declare const getDeviceModelName: (deviceModel: DeviceModel) => string;
|
|
41
|
+
export declare const getManufacturerName: (manufacturer: ManufacturerRef | Manufacturer) => string;
|
|
42
|
+
/** The best available image URL for a device model. */
|
|
43
|
+
export declare const getDeviceModelImageUrl: (deviceModel: DeviceModel, manufacturer?: Manufacturer | null) => string | null;
|
|
44
|
+
/** The manufacturer's logo, preferring a square logo. */
|
|
45
|
+
export declare const getManufacturerLogoUrl: (manufacturer: Manufacturer | null | undefined, { mono }?: {
|
|
46
|
+
mono?: boolean | undefined;
|
|
47
|
+
}) => string | null;
|