@seamapi/react 1.23.0 → 1.25.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 +1 -1
- package/dist/elements.js +5077 -4846
- package/dist/elements.js.map +1 -1
- package/dist/index.css +160 -45
- 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/AccessCodeTable/AccessCodeTable.d.ts +2 -2
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceHealthBar.d.ts +3 -2
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js +23 -11
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceRow.js +19 -1
- package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceTable.d.ts +2 -2
- package/lib/seam/components/DeviceTable/DeviceTable.js +6 -2
- package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +5 -0
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js +8 -0
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +8 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js +14 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js +45 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +36 -11
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js +12 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js +12 -4
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js +12 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +4 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js +19 -5
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.d.ts +2 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js +15 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +5 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +9 -2
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js.map +1 -1
- package/lib/seam/devices/use-device-providers.d.ts +5 -0
- package/lib/seam/devices/use-device-providers.js +17 -0
- package/lib/seam/devices/use-device-providers.js.map +1 -0
- package/lib/ui/device/OnlineStatus.js +14 -4
- package/lib/ui/device/OnlineStatus.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.element.ts +1 -0
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.element.ts +1 -0
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +2 -2
- package/src/lib/seam/components/DeviceDetails/DeviceDetails.element.ts +1 -0
- package/src/lib/seam/components/DeviceTable/DeviceHealthBar.tsx +49 -19
- package/src/lib/seam/components/DeviceTable/DeviceRow.tsx +48 -9
- package/src/lib/seam/components/DeviceTable/DeviceTable.element.ts +1 -0
- package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +16 -4
- package/src/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.tsx +11 -0
- package/src/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.tsx +32 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.tsx +96 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +62 -16
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +27 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +22 -3
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.tsx +49 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx +52 -20
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.element.ts +1 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +4 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-device-provider.ts +22 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +21 -4
- package/src/lib/seam/devices/use-device-providers.ts +25 -0
- package/src/lib/ui/device/OnlineStatus.tsx +23 -7
- package/src/lib/version.ts +1 -1
- package/src/styles/_access-code-details.scss +1 -1
- package/src/styles/_buttons.scss +3 -3
- package/src/styles/_colors.scss +6 -2
- package/src/styles/_device-table.scss +4 -0
- package/src/styles/_menus.scss +1 -1
- package/src/styles/_supported-device-table.scss +192 -52
- package/src/styles/_tables.scss +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.d.ts +0 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js +0 -12
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js.map +0 -1
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.tsx +0 -22
|
@@ -4,13 +4,13 @@ type Device = UseDevicesData[number];
|
|
|
4
4
|
export interface DeviceTableProps {
|
|
5
5
|
deviceIds?: string[];
|
|
6
6
|
connectedAccountIds?: string[];
|
|
7
|
+
disableLockUnlock?: boolean;
|
|
7
8
|
deviceFilter?: (device: Device, searchInputValue: string) => boolean;
|
|
8
9
|
deviceComparator?: (deviceA: Device, deviceB: Device) => number;
|
|
9
10
|
onDeviceClick?: (deviceId: string) => void;
|
|
10
11
|
preventDefaultOnDeviceClick?: boolean;
|
|
11
|
-
disableLockUnlock?: boolean;
|
|
12
12
|
onBack?: () => void;
|
|
13
13
|
className?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function DeviceTable({ deviceIds, connectedAccountIds, onDeviceClick, preventDefaultOnDeviceClick,
|
|
15
|
+
export declare function DeviceTable({ deviceIds, connectedAccountIds, disableLockUnlock, onDeviceClick, preventDefaultOnDeviceClick, onBack, deviceFilter, deviceComparator, className, }?: DeviceTableProps): JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -20,7 +20,7 @@ const defaultDeviceFilter = (device, searchInputValue) => {
|
|
|
20
20
|
return true;
|
|
21
21
|
return new RegExp(value, 'i').test(device.properties.name ?? '');
|
|
22
22
|
};
|
|
23
|
-
export function DeviceTable({ deviceIds, connectedAccountIds, onDeviceClick = () => { }, preventDefaultOnDeviceClick = false,
|
|
23
|
+
export function DeviceTable({ deviceIds, connectedAccountIds, disableLockUnlock = false, onDeviceClick = () => { }, preventDefaultOnDeviceClick = false, onBack, deviceFilter = defaultDeviceFilter, deviceComparator = compareByCreatedAtDesc, className, } = {}) {
|
|
24
24
|
const { devices, isLoading, isError, error } = useDevices({
|
|
25
25
|
device_ids: deviceIds,
|
|
26
26
|
connected_account_ids: connectedAccountIds,
|
|
@@ -60,8 +60,12 @@ function Content(props) {
|
|
|
60
60
|
if (filter === null) {
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
|
+
if (filter === 'account_issues') {
|
|
64
|
+
return (device.errors.filter((error) => 'is_connected_account_error' in error)
|
|
65
|
+
.length > 0);
|
|
66
|
+
}
|
|
63
67
|
if (filter === 'device_issues') {
|
|
64
|
-
return device.errors.length > 0;
|
|
68
|
+
return (device.errors.filter((error) => 'is_device_error' in error).length > 0);
|
|
65
69
|
}
|
|
66
70
|
return true;
|
|
67
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/DeviceTable/DeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAA;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"DeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/DeviceTable/DeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,OAAO,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C,CACd,CAAA;SACF;QAED,IAAI,MAAM,KAAK,eAAe,EAAE;YAC9B,OAAO,CACL,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,IAAI,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CACvE,CAAA;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;IAEF,OAAO,CACL,8BACE,KAAC,eAAe,IACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,SAAS,GACzB,EACD,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC/B,KAAC,SAAS,IACR,MAAM,EAAE,MAAM,EAEd,OAAO,EAAE,GAAG,EAAE;oBACZ,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;gBACjC,CAAC,IAHI,MAAM,CAAC,SAAS,CAIrB,CACH,CAAC,IACD,CACJ,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,8BAA8B;CACjD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HiddenDevicesOverlay.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.tsx"],"names":[],"mappings":";AAIA,MAAM,UAAU,oBAAoB,CAAC,EAAE,OAAO,EAA6B;IACzE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,cAAK,SAAS,EAAC,wBAAwB,GAAG,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface ShowAllDevicesButtonProps {
|
|
2
|
+
onClick: () => void;
|
|
3
|
+
visible: boolean;
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
totalDeviceCount: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function ShowAllDevicesButton({ onClick, visible, expanded, totalDeviceCount, }: ShowAllDevicesButtonProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon } from '../../../../lib/icons/ChevronRight.js';
|
|
3
|
+
export function ShowAllDevicesButton({ onClick, visible, expanded, totalDeviceCount, }) {
|
|
4
|
+
if (!visible) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const label = expanded ? t.showLess : t.showAll(totalDeviceCount);
|
|
8
|
+
return (_jsxs("button", { className: 'show-all-devices-button', onClick: onClick, children: [_jsx(ChevronRightIcon, {}), " ", label] }));
|
|
9
|
+
}
|
|
10
|
+
const t = {
|
|
11
|
+
showLess: 'Show less',
|
|
12
|
+
showAll: (count) => `See all ${count} devices`,
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ShowAllDevicesButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowAllDevicesButton.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAS5D,MAAM,UAAU,oBAAoB,CAAC,EACnC,OAAO,EACP,OAAO,EACP,QAAQ,EACR,gBAAgB,GACU;IAC1B,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAEjE,OAAO,CACL,kBAAQ,SAAS,EAAC,yBAAyB,EAAC,OAAO,EAAE,OAAO,aAC1D,KAAC,gBAAgB,KAAG,OAAE,KAAK,IACpB,CACV,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,WAAW,KAAK,UAAU;CACvD,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DeviceModel } from 'seamapi';
|
|
3
|
+
export interface SupportedDeviceBrandSectionProps {
|
|
4
|
+
brand: string;
|
|
5
|
+
deviceModels: DeviceModel[];
|
|
6
|
+
}
|
|
7
|
+
export declare function SupportedDeviceBrandSection({ brand, deviceModels, }: SupportedDeviceBrandSectionProps): JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { ChevronRightIcon } from '../../../../lib/icons/ChevronRight.js';
|
|
4
|
+
import { HiddenDevicesOverlay } from '../../../../lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js';
|
|
5
|
+
import { ShowAllDevicesButton } from '../../../../lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js';
|
|
6
|
+
import { SupportedDeviceRow } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js';
|
|
7
|
+
import { useDeviceProvider } from '../../../../lib/seam/components/SupportedDeviceTable/use-device-provider.js';
|
|
8
|
+
import { useToggle } from '../../../../lib/ui/use-toggle.js';
|
|
9
|
+
/**
|
|
10
|
+
* How many device models required before we collapse
|
|
11
|
+
* the list, and require the user to click to
|
|
12
|
+
* view all.
|
|
13
|
+
*/
|
|
14
|
+
const maxDevicesBeforeCollapsing = 3;
|
|
15
|
+
export function SupportedDeviceBrandSection({ brand, deviceModels, }) {
|
|
16
|
+
const deviceProvider = useDeviceProvider(brand);
|
|
17
|
+
const [expanded, toggleExpand] = useToggle();
|
|
18
|
+
const canExpand = deviceModels.length > maxDevicesBeforeCollapsing;
|
|
19
|
+
const visibleDevices = () => {
|
|
20
|
+
if (!canExpand || expanded) {
|
|
21
|
+
return deviceModels;
|
|
22
|
+
}
|
|
23
|
+
return deviceModels.filter((_deviceModel, index) => index < maxDevicesBeforeCollapsing);
|
|
24
|
+
};
|
|
25
|
+
const handleHeaderClick = () => {
|
|
26
|
+
if (!canExpand) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
toggleExpand();
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs("div", { className: classNames('seam-brand-section', {
|
|
32
|
+
'can-expand': canExpand,
|
|
33
|
+
expanded,
|
|
34
|
+
}), children: [_jsxs("div", { className: 'seam-header', onClick: handleHeaderClick, children: [_jsx("img", { src: deviceProvider.image_url, alt: brand, className: 'seam-brand-image' }), _jsxs("h5", { className: 'seam-brand-name', children: [deviceProvider.display_name, " ", t.devices] }), canExpand && _jsx(ChevronRightIcon, { className: 'chevron' })] }), _jsx("div", { className: 'seam-supported-device-table-content', children: visibleDevices().map((deviceModel, index) => (_jsx(SupportedDeviceRow, { deviceModel: deviceModel }, [
|
|
35
|
+
deviceModel.main_category,
|
|
36
|
+
deviceModel.brand,
|
|
37
|
+
deviceModel.model_name,
|
|
38
|
+
deviceModel.manufacturer_model_id,
|
|
39
|
+
index,
|
|
40
|
+
].join(':')))) }), _jsx(ShowAllDevicesButton, { visible: canExpand, onClick: toggleExpand, expanded: expanded, totalDeviceCount: deviceModels.length }), _jsx(HiddenDevicesOverlay, { visible: canExpand && !expanded })] }));
|
|
41
|
+
}
|
|
42
|
+
const t = {
|
|
43
|
+
devices: 'Devices',
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=SupportedDeviceBrandSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDeviceBrandSection.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,OAA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B,GAC5B,EACF,cAAI,SAAS,EAAC,iBAAiB,aAC5B,cAAc,CAAC,YAAY,OAAG,CAAC,CAAC,OAAO,IACrC,EACJ,SAAS,IAAI,KAAC,gBAAgB,IAAC,SAAS,EAAC,SAAS,GAAG,IAClD,EACN,cAAK,SAAS,EAAC,qCAAqC,YACjD,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,KAAC,kBAAkB,IAQjB,WAAW,EAAE,WAAW,IAPnB;oBACH,WAAW,CAAC,aAAa;oBACzB,WAAW,CAAC,KAAK;oBACjB,WAAW,CAAC,UAAU;oBACtB,WAAW,CAAC,qBAAqB;oBACjC,KAAK;iBACN,CAAC,IAAI,CAAC,GAAG,CAAC,CAEX,CACH,CAAC,GACE,EACN,KAAC,oBAAoB,IACnB,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,YAAY,CAAC,MAAM,GACrC,EACF,KAAC,oBAAoB,IAAC,OAAO,EAAE,SAAS,IAAI,CAAC,QAAQ,GAAI,IACrD,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -4,6 +4,7 @@ interface SupportedDeviceContentProps {
|
|
|
4
4
|
filterValue: string;
|
|
5
5
|
resetFilterValue: () => void;
|
|
6
6
|
filters: DeviceModelFilters;
|
|
7
|
+
brands: string[];
|
|
7
8
|
}
|
|
8
|
-
export declare function SupportedDeviceContent({ resetFilterValue, filterValue, filters, }: SupportedDeviceContentProps): JSX.Element | null;
|
|
9
|
+
export declare function SupportedDeviceContent({ resetFilterValue, filterValue, filters, brands, }: SupportedDeviceContentProps): JSX.Element | null;
|
|
9
10
|
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SupportedDeviceBrandSection } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js';
|
|
3
|
+
import { SupportedDeviceFilterResultRow } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js';
|
|
4
4
|
import { useFilteredDeviceModels, } from '../../../../lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js';
|
|
5
5
|
import { Button } from '../../../../lib/ui/Button.js';
|
|
6
|
-
export function SupportedDeviceContent({ resetFilterValue, filterValue, filters, }) {
|
|
7
|
-
const { deviceModels, isLoading, isError, refetch } = useFilteredDeviceModels(
|
|
6
|
+
export function SupportedDeviceContent({ resetFilterValue, filterValue, filters, brands, }) {
|
|
7
|
+
const { deviceModels, isLoading, isError, refetch } = useFilteredDeviceModels({
|
|
8
|
+
filterValue,
|
|
9
|
+
filters,
|
|
10
|
+
brands,
|
|
11
|
+
});
|
|
8
12
|
if (isLoading) {
|
|
9
13
|
return (_jsx("div", { className: 'seam-supported-device-table-content-state-block', children: _jsx("p", { children: t.loading }) }));
|
|
10
14
|
}
|
|
@@ -16,18 +20,39 @@ export function SupportedDeviceContent({ resetFilterValue, filterValue, filters,
|
|
|
16
20
|
if (deviceModels == null) {
|
|
17
21
|
return null;
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const isEmpty = deviceModels.length === 0;
|
|
24
|
+
if (isEmpty) {
|
|
25
|
+
return (_jsx("div", { className: 'seam-supported-device-table-content', children: _jsx(EmptyResult, { filterValue: filterValue, resetFilterValue: resetFilterValue }) }));
|
|
26
|
+
}
|
|
27
|
+
// If there are no active filters or search, show all the rows without any brand sections.
|
|
28
|
+
const hasFilters = filterValue.trim() !== '' ||
|
|
29
|
+
filters.supportedOnly ||
|
|
30
|
+
filters.category !== null ||
|
|
31
|
+
filters.brand !== null;
|
|
32
|
+
if (hasFilters) {
|
|
33
|
+
return (_jsx("div", { className: 'seam-supported-device-table-content', children: deviceModels.map((deviceModel, index) => (_jsx(SupportedDeviceFilterResultRow, { deviceModel: deviceModel }, [
|
|
34
|
+
deviceModel.main_category,
|
|
35
|
+
deviceModel.brand,
|
|
36
|
+
deviceModel.model_name,
|
|
37
|
+
deviceModel.manufacturer_model_id,
|
|
38
|
+
index,
|
|
39
|
+
].join(':')))) }));
|
|
40
|
+
}
|
|
41
|
+
return (_jsx(_Fragment, { children: Object.entries(groupDeviceModelsByBrand(deviceModels)).map(([brand, models]) => (_jsx(SupportedDeviceBrandSection, { brand: brand, deviceModels: models }, brand))) }));
|
|
26
42
|
}
|
|
27
43
|
function EmptyResult({ filterValue, resetFilterValue, }) {
|
|
28
44
|
const noMatchingRows = (_jsxs(_Fragment, { children: [_jsx("p", { children: t.noMatch }), _jsx(Button, { variant: 'outline', size: 'small', onClick: resetFilterValue, className: 'seam-supported-device-table-content-message-clear-search', children: t.clear })] }));
|
|
29
45
|
return (_jsx("tr", { className: 'seam-supported-device-table-content-message-row', children: _jsx("td", { colSpan: 6, children: _jsx("div", { className: 'seam-supported-device-table-content-message', children: filterValue.length === 0 ? _jsx("p", { children: t.noneFound }) : noMatchingRows }) }) }));
|
|
30
46
|
}
|
|
47
|
+
function groupDeviceModelsByBrand(deviceModels) {
|
|
48
|
+
const result = {};
|
|
49
|
+
for (const model of deviceModels) {
|
|
50
|
+
const { brand } = model;
|
|
51
|
+
const list = result[brand] ?? [];
|
|
52
|
+
result[brand] = [...list, model];
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
31
56
|
const t = {
|
|
32
57
|
loading: 'Loading device models...',
|
|
33
58
|
retry: 'Retry',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAA;AACrH,OAAO,EAAE,8BAA8B,EAAE,MAAM,iFAAiF,CAAA;AAChI,OAAO,EAEL,uBAAuB,GACxB,MAAM,wEAAwE,CAAA;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AASzC,MAAM,UAAU,sBAAsB,CAAC,EACrC,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,MAAM,GACsB;IAC5B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAC3E;QACE,WAAW;QACX,OAAO;QACP,MAAM;KACP,CACF,CAAA;IAED,IAAI,SAAS,EAAE;QACb,OAAO,CACL,cAAK,SAAS,EAAC,iDAAiD,YAC9D,sBAAI,CAAC,CAAC,OAAO,GAAK,GACd,CACP,CAAA;KACF;IAED,IAAI,OAAO,EAAE;QACX,OAAO,CACL,eAAK,SAAS,EAAC,iDAAiD,aAC9D,sBAAI,CAAC,CAAC,KAAK,GAAK,EAChB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;wBACZ,KAAK,OAAO,EAAE,CAAA;oBAChB,CAAC,YAEA,CAAC,CAAC,KAAK,GACD,IACL,CACP,CAAA;KACF;IAED,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,KAAK,CAAC,CAAA;IACzC,IAAI,OAAO,EAAE;QACX,OAAO,CACL,cAAK,SAAS,EAAC,qCAAqC,YAClD,KAAC,WAAW,IACV,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,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AAS,EAAC,6CAA6C,YACzD,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAI,CAAC,CAAC,SAAS,GAAK,CAAC,CAAC,CAAC,cAAc,GAC7D,GACH,GACF,CACN,CAAA;AACH,CAAC;AAED,SAAS,wBAAwB,CAC/B,YAAiC;IAEjC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAEhD,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;QAChC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;QACvB,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;QAChC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAA;KACjC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,CAAC,GAAG;IACR,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,4CAA4C;IACnD,SAAS,EAAE,yBAAyB;IACpC,OAAO,EAAE,uCAAuC;IAChD,KAAK,EAAE,oBAAoB;CAC5B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UseDeviceModelsData } from '../../../../lib/seam/device-models/use-device-models.js';
|
|
3
|
+
interface SupportedDeviceContentRowsProps {
|
|
4
|
+
deviceModels: UseDeviceModelsData;
|
|
5
|
+
}
|
|
6
|
+
export declare function SupportedDeviceContentRows({ deviceModels, }: SupportedDeviceContentRowsProps): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SupportedDeviceRow } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js';
|
|
3
|
+
export function SupportedDeviceContentRows({ deviceModels, }) {
|
|
4
|
+
return (_jsx("div", { className: 'seam-supported-device-table-content', children: deviceModels.map((deviceModel, index) => (_jsx(SupportedDeviceRow, { deviceModel: deviceModel }, [
|
|
5
|
+
deviceModel.main_category,
|
|
6
|
+
deviceModel.brand,
|
|
7
|
+
deviceModel.model_name,
|
|
8
|
+
deviceModel.manufacturer_model_id,
|
|
9
|
+
index,
|
|
10
|
+
].join(':')))) }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SupportedDeviceContentRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDeviceContentRows.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAOnG,MAAM,UAAU,0BAA0B,CAAC,EACzC,YAAY,GACoB;IAChC,OAAO,CACL,cAAK,SAAS,EAAC,qCAAqC,YACjD,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CACxC,KAAC,kBAAkB,IAQjB,WAAW,EAAE,WAAW,IAPnB;YACH,WAAW,CAAC,aAAa;YACzB,WAAW,CAAC,KAAK;YACjB,WAAW,CAAC,UAAU;YACtB,WAAW,CAAC,qBAAqB;YACjC,KAAK;SACN,CAAC,IAAI,CAAC,GAAG,CAAC,CAEX,CACH,CAAC,GACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -5,5 +5,6 @@ export interface SupportedDeviceFilterAreaProps {
|
|
|
5
5
|
setFilterValue: (filter: string) => void;
|
|
6
6
|
filters: DeviceModelFilters;
|
|
7
7
|
setFilters: Dispatch<SetStateAction<DeviceModelFilters>>;
|
|
8
|
+
brands: string[];
|
|
8
9
|
}
|
|
9
|
-
export declare function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, }: SupportedDeviceFilterAreaProps): JSX.Element;
|
|
10
|
+
export declare function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }: SupportedDeviceFilterAreaProps): JSX.Element;
|
|
@@ -5,10 +5,10 @@ import { capitalize } from '../../../../lib/strings.js';
|
|
|
5
5
|
import { Button } from '../../../../lib/ui/Button.js';
|
|
6
6
|
import { Menu } from '../../../../lib/ui/Menu/Menu.js';
|
|
7
7
|
import { SearchTextField } from '../../../../lib/ui/TextField/SearchTextField.js';
|
|
8
|
-
export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, }) {
|
|
8
|
+
export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }) {
|
|
9
9
|
const appliedFiltersCount = Object.values(filters).filter((v) => v != null && v !== false).length;
|
|
10
10
|
const filterProperty = 'brand';
|
|
11
|
-
const availableProperties = useAvailableProperties(filterProperty);
|
|
11
|
+
const availableProperties = useAvailableProperties(filterProperty, { brands });
|
|
12
12
|
const resetFilter = (filterType) => {
|
|
13
13
|
setFilters((filters) => ({
|
|
14
14
|
...filters,
|
|
@@ -35,13 +35,21 @@ export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters
|
|
|
35
35
|
setFilterValue(value);
|
|
36
36
|
}, className: 'seam-supported-device-table-filter-area-search-bar' }) })] })] }));
|
|
37
37
|
}
|
|
38
|
-
const useAvailableProperties = (property) => {
|
|
38
|
+
const useAvailableProperties = (property, options) => {
|
|
39
39
|
const { deviceModels } = useDeviceModels();
|
|
40
40
|
if (deviceModels == null)
|
|
41
41
|
return [];
|
|
42
42
|
const properties = new Set();
|
|
43
43
|
for (const deviceModel of deviceModels) {
|
|
44
|
-
|
|
44
|
+
const value = deviceModel[property];
|
|
45
|
+
// If we're only looking at a subset of brands, such as ["yale", "august"], then we
|
|
46
|
+
// don't want to show other brands in the filter.
|
|
47
|
+
if (property === 'brand' &&
|
|
48
|
+
options.brands.length > 0 &&
|
|
49
|
+
!options.brands.includes(value)) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
properties.add(capitalize(value));
|
|
45
53
|
}
|
|
46
54
|
return Array.from(properties);
|
|
47
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAUrE,MAAM,UAAU,yBAAyB,CAAC,EACxC,WAAW,EACX,cAAc,EACd,OAAO,EACP,UAAU,EACV,MAAM,GACyB;IAC/B,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,CAChC,CAAC,MAAM,CAAA;IAER,MAAM,cAAc,GAAG,OAAO,CAAA;IAC9B,MAAM,m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ACpB,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YACzB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B;YACA,SAAQ;SACT;QAED,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;KAClC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,GAAG;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DeviceModel } from 'seamapi';
|
|
3
|
+
export interface SupportedDeviceFilterResultRowProps {
|
|
4
|
+
deviceModel: DeviceModel;
|
|
5
|
+
}
|
|
6
|
+
export declare function SupportedDeviceFilterResultRow({ deviceModel, }: SupportedDeviceFilterResultRowProps): JSX.Element;
|
|
7
|
+
export declare function ModelColumn({ deviceModel, }: SupportedDeviceFilterResultRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { connectionTypeNames, ImageColumn, StatusColumn, } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js';
|
|
3
|
+
import { useDeviceProvider } from '../../../../lib/seam/components/SupportedDeviceTable/use-device-provider.js';
|
|
4
|
+
import { DotDivider } from '../../../../lib/ui/layout/DotDivider.js';
|
|
5
|
+
export function SupportedDeviceFilterResultRow({ deviceModel, }) {
|
|
6
|
+
return (_jsxs("div", { className: 'seam-row filter-result-row', children: [_jsx(ImageColumn, { deviceModel: deviceModel }), _jsx(ModelColumn, { deviceModel: deviceModel }), _jsx(StatusColumn, { deviceModel: deviceModel })] }));
|
|
7
|
+
}
|
|
8
|
+
export function ModelColumn({ deviceModel, }) {
|
|
9
|
+
const deviceProvider = useDeviceProvider(deviceModel.brand);
|
|
10
|
+
return (_jsxs("div", { className: 'seam-col seam-model-col', children: [_jsxs("div", { className: 'seam-model-name', children: [_jsx("img", { src: deviceProvider.image_url, alt: deviceModel.brand, className: 'seam-brand-image' }), ' ', deviceModel.model_name] }), _jsxs("div", { className: 'seam-model-id', children: [deviceModel.manufacturer_model_id, _jsx(DotDivider, {}), connectionTypeNames[deviceModel.connection_type]] })] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SupportedDeviceFilterResultRowProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDeviceFilterResultRowProps.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gEAAgE,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAA;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAMxD,MAAM,UAAU,8BAA8B,CAAC,EAC7C,WAAW,GACyB;IACpC,OAAO,CACL,eAAK,SAAS,EAAC,4BAA4B,aACzC,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,GAAI,EACzC,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,GAAI,EACzC,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,GAAI,IACtC,CACP,CAAA;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAC1B,WAAW,GACyB;IACpC,MAAM,cAAc,GAAG,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IAE3D,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,eAAK,SAAS,EAAC,iBAAiB,aAC9B,cACE,GAAG,EAAE,cAAc,CAAC,SAAS,EAC7B,GAAG,EAAE,WAAW,CAAC,KAAK,EACtB,SAAS,EAAC,kBAAkB,GAC5B,EAAC,GAAG,EACL,WAAW,CAAC,UAAU,IACnB,EACN,eAAK,SAAS,EAAC,eAAe,aAC3B,WAAW,CAAC,qBAAqB,EAClC,KAAC,UAAU,KAAG,EACb,mBAAmB,CAAC,WAAW,CAAC,eAAe,CAAC,IAC7C,IACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -4,3 +4,7 @@ export interface SupportedDeviceRowProps {
|
|
|
4
4
|
deviceModel: DeviceModel;
|
|
5
5
|
}
|
|
6
6
|
export declare function SupportedDeviceRow({ deviceModel, }: SupportedDeviceRowProps): JSX.Element;
|
|
7
|
+
export declare function ImageColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ModelColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function StatusColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const connectionTypeNames: Record<DeviceModel['connection_type'], string>;
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import {
|
|
3
|
+
import { DotDivider } from '../../../../lib/ui/layout/DotDivider.js';
|
|
4
4
|
export function SupportedDeviceRow({ deviceModel, }) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
return (_jsxs("div", { className: 'seam-row', children: [_jsx(ImageColumn, { deviceModel: deviceModel }), _jsx(ModelColumn, { deviceModel: deviceModel }), _jsx(StatusColumn, { deviceModel: deviceModel })] }));
|
|
6
|
+
}
|
|
7
|
+
export function ImageColumn({ deviceModel }) {
|
|
8
|
+
return (_jsx("div", { className: 'seam-col seam-device-image-col', children: _jsx("div", { className: 'seam-image-box', children: _jsx("img", { width: 40, src: deviceModel.icon_url }) }) }));
|
|
9
|
+
}
|
|
10
|
+
export function ModelColumn({ deviceModel }) {
|
|
11
|
+
return (_jsxs("div", { className: 'seam-col seam-model-col', children: [_jsx("div", { className: 'seam-model-name', children: deviceModel.model_name }), _jsxs("div", { className: 'seam-model-id', children: [deviceModel.manufacturer_model_id, _jsx(DotDivider, {}), connectionTypeNames[deviceModel.connection_type]] })] }));
|
|
12
|
+
}
|
|
13
|
+
export function StatusColumn({ deviceModel }) {
|
|
14
|
+
const statusColor = supportLevelColors[deviceModel.support_level] ?? 'unknown';
|
|
15
|
+
return (_jsx("div", { className: 'seam-col seam-status-col', children: _jsx("div", { className: classNames('seam-status-pill', `status-${statusColor}`), children: _jsx("span", { children: status[deviceModel.support_level] }) }) }));
|
|
7
16
|
}
|
|
8
17
|
const supportLevelColors = {
|
|
9
18
|
live: 'green',
|
|
10
19
|
beta: 'blue',
|
|
11
|
-
unsupported: '
|
|
20
|
+
unsupported: 'unknown',
|
|
21
|
+
};
|
|
22
|
+
const status = {
|
|
23
|
+
live: 'LIVE',
|
|
24
|
+
beta: 'BETA',
|
|
25
|
+
unsupported: 'Inquire',
|
|
12
26
|
};
|
|
13
|
-
const connectionTypeNames = {
|
|
27
|
+
export const connectionTypeNames = {
|
|
14
28
|
wifi: 'Wifi',
|
|
15
29
|
zwave: 'Z-Wave',
|
|
16
30
|
zigbee: 'Zigbee',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YA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pB;IACF,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,SAAS;CACvB,CAAA;AAED,MAAM,MAAM,GAAiD;IAC3D,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,SAAS;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -5,6 +5,7 @@ export interface SupportedDeviceTableProps {
|
|
|
5
5
|
* @deprecated Use disableFilter.
|
|
6
6
|
*/
|
|
7
7
|
cannotFilter?: boolean;
|
|
8
|
+
brands?: string[];
|
|
8
9
|
className?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function SupportedDeviceTable({ disableFilter, cannotFilter, className, }?: SupportedDeviceTableProps): JSX.Element;
|
|
11
|
+
export declare function SupportedDeviceTable({ disableFilter, cannotFilter, brands, className, }?: SupportedDeviceTableProps): JSX.Element;
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { SupportedDeviceContent } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js';
|
|
5
5
|
import { SupportedDeviceFilterArea } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js';
|
|
6
|
-
export function SupportedDeviceTable({ disableFilter = false, cannotFilter, className, } = {}) {
|
|
6
|
+
export function SupportedDeviceTable({ disableFilter = false, cannotFilter, brands = [], className, } = {}) {
|
|
7
7
|
const [filterValue, setFilterValue] = useState('');
|
|
8
8
|
const [filters, setFilters] = useState({
|
|
9
9
|
supportedOnly: false,
|
|
@@ -11,8 +11,8 @@ export function SupportedDeviceTable({ disableFilter = false, cannotFilter, clas
|
|
|
11
11
|
brand: null,
|
|
12
12
|
});
|
|
13
13
|
const hideFilter = cannotFilter ?? disableFilter;
|
|
14
|
-
return (_jsxs("div", { className: classNames('seam-supported-device-table-content-wrap', className), children: [!hideFilter && (_jsx(SupportedDeviceFilterArea, { filterValue: filterValue, setFilterValue: setFilterValue, filters: filters, setFilters: setFilters })), _jsx(SupportedDeviceContent, { resetFilterValue: () => {
|
|
14
|
+
return (_jsxs("div", { className: classNames('seam-supported-device-table-content-wrap', className), children: [!hideFilter && (_jsx(SupportedDeviceFilterArea, { filterValue: filterValue, setFilterValue: setFilterValue, filters: filters, setFilters: setFilters, brands: brands })), _jsx(SupportedDeviceContent, { resetFilterValue: () => {
|
|
15
15
|
setFilterValue('');
|
|
16
|
-
}, filterValue: filterValue, filters: filters })] }));
|
|
16
|
+
}, filterValue: filterValue, filters: filters, brands: brands })] }));
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=SupportedDeviceTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAA;
|
|
1
|
+
{"version":3,"file":"SupportedDeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAA;AAajH,MAAM,UAAU,oBAAoB,CAAC,EACnC,aAAa,GAAG,KAAK,EACrB,YAAY,EACZ,MAAM,GAAG,EAAE,EACX,SAAS,MACoB,EAAE;IAC/B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB;QACzD,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,YAAY,IAAI,aAAa,CAAA;IAEhD,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CACnB,0CAA0C,EAC1C,SAAS,CACV,aAEA,CAAC,UAAU,IAAI,CACd,KAAC,yBAAyB,IACxB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACd,CACH,EACD,KAAC,sBAAsB,IACrB,gBAAgB,EAAE,GAAG,EAAE;oBACrB,cAAc,CAAC,EAAE,CAAC,CAAA;gBACpB,CAAC,EACD,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,IACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useDeviceProviders } from '../../../../lib/seam/devices/use-device-providers.js';
|
|
2
|
+
export function useDeviceProvider(brand) {
|
|
3
|
+
const { deviceProviders } = useDeviceProviders();
|
|
4
|
+
const definedProvider = deviceProviders?.find((provider) => provider.device_provider_name === brand);
|
|
5
|
+
if (definedProvider != null) {
|
|
6
|
+
return definedProvider;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
device_provider_name: 'unknown',
|
|
10
|
+
display_name: 'Unknown',
|
|
11
|
+
image_url: `https://connect.getseam.com/assets/images/logos/seam.png`,
|
|
12
|
+
provider_categories: [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=use-device-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-device-provider.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-device-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAE7E,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAEhD,MAAM,eAAe,GAAG,eAAe,EAAE,IAAI,CAC3C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,oBAAoB,KAAK,KAAK,CACtD,CAAA;IAED,IAAI,eAAe,IAAI,IAAI,EAAE;QAC3B,OAAO,eAAe,CAAA;KACvB;IAED,OAAO;QACL,oBAAoB,EAAE,SAAS;QAC/B,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,0DAA0D;QACrE,mBAAmB,EAAE,EAAE;KACxB,CAAA;AACH,CAAC"}
|
|
@@ -4,4 +4,8 @@ export interface DeviceModelFilters {
|
|
|
4
4
|
category: string | null;
|
|
5
5
|
brand: string | null;
|
|
6
6
|
}
|
|
7
|
-
export declare const useFilteredDeviceModels: (filterValue
|
|
7
|
+
export declare const useFilteredDeviceModels: ({ filterValue, filters, brands, }: {
|
|
8
|
+
filterValue: string;
|
|
9
|
+
filters: DeviceModelFilters;
|
|
10
|
+
brands: string[];
|
|
11
|
+
}) => ReturnType<typeof useDeviceModels>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useDeviceModels, } from '../../../../lib/seam/device-models/use-device-models.js';
|
|
2
|
-
export const useFilteredDeviceModels = (filterValue, filters) => {
|
|
2
|
+
export const useFilteredDeviceModels = ({ filterValue, filters, brands, }) => {
|
|
3
3
|
const params = {};
|
|
4
4
|
if (filterValue.trim() !== '') {
|
|
5
5
|
params.text_search = filterValue.trim();
|
|
@@ -13,6 +13,13 @@ export const useFilteredDeviceModels = (filterValue, filters) => {
|
|
|
13
13
|
if (filters.brand !== null) {
|
|
14
14
|
params.brand = filters.brand;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const query = useDeviceModels(params);
|
|
17
|
+
if (brands.length === 0) {
|
|
18
|
+
return query;
|
|
19
|
+
}
|
|
20
|
+
// If the user only wants models for a collection of brands, such as ["yale", "august"], then
|
|
21
|
+
// we'll filter everything else out here.
|
|
22
|
+
const onlySpecificBrands = query.deviceModels?.filter((deviceModel) => brands.includes(deviceModel.brand));
|
|
23
|
+
return { ...query, deviceModels: onlySpecificBrands };
|
|
17
24
|
};
|
|
18
25
|
//# sourceMappingURL=use-filtered-device-models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,6CAA6C,CAAA;AAQpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,6CAA6C,CAAA;AAQpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,WAAW,EACX,OAAO,EACP,MAAM,GAKP,EAAsC,EAAE;IACvC,MAAM,MAAM,GAA0B,EAAE,CAAA;IAExC,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,aAAa,EAAE;QACzB,MAAM,CAAC,aAAa,GAAG,MAAM,CAAA;KAC9B;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC7B,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE;QAC1B,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;KAC7B;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAErC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,KAAK,CAAA;KACb;IAED,6FAA6F;IAC7F,yCAAyC;IACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CACpE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CACnC,CAAA;IAED,OAAO,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAA;AACvD,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useSeamClient } from '../../../lib/seam/use-seam-client.js';
|
|
3
|
+
export function useDeviceProviders() {
|
|
4
|
+
const { client } = useSeamClient();
|
|
5
|
+
const { data, isLoading } = useQuery({
|
|
6
|
+
queryFn: async () => {
|
|
7
|
+
if (client == null) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return await client?.devices.listDeviceProviders({});
|
|
11
|
+
},
|
|
12
|
+
queryKey: ['devices', 'list_device_providers'],
|
|
13
|
+
enabled: client != null,
|
|
14
|
+
});
|
|
15
|
+
return { deviceProviders: data, isLoading };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-device-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-device-providers.js","sourceRoot":"","sources":["../../../src/lib/seam/devices/use-device-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,MAAM,UAAU,kBAAkB;IAIhC,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAA;IAElC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QACnC,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI,EAAE;gBAClB,OAAO,EAAE,CAAA;aACV;YAED,OAAO,MAAM,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA;QACtD,CAAC;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,uBAAuB,CAAC;QAC9C,OAAO,EAAE,MAAM,IAAI,IAAI;KACxB,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAC7C,CAAC"}
|