@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,17 @@
|
|
|
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: seam } = useSeamClient();
|
|
5
|
+
const { data, ...rest } = useQuery({
|
|
6
|
+
enabled: seam != null,
|
|
7
|
+
queryKey: ['internal', 'device_models', 'list', params],
|
|
8
|
+
queryFn: async () => {
|
|
9
|
+
if (seam == null)
|
|
10
|
+
return [];
|
|
11
|
+
const { data: { device_models: deviceModels }, } = await seam.client.get('/internal/devicedb/v1/device_models/list', { params });
|
|
12
|
+
return deviceModels;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return { ...rest, deviceModels: data };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-device-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-device-models.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAM3D,MAAM,UAAU,eAAe,CAC7B,MAA8B;IAE9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IAExC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAGhC;QACA,OAAO,EAAE,IAAI,IAAI,IAAI;QACrB,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,IAAI,IAAI,IAAI;gBAAE,OAAO,EAAE,CAAA;YAC3B,MAAM,EACJ,IAAI,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,GACtC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACvB,0CAA0C,EAC1C,EAAE,MAAM,EAAE,CACX,CAAA;YACD,OAAO,YAAY,CAAA;QACrB,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useDeviceModels } from '../../../../lib/seam/
|
|
1
|
+
import { useDeviceModels } from '../../../../lib/seam/components/SupportedDeviceTable/use-device-models.js';
|
|
2
2
|
export interface DeviceModelFilters {
|
|
3
3
|
supportedOnly: boolean;
|
|
4
|
-
|
|
4
|
+
manufacturer: string | null;
|
|
5
5
|
}
|
|
6
|
-
export declare const useFilteredDeviceModels: ({ filterValue, filters,
|
|
6
|
+
export declare const useFilteredDeviceModels: ({ filterValue, filters, ...manufacturersParams }: {
|
|
7
7
|
filterValue: string;
|
|
8
8
|
filters: DeviceModelFilters;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
manufacturers: string[] | null;
|
|
10
|
+
excludedManufacturers: string[];
|
|
11
11
|
}) => ReturnType<typeof useDeviceModels>;
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { useDeviceModels, } from '../../../../lib/seam/
|
|
2
|
-
|
|
1
|
+
import { useDeviceModels, } from '../../../../lib/seam/components/SupportedDeviceTable/use-device-models.js';
|
|
2
|
+
import { useFilteredManufacturers } from './use-filtered-manufacturers.js';
|
|
3
|
+
export const useFilteredDeviceModels = ({ filterValue, filters, ...manufacturersParams }) => {
|
|
4
|
+
const { manufacturers } = useFilteredManufacturers(manufacturersParams);
|
|
3
5
|
const params = {};
|
|
4
6
|
if (filterValue.trim() !== '') {
|
|
5
7
|
params.text_search = filterValue.trim();
|
|
6
8
|
}
|
|
7
9
|
if (filters.supportedOnly) {
|
|
8
|
-
params.
|
|
10
|
+
params.integration_status = 'stable';
|
|
9
11
|
}
|
|
10
|
-
if (filters.
|
|
11
|
-
|
|
12
|
+
if (filters.manufacturer !== null) {
|
|
13
|
+
const manufacturer = manufacturers?.find((manufacturer) => manufacturer.display_name === filters.manufacturer);
|
|
14
|
+
if (manufacturer != null) {
|
|
15
|
+
params.manufacturer_id = manufacturer.manufacturer_id;
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
if (filters.manufacturer == null && manufacturers != null) {
|
|
19
|
+
params.manufacturer_ids = manufacturers.map((m) => m.manufacturer_id);
|
|
20
|
+
}
|
|
21
|
+
const { deviceModels, ...query } = useDeviceModels(params);
|
|
16
22
|
return {
|
|
17
23
|
...query,
|
|
18
|
-
deviceModels:
|
|
19
|
-
|
|
20
|
-
if (brands === null)
|
|
21
|
-
return true;
|
|
22
|
-
return brands.includes(brand);
|
|
23
|
-
})
|
|
24
|
-
.filter(({ brand }) => {
|
|
25
|
-
return !excludedBrands.includes(brand);
|
|
26
|
-
}),
|
|
24
|
+
deviceModels: deviceModels?.filter((deviceModel) => manufacturers?.some((manufacturer) => deviceModel.manufacturer.manufacturer_id ===
|
|
25
|
+
manufacturer.manufacturer_id)),
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
//# 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,
|
|
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,+DAA+D,CAAA;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAO1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,WAAW,EACX,OAAO,EACP,GAAG,mBAAmB,EAMvB,EAAsC,EAAE;IACvC,MAAM,EAAE,aAAa,EAAE,GAAG,wBAAwB,CAAC,mBAAmB,CAAC,CAAA;IAEvE,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,kBAAkB,GAAG,QAAQ,CAAA;KACrC;IAED,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE;QACjC,MAAM,YAAY,GAAG,aAAa,EAAE,IAAI,CACtC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY,CACrE,CAAA;QAED,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;SACtD;KACF;IAED,IAAI,OAAO,CAAC,YAAY,IAAI,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE;QACzD,MAAM,CAAC,gBAAgB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;KACtE;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1D,OAAO;QACL,GAAG,KAAK;QACR,YAAY,EAAE,YAAY,EAAE,MAAM,CAChC,CAAC,WAAW,EAAE,EAAE,CACd,aAAa,EAAE,IAAI,CACjB,CAAC,YAAY,EAAE,EAAE,CACf,WAAW,CAAC,YAAY,CAAC,eAAe;YACxC,YAAY,CAAC,eAAe,CAC/B,CACJ;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useManufacturers } from '../../../../lib/seam/components/SupportedDeviceTable/use-manufacturers.js';
|
|
2
|
+
interface Params {
|
|
3
|
+
manufacturers: string[] | null;
|
|
4
|
+
excludedManufacturers: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const useFilteredManufacturers: (params: Params) => ReturnType<typeof useManufacturers>;
|
|
7
|
+
export declare const createLiqeQuery: ({ manufacturers, excludedManufacturers, }: Params) => string | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useManufacturers } from '../../../../lib/seam/components/SupportedDeviceTable/use-manufacturers.js';
|
|
2
|
+
export const useFilteredManufacturers = (params) => {
|
|
3
|
+
return useManufacturers({
|
|
4
|
+
liqe_query: createLiqeQuery(params),
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
export const createLiqeQuery = ({ manufacturers, excludedManufacturers, }) => {
|
|
8
|
+
if ((manufacturers?.some(isInvalidInput) ?? false) ||
|
|
9
|
+
excludedManufacturers.some(isInvalidInput)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const excludedManufacturersClause = `NOT (${excludedManufacturers
|
|
13
|
+
.map(manufacturerToMatcher)
|
|
14
|
+
.join(' OR ')})`;
|
|
15
|
+
if (manufacturers == null) {
|
|
16
|
+
if (excludedManufacturers.length === 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
return excludedManufacturersClause;
|
|
19
|
+
}
|
|
20
|
+
if (manufacturers.length === 0) {
|
|
21
|
+
return 'manufacturer_id:none';
|
|
22
|
+
}
|
|
23
|
+
const includedManufacturersClause = `(${manufacturers
|
|
24
|
+
.map(manufacturerToMatcher)
|
|
25
|
+
.join(' OR ')})`;
|
|
26
|
+
if (excludedManufacturers.length === 0)
|
|
27
|
+
return includedManufacturersClause;
|
|
28
|
+
return `${includedManufacturersClause} AND ${excludedManufacturersClause}`;
|
|
29
|
+
};
|
|
30
|
+
const manufacturerToMatcher = (value) => {
|
|
31
|
+
const [manufacturer, uuid] = value.split('=');
|
|
32
|
+
if (uuid != null)
|
|
33
|
+
return `manufacturer_id:"${uuid}"`;
|
|
34
|
+
return `display_name:"${manufacturer}"`;
|
|
35
|
+
};
|
|
36
|
+
const isInvalidInput = (value) => value.includes('"');
|
|
37
|
+
//# sourceMappingURL=use-filtered-manufacturers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-filtered-manufacturers.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.ts"],"names":[],"m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QAAE,OAAO,oBAAoB,IAAI,GAAG,CAAA;IACpD,OAAO,iBAAiB,YAAY,GAAG,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Manufacturer, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
+
import type { UseSeamQueryResult } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
|
+
export type UseManufacturerParams = ManufacturersGetParams | string;
|
|
4
|
+
export type UseManufacturerData = Manufacturer | null;
|
|
5
|
+
export declare function useManufacturer(params?: UseManufacturerParams): UseSeamQueryResult<'manufacturer', UseManufacturerData>;
|
|
6
|
+
type ManufacturersGetParams = RouteRequestParams<'/v1/manufacturers/get'>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useSeamClient } from '../../../../lib/seam/use-seam-client.js';
|
|
3
|
+
export function useManufacturer(params) {
|
|
4
|
+
const normalizedParams = typeof params === 'string' ? { manufacturer_id: params } : params;
|
|
5
|
+
const { client: seam } = useSeamClient();
|
|
6
|
+
const { data, ...rest } = useQuery({
|
|
7
|
+
enabled: seam != null,
|
|
8
|
+
queryKey: ['internal', 'manufacturers', 'get', normalizedParams],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
if (seam == null)
|
|
11
|
+
return null;
|
|
12
|
+
const { data: { manufacturer }, } = await seam.client.get('/internal/devicedb/v1/manufacturers/get', { params: normalizedParams });
|
|
13
|
+
return manufacturer;
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
return { ...rest, manufacturer: data };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=use-manufacturer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-manufacturer.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAM3D,MAAM,UAAU,eAAe,CAC7B,MAA8B;IAE9B,MAAM,gBAAgB,GACpB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;IAEnE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IACxC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAGhC;QACA,OAAO,EAAE,IAAI,IAAI,IAAI;QACrB,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,CAAC;QAChE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,IAAI,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC7B,MAAM,EACJ,IAAI,EAAE,EAAE,YAAY,EAAE,GACvB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACvB,yCAAyC,EACzC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAC7B,CAAA;YACD,OAAO,YAAY,CAAA;QACrB,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,GAAG,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Manufacturer, RouteRequestParams } from '@seamapi/types/devicedb';
|
|
2
|
+
import type { UseSeamQueryResult } from '../../../../lib/seam/use-seam-query-result.js';
|
|
3
|
+
export type UseManufacturersParams = ManufacturersListParams;
|
|
4
|
+
export type UseManufacturersData = Manufacturer[];
|
|
5
|
+
export declare function useManufacturers(params?: UseManufacturersParams): UseSeamQueryResult<'manufacturers', UseManufacturersData>;
|
|
6
|
+
type ManufacturersListParams = RouteRequestParams<'/v1/manufacturers/list'>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useSeamClient } from '../../../../lib/seam/use-seam-client.js';
|
|
3
|
+
export function useManufacturers(params) {
|
|
4
|
+
const { client: seam } = useSeamClient();
|
|
5
|
+
const { data, ...rest } = useQuery({
|
|
6
|
+
enabled: seam != null,
|
|
7
|
+
queryKey: ['internal', 'manufacturers', 'list', params],
|
|
8
|
+
queryFn: async () => {
|
|
9
|
+
if (seam == null)
|
|
10
|
+
return [];
|
|
11
|
+
const { data: { manufacturers }, } = await seam.client.get('/internal/devicedb/v1/manufacturers/list', { params });
|
|
12
|
+
return manufacturers;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return { ...rest, manufacturers: data };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-manufacturers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-manufacturers.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAM3D,MAAM,UAAU,gBAAgB,CAC9B,MAA+B;IAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,CAAA;IAExC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAGhC;QACA,OAAO,EAAE,IAAI,IAAI,IAAI;QACrB,QAAQ,EAAE,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,IAAI,IAAI,IAAI;gBAAE,OAAO,EAAE,CAAA;YAC3B,MAAM,EACJ,IAAI,EAAE,EAAE,aAAa,EAAE,GACxB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACvB,0CAA0C,EAC1C,EAAE,MAAM,EAAE,CACX,CAAA;YACD,OAAO,aAAa,CAAA;QACtB,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { AccessCodeError, ConnectedAccountError, DeviceError, SeamWarning } from 'seamapi';
|
|
2
3
|
export interface RequiredCommonProps {
|
|
3
4
|
className: string | undefined;
|
|
4
5
|
onBack: (() => void) | undefined;
|
|
6
|
+
errorFilter: (error: ConnectedAccountError | DeviceError | AccessCodeError) => boolean;
|
|
7
|
+
warningFilter: (warning: SeamWarning) => boolean;
|
|
5
8
|
disableDeleteAccessCode: boolean | undefined;
|
|
6
9
|
disableCreateAccessCode: boolean | undefined;
|
|
7
10
|
disableEditAccessCode: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-props.js","sourceRoot":"","sources":["../../../src/lib/seam/components/common-props.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"common-props.js","sourceRoot":"","sources":["../../../src/lib/seam/components/common-props.tsx"],"names":[],"mappings":";AAwBA,MAAM,UAAU,uBAAuB,CAGrC,SAA2B;IAE3B,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,CAAA;IAEnE,SAAS,uBAAuB,CAC9B,KAA8B;QAE9B,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAA;IACjC,CAAC;IAED,uBAAuB,CAAC,WAAW,GAAG,2BAA2B,IAAI,GAAG,CAAA;IAExE,OAAO,uBAAuB,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AccessCodeError, ConnectedAccountError, DeviceError, SeamWarning } from 'seamapi';
|
|
2
|
+
type SeamCompositeError = ConnectedAccountError | DeviceError | AccessCodeError;
|
|
3
|
+
export declare const accessCodeErrorFilter: (error: SeamCompositeError) => boolean;
|
|
4
|
+
export declare const accessCodeWarningFilter: (_: SeamWarning) => boolean;
|
|
5
|
+
export declare const deviceErrorFilter: (error: SeamCompositeError) => boolean;
|
|
6
|
+
export declare const deviceWarningFilter: (_: SeamWarning) => boolean;
|
|
7
|
+
export declare const connectedAccountErrorFilter: (error: SeamCompositeError) => boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const accessCodeErrorFilter = (error) => {
|
|
2
|
+
return 'is_access_code_error' in error && error.is_access_code_error;
|
|
3
|
+
};
|
|
4
|
+
export const accessCodeWarningFilter = (_) => {
|
|
5
|
+
return true;
|
|
6
|
+
};
|
|
7
|
+
export const deviceErrorFilter = (error) => {
|
|
8
|
+
return 'is_device_error' in error && error.is_device_error;
|
|
9
|
+
};
|
|
10
|
+
export const deviceWarningFilter = (_) => {
|
|
11
|
+
return true;
|
|
12
|
+
};
|
|
13
|
+
export const connectedAccountErrorFilter = (error) => {
|
|
14
|
+
return ('is_connected_account_error' in error && error.is_connected_account_error);
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/lib/seam/filters.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAyB,EAAW,EAAE;IAC1E,OAAO,sBAAsB,IAAI,KAAK,IAAI,KAAK,CAAC,oBAAoB,CAAA;AACtE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAc,EAAW,EAAE;IACjE,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAyB,EAAW,EAAE;IACtE,OAAO,iBAAiB,IAAI,KAAK,IAAI,KAAK,CAAC,eAAe,CAAA;AAC5D,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAc,EAAW,EAAE;IAC7D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,KAAyB,EAChB,EAAE;IACX,OAAO,CACL,4BAA4B,IAAI,KAAK,IAAI,KAAK,CAAC,0BAA0B,CAC1E,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/telemetry/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,OAAO,MAAM,gBAAgB,CAAA;AAQpC,iEAAiE;AACjE,qFAAqF;AACrF,MAAM,OAAO,eAAe;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/telemetry/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,OAAO,MAAM,gBAAgB,CAAA;AAQpC,iEAAiE;AACjE,qFAAqF;AACrF,MAAM,OAAO,eAAe;IACjB,MAAM,CAAO;IACtB,YAAY,CAAe;IAE3B,SAAS,CAAQ;IACjB,MAAM,CAAS;IACf,SAAS,CAAS;IAElB,OAAO,GAAY,KAAK,CAAA;IACxB,KAAK,GAAgB,IAAI,CAAA;IAEzB,YAAY,EACV,QAAQ,GAAG,6BAA6B,EACxC,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,MACU,EAAE;QAC5B,IAA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AC;gBAC7B,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;aAChD,CAAC,CAAA;YACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;gBAChB,MAAM,IAAI,KAAK,CACb,iCAAiC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAC1E,CAAA;aACF;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;IAEQ,IAAI,GAAG,CACd,MAAc,EACd,GAAG,IAAyC,EACtC,EAAE;QACR,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAM;QACxB,MAAM,OAAO,GACX,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1E,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,IAAI,OAAO,GAAG,CAAC,CAAA;IACtD,CAAC,CAAA;CACF"}
|
|
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
|
|
|
4
4
|
import { CheckGreenIcon } from '../../../lib/icons/CheckGreen.js';
|
|
5
5
|
import { CloseWhiteIcon } from '../../../lib/icons/CloseWhite.js';
|
|
6
6
|
import { ExclamationCircleIcon } from '../../../lib/icons/ExclamationCircle.js';
|
|
7
|
-
export function Snackbar({ message, variant, visible, action, autoDismiss = false, dismissAfterMs = 5000, disableCloseButton = false, onClose, }) {
|
|
7
|
+
export function Snackbar({ message, variant, visible, action, autoDismiss = false, dismissAfterMs = 5000, disableCloseButton = false, onClose = () => { }, }) {
|
|
8
8
|
const { label: actionLabel, onClick: handleActionClick } = action ?? {};
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
if (!autoDismiss) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.js","sourceRoot":"","sources":["../../../src/lib/ui/Snackbar/Snackbar.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAkBtE,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,GAAG,KAAK,EACnB,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,KAAK,EAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Snackbar.js","sourceRoot":"","sources":["../../../src/lib/ui/Snackbar/Snackbar.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAkBtE,MAAM,UAAU,QAAQ,CAAC,EACvB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,GAAG,KAAK,EACnB,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,KAAK,EAC1B,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,GACJ;IACd,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;IAEvE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;SAChB;QAED,MAAM,O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2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/lib/version.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/lib/version.ts"],"names":[],"mappings":"AAAA,MAAM,mBAAmB,GAAG,OAAO,CAAA;AAEnC,eAAe,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Seam Components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -90,6 +90,8 @@
|
|
|
90
90
|
"storybook:docs": "storybook dev --docs --port 6007",
|
|
91
91
|
"storybook:build": "storybook build",
|
|
92
92
|
"prestorybook:build": "vite build examples",
|
|
93
|
+
"storybook:update-devicedb-seed": "tsx .storybook/update-devicedb-seed.ts",
|
|
94
|
+
"poststorybook:update-devicedb-seed": "npm run format",
|
|
93
95
|
"examples": "vite examples --host",
|
|
94
96
|
"examples:build": "vite build examples",
|
|
95
97
|
"examples:preview": "vite preview examples",
|
|
@@ -107,12 +109,16 @@
|
|
|
107
109
|
"npm": ">= 8.1.0"
|
|
108
110
|
},
|
|
109
111
|
"peerDependencies": {
|
|
112
|
+
"@seamapi/types": "^1.26.2",
|
|
110
113
|
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
111
114
|
"@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
112
115
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
113
116
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
114
117
|
},
|
|
115
118
|
"peerDependenciesMeta": {
|
|
119
|
+
"@seamapi/types": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
116
122
|
"@types/react": {
|
|
117
123
|
"optional": true
|
|
118
124
|
},
|
|
@@ -126,7 +132,7 @@
|
|
|
126
132
|
"luxon": "^3.3.0",
|
|
127
133
|
"queue": "^7.0.0",
|
|
128
134
|
"react-hook-form": "^7.46.1",
|
|
129
|
-
"seamapi": "^8.13.
|
|
135
|
+
"seamapi": "^8.13.3",
|
|
130
136
|
"uuid": "^9.0.0"
|
|
131
137
|
},
|
|
132
138
|
"devDependencies": {
|
|
@@ -134,7 +140,10 @@
|
|
|
134
140
|
"@mui/icons-material": "^5.11.16",
|
|
135
141
|
"@mui/material": "^5.12.2",
|
|
136
142
|
"@rxfork/r2wc-react-to-web-component": "^2.4.0",
|
|
137
|
-
"@seamapi/fake-
|
|
143
|
+
"@seamapi/fake-devicedb": "^1.1.0",
|
|
144
|
+
"@seamapi/fake-seam-connect": "^1.37.1",
|
|
145
|
+
"@seamapi/http": "^0.2.1",
|
|
146
|
+
"@seamapi/types": "^1.28.0",
|
|
138
147
|
"@storybook/addon-designs": "^7.0.1",
|
|
139
148
|
"@storybook/addon-essentials": "^7.0.2",
|
|
140
149
|
"@storybook/addon-links": "^7.0.2",
|
|
@@ -149,6 +158,7 @@
|
|
|
149
158
|
"@types/react": "^18.0.33",
|
|
150
159
|
"@types/react-dom": "^18.0.11",
|
|
151
160
|
"@types/uuid": "^9.0.1",
|
|
161
|
+
"@vercel/node": "^3.0.7",
|
|
152
162
|
"@vitejs/plugin-react": "^4.0.0",
|
|
153
163
|
"@vitest/coverage-v8": "^0.34.4",
|
|
154
164
|
"@vitest/ui": "^0.34.4",
|
|
@@ -181,7 +191,7 @@
|
|
|
181
191
|
"tsconfig-paths-webpack-plugin": "^4.0.1",
|
|
182
192
|
"tsx": "^3.12.7",
|
|
183
193
|
"typedoc": "^0.25.1",
|
|
184
|
-
"typescript": "
|
|
194
|
+
"typescript": "^5.2.2",
|
|
185
195
|
"vite": "^4.2.1",
|
|
186
196
|
"vite-tsconfig-paths": "^4.0.8",
|
|
187
197
|
"vitest": "^0.34.4",
|
package/src/lib/element.tsx
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames'
|
|
2
2
|
import { DateTime } from 'luxon'
|
|
3
3
|
import { useState } from 'react'
|
|
4
|
-
import type {
|
|
5
|
-
AccessCode,
|
|
6
|
-
AccessCodeError,
|
|
7
|
-
ConnectedAccountError,
|
|
8
|
-
DeviceError,
|
|
9
|
-
} from 'seamapi'
|
|
4
|
+
import type { AccessCode } from 'seamapi'
|
|
10
5
|
|
|
11
6
|
import { useComponentTelemetry } from 'lib/telemetry/index.js'
|
|
12
7
|
|
|
@@ -19,6 +14,10 @@ import {
|
|
|
19
14
|
withRequiredCommonProps,
|
|
20
15
|
} from 'lib/seam/components/common-props.js'
|
|
21
16
|
import { NestedDeviceDetails } from 'lib/seam/components/DeviceDetails/DeviceDetails.js'
|
|
17
|
+
import {
|
|
18
|
+
accessCodeErrorFilter,
|
|
19
|
+
accessCodeWarningFilter,
|
|
20
|
+
} from 'lib/seam/filters.js'
|
|
22
21
|
import { Alerts } from 'lib/ui/Alert/Alerts.js'
|
|
23
22
|
import { Button } from 'lib/ui/Button.js'
|
|
24
23
|
import { copyToClipboard } from 'lib/ui/clipboard.js'
|
|
@@ -37,6 +36,8 @@ export const NestedAccessCodeDetails =
|
|
|
37
36
|
export function AccessCodeDetails({
|
|
38
37
|
accessCodeId,
|
|
39
38
|
onEdit,
|
|
39
|
+
errorFilter = () => true,
|
|
40
|
+
warningFilter = () => true,
|
|
40
41
|
disableCreateAccessCode = false,
|
|
41
42
|
disableEditAccessCode = false,
|
|
42
43
|
disableLockUnlock = false,
|
|
@@ -61,6 +62,8 @@ export function AccessCodeDetails({
|
|
|
61
62
|
return (
|
|
62
63
|
<NestedDeviceDetails
|
|
63
64
|
deviceId={selectedDeviceId}
|
|
65
|
+
errorFilter={errorFilter}
|
|
66
|
+
warningFilter={warningFilter}
|
|
64
67
|
disableLockUnlock={disableLockUnlock}
|
|
65
68
|
disableCreateAccessCode={disableCreateAccessCode}
|
|
66
69
|
disableEditAccessCode={disableEditAccessCode}
|
|
@@ -75,14 +78,21 @@ export function AccessCodeDetails({
|
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
const alerts = [
|
|
78
|
-
...accessCode.errors
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
...accessCode.errors
|
|
82
|
+
.filter(accessCodeErrorFilter)
|
|
83
|
+
.filter(errorFilter)
|
|
84
|
+
.map((error) => ({
|
|
85
|
+
variant: 'error' as const,
|
|
86
|
+
message: error.message,
|
|
87
|
+
})),
|
|
88
|
+
|
|
89
|
+
...accessCode.warnings
|
|
90
|
+
.filter(accessCodeWarningFilter)
|
|
91
|
+
.filter(warningFilter)
|
|
92
|
+
.map((warning) => ({
|
|
93
|
+
variant: 'warning' as const,
|
|
94
|
+
message: warning.message,
|
|
95
|
+
})),
|
|
86
96
|
]
|
|
87
97
|
|
|
88
98
|
return (
|
|
@@ -245,22 +255,6 @@ const formatDate = (date: string): string =>
|
|
|
245
255
|
year: 'numeric',
|
|
246
256
|
})
|
|
247
257
|
|
|
248
|
-
const errorFilter = (
|
|
249
|
-
error: AccessCodeError | DeviceError | ConnectedAccountError
|
|
250
|
-
): boolean => {
|
|
251
|
-
if ('is_access_code_error' in error && !error.is_access_code_error)
|
|
252
|
-
return true
|
|
253
|
-
|
|
254
|
-
if (
|
|
255
|
-
error.error_code === 'failed_to_set_on_device' ||
|
|
256
|
-
error.error_code === 'failed_to_remove_on_device'
|
|
257
|
-
) {
|
|
258
|
-
return true
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return false
|
|
262
|
-
}
|
|
263
|
-
|
|
264
258
|
const t = {
|
|
265
259
|
accessCode: 'Access code',
|
|
266
260
|
fallbackName: 'Code',
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AccessCode } from 'seamapi'
|
|
2
|
+
|
|
1
3
|
import { CheckIcon } from 'lib/icons/Check.js'
|
|
2
4
|
import { ExclamationCircleOutlineIcon } from 'lib/icons/ExclamationCircleOutline.js'
|
|
3
5
|
import type { UseAccessCodesData } from 'lib/seam/access-codes/use-access-codes.js'
|
|
@@ -8,17 +10,23 @@ export type AccessCodeFilter = 'access_code_issues'
|
|
|
8
10
|
|
|
9
11
|
interface AccessCodeHealthBarProps {
|
|
10
12
|
accessCodes: Array<UseAccessCodesData[number]>
|
|
13
|
+
errorFilter: (error: AccessCode['errors'][number]) => boolean
|
|
14
|
+
warningFilter: (warning: AccessCode['warnings'][number]) => boolean
|
|
11
15
|
filter: AccessCodeFilter | null
|
|
12
16
|
onFilterSelect: (filter: AccessCodeFilter | null) => void
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export function AccessCodeHealthBar({
|
|
16
20
|
accessCodes,
|
|
21
|
+
errorFilter,
|
|
22
|
+
warningFilter,
|
|
17
23
|
filter,
|
|
18
24
|
onFilterSelect,
|
|
19
25
|
}: AccessCodeHealthBarProps): JSX.Element {
|
|
20
26
|
const codesWithIssues = accessCodes.filter(
|
|
21
|
-
({ errors, warnings }) =>
|
|
27
|
+
({ errors, warnings }) =>
|
|
28
|
+
errors.filter(errorFilter).length > 0 ||
|
|
29
|
+
warnings.filter(warningFilter).length > 0
|
|
22
30
|
)
|
|
23
31
|
const issueCount = codesWithIssues.length
|
|
24
32
|
|