@seamapi/react 1.64.0 → 2.0.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 +16 -4
- package/dist/elements.js +5533 -5359
- package/dist/elements.js.map +1 -1
- package/dist/index.css +17 -19
- 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/AccessCodeDetails/AccessCodeDetails.d.ts +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +11 -13
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.d.ts +4 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.js +3 -2
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +1 -5
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +15 -11
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +2 -2
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +12 -7
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +11 -4
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +1 -1
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +4 -4
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceHealthBar.d.ts +3 -1
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js +4 -3
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceTable.d.ts +1 -5
- package/lib/seam/components/DeviceTable/DeviceTable.js +14 -9
- package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +11 -17
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js +1 -7
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js +12 -31
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.js +2 -4
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.d.ts +8 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js +35 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js +10 -6
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +3 -7
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +4 -5
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js +18 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-models.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js +17 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +5 -5
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +16 -17
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.d.ts +8 -0
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.js +37 -0
- package/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +18 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +17 -0
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -0
- package/lib/seam/components/common-props.d.ts +3 -0
- package/lib/seam/components/common-props.js.map +1 -1
- package/lib/seam/filters.d.ts +8 -0
- package/lib/seam/filters.js +16 -0
- package/lib/seam/filters.js.map +1 -0
- package/lib/telemetry/client.js.map +1 -1
- package/lib/ui/Snackbar/Snackbar.d.ts +1 -1
- package/lib/ui/Snackbar/Snackbar.js +1 -1
- package/lib/ui/Snackbar/Snackbar.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +14 -4
- package/src/lib/element.tsx +2 -0
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +24 -30
- package/src/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.tsx +9 -1
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +34 -13
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +4 -0
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +21 -5
- package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +19 -8
- package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +6 -2
- package/src/lib/seam/components/DeviceTable/DeviceHealthBar.tsx +10 -2
- package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +31 -15
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +23 -29
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +3 -9
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +22 -41
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.tsx +8 -12
- package/src/lib/seam/components/SupportedDeviceTable/{SupportedDeviceBrandSection.tsx → SupportedDeviceManufacturerSection.tsx} +19 -26
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx +20 -11
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.element.ts +2 -3
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +10 -17
- package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +45 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +43 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +31 -20
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.ts +54 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +45 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +43 -0
- package/src/lib/seam/components/common-props.tsx +10 -0
- package/src/lib/seam/filters.ts +32 -0
- package/src/lib/telemetry/client.ts +3 -3
- package/src/lib/ui/Snackbar/Snackbar.tsx +2 -2
- package/src/lib/version.ts +1 -1
- package/src/styles/_device-details.scss +1 -2
- package/src/styles/_supported-device-table.scss +4 -4
- package/src/styles/_thermostat.scss +1 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.d.ts +0 -8
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js +0 -42
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js.map +0 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.d.ts +0 -2
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js +0 -13
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js.map +0 -1
- package/lib/seam/device-models/use-device-models.d.ts +0 -5
- package/lib/seam/device-models/use-device-models.js +0 -19
- package/lib/seam/device-models/use-device-models.js.map +0 -1
- package/lib/strings.d.ts +0 -1
- package/lib/strings.js +0 -4
- package/lib/strings.js.map +0 -1
- package/src/lib/seam/components/SupportedDeviceTable/use-device-provider.ts +0 -16
- package/src/lib/seam/device-models/use-device-models.ts +0 -39
- package/src/lib/strings.ts +0 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Manufacturer,
|
|
3
|
+
RouteRequestParams,
|
|
4
|
+
RouteResponse,
|
|
5
|
+
} from '@seamapi/types/devicedb'
|
|
6
|
+
import { useQuery } from '@tanstack/react-query'
|
|
7
|
+
import type { SeamError } from 'seamapi'
|
|
8
|
+
|
|
9
|
+
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
|
+
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
+
|
|
12
|
+
export type UseManufacturerParams = ManufacturersGetParams | string
|
|
13
|
+
export type UseManufacturerData = Manufacturer | null
|
|
14
|
+
|
|
15
|
+
export function useManufacturer(
|
|
16
|
+
params?: UseManufacturerParams
|
|
17
|
+
): UseSeamQueryResult<'manufacturer', UseManufacturerData> {
|
|
18
|
+
const normalizedParams =
|
|
19
|
+
typeof params === 'string' ? { manufacturer_id: params } : params
|
|
20
|
+
|
|
21
|
+
const { client: seam } = useSeamClient()
|
|
22
|
+
const { data, ...rest } = useQuery<
|
|
23
|
+
ManufacturersGetResponse['manufacturer'] | null,
|
|
24
|
+
SeamError
|
|
25
|
+
>({
|
|
26
|
+
enabled: seam != null,
|
|
27
|
+
queryKey: ['internal', 'manufacturers', 'get', normalizedParams],
|
|
28
|
+
queryFn: async () => {
|
|
29
|
+
if (seam == null) return null
|
|
30
|
+
const {
|
|
31
|
+
data: { manufacturer },
|
|
32
|
+
} = await seam.client.get<ManufacturersGetResponse>(
|
|
33
|
+
'/internal/devicedb/v1/manufacturers/get',
|
|
34
|
+
{ params: normalizedParams }
|
|
35
|
+
)
|
|
36
|
+
return manufacturer
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return { ...rest, manufacturer: data }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ManufacturersGetParams = RouteRequestParams<'/v1/manufacturers/get'>
|
|
44
|
+
|
|
45
|
+
type ManufacturersGetResponse = RouteResponse<'/v1/manufacturers/get'>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Manufacturer,
|
|
3
|
+
RouteRequestParams,
|
|
4
|
+
RouteResponse,
|
|
5
|
+
} from '@seamapi/types/devicedb'
|
|
6
|
+
import { useQuery } from '@tanstack/react-query'
|
|
7
|
+
import type { SeamError } from 'seamapi'
|
|
8
|
+
|
|
9
|
+
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
|
+
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
+
|
|
12
|
+
export type UseManufacturersParams = ManufacturersListParams
|
|
13
|
+
export type UseManufacturersData = Manufacturer[]
|
|
14
|
+
|
|
15
|
+
export function useManufacturers(
|
|
16
|
+
params?: UseManufacturersParams
|
|
17
|
+
): UseSeamQueryResult<'manufacturers', UseManufacturersData> {
|
|
18
|
+
const { client: seam } = useSeamClient()
|
|
19
|
+
|
|
20
|
+
const { data, ...rest } = useQuery<
|
|
21
|
+
ManufacturersListResponse['manufacturers'],
|
|
22
|
+
SeamError
|
|
23
|
+
>({
|
|
24
|
+
enabled: seam != null,
|
|
25
|
+
queryKey: ['internal', 'manufacturers', 'list', params],
|
|
26
|
+
queryFn: async () => {
|
|
27
|
+
if (seam == null) return []
|
|
28
|
+
const {
|
|
29
|
+
data: { manufacturers },
|
|
30
|
+
} = await seam.client.get<ManufacturersListResponse>(
|
|
31
|
+
'/internal/devicedb/v1/manufacturers/list',
|
|
32
|
+
{ params }
|
|
33
|
+
)
|
|
34
|
+
return manufacturers
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return { ...rest, manufacturers: data }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type ManufacturersListParams = RouteRequestParams<'/v1/manufacturers/list'>
|
|
42
|
+
|
|
43
|
+
type ManufacturersListResponse = RouteResponse<'/v1/manufacturers/list'>
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { ComponentType } from 'react'
|
|
2
|
+
import type {
|
|
3
|
+
AccessCodeError,
|
|
4
|
+
ConnectedAccountError,
|
|
5
|
+
DeviceError,
|
|
6
|
+
SeamWarning,
|
|
7
|
+
} from 'seamapi'
|
|
2
8
|
|
|
3
9
|
export interface RequiredCommonProps {
|
|
4
10
|
className: string | undefined
|
|
5
11
|
onBack: (() => void) | undefined
|
|
12
|
+
errorFilter: (
|
|
13
|
+
error: ConnectedAccountError | DeviceError | AccessCodeError
|
|
14
|
+
) => boolean
|
|
15
|
+
warningFilter: (warning: SeamWarning) => boolean
|
|
6
16
|
disableDeleteAccessCode: boolean | undefined
|
|
7
17
|
disableCreateAccessCode: boolean | undefined
|
|
8
18
|
disableEditAccessCode: boolean | undefined
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AccessCodeError,
|
|
3
|
+
ConnectedAccountError,
|
|
4
|
+
DeviceError,
|
|
5
|
+
SeamWarning,
|
|
6
|
+
} from 'seamapi'
|
|
7
|
+
|
|
8
|
+
type SeamCompositeError = ConnectedAccountError | DeviceError | AccessCodeError
|
|
9
|
+
|
|
10
|
+
export const accessCodeErrorFilter = (error: SeamCompositeError): boolean => {
|
|
11
|
+
return 'is_access_code_error' in error && error.is_access_code_error
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const accessCodeWarningFilter = (_: SeamWarning): boolean => {
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const deviceErrorFilter = (error: SeamCompositeError): boolean => {
|
|
19
|
+
return 'is_device_error' in error && error.is_device_error
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const deviceWarningFilter = (_: SeamWarning): boolean => {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const connectedAccountErrorFilter = (
|
|
27
|
+
error: SeamCompositeError
|
|
28
|
+
): boolean => {
|
|
29
|
+
return (
|
|
30
|
+
'is_connected_account_error' in error && error.is_connected_account_error
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -12,7 +12,7 @@ export interface TelemetryClientOptions {
|
|
|
12
12
|
// Implements a compatible Analytics 2.0 API with custom options.
|
|
13
13
|
// https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/
|
|
14
14
|
export class TelemetryClient {
|
|
15
|
-
#queue: Queue
|
|
15
|
+
readonly #queue: Queue
|
|
16
16
|
#anonymousId: string | null
|
|
17
17
|
|
|
18
18
|
#endpoint: string
|
|
@@ -154,7 +154,7 @@ export class TelemetryClient {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
#push = (message: Message): void => {
|
|
157
|
+
readonly #push = (message: Message): void => {
|
|
158
158
|
if (this.#disabled) return
|
|
159
159
|
this.#queue.push(async () => {
|
|
160
160
|
const payload: Payload = {
|
|
@@ -178,7 +178,7 @@ export class TelemetryClient {
|
|
|
178
178
|
})
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
#log = (
|
|
181
|
+
readonly #log = (
|
|
182
182
|
method: string,
|
|
183
183
|
...args: Array<string | Traits | Properties>
|
|
184
184
|
): void => {
|
|
@@ -11,7 +11,7 @@ interface SnackbarProps {
|
|
|
11
11
|
message: string
|
|
12
12
|
variant: SnackbarVariant
|
|
13
13
|
visible: boolean
|
|
14
|
-
onClose
|
|
14
|
+
onClose?: () => void
|
|
15
15
|
action?: {
|
|
16
16
|
label: string
|
|
17
17
|
onClick: () => void
|
|
@@ -29,7 +29,7 @@ export function Snackbar({
|
|
|
29
29
|
autoDismiss = false,
|
|
30
30
|
dismissAfterMs = 5000,
|
|
31
31
|
disableCloseButton = false,
|
|
32
|
-
onClose,
|
|
32
|
+
onClose = () => {},
|
|
33
33
|
}: SnackbarProps): JSX.Element {
|
|
34
34
|
const { label: actionLabel, onClick: handleActionClick } = action ?? {}
|
|
35
35
|
|
package/src/lib/version.ts
CHANGED
|
@@ -96,7 +96,7 @@ $row-padding: 8px;
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.seam-
|
|
99
|
+
.seam-manufacturer-section {
|
|
100
100
|
margin-bottom: 32px;
|
|
101
101
|
position: relative;
|
|
102
102
|
|
|
@@ -105,7 +105,7 @@ $row-padding: 8px;
|
|
|
105
105
|
align-items: center;
|
|
106
106
|
height: 64px;
|
|
107
107
|
|
|
108
|
-
.seam-
|
|
108
|
+
.seam-manufacturer-image {
|
|
109
109
|
width: 48px;
|
|
110
110
|
height: 48px;
|
|
111
111
|
padding: 0 8px;
|
|
@@ -113,7 +113,7 @@ $row-padding: 8px;
|
|
|
113
113
|
margin-right: 8px;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.seam-
|
|
116
|
+
.seam-manufacturer-name {
|
|
117
117
|
font-size: 21px;
|
|
118
118
|
line-height: 132%;
|
|
119
119
|
flex: 1;
|
|
@@ -254,7 +254,7 @@ $row-padding: 8px;
|
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
|
|
257
|
-
.seam-
|
|
257
|
+
.seam-manufacturer-image {
|
|
258
258
|
width: 32px;
|
|
259
259
|
margin-right: 4px;
|
|
260
260
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
import type { DeviceModel } from 'seamapi';
|
|
3
|
-
interface SupportedDeviceBrandSectionProps {
|
|
4
|
-
brand: string;
|
|
5
|
-
deviceModels: DeviceModel[];
|
|
6
|
-
}
|
|
7
|
-
export declare function SupportedDeviceBrandSection({ brand, deviceModels, }: SupportedDeviceBrandSectionProps): JSX.Element | null;
|
|
8
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
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 = !canExpand || expanded
|
|
20
|
-
? deviceModels
|
|
21
|
-
: deviceModels.filter((_deviceModel, index) => index < maxDevicesBeforeCollapsing);
|
|
22
|
-
const handleHeaderClick = () => {
|
|
23
|
-
if (!canExpand) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
toggleExpand();
|
|
27
|
-
};
|
|
28
|
-
return (_jsxs("div", { className: classNames('seam-brand-section', {
|
|
29
|
-
'can-expand': canExpand,
|
|
30
|
-
expanded,
|
|
31
|
-
}), 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 }, [
|
|
32
|
-
deviceModel.main_category,
|
|
33
|
-
deviceModel.brand,
|
|
34
|
-
deviceModel.model_name,
|
|
35
|
-
deviceModel.manufacturer_model_id,
|
|
36
|
-
index,
|
|
37
|
-
].join(':')))) }), _jsx(ShowAllDevicesButton, { visible: canExpand, onClick: toggleExpand, expanded: expanded, totalDeviceCount: deviceModels.length }), _jsx(HiddenDevicesOverlay, { visible: canExpand && !expanded })] }));
|
|
38
|
-
}
|
|
39
|
-
const t = {
|
|
40
|
-
devices: 'Devices',
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=SupportedDeviceBrandSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceBrandSection.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kEAAkE,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kEAAkE,CAAA;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAA;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAOpC,MAAM,UAAU,2BAA2B,CAAC,EAC1C,KAAK,EACL,YAAY,GACqB;IACjC,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAE/C,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,GAAG,SAAS,EAAE,CAAA;IAE5C,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,GAAG,0BAA0B,CAAA;IAElE,MAAM,cAAc,GAClB,CAAC,SAAS,IAAI,QAAQ;QACpB,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,YAAY,CAAC,MAAM,CACjB,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,0BAA0B,CAC5D,CAAA;IAEP,MAAM,iBAAiB,GAAG,GAAS,EAAE;QACnC,IAAI,CAAC,SAAS,EAAE;YACd,OAAM;SACP;QAED,YAAY,EAAE,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE;YAC1C,YAAY,EAAE,SAAS;YACvB,QAAQ;SACT,CAAC,aAEF,eAAK,SAAS,EAAC,aAAa,EAAC,OAAO,EAAE,iBAAiB,aACrD,cACE,GAAG,EAAE,cAAc,CAAC,SAAS,EAC7B,GAAG,EAAE,KAAK,EACV,SAAS,EAAC,kBAAkB,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,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1C,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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useDeviceProviders } from '../../../../lib/seam/devices/use-device-providers.js';
|
|
2
|
-
export function useDeviceProvider(name) {
|
|
3
|
-
const { deviceProviders } = useDeviceProviders();
|
|
4
|
-
const provider = deviceProviders?.find((p) => p.device_provider_name === name);
|
|
5
|
-
return provider ?? unknownProvider;
|
|
6
|
-
}
|
|
7
|
-
const unknownProvider = {
|
|
8
|
-
device_provider_name: 'unknown',
|
|
9
|
-
display_name: 'Unknown',
|
|
10
|
-
image_url: 'https://connect.getseam.com/assets/images/logos/seam.png',
|
|
11
|
-
provider_categories: [],
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=use-device-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,IAAY;IAC5C,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAChD,MAAM,QAAQ,GAAG,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,KAAK,IAAI,CAAC,CAAA;IAC9E,OAAO,QAAQ,IAAI,eAAe,CAAA;AACpC,CAAC;AAED,MAAM,eAAe,GAAmB;IACtC,oBAAoB,EAAE,SAAS;IAC/B,YAAY,EAAE,SAAS;IACvB,SAAS,EAAE,0DAA0D;IACrE,mBAAmB,EAAE,EAAE;CACxB,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DeviceModel, DeviceModelsListRequest } from 'seamapi';
|
|
2
|
-
import type { UseSeamQueryResult } from '../../../lib/seam/use-seam-query-result.js';
|
|
3
|
-
export type UseDeviceModelsParams = DeviceModelsListRequest;
|
|
4
|
-
export type UseDeviceModelsData = DeviceModel[];
|
|
5
|
-
export declare function useDeviceModels(params?: Omit<UseDeviceModelsParams, 'acknowledge_intentional_use_of_internal_api'>): UseSeamQueryResult<'deviceModels', UseDeviceModelsData>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { useSeamClient } from '../../../lib/seam/use-seam-client.js';
|
|
3
|
-
export function useDeviceModels(params) {
|
|
4
|
-
const { client } = useSeamClient();
|
|
5
|
-
const { data, ...rest } = useQuery({
|
|
6
|
-
enabled: client != null,
|
|
7
|
-
queryKey: ['device_models', 'list', params],
|
|
8
|
-
queryFn: async () => {
|
|
9
|
-
if (client == null)
|
|
10
|
-
return [];
|
|
11
|
-
return await client.deviceModels.list({
|
|
12
|
-
...params,
|
|
13
|
-
acknowledge_intentional_use_of_internal_api: true,
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
return { ...rest, deviceModels: data };
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=use-device-models.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-device-models.js","sourceRoot":"","sources":["../../../src/lib/seam/device-models/use-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAQhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAM3D,MAAM,UAAU,eAAe,CAC7B,MAGC;IAED,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAA;IAElC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAGhC;QACA,OAAO,EAAE,MAAM,IAAI,IAAI;QACvB,QAAQ,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC;QAC3C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI;gBAAE,OAAO,EAAE,CAAA;YAC7B,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC;gBACpC,GAAG,MAAM;gBACT,2CAA2C,EAAE,IAAI;aAClD,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACxC,CAAC"}
|
package/lib/strings.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function capitalize(str: string): string;
|
package/lib/strings.js
DELETED
package/lib/strings.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../src/lib/strings.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { DeviceProvider } from 'seamapi'
|
|
2
|
-
|
|
3
|
-
import { useDeviceProviders } from 'lib/seam/devices/use-device-providers.js'
|
|
4
|
-
|
|
5
|
-
export function useDeviceProvider(name: string): DeviceProvider {
|
|
6
|
-
const { deviceProviders } = useDeviceProviders()
|
|
7
|
-
const provider = deviceProviders?.find((p) => p.device_provider_name === name)
|
|
8
|
-
return provider ?? unknownProvider
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const unknownProvider: DeviceProvider = {
|
|
12
|
-
device_provider_name: 'unknown',
|
|
13
|
-
display_name: 'Unknown',
|
|
14
|
-
image_url: 'https://connect.getseam.com/assets/images/logos/seam.png',
|
|
15
|
-
provider_categories: [],
|
|
16
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@tanstack/react-query'
|
|
2
|
-
import type {
|
|
3
|
-
DeviceModel,
|
|
4
|
-
DeviceModelsListRequest,
|
|
5
|
-
DeviceModelsListResponse,
|
|
6
|
-
SeamError,
|
|
7
|
-
} from 'seamapi'
|
|
8
|
-
|
|
9
|
-
import { useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
10
|
-
import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
|
|
11
|
-
|
|
12
|
-
export type UseDeviceModelsParams = DeviceModelsListRequest
|
|
13
|
-
export type UseDeviceModelsData = DeviceModel[]
|
|
14
|
-
|
|
15
|
-
export function useDeviceModels(
|
|
16
|
-
params?: Omit<
|
|
17
|
-
UseDeviceModelsParams,
|
|
18
|
-
'acknowledge_intentional_use_of_internal_api'
|
|
19
|
-
>
|
|
20
|
-
): UseSeamQueryResult<'deviceModels', UseDeviceModelsData> {
|
|
21
|
-
const { client } = useSeamClient()
|
|
22
|
-
|
|
23
|
-
const { data, ...rest } = useQuery<
|
|
24
|
-
DeviceModelsListResponse['device_models'],
|
|
25
|
-
SeamError
|
|
26
|
-
>({
|
|
27
|
-
enabled: client != null,
|
|
28
|
-
queryKey: ['device_models', 'list', params],
|
|
29
|
-
queryFn: async () => {
|
|
30
|
-
if (client == null) return []
|
|
31
|
-
return await client.deviceModels.list({
|
|
32
|
-
...params,
|
|
33
|
-
acknowledge_intentional_use_of_internal_api: true,
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
return { ...rest, deviceModels: data }
|
|
39
|
-
}
|
package/src/lib/strings.ts
DELETED