@trackunit/filters-asset-filter-definitions 2.1.94 → 2.1.96

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/index.esm.js CHANGED
@@ -13,7 +13,7 @@ import { geoJsonPolygonSchema, geoJsonPointSchema, geoJsonMultiPolygonSchema, ge
13
13
  import { z } from 'zod';
14
14
  import { useLocalStorage, useDebounce, IconButton, Icon, Text, Button, usePrevious, MenuItem, useMeasure, Popover, PopoverTrigger, PopoverContent, MenuList } from '@trackunit/react-components';
15
15
  import { titleCase, lowerCase } from 'string-ts';
16
- import { objectValues, hourIntervals, enumFromValue } from '@trackunit/shared-utils';
16
+ import { objectValues, getCountryName, stringCompare, hourIntervals, enumFromValue } from '@trackunit/shared-utils';
17
17
  import { useMachineTypeTranslations } from '@trackunit/translations-machine-type';
18
18
  import { CriticalityIndicator } from '@trackunit/criticality-indicator';
19
19
  import { useDeviceTypeTranslations } from '@trackunit/translations-device';
@@ -97,6 +97,7 @@ var defaultTranslations = {
97
97
  "assetFilters.metadataCompleteness.ALL": "All",
98
98
  "assetFilters.metadataCompleteness.COMPLETE": "Complete",
99
99
  "assetFilters.metadataCompleteness.PARTIAL": "Partial",
100
+ "assetFilters.modbusProfile.label": "Modbus profile",
100
101
  "assetFilters.ownerAccountNameFilter.label": "Owner",
101
102
  "assetFilters.partnerFilter.label": "Partner",
102
103
  "assetFilters.pendingTelematicsDevicesFilter.label": "Pending Telematics Devices",
@@ -361,7 +362,7 @@ const GET_ACCESS_MANAGEMENT_MODE_DESIRED_SUMMARY = gql `
361
362
  }
362
363
  }
363
364
  `;
364
- const FETCH_LIMIT$e = 1000;
365
+ const FETCH_LIMIT$f = 1000;
365
366
  /**
366
367
  Renders the Access Management Mode Filter view with the provided props.
367
368
 
@@ -375,7 +376,7 @@ const AccessManagementModeFilterView = ({ filterDefinition, filterState, filterB
375
376
  const { data, loading } = useQuery(GET_ACCESS_MANAGEMENT_MODE_DESIRED_SUMMARY, {
376
377
  fetchPolicy: "cache-first",
377
378
  variables: {
378
- limit: FETCH_LIMIT$e,
379
+ limit: FETCH_LIMIT$f,
379
380
  filters: {
380
381
  ...activeFilters,
381
382
  accessManagementDesiredModes: null, // Omit the filters own values so list shows options correctly
@@ -516,6 +517,77 @@ const servicePlanStatus = {
516
517
  PLANNED: "PLANNED",
517
518
  UPCOMING: "UPCOMING",
518
519
  };
520
+ const GetFleetCountriesSummaryDocument = {
521
+ kind: "Document",
522
+ definitions: [
523
+ {
524
+ kind: "OperationDefinition",
525
+ operation: "query",
526
+ name: { kind: "Name", value: "GetFleetCountriesSummary" },
527
+ variableDefinitions: [
528
+ {
529
+ kind: "VariableDefinition",
530
+ variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
531
+ type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
532
+ },
533
+ {
534
+ kind: "VariableDefinition",
535
+ variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
536
+ type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
537
+ },
538
+ ],
539
+ selectionSet: {
540
+ kind: "SelectionSet",
541
+ selections: [
542
+ {
543
+ kind: "Field",
544
+ name: { kind: "Name", value: "assetSummary" },
545
+ arguments: [
546
+ {
547
+ kind: "Argument",
548
+ name: { kind: "Name", value: "filters" },
549
+ value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
550
+ },
551
+ ],
552
+ selectionSet: {
553
+ kind: "SelectionSet",
554
+ selections: [
555
+ {
556
+ kind: "Field",
557
+ name: { kind: "Name", value: "countries" },
558
+ arguments: [
559
+ {
560
+ kind: "Argument",
561
+ name: { kind: "Name", value: "limit" },
562
+ value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
563
+ },
564
+ ],
565
+ selectionSet: {
566
+ kind: "SelectionSet",
567
+ selections: [
568
+ { kind: "Field", name: { kind: "Name", value: "total" } },
569
+ {
570
+ kind: "Field",
571
+ name: { kind: "Name", value: "summary" },
572
+ selectionSet: {
573
+ kind: "SelectionSet",
574
+ selections: [
575
+ { kind: "Field", name: { kind: "Name", value: "key" } },
576
+ { kind: "Field", name: { kind: "Name", value: "count" } },
577
+ ],
578
+ },
579
+ },
580
+ ],
581
+ },
582
+ },
583
+ ],
584
+ },
585
+ },
586
+ ],
587
+ },
588
+ },
589
+ ],
590
+ };
519
591
  const DeviceHealthIssueCategorySummariesDocument = {
520
592
  kind: "Document",
521
593
  definitions: [
@@ -833,6 +905,87 @@ const GetFleetFirmwareVersionSummaryDocument = {
833
905
  },
834
906
  ],
835
907
  };
908
+ const GetFleetModbusProfileSummaryDocument = {
909
+ kind: "Document",
910
+ definitions: [
911
+ {
912
+ kind: "OperationDefinition",
913
+ operation: "query",
914
+ name: { kind: "Name", value: "GetFleetModbusProfileSummary" },
915
+ variableDefinitions: [
916
+ {
917
+ kind: "VariableDefinition",
918
+ variable: { kind: "Variable", name: { kind: "Name", value: "filters" } },
919
+ type: { kind: "NamedType", name: { kind: "Name", value: "AssetFiltersInput" } },
920
+ },
921
+ {
922
+ kind: "VariableDefinition",
923
+ variable: { kind: "Variable", name: { kind: "Name", value: "search" } },
924
+ type: { kind: "NamedType", name: { kind: "Name", value: "String" } },
925
+ },
926
+ {
927
+ kind: "VariableDefinition",
928
+ variable: { kind: "Variable", name: { kind: "Name", value: "limit" } },
929
+ type: { kind: "NamedType", name: { kind: "Name", value: "Int" } },
930
+ },
931
+ ],
932
+ selectionSet: {
933
+ kind: "SelectionSet",
934
+ selections: [
935
+ {
936
+ kind: "Field",
937
+ name: { kind: "Name", value: "assetSummary" },
938
+ arguments: [
939
+ {
940
+ kind: "Argument",
941
+ name: { kind: "Name", value: "filters" },
942
+ value: { kind: "Variable", name: { kind: "Name", value: "filters" } },
943
+ },
944
+ ],
945
+ selectionSet: {
946
+ kind: "SelectionSet",
947
+ selections: [
948
+ {
949
+ kind: "Field",
950
+ name: { kind: "Name", value: "modbusProfileSummary" },
951
+ arguments: [
952
+ {
953
+ kind: "Argument",
954
+ name: { kind: "Name", value: "filter" },
955
+ value: { kind: "Variable", name: { kind: "Name", value: "search" } },
956
+ },
957
+ {
958
+ kind: "Argument",
959
+ name: { kind: "Name", value: "limit" },
960
+ value: { kind: "Variable", name: { kind: "Name", value: "limit" } },
961
+ },
962
+ ],
963
+ selectionSet: {
964
+ kind: "SelectionSet",
965
+ selections: [
966
+ { kind: "Field", name: { kind: "Name", value: "total" } },
967
+ {
968
+ kind: "Field",
969
+ name: { kind: "Name", value: "summary" },
970
+ selectionSet: {
971
+ kind: "SelectionSet",
972
+ selections: [
973
+ { kind: "Field", name: { kind: "Name", value: "key" } },
974
+ { kind: "Field", name: { kind: "Name", value: "count" } },
975
+ ],
976
+ },
977
+ },
978
+ ],
979
+ },
980
+ },
981
+ ],
982
+ },
983
+ },
984
+ ],
985
+ },
986
+ },
987
+ ],
988
+ };
836
989
  const GetFleetAssetTypesSummaryDocument = {
837
990
  kind: "Document",
838
991
  definitions: [
@@ -2978,7 +3131,7 @@ const useAssetTypeFilter = ({ showTypes } = { showTypes: ALL_TYPES }) => {
2978
3131
  return result;
2979
3132
  };
2980
3133
 
2981
- const FETCH_LIMIT$d = 1000;
3134
+ const FETCH_LIMIT$e = 1000;
2982
3135
  /**
2983
3136
  * React component for rendering the brand filter.
2984
3137
  *
@@ -2994,7 +3147,7 @@ const BrandFilterView = (props) => {
2994
3147
  const { data, loading } = useQuery(GetFleetBrandsSummaryDocument, {
2995
3148
  fetchPolicy: "cache-first",
2996
3149
  variables: {
2997
- limit: FETCH_LIMIT$d,
3150
+ limit: FETCH_LIMIT$e,
2998
3151
  search: debouncedSearch.trim(),
2999
3152
  filters: {
3000
3153
  ...activeFilters,
@@ -3011,7 +3164,7 @@ const BrandFilterView = (props) => {
3011
3164
  return result;
3012
3165
  }, [data?.assetSummary?.brands?.summary, getMachineTypeTranslation]);
3013
3166
  useEffect(() => {
3014
- setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$d);
3167
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$e);
3015
3168
  }, [options]);
3016
3169
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3017
3170
  };
@@ -3038,6 +3191,71 @@ const useBrandFilter = () => {
3038
3191
  return result;
3039
3192
  };
3040
3193
 
3194
+ /**
3195
+ * Build the country filter options from the SFS country summary, translating each
3196
+ * code to its localized name and ordering the list alphabetically by that name.
3197
+ *
3198
+ * @param summary - The country summary entries (code + asset count) from the SFS dimension.
3199
+ * @param languages - Preferred display languages, typically `i18n.languages`.
3200
+ * @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
3201
+ */
3202
+ const buildCountryOptions = (summary, languages) => {
3203
+ return summary
3204
+ .map(country => ({
3205
+ key: country.key,
3206
+ count: country.count,
3207
+ label: getCountryName(country.key, languages),
3208
+ }))
3209
+ .sort((a, b) => stringCompare(a.label, b.label));
3210
+ };
3211
+
3212
+ const COUNTRY_FETCH_LIMIT = 300;
3213
+ /**
3214
+ * React component for rendering the country filter.
3215
+ *
3216
+ * @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
3217
+ * @returns {ReactElement} The country filter component.
3218
+ */
3219
+ const CountryFilter = (props) => {
3220
+ const [, i18n] = useTranslation();
3221
+ const activeFilters = useActiveAssetFilters(props.filterState.values);
3222
+ const { data, loading } = useQuery(GetFleetCountriesSummaryDocument, {
3223
+ fetchPolicy: "cache-first",
3224
+ variables: {
3225
+ limit: COUNTRY_FETCH_LIMIT,
3226
+ filters: {
3227
+ ...activeFilters,
3228
+ countries: null, // Omit the filters own values so list shows options correctly
3229
+ },
3230
+ },
3231
+ });
3232
+ const options = useMemo(() => {
3233
+ return buildCountryOptions(data?.assetSummary?.countries?.summary ?? [], i18n.languages);
3234
+ }, [data?.assetSummary?.countries?.summary, i18n.languages]);
3235
+ return jsx(DefaultCheckboxFilter, { ...props, loading: loading, options: options });
3236
+ };
3237
+
3238
+ /**
3239
+ * Get the Country filter definition
3240
+ *
3241
+ * @returns {StringArrayFilterDefinition} The Country filter definition
3242
+ */
3243
+ const useCountryFilter = () => {
3244
+ const [t, i18n] = useTranslation();
3245
+ return useMemo(() => {
3246
+ return {
3247
+ filterKey: "countries",
3248
+ type: "stringArray",
3249
+ group: "CURRENT_LOCATION",
3250
+ title: t("fleetlist.column.country"),
3251
+ valueAsText(value) {
3252
+ return value.map(code => getCountryName(code, i18n.languages));
3253
+ },
3254
+ component: props => jsx(CountryFilter, { ...props }),
3255
+ };
3256
+ }, [t, i18n.languages]);
3257
+ };
3258
+
3041
3259
  const mapCriticalityToLabelId = (state) => {
3042
3260
  switch (state) {
3043
3261
  case assetCriticalityState.CRITICAL:
@@ -3110,7 +3328,7 @@ const useCriticalityFilter = () => {
3110
3328
  return result;
3111
3329
  };
3112
3330
 
3113
- const FETCH_LIMIT$c = 1000;
3331
+ const FETCH_LIMIT$d = 1000;
3114
3332
  /**
3115
3333
  * Custom hook to fetch customer summary data based on active filters and search text.
3116
3334
  *
@@ -3125,7 +3343,7 @@ const useCustomerData = (filterValues, customerId) => {
3125
3343
  const { data, loading } = useQuery(GetCustomerIdSummaryDocument, {
3126
3344
  fetchPolicy: "cache-first",
3127
3345
  variables: {
3128
- limit: FETCH_LIMIT$c,
3346
+ limit: FETCH_LIMIT$d,
3129
3347
  search: debouncedSearch,
3130
3348
  filters: {
3131
3349
  ...activeFilters,
@@ -3542,7 +3760,7 @@ const useDeviceTypesFilter = (showInFilterBar) => {
3542
3760
  }, [t, showInFilterBar]);
3543
3761
  };
3544
3762
 
3545
- const FETCH_LIMIT$b = 1000;
3763
+ const FETCH_LIMIT$c = 1000;
3546
3764
  /**
3547
3765
  * The Firmware Version Filter component.
3548
3766
  *
@@ -3563,7 +3781,7 @@ const FirmwareVersionFilter = ({ filterDefinition, filterState, filterBarActions
3563
3781
  const debouncedSearch = useDebounce(searchText, { delay: 500 });
3564
3782
  const { data, loading } = useQuery(GetFleetFirmwareVersionSummaryDocument, {
3565
3783
  variables: {
3566
- limit: FETCH_LIMIT$b,
3784
+ limit: FETCH_LIMIT$c,
3567
3785
  search: debouncedSearch,
3568
3786
  filters: {
3569
3787
  ...activeFilters,
@@ -3580,7 +3798,7 @@ const FirmwareVersionFilter = ({ filterDefinition, filterState, filterBarActions
3580
3798
  return result;
3581
3799
  }, [data?.assetSummary?.firmwareVersionSummary?.summary, t]);
3582
3800
  useEffect(() => {
3583
- setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$b);
3801
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$c);
3584
3802
  }, [options]);
3585
3803
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3586
3804
  };
@@ -3647,7 +3865,7 @@ const useFollowedFilter = () => {
3647
3865
  return result;
3648
3866
  };
3649
3867
 
3650
- const FETCH_LIMIT$a = 1000;
3868
+ const FETCH_LIMIT$b = 1000;
3651
3869
  /**
3652
3870
  * The GroupIdsFilterView component is a filter view for group IDs.
3653
3871
  * It utilizes a checkbox filter with a search feature to display and manage group selections.
@@ -3663,7 +3881,7 @@ const GroupIdsFilterView = (props) => {
3663
3881
  const { data, loading } = useQuery(GetFleetGroupSummaryDocument, {
3664
3882
  fetchPolicy: "cache-first",
3665
3883
  variables: {
3666
- limit: FETCH_LIMIT$a,
3884
+ limit: FETCH_LIMIT$b,
3667
3885
  search: debouncedSearch,
3668
3886
  filters: {
3669
3887
  ...activeFilters,
@@ -3687,7 +3905,7 @@ const GroupIdsFilterView = (props) => {
3687
3905
  return result;
3688
3906
  }, [data?.assetSummary?.groups, props.hasCount]);
3689
3907
  useEffect(() => {
3690
- setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$a);
3908
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$b);
3691
3909
  }, [options]);
3692
3910
  return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
3693
3911
  };
@@ -4182,6 +4400,67 @@ const useMetadataCompletenessFilter = ({ isDefault } = {}) => {
4182
4400
  return result;
4183
4401
  };
4184
4402
 
4403
+ const FETCH_LIMIT$a = 1000;
4404
+ /**
4405
+ * The Modbus Profile Filter component.
4406
+ *
4407
+ * Provides an interface to select Modbus profiles. It fetches data from a GraphQL query
4408
+ * and integrates with the filter bar's filtering logic.
4409
+ *
4410
+ * @param props - The filter view props.
4411
+ * @param props.filterDefinition - The filter's definition.
4412
+ * @param props.filterState - The current state of the filter, including selected values.
4413
+ * @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
4414
+ * @returns {ReactElement} React component to render the Modbus profile filter.
4415
+ */
4416
+ const ModbusProfileFilter = ({ filterDefinition, filterState, filterBarActions, ...props }) => {
4417
+ const [t] = useTranslation();
4418
+ const activeFilters = useActiveAssetFilters(filterState.values);
4419
+ const [showRequestMoreUseSearch, setShowRequestMoreUseSearch] = useState(false);
4420
+ const [searchText, setSearchText] = useState("");
4421
+ const debouncedSearch = useDebounce(searchText, { delay: 500 });
4422
+ const { data, loading } = useQuery(GetFleetModbusProfileSummaryDocument, {
4423
+ variables: {
4424
+ limit: FETCH_LIMIT$a,
4425
+ search: debouncedSearch,
4426
+ filters: {
4427
+ ...activeFilters,
4428
+ modbusProfile: null, // Omit the filters own values so list shows options correctly
4429
+ },
4430
+ },
4431
+ fetchPolicy: "cache-first",
4432
+ });
4433
+ const options = useMemo(() => {
4434
+ const result = data?.assetSummary?.modbusProfileSummary?.summary.map(modbusProfile => ({
4435
+ ...modbusProfile,
4436
+ label: modbusProfile.key.toUpperCase() === "UNDEFINED" ? t(`machine.types.Unknown`) : modbusProfile.key,
4437
+ })) ?? [];
4438
+ return result;
4439
+ }, [data?.assetSummary?.modbusProfileSummary?.summary, t]);
4440
+ useEffect(() => {
4441
+ setShowRequestMoreUseSearch(options.length === FETCH_LIMIT$a);
4442
+ }, [options]);
4443
+ return (jsx(DefaultCheckboxFilter, { ...props, customSearch: { value: searchText, onChange: setSearchText, onClear: () => setSearchText("") }, filterBarActions: filterBarActions, filterDefinition: filterDefinition, filterState: filterState, loading: loading, options: options, showRequestMoreUseSearch: showRequestMoreUseSearch }));
4444
+ };
4445
+
4446
+ /**
4447
+ * Get the Modbus Profile filter definition
4448
+ *
4449
+ * @returns {ValueNameArrayFilterDefinition} The Modbus Profile filter definition
4450
+ */
4451
+ const useModbusProfileFilter = () => {
4452
+ const [t] = useTranslation();
4453
+ return useMemo(() => {
4454
+ return {
4455
+ filterKey: "modbusProfile",
4456
+ type: "valueNameArray",
4457
+ group: "DEVICE",
4458
+ title: t("assetFilters.modbusProfile.label"),
4459
+ component: props => jsx(ModbusProfileFilter, { ...props }),
4460
+ };
4461
+ }, [t]);
4462
+ };
4463
+
4185
4464
  const FETCH_LIMIT$9 = 1000;
4186
4465
  /**
4187
4466
  * Renders a custom model filter component, allowing filtering of active assets by models.
@@ -5673,6 +5952,7 @@ const useDefaultAssetFilterBarDefinition = () => {
5673
5952
  const siteIds = useSiteIdsFilter(siteEnabledProps);
5674
5953
  const siteDepotOwnershipIds = useSiteDepotOwnershipIdsFilter();
5675
5954
  const brands = useBrandFilter();
5955
+ const countries = useCountryFilter();
5676
5956
  const models = useModelsFilter();
5677
5957
  const types = useTypesFilter();
5678
5958
  const activity = useActivityFilter();
@@ -5730,6 +6010,7 @@ const useDefaultAssetFilterBarDefinition = () => {
5730
6010
  metadataCompleteness,
5731
6011
  siteIds,
5732
6012
  siteType,
6013
+ countries,
5733
6014
  area,
5734
6015
  groups,
5735
6016
  ownerAccountIds,
@@ -5764,6 +6045,7 @@ const useDefaultAssetFilterBarDefinition = () => {
5764
6045
  assetType,
5765
6046
  metadataCompleteness,
5766
6047
  brands,
6048
+ countries,
5767
6049
  models,
5768
6050
  types,
5769
6051
  activity,
@@ -5806,4 +6088,4 @@ const useDefaultAssetFilterBarDefinition = () => {
5806
6088
  */
5807
6089
  setupLibraryTranslations();
5808
6090
 
5809
- export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModelsFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
6091
+ export { ALL_TYPES, AccessManagementMode, ActiveFilterFiltersView, ActivityFiltersView, AreaView, AssetActivityState, AssetIdsFiltersView, AssetLastSeen, AssetTypesFilterView, BrandFilterView, ClearItemButton, CriticalityFiltersView, CustomerIdsFilterView, DayPeriod, FollowedFiltersView, GetFleetGroupSummaryDocument, GroupIdsFilterView, HourIntervalFilterView, InsightsAfterTreatmentDieselExhaustFluidTankLevelFilterView, InsightsBatteryChargerStateFilterView, InsightsBatteryPotentialFilterView, InsightsBatteryStateOfChargePercentFilterView, InsightsFuelLevelFilterView, LastSeenFiltersView, MetadataCompletenessFilterView, ModelsFilterView, OwnerAccountIdsFilterView, PartnerFilterView, PeriodFilterView, ProductionYearFilterView, RecentSearchesFooter, RentalContractCustomerParentExternalReferenceFilterView, RentalContractCustomerParentNameFilterView, RentalContractOrderNumberFilterView, RentalContractReferenceCodeDescriptionFilterView, RentalContractReferenceCodeFilterView, SERVICE_PLAN_STATUSES_TO_SHOW, SearchFilterInline, ServicePanStatusesFiltersView, SiteDepotOwnershipIdsFilterView, SiteIdsFilterView, SiteStatus, SiteStatusFilterView, SiteTypeSFS, SiteTypesFilterView, TelematicsConnectedFiltersView, TypesFilterView, areaFilterInternalGeoJsonGeometrySchema, areaFilterInternalSchema, assetTypeConst, mapActivityToLabelId, mapMetadataCompletenessToLabelId, metadataCompleteness, metadataCompletenessOptions, placePredictionSchema, placeSchema, sortSiteTypeSummary, useAccessManagementModeFilter, useActiveFilterFilter, useActivityFilter, useAreaFilter, useAssetIdsFilter, useAssetTypeFilter, useBrandFilter, useCountryFilter, useCriticalityFilter, useCustomerIdsFilter, useDefaultAssetFilterBarDefinition, useDeviceHealthIssueCategoryFilter, useDeviceHealthIssueStatusFilter, useDeviceHealthIssueTypeFilter, useDeviceTypesFilter, useFirmwareVersionFilter, useFollowedFilter, useGroupIdsFilter, useHourIntervalFilter, useInsightsAfterTreatmentDieselExhaustFluidTankLevelFilter, useInsightsBatteryChargerStateFilter, useInsightsBatteryPotentialFilter, useInsightsBatteryStateOfChargePercentFilter, useInsightsFuelLevelFilter, useLastSeenFilter, useMetadataCompletenessFilter, useModbusProfileFilter, useModelsFilter, useOwnerAccountIdsFilter, usePartnerFilter, usePeriodFilter, usePlacesSearch, useProductionYearFilter, useRentalActiveContractItemOffRentDatesDateRangeFilter, useRentalActiveContractItemOnRentDatesDateRangeFilter, useRentalContractCustomerParentExternalReferenceFilter, useRentalContractCustomerParentNameFilter, useRentalContractOrderNumberFilter, useRentalContractReferenceCodeDescriptionFilter, useRentalContractReferenceCodeFilter, useSearchFilter, useServicePlanStatusFilter, useSiteDepotOwnershipIdsFilter, useSiteIdsFilter, useSiteStatusFilter, useSiteTypeFilter, useTelematicsConnectedFilter, useTypesFilter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-asset-filter-definitions",
3
- "version": "2.1.94",
3
+ "version": "2.1.96",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -12,24 +12,24 @@
12
12
  "zod": "^3.25.76",
13
13
  "string-ts": "^2.0.0",
14
14
  "tailwind-merge": "^2.0.0",
15
- "@trackunit/iris-app-build-utilities": "2.0.52",
16
- "@trackunit/filters-filter-bar": "2.1.64",
17
- "@trackunit/react-core-hooks": "1.17.69",
18
- "@trackunit/react-filter-components": "2.1.64",
19
- "@trackunit/react-form-components": "2.1.63",
20
- "@trackunit/filters-graphql-hook": "2.1.86",
21
- "@trackunit/utilization-indicator": "2.1.60",
15
+ "@trackunit/iris-app-build-utilities": "2.0.53",
16
+ "@trackunit/filters-filter-bar": "2.1.66",
17
+ "@trackunit/react-core-hooks": "1.17.70",
18
+ "@trackunit/react-filter-components": "2.1.65",
19
+ "@trackunit/react-form-components": "2.1.64",
20
+ "@trackunit/filters-graphql-hook": "2.1.88",
21
+ "@trackunit/utilization-indicator": "2.1.61",
22
22
  "@trackunit/geo-json-utils": "1.14.59",
23
- "@trackunit/react-components": "2.1.60",
24
- "@trackunit/shared-utils": "1.15.57",
25
- "@trackunit/translations-machine-type": "2.0.62",
26
- "@trackunit/criticality-indicator": "2.1.60",
27
- "@trackunit/iris-app-api": "2.0.48",
28
- "@trackunit/react-core-contexts-test": "1.17.63",
29
- "@trackunit/i18n-library-translation": "2.0.58",
30
- "@trackunit/iris-app-runtime-core-api": "1.16.63",
31
- "@trackunit/react-graphql-hooks": "2.1.60",
32
- "@trackunit/translations-device": "1.1.44"
23
+ "@trackunit/react-components": "2.1.61",
24
+ "@trackunit/shared-utils": "1.15.58",
25
+ "@trackunit/translations-machine-type": "2.0.63",
26
+ "@trackunit/criticality-indicator": "2.1.61",
27
+ "@trackunit/iris-app-api": "2.0.49",
28
+ "@trackunit/react-core-contexts-test": "1.17.64",
29
+ "@trackunit/i18n-library-translation": "2.0.59",
30
+ "@trackunit/iris-app-runtime-core-api": "1.16.64",
31
+ "@trackunit/react-graphql-hooks": "2.1.61",
32
+ "@trackunit/translations-device": "1.1.46"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@apollo/client": "^3.13.8",
@@ -0,0 +1,9 @@
1
+ import { FilterViewProps } from "@trackunit/filters-filter-bar";
2
+ import { ReactElement } from "react";
3
+ /**
4
+ * React component for rendering the country filter.
5
+ *
6
+ * @param {FilterViewProps<string[]>} props - The component's properties, including filter state and values.
7
+ * @returns {ReactElement} The country filter component.
8
+ */
9
+ export declare const CountryFilter: (props: FilterViewProps<Array<string>>) => ReactElement;
@@ -0,0 +1,18 @@
1
+ interface CountrySummaryEntry {
2
+ key: string;
3
+ count: number;
4
+ }
5
+ /**
6
+ * Build the country filter options from the SFS country summary, translating each
7
+ * code to its localized name and ordering the list alphabetically by that name.
8
+ *
9
+ * @param summary - The country summary entries (code + asset count) from the SFS dimension.
10
+ * @param languages - Preferred display languages, typically `i18n.languages`.
11
+ * @returns {Array<{ key: string; count: number; label: string }>} Filter options sorted alphabetically by localized name.
12
+ */
13
+ export declare const buildCountryOptions: (summary: ReadonlyArray<CountrySummaryEntry>, languages: ReadonlyArray<string>) => {
14
+ key: string;
15
+ count: number;
16
+ label: string;
17
+ }[];
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import { StringArrayFilterDefinition } from "@trackunit/filters-filter-bar";
2
+ /**
3
+ * Get the Country filter definition
4
+ *
5
+ * @returns {StringArrayFilterDefinition} The Country filter definition
6
+ */
7
+ export declare const useCountryFilter: () => StringArrayFilterDefinition;
@@ -0,0 +1,15 @@
1
+ import { FilterViewProps, ValueName } from "@trackunit/filters-filter-bar";
2
+ import { ReactElement } from "react";
3
+ /**
4
+ * The Modbus Profile Filter component.
5
+ *
6
+ * Provides an interface to select Modbus profiles. It fetches data from a GraphQL query
7
+ * and integrates with the filter bar's filtering logic.
8
+ *
9
+ * @param props - The filter view props.
10
+ * @param props.filterDefinition - The filter's definition.
11
+ * @param props.filterState - The current state of the filter, including selected values.
12
+ * @param props.filterBarActions - Actions for the filter's interaction with the filter bar.
13
+ * @returns {ReactElement} React component to render the Modbus profile filter.
14
+ */
15
+ export declare const ModbusProfileFilter: ({ filterDefinition, filterState, filterBarActions, ...props }: FilterViewProps<Array<ValueName>>) => ReactElement;
@@ -0,0 +1,7 @@
1
+ import { ValueNameArrayFilterDefinition } from "@trackunit/filters-filter-bar";
2
+ /**
3
+ * Get the Modbus Profile filter definition
4
+ *
5
+ * @returns {ValueNameArrayFilterDefinition} The Modbus Profile filter definition
6
+ */
7
+ export declare const useModbusProfileFilter: () => ValueNameArrayFilterDefinition;
@@ -12,6 +12,10 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
12
12
  * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
13
13
  */
14
14
  declare const documents: {
15
+ "query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetCountriesSummaryQuery, types.Exact<{
16
+ filters: types.InputMaybe<types.AssetFiltersInput>;
17
+ limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
18
+ }>>;
15
19
  "query DeviceHealthIssueCategorySummaries($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n fleetHealthCategoriesSummary {\n summary {\n count\n key\n }\n total\n }\n }\n}": DocumentNode<types.DeviceHealthIssueCategorySummariesQuery, types.Exact<{
16
20
  filters: types.InputMaybe<types.AssetFiltersInput>;
17
21
  }>>;
@@ -29,6 +33,11 @@ declare const documents: {
29
33
  search: types.InputMaybe<types.Scalars["String"]["input"]>;
30
34
  limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
31
35
  }>>;
36
+ "query GetFleetModbusProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n modbusProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}": DocumentNode<types.GetFleetModbusProfileSummaryQuery, types.Exact<{
37
+ filters: types.InputMaybe<types.AssetFiltersInput>;
38
+ search: types.InputMaybe<types.Scalars["String"]["input"]>;
39
+ limit: types.InputMaybe<types.Scalars["Int"]["input"]>;
40
+ }>>;
32
41
  "query GetFleetAssetTypesSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n assetTypes {\n total\n summary {\n machines\n attachments\n equipments\n tools\n gateways\n others\n vehicles\n }\n }\n }\n}\n\nquery GetFleetSiteTypeSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n siteTypes {\n total\n summary {\n siteType\n count\n }\n }\n }\n}\n\nquery GetMetadataCompletenessSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n metadataCompletenesses {\n total\n summary {\n metadataCompleteness\n count\n }\n }\n }\n}\n\nquery GetFleetGroupSummary($filters: AssetFiltersInput, $search: String, $limit: Int!) {\n assetSummary(filters: $filters) {\n groups(filter: $search, limit: $limit) {\n total\n missing\n summary {\n group {\n id\n groupId\n name\n }\n count\n }\n }\n }\n}\n\nquery GetFleetOwnerAccountSummary($filters: AssetFiltersInput, $search: String, $limit: Int!) {\n assetSummary(filters: $filters) {\n ownerAccounts(filter: $search, limit: $limit) {\n total\n summary {\n ownerAccount {\n accountId\n name\n }\n count\n }\n }\n }\n}\n\nquery GetFleetModelsSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n models(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetCustomFieldSummary($filters: AssetFiltersInput, $definitionIds: [String!]!) {\n assetSummary(filters: $filters) {\n customFields(definitionIds: $definitionIds) {\n definition {\n definition {\n id\n }\n }\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetBrandsSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n brands(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetTypesSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n types(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetCriticalitySummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n criticality {\n critical\n low\n good\n }\n }\n}\n\nquery GetFleetProductionYearsSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n productionYears(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetServicePlanNamesSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n servicePlanNames {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetServicePlanStatusesSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n servicePlanStatuses {\n overdue\n upcoming\n planned\n }\n }\n}\n\nquery GetFleetServiceProvidersSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n serviceProviders {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetServicePlanAssignmentsSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n servicePlanAssignments {\n fullyConfigured\n partiallyConfigured\n notConfigured\n }\n }\n}\n\nquery GetFleetActivitySummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n activity {\n working\n idling\n stopped\n unknown\n }\n }\n}\n\nquery GetSiteIdSummary($filters: AssetFiltersInput, $search: String, $limit: Int!) {\n assetSummary(filters: $filters) {\n sites(filter: $search, limit: $limit) {\n total\n summary {\n site {\n id\n siteId\n name\n }\n count\n }\n }\n }\n}\n\nquery GetSiteDepotOwnershipIdSummary($filters: AssetFiltersInput, $search: String, $limit: Int!) {\n assetSummary(filters: $filters) {\n owningDepots(filter: $search, limit: $limit) {\n total\n summary {\n site {\n id\n siteId\n name\n }\n count\n }\n }\n }\n}\n\nquery GetCustomerIdSummary($filters: AssetFiltersInput, $search: String, $limit: Int!) {\n assetSummary(filters: $filters) {\n customers(filter: $search, limit: $limit) {\n total\n summary {\n customer {\n id\n customerId\n name\n parent {\n customerId\n name\n }\n }\n count\n }\n }\n }\n}\n\nquery GetAssetTelematicsDeviceConnectionSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n assetTelematicsDeviceConnected {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetPlaceAutocompletePredictions($search: String!) {\n placeAutocomplete(input: $search) {\n predictions {\n placeId\n description\n }\n }\n}\n\nquery GetPlaceDetails($placeId: String!) {\n placeDetails(placeId: $placeId) {\n geometry {\n type\n coordinates\n }\n bbox\n properties {\n formattedAddress\n }\n }\n}\n\nquery GetFleetRentalContractOrderNumberSummary($filters: AssetFiltersInput, $limit: Int!, $search: String) {\n assetSummary(filters: $filters) {\n rentalContractOrderNumbers(limit: $limit, filter: $search) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetRentalContractReferenceCodesSummary($filters: AssetFiltersInput, $limit: Int!, $search: String) {\n assetSummary(filters: $filters) {\n rentalContractReferenceCodes(limit: $limit, filter: $search) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetRentalCustomerParentExternalReferenceSummary($filters: AssetFiltersInput, $limit: Int!, $search: String) {\n assetSummary(filters: $filters) {\n rentalContractCustomerParentExternalReferences(limit: $limit, filter: $search) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetFleetRentalCustomerParentNameSummary($filters: AssetFiltersInput, $limit: Int!, $search: String) {\n assetSummary(filters: $filters) {\n rentalContractCustomerParentNames(limit: $limit, filter: $search) {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetAccessManagementModeDesiredSummary($filters: AssetFiltersInput, $limit: Int!) {\n assetSummary(filters: $filters) {\n accessManagementModeDesired(limit: $limit) {\n total\n summary {\n accessManagementMode\n count\n }\n }\n }\n}\n\nquery GetPendingTelematicsDevicesSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n pendingTelematicsDevices {\n total\n summary {\n key\n count\n }\n }\n }\n}\n\nquery GetBatteryChargerStageSummary($filters: AssetFiltersInput) {\n assetSummary(filters: $filters) {\n insights {\n batteryChargerState {\n disabled\n enabled\n undefined\n }\n }\n }\n}": DocumentNode<types.GetFleetAssetTypesSummaryQuery, types.Exact<{
33
42
  filters: types.InputMaybe<types.AssetFiltersInput>;
34
43
  }>>;
@@ -46,6 +55,10 @@ declare const documents: {
46
55
  * Please regenerate the types.
47
56
  */
48
57
  export declare function graphql(source: string): unknown;
58
+ /**
59
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
60
+ */
61
+ export declare function graphql(source: "query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetCountriesSummary($filters: AssetFiltersInput, $limit: Int) {\n assetSummary(filters: $filters) {\n countries(limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
49
62
  /**
50
63
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
51
64
  */
@@ -66,6 +79,10 @@ export declare function graphql(source: "query DeviceTypesSummary($filters: Asse
66
79
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
67
80
  */
68
81
  export declare function graphql(source: "query GetFleetFirmwareVersionSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n firmwareVersionSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetFirmwareVersionSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n firmwareVersionSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
82
+ /**
83
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
84
+ */
85
+ export declare function graphql(source: "query GetFleetModbusProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n modbusProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"): (typeof documents)["query GetFleetModbusProfileSummary($filters: AssetFiltersInput, $search: String, $limit: Int) {\n assetSummary(filters: $filters) {\n modbusProfileSummary(filter: $search, limit: $limit) {\n total\n summary {\n key\n count\n }\n }\n }\n}"];
69
86
  /**
70
87
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
71
88
  */