@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
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
type CommonProps,
|
|
6
|
-
withRequiredCommonProps,
|
|
7
|
-
} from 'lib/seam/components/common-props.js'
|
|
8
|
-
import { SupportedDeviceContent } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js'
|
|
9
|
-
import { SupportedDeviceFilterArea } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js'
|
|
10
|
-
import type { DeviceModelFilters } from 'lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js'
|
|
11
|
-
import { useComponentTelemetry } from 'lib/telemetry/index.js'
|
|
12
|
-
|
|
13
|
-
export interface SupportedDeviceTableProps extends CommonProps {
|
|
14
|
-
disableFilter?: boolean
|
|
15
|
-
manufacturers?: string[] | null
|
|
16
|
-
excludedManufacturers?: string[]
|
|
17
|
-
includeIf?: string[] | null
|
|
18
|
-
excludeIf?: string[]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const NestedSupportedDeviceTable =
|
|
22
|
-
withRequiredCommonProps(SupportedDeviceTable)
|
|
23
|
-
|
|
24
|
-
export function SupportedDeviceTable({
|
|
25
|
-
disableFilter = false,
|
|
26
|
-
manufacturers = null,
|
|
27
|
-
excludedManufacturers = [],
|
|
28
|
-
includeIf = null,
|
|
29
|
-
excludeIf = [],
|
|
30
|
-
className,
|
|
31
|
-
}: SupportedDeviceTableProps = {}): JSX.Element {
|
|
32
|
-
useComponentTelemetry('SupportedDeviceTable')
|
|
33
|
-
|
|
34
|
-
const [filterValue, setFilterValue] = useState('')
|
|
35
|
-
const [filters, setFilters] = useState<DeviceModelFilters>({
|
|
36
|
-
supportedOnly: true,
|
|
37
|
-
manufacturer: null,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
className={classNames(
|
|
43
|
-
'seam-supported-device-table-content-wrap',
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
>
|
|
47
|
-
{!disableFilter && (
|
|
48
|
-
<SupportedDeviceFilterArea
|
|
49
|
-
filterValue={filterValue}
|
|
50
|
-
setFilterValue={setFilterValue}
|
|
51
|
-
filters={filters}
|
|
52
|
-
setFilters={setFilters}
|
|
53
|
-
manufacturers={manufacturers}
|
|
54
|
-
excludedManufacturers={excludedManufacturers}
|
|
55
|
-
/>
|
|
56
|
-
)}
|
|
57
|
-
<SupportedDeviceContent
|
|
58
|
-
resetFilterValue={() => {
|
|
59
|
-
setFilterValue('')
|
|
60
|
-
}}
|
|
61
|
-
filterValue={filterValue}
|
|
62
|
-
filters={filters}
|
|
63
|
-
manufacturers={manufacturers}
|
|
64
|
-
excludedManufacturers={excludedManufacturers}
|
|
65
|
-
includeIf={includeIf}
|
|
66
|
-
excludeIf={excludeIf}
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
)
|
|
70
|
-
}
|
package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.element.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ElementProps } from 'lib/element.js'
|
|
2
|
-
|
|
3
|
-
import type { SupportedDeviceTableManufacturerKeysProps } from './SupportedDeviceTableManufacturerKeys.js'
|
|
4
|
-
|
|
5
|
-
export const name = 'seam-supported-device-table-manufacturer-keys'
|
|
6
|
-
|
|
7
|
-
export const props: ElementProps<SupportedDeviceTableManufacturerKeysProps> = {}
|
|
8
|
-
|
|
9
|
-
export { SupportedDeviceTableManufacturerKeys as Component } from './SupportedDeviceTableManufacturerKeys.js'
|
package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.tsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Manufacturer } from '@seamapi/types/devicedb'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
import { CopyIcon } from 'lib/icons/Copy.js'
|
|
5
|
-
import {
|
|
6
|
-
type CommonProps,
|
|
7
|
-
withRequiredCommonProps,
|
|
8
|
-
} from 'lib/seam/components/common-props.js'
|
|
9
|
-
import { useComponentTelemetry } from 'lib/telemetry/index.js'
|
|
10
|
-
import { copyToClipboard } from 'lib/ui/clipboard.js'
|
|
11
|
-
import { MenuItem } from 'lib/ui/Menu/MenuItem.js'
|
|
12
|
-
|
|
13
|
-
import { useManufacturers } from './use-manufacturers.js'
|
|
14
|
-
|
|
15
|
-
export interface SupportedDeviceTableManufacturerKeysProps
|
|
16
|
-
extends CommonProps {}
|
|
17
|
-
|
|
18
|
-
export const NestedSupportedDeviceTableManufacturerKeys =
|
|
19
|
-
withRequiredCommonProps(SupportedDeviceTableManufacturerKeys)
|
|
20
|
-
|
|
21
|
-
export function SupportedDeviceTableManufacturerKeys({
|
|
22
|
-
className,
|
|
23
|
-
}: SupportedDeviceTableManufacturerKeysProps = {}): JSX.Element {
|
|
24
|
-
useComponentTelemetry('SupportedDeviceTableManufacturerKeys')
|
|
25
|
-
|
|
26
|
-
const { manufacturers } = useManufacturers()
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div
|
|
30
|
-
className={classNames(
|
|
31
|
-
'supported-device-table-manufacturer-keys',
|
|
32
|
-
className
|
|
33
|
-
)}
|
|
34
|
-
>
|
|
35
|
-
{manufacturers?.map((manufacturer) => (
|
|
36
|
-
<ManufacturerKey
|
|
37
|
-
key={manufacturer.manufacturer_id}
|
|
38
|
-
manufacturer={manufacturer}
|
|
39
|
-
/>
|
|
40
|
-
))}
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function ManufacturerKey({
|
|
46
|
-
manufacturer,
|
|
47
|
-
}: {
|
|
48
|
-
manufacturer: Manufacturer
|
|
49
|
-
}): JSX.Element {
|
|
50
|
-
const key = manufacturer.display_name
|
|
51
|
-
return (
|
|
52
|
-
<div className='seam-manufacturer-key'>
|
|
53
|
-
<div className='seam-manufacturer-key-value'>{key}</div>
|
|
54
|
-
<MenuItem
|
|
55
|
-
className='seam-copy-button'
|
|
56
|
-
onClick={() => {
|
|
57
|
-
void copyToClipboard(key)
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
<CopyIcon />
|
|
61
|
-
</MenuItem>
|
|
62
|
-
</div>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
-
import { useSeamClient } from '@seamapi/react-query'
|
|
3
|
-
import type {
|
|
4
|
-
DeviceModel,
|
|
5
|
-
RouteRequestParams,
|
|
6
|
-
RouteResponse,
|
|
7
|
-
} from '@seamapi/types/devicedb'
|
|
8
|
-
import { useQuery } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
-
|
|
12
|
-
export type UseDeviceModelParams = DeviceModelsGetParams
|
|
13
|
-
|
|
14
|
-
export type UseDeviceModelData = DeviceModel | null
|
|
15
|
-
|
|
16
|
-
export function useDeviceModel(
|
|
17
|
-
params: UseDeviceModelParams
|
|
18
|
-
): UseSeamQueryResultLegacy<'deviceModel', UseDeviceModelData> {
|
|
19
|
-
const { client: seam } = useSeamClient()
|
|
20
|
-
const { data, ...rest } = useQuery<UseDeviceModelData, SeamHttpApiError>({
|
|
21
|
-
enabled: seam != null,
|
|
22
|
-
queryKey: ['internal', 'device_models', 'get', params],
|
|
23
|
-
queryFn: async () => {
|
|
24
|
-
if (seam == null) return null
|
|
25
|
-
const {
|
|
26
|
-
data: { device_model: deviceModel },
|
|
27
|
-
} = await seam.client.get<DeviceModelsGetResponse>(
|
|
28
|
-
'/internal/devicedb/v1/device_models/get',
|
|
29
|
-
{ params }
|
|
30
|
-
)
|
|
31
|
-
// UPSTREAM: Response type does not match DeviceModel.
|
|
32
|
-
return deviceModel as DeviceModel
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
...rest,
|
|
38
|
-
deviceModel: data,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type DeviceModelsGetParams = RouteRequestParams<'/v1/device_models/get'>
|
|
43
|
-
|
|
44
|
-
type DeviceModelsGetResponse = RouteResponse<'/v1/device_models/get'>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
-
import { useSeamClient } from '@seamapi/react-query'
|
|
3
|
-
import type {
|
|
4
|
-
DeviceModel,
|
|
5
|
-
RouteRequestParams,
|
|
6
|
-
RouteResponse,
|
|
7
|
-
} from '@seamapi/types/devicedb'
|
|
8
|
-
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
-
|
|
12
|
-
export type UseDeviceModelsParams = DeviceModelsListParams
|
|
13
|
-
|
|
14
|
-
export type UseDeviceModelsData = DeviceModel[]
|
|
15
|
-
|
|
16
|
-
export function useDeviceModels(
|
|
17
|
-
params?: UseDeviceModelsParams
|
|
18
|
-
): UseSeamQueryResultLegacy<'deviceModels', UseDeviceModelsData> {
|
|
19
|
-
const { client: seam } = useSeamClient()
|
|
20
|
-
const queryClient = useQueryClient()
|
|
21
|
-
|
|
22
|
-
const { data, ...rest } = useQuery<UseDeviceModelsData, SeamHttpApiError>({
|
|
23
|
-
enabled: seam != null,
|
|
24
|
-
queryKey: ['internal', 'device_models', 'list', params],
|
|
25
|
-
queryFn: async () => {
|
|
26
|
-
if (seam == null) return []
|
|
27
|
-
const {
|
|
28
|
-
data: { device_models: deviceModels },
|
|
29
|
-
} = await seam.client.get<DeviceModelsListResponse>(
|
|
30
|
-
'/internal/devicedb/v1/device_models/list',
|
|
31
|
-
{ params }
|
|
32
|
-
)
|
|
33
|
-
for (const deviceModel of deviceModels) {
|
|
34
|
-
queryClient.setQueryData(
|
|
35
|
-
[
|
|
36
|
-
'internal',
|
|
37
|
-
'device_models',
|
|
38
|
-
'get',
|
|
39
|
-
{ device_model_id: deviceModel.device_model_id },
|
|
40
|
-
],
|
|
41
|
-
deviceModel
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
// UPSTREAM: Response type does not match DeviceModel[].
|
|
45
|
-
return deviceModels as DeviceModel[]
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
...rest,
|
|
51
|
-
deviceModels: data,
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type DeviceModelsListParams = RouteRequestParams<'/v1/device_models/list'>
|
|
56
|
-
|
|
57
|
-
type DeviceModelsListResponse = RouteResponse<'/v1/device_models/list'>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { ManufacturerIntegrationSupportLevel } from '@seamapi/types/devicedb'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
useDeviceModels,
|
|
5
|
-
type UseDeviceModelsParams,
|
|
6
|
-
} from 'lib/seam/components/SupportedDeviceTable/use-device-models.js'
|
|
7
|
-
|
|
8
|
-
import { useFilteredManufacturers } from './use-filtered-manufacturers.js'
|
|
9
|
-
|
|
10
|
-
export interface DeviceModelFilters {
|
|
11
|
-
supportedOnly: boolean
|
|
12
|
-
manufacturer: string | null
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const supportedIntegrationSupportLevels: ManufacturerIntegrationSupportLevel[] =
|
|
16
|
-
['stable', 'beta']
|
|
17
|
-
|
|
18
|
-
export const useFilteredDeviceModels = ({
|
|
19
|
-
filterValue,
|
|
20
|
-
filters,
|
|
21
|
-
includeIf,
|
|
22
|
-
excludeIf,
|
|
23
|
-
...manufacturersParams
|
|
24
|
-
}: {
|
|
25
|
-
filterValue: string
|
|
26
|
-
filters: DeviceModelFilters
|
|
27
|
-
manufacturers: string[] | null
|
|
28
|
-
excludedManufacturers: string[]
|
|
29
|
-
includeIf: string[] | null
|
|
30
|
-
excludeIf: string[]
|
|
31
|
-
}): ReturnType<typeof useDeviceModels> => {
|
|
32
|
-
const { manufacturers } = useFilteredManufacturers({
|
|
33
|
-
...manufacturersParams,
|
|
34
|
-
integrationSupportLevels: filters.supportedOnly
|
|
35
|
-
? supportedIntegrationSupportLevels
|
|
36
|
-
: null,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const params: UseDeviceModelsParams = {}
|
|
40
|
-
|
|
41
|
-
if (excludeIf.length > 0) {
|
|
42
|
-
params.exclude_if = excludeIf
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// UPSTREAM: API does not parse zero-length arrays correctly.
|
|
46
|
-
if (includeIf != null && includeIf.length > 0) {
|
|
47
|
-
params.include_if = includeIf
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (filterValue.trim() !== '') {
|
|
51
|
-
params.text_search = filterValue.trim()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (filters.supportedOnly) {
|
|
55
|
-
params.integration_support_levels = supportedIntegrationSupportLevels
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (filters.manufacturer !== null) {
|
|
59
|
-
const manufacturer = manufacturers?.find(
|
|
60
|
-
(manufacturer) => manufacturer.display_name === filters.manufacturer
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
if (manufacturer != null) {
|
|
64
|
-
params.manufacturer_id = manufacturer.manufacturer_id
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (filters.manufacturer == null && manufacturers != null) {
|
|
69
|
-
params.manufacturer_ids = manufacturers.map((m) => m.manufacturer_id)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const { deviceModels, ...rest } = useDeviceModels(params)
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
...rest,
|
|
76
|
-
deviceModels:
|
|
77
|
-
// UPSTREAM: API does not parse zero-length arrays correctly.
|
|
78
|
-
includeIf?.length === 0
|
|
79
|
-
? []
|
|
80
|
-
: deviceModels?.filter((deviceModel) =>
|
|
81
|
-
manufacturers?.some(
|
|
82
|
-
(manufacturer) =>
|
|
83
|
-
deviceModel.manufacturer.manufacturer_id ===
|
|
84
|
-
manufacturer.manufacturer_id
|
|
85
|
-
)
|
|
86
|
-
),
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { ManufacturerIntegrationSupportLevel } from '@seamapi/types/devicedb'
|
|
2
|
-
|
|
3
|
-
import { useManufacturers } from 'lib/seam/components/SupportedDeviceTable/use-manufacturers.js'
|
|
4
|
-
|
|
5
|
-
interface Params {
|
|
6
|
-
manufacturers: string[] | null
|
|
7
|
-
excludedManufacturers: string[]
|
|
8
|
-
integrationSupportLevels: ManufacturerIntegrationSupportLevel[] | null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const useFilteredManufacturers = ({
|
|
12
|
-
integrationSupportLevels,
|
|
13
|
-
...params
|
|
14
|
-
}: Params): ReturnType<typeof useManufacturers> => {
|
|
15
|
-
const { manufacturers, ...rest } = useManufacturers({
|
|
16
|
-
integration_support_levels: integrationSupportLevels ?? undefined,
|
|
17
|
-
liqe_query: createLiqeQuery(params),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
...rest,
|
|
22
|
-
manufacturers: manufacturers?.filter(
|
|
23
|
-
(manufacturer) => manufacturer.device_model_count > 0
|
|
24
|
-
),
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const createLiqeQuery = ({
|
|
29
|
-
manufacturers,
|
|
30
|
-
excludedManufacturers,
|
|
31
|
-
}: Pick<Params, 'manufacturers' | 'excludedManufacturers'>):
|
|
32
|
-
| string
|
|
33
|
-
| undefined => {
|
|
34
|
-
if (
|
|
35
|
-
(manufacturers?.some(isInvalidInput) ?? false) ||
|
|
36
|
-
excludedManufacturers.some(isInvalidInput)
|
|
37
|
-
) {
|
|
38
|
-
return undefined
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const excludedManufacturersClause = `NOT (${excludedManufacturers
|
|
42
|
-
.map(manufacturerToMatcher)
|
|
43
|
-
.join(' OR ')})`
|
|
44
|
-
|
|
45
|
-
if (manufacturers == null) {
|
|
46
|
-
if (excludedManufacturers.length === 0) return undefined
|
|
47
|
-
return excludedManufacturersClause
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (manufacturers.length === 0) {
|
|
51
|
-
return 'manufacturer_id:none'
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const includedManufacturersClause = `(${manufacturers
|
|
55
|
-
.map(manufacturerToMatcher)
|
|
56
|
-
.join(' OR ')})`
|
|
57
|
-
|
|
58
|
-
if (excludedManufacturers.length === 0) return includedManufacturersClause
|
|
59
|
-
|
|
60
|
-
return `${includedManufacturersClause} AND ${excludedManufacturersClause}`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const manufacturerToMatcher = (value: string): string => {
|
|
64
|
-
const [manufacturer, uuid] = value.split('=')
|
|
65
|
-
if (uuid != null) return `manufacturer_id:"${uuid}"`
|
|
66
|
-
return `display_name:"${manufacturer}"`
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const isInvalidInput = (value: string): boolean => value.includes('"')
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
-
import { useSeamClient } from '@seamapi/react-query'
|
|
3
|
-
import type {
|
|
4
|
-
Manufacturer,
|
|
5
|
-
RouteRequestParams,
|
|
6
|
-
RouteResponse,
|
|
7
|
-
} from '@seamapi/types/devicedb'
|
|
8
|
-
import { useQuery } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
-
|
|
12
|
-
export type UseManufacturerParams = ManufacturersGetParams
|
|
13
|
-
|
|
14
|
-
export type UseManufacturerData = Manufacturer | null
|
|
15
|
-
|
|
16
|
-
export function useManufacturer(
|
|
17
|
-
params: UseManufacturerParams
|
|
18
|
-
): UseSeamQueryResultLegacy<'manufacturer', UseManufacturerData> {
|
|
19
|
-
const { client: seam } = useSeamClient()
|
|
20
|
-
const { data, ...rest } = useQuery<UseManufacturerData, SeamHttpApiError>({
|
|
21
|
-
enabled: seam != null,
|
|
22
|
-
queryKey: ['internal', 'manufacturers', 'get', params],
|
|
23
|
-
queryFn: async () => {
|
|
24
|
-
if (seam == null) return null
|
|
25
|
-
const {
|
|
26
|
-
data: { manufacturer },
|
|
27
|
-
} = await seam.client.get<ManufacturersGetResponse>(
|
|
28
|
-
'/internal/devicedb/v1/manufacturers/get',
|
|
29
|
-
{ params }
|
|
30
|
-
)
|
|
31
|
-
return manufacturer
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
return { ...rest, manufacturer: data }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type ManufacturersGetParams = RouteRequestParams<'/v1/manufacturers/get'>
|
|
39
|
-
|
|
40
|
-
type ManufacturersGetResponse = RouteResponse<'/v1/manufacturers/get'>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { SeamHttpApiError } from '@seamapi/http/connect'
|
|
2
|
-
import { useSeamClient } from '@seamapi/react-query'
|
|
3
|
-
import type {
|
|
4
|
-
Manufacturer,
|
|
5
|
-
RouteRequestParams,
|
|
6
|
-
RouteResponse,
|
|
7
|
-
} from '@seamapi/types/devicedb'
|
|
8
|
-
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
-
|
|
12
|
-
export type UseManufacturersParams = ManufacturersListParams
|
|
13
|
-
|
|
14
|
-
export type UseManufacturersData = Manufacturer[]
|
|
15
|
-
|
|
16
|
-
export function useManufacturers(
|
|
17
|
-
params?: UseManufacturersParams
|
|
18
|
-
): UseSeamQueryResultLegacy<'manufacturers', UseManufacturersData> {
|
|
19
|
-
const { client: seam } = useSeamClient()
|
|
20
|
-
const queryClient = useQueryClient()
|
|
21
|
-
|
|
22
|
-
const { data, ...rest } = useQuery<UseManufacturersData, SeamHttpApiError>({
|
|
23
|
-
enabled: seam != null,
|
|
24
|
-
queryKey: ['internal', 'manufacturers', 'list', params],
|
|
25
|
-
queryFn: async () => {
|
|
26
|
-
if (seam == null) return []
|
|
27
|
-
const {
|
|
28
|
-
data: { manufacturers },
|
|
29
|
-
} = await seam.client.get<ManufacturersListResponse>(
|
|
30
|
-
'/internal/devicedb/v1/manufacturers/list',
|
|
31
|
-
{ params }
|
|
32
|
-
)
|
|
33
|
-
for (const manufacturer of manufacturers) {
|
|
34
|
-
queryClient.setQueryData(
|
|
35
|
-
[
|
|
36
|
-
'internal',
|
|
37
|
-
'manufacturers',
|
|
38
|
-
'get',
|
|
39
|
-
{ manufacturer_id: manufacturer.manufacturer_id },
|
|
40
|
-
],
|
|
41
|
-
manufacturer
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
return manufacturers
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
return { ...rest, manufacturers: data }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
type ManufacturersListParams = RouteRequestParams<'/v1/manufacturers/list'>
|
|
52
|
-
|
|
53
|
-
type ManufacturersListResponse = RouteResponse<'/v1/manufacturers/list'>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
@mixin all {
|
|
2
|
-
.supported-device-table-manufacturer-keys {
|
|
3
|
-
font-size: 18px;
|
|
4
|
-
|
|
5
|
-
.seam-manufacturer-key {
|
|
6
|
-
display: table-row;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.seam-manufacturer-key-value {
|
|
10
|
-
display: table-cell;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.seam-copy-button {
|
|
14
|
-
display: table-cell;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
padding-left: 10px;
|
|
17
|
-
font-size: 25px;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|