@equinor/echo-framework 4.0.1 → 4.1.1

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.
Files changed (56) hide show
  1. package/index.cjs.js +3 -3
  2. package/package.json +7 -7
  3. package/src/index.d.ts +1 -1
  4. package/src/lib/components/plantSelector/index.d.ts +1 -0
  5. package/src/lib/components/plantSelector/plantSelector.d.ts +5 -14
  6. package/src/lib/components/plantSelector/plantSelector.hooks.d.ts +19 -0
  7. package/src/lib/feature/globalSelection/OpenGlobalSelectionIn3DButton.utils.d.ts +9 -0
  8. package/src/lib/feature/globalSelection/components/SelectionActionBar/SelectionFeedbackDisplay.d.ts +7 -0
  9. package/src/lib/feature/globalSelection/components/SelectionActionBar/selectionFeedback.types.d.ts +1 -0
  10. package/src/lib/feature/globalSelection/components/SelectionActionBar.d.ts +3 -4
  11. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionGroupMenuItem.d.ts +9 -0
  12. package/src/lib/feature/globalSelection/components/SelectionMenuTrigger/SelectionMenuTrigger.d.ts +12 -0
  13. package/src/lib/feature/globalSelection/globalSelection.api.d.ts +9 -0
  14. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +14 -18
  15. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.mutableSelectionItem.d.ts +37 -0
  16. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.types.d.ts +49 -54
  17. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.utils.d.ts +12 -6
  18. package/src/lib/feature/globalSelection/globalSelectionStore/itemIdTypeGuards.d.ts +7 -0
  19. package/src/lib/feature/globalSelection/hooks/useGlobalSelectionLists.d.ts +1 -1
  20. package/src/lib/feature/globalSelection/hooks/useItemGroupMembership.d.ts +13 -0
  21. package/src/lib/feature/globalSelection/hooks/useSelectionAction.d.ts +21 -0
  22. package/src/lib/feature/globalSelection/index.d.ts +6 -2
  23. package/src/lib/feature/globalSelection/pdmsTag/pdmsTag.logic.d.ts +1 -0
  24. package/src/lib/feature/globalSelection/pdmsTag/pdmsTag.types.d.ts +12 -3
  25. package/src/lib/feature/globalSelection/pdmsTag/pdmsTag.utils.d.ts +0 -2
  26. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.d.ts +2 -3
  27. package/src/lib/feature/globalSelection/selectionMenu/selectionTreeStore/selectionTree.store.utils.d.ts +1 -1
  28. package/src/lib/feature/legend/components/LegendFeedbackMessage.d.ts +1 -1
  29. package/src/lib/feature/legend/components/pdfMarkers/subComponents/components/MultipleMarkersBySingleLegend/multipleMarkersBySingleLegend.logic.d.ts +15 -0
  30. package/src/lib/feature/legend/components/pdfMarkers/subComponents/components/MultipleMarkersBySingleLegend/useStalePopoverMarkers.d.ts +19 -0
  31. package/src/lib/feature/legend/components/pdfMarkers/subComponents/hooks/useMarkerPopover.d.ts +1 -0
  32. package/src/lib/feature/legend/components/pdfMarkers/utils/markerId.utils.d.ts +9 -0
  33. package/src/lib/feature/legend/hooks/useFetchNotificationsByWorkOrderId.d.ts +13 -0
  34. package/src/lib/feature/legend/hooks/useItemToSelectionGroupsMapSubscription.d.ts +3 -3
  35. package/src/lib/feature/legend/hooks/useSelectionItemColorSubscription.d.ts +3 -3
  36. package/src/lib/feature/legend/hooks/useUniqueSelectionOnlyBadgeIdStrings.d.ts +8 -0
  37. package/src/lib/feature/legend/index.d.ts +1 -0
  38. package/src/lib/feature/legend/legendFacade.d.ts +10 -1
  39. package/src/lib/feature/legend/legendStrategies/notificationStrategy/notificationStrategy.d.ts +1 -0
  40. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/CreateWorkOrderPopoverContent.d.ts +1 -2
  41. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/components/WorkOrderPopoverPrimaryRow.d.ts +3 -3
  42. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/useCreateWorkOrderMarkers.d.ts +1 -1
  43. package/src/lib/feature/legend/legendStrategies/workOrderStrategy/workOrderPopover.types.d.ts +9 -10
  44. package/src/lib/feature/legend/logic/legendDataId.utils.d.ts +50 -0
  45. package/src/lib/feature/legend/stores/legendUIStore/legendUIStore.types.d.ts +13 -1
  46. package/src/lib/feature/legend/stores/legendVisibleDataStore/legendVisibleDataStore.d.ts +2 -3
  47. package/src/lib/feature/legend/types/legendMarkerBadge.type.d.ts +6 -1
  48. package/src/lib/feature/legend/types/legendStrategy.type.d.ts +2 -3
  49. package/src/lib/feature/legend/types/legendType.d.ts +18 -2
  50. package/src/lib/feature/measuringPoint/components/lastRecordedMeasurement/lastRecordedMeasurement.logic.d.ts +3 -3
  51. package/src/lib/feature/workOrder/api/api-workOrder-notification.d.ts +12 -0
  52. package/src/lib/services/dataLayerPanel/dataLayerPanel.store.d.ts +13 -11
  53. package/src/lib/feature/globalSelection/components/AddToSelectionMenuTrigger/AddToSelectionMenuItem.d.ts +0 -8
  54. package/src/lib/feature/globalSelection/components/AddToSelectionMenuTrigger/AddToSelectionMenuTrigger.d.ts +0 -6
  55. package/src/lib/feature/legend/hooks/useUniqueBadgeItemIdStrings.d.ts +0 -6
  56. package/src/lib/feature/measuringPoint/components/lastRecordedMeasurement/lastRecordedMeasurement.d.ts +0 -8
@@ -2,11 +2,20 @@ import type { TagSummaryDto } from '@equinor/echo-search';
2
2
  export declare const PDMS_INTERNAL_TAG_TYPES: readonly ["PdmsTag", "PdmsPart"];
3
3
  export type PdmsInternalTagType = (typeof PDMS_INTERNAL_TAG_TYPES)[number];
4
4
  export declare const isPdmsInternalTagType: (value: string) => value is PdmsInternalTagType;
5
- export interface PdmsTagId {
6
- readonly tagNo: string;
7
- readonly instCode: string;
5
+ /**
6
+ * StidTagId contains only tagNo and instCode.
7
+ */
8
+ export type StidTagId = Pick<TagSummaryDto, 'tagNo' | 'instCode'>;
9
+ /**
10
+ * Identifies a PDMS tag. Extends the standard STID tag ID (tagNo + instCode) with additional PDMS-specific properties.
11
+ * @remarks STID tags only have `tagNo` and `instCode`. PDMS tags add `internalTagType`, `plantNo`, and `plantCode`.
12
+ */
13
+ export interface PdmsTagId extends StidTagId {
14
+ /** @remarks Discriminator between PDMS tag types: 'PdmsTag' for tags not in STID, 'PdmsPart' for parts without a tag. */
8
15
  readonly internalTagType: PdmsInternalTagType;
16
+ /** @remarks Also known as sapId. */
9
17
  readonly plantNo: string;
18
+ /** @remarks Usually same as instCode, but for some plants it replaces last instCode character with A, B, C, etc. */
10
19
  readonly plantCode: string;
11
20
  }
12
21
  export interface PdmsTagSummaryDto extends TagSummaryDto, PdmsTagId {
@@ -1,6 +1,4 @@
1
1
  import { type TagSummaryDto } from '@equinor/echo-search';
2
- import type { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionStore.types';
3
2
  import type { PdmsTagId, PdmsTagSummaryDto } from './pdmsTag.types';
4
- export declare function isPdmsTagId(itemId: GlobalSelectionTypes.ItemId): itemId is PdmsTagId;
5
3
  export declare function isPdmsTagSummaryDto(dto: TagSummaryDto): dto is PdmsTagSummaryDto;
6
4
  export declare function createPdmsTagSummaryDto(pdmsTagId: PdmsTagId): PdmsTagSummaryDto;
@@ -89,15 +89,14 @@ export declare const useSelectionTreeStore: import("zustand").UseBoundStore<Omit
89
89
  id: {
90
90
  workOrderId: string;
91
91
  } | {
92
- tagNo: string;
93
92
  instCode: string;
93
+ tagNo: string;
94
+ } | {
94
95
  internalTagType: import("../..").PdmsInternalTagType;
95
96
  plantNo: string;
96
97
  plantCode: string;
97
- } | {
98
98
  instCode: string;
99
99
  tagNo: string;
100
- internalTagType?: never | undefined;
101
100
  } | {
102
101
  equipmentId: string;
103
102
  } | {
@@ -104,7 +104,7 @@ export declare function isSelectionEmpty(groups: SelectionTreeTypes.Group[]): bo
104
104
  * @returns {void}
105
105
  */
106
106
  export declare function removeStaleItemsFromGlobalSelection(groups: SelectionTreeTypes.Group[], itemIds: GlobalSelectionTypes.ItemId[]): void;
107
- export declare function getItemsByIdsFromGlobalSelectionStore(itemIds: GlobalSelectionTypes.ItemId[]): GlobalSelectionTypes.GenericItem<GlobalSelectionItemType>[];
107
+ export declare function getItemsByIdsFromGlobalSelectionStore(itemIds: GlobalSelectionTypes.ItemId[]): GlobalSelectionTypes.SelectionItem[];
108
108
  /**
109
109
  * Returns an array of selection colors sorted by their frequency for the specified item IDs within a group.
110
110
  *
@@ -1,4 +1,4 @@
1
- export type LegendFeedbackVariant = 'error' | 'info' | 'warning';
1
+ import type { LegendFeedbackVariant } from '../stores/legendUIStore/legendUIStore.types';
2
2
  interface LegendFeedbackMessageProps {
3
3
  className?: string;
4
4
  variant?: LegendFeedbackVariant;
@@ -0,0 +1,15 @@
1
+ import { Marker } from '../../../../../types/legendMarkerBadge.type';
2
+ import { MarkerId } from '../../../utils/markerId.utils';
3
+ import { ColorGroupedMarker } from '../../../utils/splitMarkerByColor.types';
4
+ /**
5
+ * Builds the list of color-grouped markers to render for a single legend item.
6
+ *
7
+ * When the item has no selection grouping, wraps the raw marker as a single transparent-key variant.
8
+ * Always returns markers sorted by color key for stable render order.
9
+ */
10
+ export declare function buildMarkersToRender(marker: Marker, groupedMarkers: ReadonlyArray<ColorGroupedMarker> | null | undefined): ColorGroupedMarker[];
11
+ /**
12
+ * Finds the best new markerId to migrate the active popover to after the old marker disappears.
13
+ * Prefers a marker with the same color key, falls back to the first available.
14
+ */
15
+ export declare function findNewMarkerId(markerIds: MarkerId[], previousMarkerId: MarkerId): MarkerId | undefined;
@@ -0,0 +1,19 @@
1
+ import { MarkerId } from '../../../utils/markerId.utils';
2
+ import { ColorGroupedMarker } from '../../../utils/splitMarkerByColor.types';
3
+ interface UseStalePopoverMarkersProps {
4
+ readonly markersToRender: ReadonlyArray<ColorGroupedMarker> | null;
5
+ readonly markerIds: ReadonlyArray<MarkerId>;
6
+ readonly selectionMarkerIds: ReadonlyArray<MarkerId>;
7
+ }
8
+ /**
9
+ * Holds stale markers visible while selection feedback is displayed after a delayed close or migration.
10
+ *
11
+ * When `shouldDelayPopoverUpdate` is true and the active popover's marker disappears (e.g. last item
12
+ * removed from a color group), this hook keeps the old `MarkerWithPopover` rendered for
13
+ * `POPOVER_UPDATE_DELAY_MS`. That gives the loading indicator and feedback message ("Removed",
14
+ * "Color changed") time to be visible before the popover closes or migrates to a new marker.
15
+ *
16
+ * @returns The markers that should be rendered — either the stale snapshot or the live `markersToRender`.
17
+ */
18
+ export declare function useStalePopoverMarkers({ markersToRender, markerIds, selectionMarkerIds }: UseStalePopoverMarkersProps): ReadonlyArray<ColorGroupedMarker> | null;
19
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { LegendDataId, LegendId } from '../../../../types/legendType';
2
2
  import { MarkerId } from '../../utils/markerId.utils';
3
3
  import { ColorGroupedMarker } from '../../utils/splitMarkerByColor.types';
4
+ export declare const POPOVER_UPDATE_DELAY_MS = 2000;
4
5
  /**
5
6
  * Hook to manage popover state and async content loading for legend markers.
6
7
  * When fetching, it will show a loading spinner if content takes too long to load.
@@ -1,6 +1,10 @@
1
1
  import { Brand } from '@equinor/echo-utils';
2
2
  import { LegendId } from '../../../types/legendType';
3
3
  export type MarkerId = Brand<string, 'MarkerId'>;
4
+ /**
5
+ * Color key used when a marker is not in any selection group (fallback/transparent state).
6
+ */
7
+ export declare const TRANSPARENT_COLOR_KEY = "color_transparent";
4
8
  /**
5
9
  * Creates a unique marker ID from its component parts.
6
10
  * Format: positionId::legendId::groupKey
@@ -16,3 +20,8 @@ export declare function getPositionIdFromMarkerId(markerId: MarkerId): string |
16
20
  * Checks if a marker ID belongs to a specific position.
17
21
  */
18
22
  export declare function isMarkerAtPosition(markerId: MarkerId | undefined, positionId: string): boolean;
23
+ /**
24
+ * Extracts the color/group key from a marker ID.
25
+ * Returns undefined if the marker ID is invalid.
26
+ */
27
+ export declare function getColorKeyFromMarkerId(markerId: MarkerId): string | undefined;
@@ -0,0 +1,13 @@
1
+ import { WorkOrderNotificationStatus } from '../../workOrder/api/api-workOrder-notification';
2
+ /**
3
+ * React Query hook that fetches maintenance record/attachment notification data for a given work order.
4
+ *
5
+ * This hook returns only the resolved `data` value from React Query.
6
+ * Callers that need loading/error state should use `useQuery` directly.
7
+ *
8
+ * @param workOrderId - Unique identifier of the work order for which to fetch notification data.
9
+ * @returns Notification data for the work order, or `undefined` when not yet loaded or when the API returns no data.
10
+ */
11
+ export declare function useFetchNotificationsByWorkOrderId({ workOrderId }: {
12
+ workOrderId: string;
13
+ }): WorkOrderNotificationStatus | undefined;
@@ -1,4 +1,4 @@
1
- import { GlobalSelectionTypes } from '../../globalSelection';
1
+ import type { GlobalSelectionTypes } from '../../globalSelection/globalSelectionStore/globalSelectionStore.types';
2
2
  import { ItemToSelectionGroupsMap } from '../stores/itemToSelectionGroupsMapStore/itemToSelectionGroupsMapStore.types';
3
3
  interface ItemToSelectionGroupsMapSubscriptionResult {
4
4
  /** The complete itemToSelectionGroupsMap for looking up item -> selection groups */
@@ -11,7 +11,7 @@ interface ItemToSelectionGroupsMapSubscriptionResult {
11
11
  * and only triggers a re-render when any of the watched items change group membership.
12
12
  * Returns the full itemToSelectionGroupsMap so the caller can look up selection groups for each badge.
13
13
  *
14
- * @param watchItemIds - Array of item ID strings to watch (e.g., all badge item IDs from a marker)
14
+ * @param watchItemIds - Array of global selection item ID strings to watch
15
15
  * @returns Object containing the complete itemToSelectionGroupsMap for lookups
16
16
  *
17
17
  * @example
@@ -25,5 +25,5 @@ interface ItemToSelectionGroupsMapSubscriptionResult {
25
25
  * const { itemToSelectionGroupsMap } = useItemToSelectionGroupsMapSubscription(badgeItemIds);
26
26
  * ```
27
27
  */
28
- export declare const useItemToSelectionGroupsMapSubscription: (watchItemIds: GlobalSelectionTypes.ItemIdString[]) => ItemToSelectionGroupsMapSubscriptionResult;
28
+ export declare const useItemToSelectionGroupsMapSubscription: (watchItemIds: ReadonlyArray<GlobalSelectionTypes.ItemIdString>) => ItemToSelectionGroupsMapSubscriptionResult;
29
29
  export {};
@@ -1,4 +1,4 @@
1
- import { GlobalSelectionTypes } from '../../globalSelection';
1
+ import { type GlobalSelectionTypes } from '../../globalSelection/globalSelectionStore/globalSelectionStore.types';
2
2
  /**
3
3
  * Creates a per-marker subscription to selection item color changes.
4
4
  *
@@ -10,7 +10,7 @@ import { GlobalSelectionTypes } from '../../globalSelection';
10
10
  * the selection color of THIS marker's specific items changes, not when any
11
11
  * item's color changes in the global selection.
12
12
  *
13
- * @param itemIdStrings - Sorted array of item ID strings to watch
13
+ * @param itemIdStrings - Sorted array of global selection item ID strings to watch
14
14
  * @returns A combined key string representing current selection item colors for these items
15
15
  */
16
- export declare const useSelectionItemColorSubscription: (itemIdStrings: GlobalSelectionTypes.ItemIdString[]) => string;
16
+ export declare const useSelectionItemColorSubscription: (itemIdStrings: ReadonlyArray<GlobalSelectionTypes.ItemIdString>) => string;
@@ -0,0 +1,8 @@
1
+ import type { GlobalSelectionTypes } from '../../globalSelection/globalSelectionStore/globalSelectionStore.types';
2
+ import { Marker } from '../types/legendMarkerBadge.type';
3
+ /**
4
+ * Returns unique global-selection item ID strings from all badges on the marker.
5
+ * Non-selection items are filtered out since they
6
+ * don't exist in global selection and need no selection lookups.
7
+ */
8
+ export declare const useUniqueSelectionOnlyBadgeIdStrings: (marker?: Marker) => GlobalSelectionTypes.ItemIdString[];
@@ -1,3 +1,4 @@
1
+ import './legendStrategies/notificationStrategy/notificationStrategy';
1
2
  import './legendStrategies/workOrderStrategy/WorkOrderLegend';
2
3
  export { getBadgeChips, getMarkerChips } from './components/basicLegendRenderer.logic';
3
4
  export { LegendList } from './components/LegendList';
@@ -1,8 +1,8 @@
1
- import type { LegendFeedbackVariant } from './components/LegendFeedbackMessage';
2
1
  import { getLegendStrategy, injectLegendStrategy } from './legendStrategies/legendCollections';
3
2
  import { isLegendDataIdEqualWithTag } from './logic/isLegendDataIdEqualWithTag';
4
3
  import { legendExistsInLegendStore, legendSnapShot, legendStoreSubscribe, useAllLegends, useLegendById } from './stores/legendDataStore/legendStore';
5
4
  import { legendExistsInLegendUIStore, useLegendUIById } from './stores/legendUIStore/legendUIStore';
5
+ import type { LegendFeedbackVariant } from './stores/legendUIStore/legendUIStore.types';
6
6
  import { visibleDataAsTagsSnapshot } from './stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore';
7
7
  import { LegendId } from './types/legendType';
8
8
  /**
@@ -143,10 +143,19 @@ export declare const legendFacade: Readonly<{
143
143
  };
144
144
  utils: {
145
145
  isLegendDataIdEqualWithTag: typeof isLegendDataIdEqualWithTag;
146
+ dataIdToString: (id: import("./types/legendType").LegendDataId) => import("./types/legendType").LegendDataIdString;
147
+ dataIdToSelectionItemIdString: (id: import("./types/legendType").LegendDataId) => import("../globalSelection").GlobalSelectionTypes.ItemIdString | undefined;
148
+ isGlobalSelectionItemId: (id: import("./types/legendType").LegendDataId) => id is import("./types/legendType").GlobalSelectionLegendDataId;
149
+ selectionGuards: {
150
+ readonly WorkOrder: (legendDataId: import("./types/legendType").LegendDataId) => legendDataId is import("../globalSelection").GlobalSelectionTypes.WorkOrderId;
151
+ readonly Tag: (legendDataId: import("./types/legendType").LegendDataId) => legendDataId is import("../globalSelection").GlobalSelectionTypes.TagId;
152
+ readonly Equipment: (legendDataId: import("./types/legendType").LegendDataId) => legendDataId is import("../globalSelection").GlobalSelectionTypes.EquipmentId;
153
+ };
146
154
  };
147
155
  knownLegendIds: {
148
156
  equipmentLegendId: LegendId;
149
157
  tagLegendId: LegendId;
150
158
  workOrderLegendId: LegendId;
159
+ notificationLegendId: LegendId;
151
160
  };
152
161
  }>;
@@ -1,4 +1,3 @@
1
- import { GlobalSelectionTypes } from '../../../globalSelection';
2
1
  import { LegendDataId } from '../../types/legendType';
3
2
  /**
4
3
  * Creates popover content for a work order legend item.
@@ -11,4 +10,4 @@ import { LegendDataId } from '../../types/legendType';
11
10
  * @param itemIds - Selected item ids used to filter which work orders should be shown in the popover.
12
11
  * @returns A JSX element array when work orders are found, otherwise a single fallback JSX element.
13
12
  */
14
- export declare function createPopoverContent(legendDataId: LegendDataId, itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>): Promise<JSX.Element | JSX.Element[]>;
13
+ export declare function createPopoverContent(legendDataId: LegendDataId, itemIds: ReadonlyArray<LegendDataId>): Promise<JSX.Element | JSX.Element[]>;
@@ -5,11 +5,11 @@
5
5
  * a list of unique notification type identifiers resolved for the work order.
6
6
  *
7
7
  * @param props \- Component props.
8
- * @param props.workOrderNumber \- Work order identifier used for display and for fetching related objects.
8
+ * @param props.workOrderId \- Work order identifier used for display and for fetching related objects.
9
9
  * @param props.isActive \- Whether the work order is active \(`true`\) or completed \(`false`\).
10
10
  * @returns A React element containing the primary row content.
11
11
  */
12
- export declare const WorkOrderPopoverPrimaryRow: ({ workOrderNumber, isActive }: {
13
- workOrderNumber: string;
12
+ export declare const WorkOrderPopoverPrimaryRow: ({ workOrderId, isActive }: {
13
+ workOrderId: string;
14
14
  isActive: boolean;
15
15
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { LegendDataId } from '../../types/legendType';
2
1
  import { Marker } from '../../types/legendMarkerBadge.type';
2
+ import { LegendDataId } from '../../types/legendType';
3
3
  /**
4
4
  * Creates legend markers for work orders grouped by `tagId`.
5
5
  *
@@ -1,16 +1,15 @@
1
1
  import { LegendDataId } from '../../types/legendType';
2
- import { GlobalSelectionTypes } from '../../../globalSelection';
3
2
  export type PopoverProps = {
4
3
  legendDataId: LegendDataId;
5
- itemIds?: ReadonlyArray<GlobalSelectionTypes.ItemId>;
4
+ itemIds?: ReadonlyArray<LegendDataId>;
6
5
  };
7
6
  export interface WorkOrderPopover {
8
- workOrderId: string;
9
- isActive: boolean;
10
- orderTypeId: string;
11
- description: string;
12
- plantNo: string;
13
- workCenter: string;
14
- basicFinishDateTime: Date | undefined;
15
- basicFinishDateStatus: string | undefined;
7
+ readonly workOrderId: string;
8
+ readonly isActive: boolean;
9
+ readonly orderTypeId: string;
10
+ readonly description: string;
11
+ readonly plantNo: string;
12
+ readonly workCenter: string;
13
+ readonly basicFinishDateTime: Date | undefined;
14
+ readonly basicFinishDateStatus: string | undefined;
16
15
  }
@@ -0,0 +1,50 @@
1
+ import { GlobalSelectionItemType, type GlobalSelectionTypes } from '../../globalSelection';
2
+ import type { SelectionItemTypeToItemIdMap } from '../../globalSelection/globalSelectionStore/globalSelectionStore.types';
3
+ import { LegendDataId, LegendDataIdString, type GlobalSelectionLegendDataId } from '../types/legendType';
4
+ /**
5
+ * Mapped type that produces proper TypeScript type predicates for each selection type.
6
+ * - Derives the GlobalSelectionItemType keys whose ID types are part of GlobalSelectionLegendDataId
7
+ * - Creates type guard functions that narrow `LegendDataId` to the specific ID type
8
+ */
9
+ type SelectionGuardMap = {
10
+ readonly [K in GlobalSelectionItemType as SelectionItemTypeToItemIdMap[K] extends GlobalSelectionLegendDataId ? K : never]: (legendDataId: LegendDataId) => legendDataId is Extract<SelectionItemTypeToItemIdMap[K], LegendDataId>;
11
+ };
12
+ /**
13
+ * Type guards that narrow LegendDataId to specific selection ID types.
14
+ * Record-based exhaustiveness: if a new type is added to GlobalSelectionLegendDataId,
15
+ * SelectionGuardMap expands and demands a new entry — compile error.
16
+ *
17
+ * **Adding a new selection-based legend?**
18
+ * 1. Add its type to legendType.ts
19
+ * 2. Add its guard here (compile error until you do)
20
+ *
21
+ * isGlobalSelectionItemId automatically picks up new guards.
22
+ */
23
+ export declare const selectionGuards: SelectionGuardMap;
24
+ /**
25
+ * This is the bridge between the legend system and global selection.
26
+ * The generic legend infrastructure (color subscription, grouping, marker splitting)
27
+ * uses this to determine which items participate in selection-based features.
28
+ *
29
+ * Automatically includes all guards from selectionGuards.
30
+ */
31
+ export declare const isGlobalSelectionItemId: (id: LegendDataId) => id is GlobalSelectionLegendDataId;
32
+ /**
33
+ * Converts any LegendDataId to a stable, unique string.
34
+ * For global selection types this delegates to globalSelectionUtils.itemIdToString.
35
+ * For non-selection types (e.g. notifications) it produces a prefixed string
36
+ * that will never collide with global selection ID strings.
37
+ */
38
+ export declare const dataIdToString: (id: LegendDataId) => LegendDataIdString;
39
+ /**
40
+ * Converts a LegendDataId to a GlobalSelection ItemIdString if the ID
41
+ * belongs to global selection (tag, equipment, work order).
42
+ * Returns undefined for non-selection IDs (e.g. notifications) since they have no corresponding item ID string.
43
+ */
44
+ export declare const dataIdToSelectionItemIdString: (id: LegendDataId) => GlobalSelectionTypes.ItemIdString | undefined;
45
+ /**
46
+ * Maps a LegendDataId to its GlobalSelectionItemType, or undefined
47
+ * if the ID does not belong to global selection (e.g. notifications).
48
+ */
49
+ export declare const dataIdToSelectionItemType: (id: LegendDataId) => GlobalSelectionItemType | undefined;
50
+ export {};
@@ -1,6 +1,8 @@
1
- import type { LegendFeedbackVariant } from '../../components/LegendFeedbackMessage';
1
+ import type { SelectionFeedbackType } from '../../../globalSelection/components/SelectionActionBar/selectionFeedback.types';
2
2
  import { MarkerId } from '../../components/pdfMarkers/utils/markerId.utils';
3
3
  import { LegendId } from '../../types/legendType';
4
+ export type { SelectionFeedbackType };
5
+ export type LegendFeedbackVariant = 'error' | 'info' | 'warning';
4
6
  export interface LegendUIState {
5
7
  readonly accordionFeedback?: {
6
8
  message: string;
@@ -17,11 +19,16 @@ export type LegendUIStoreValues = {
17
19
  readonly activePopover: {
18
20
  readonly id?: MarkerId;
19
21
  readonly elements: ReadonlyArray<React.ReactElement>;
22
+ readonly selectionFeedback?: {
23
+ readonly isLoading: boolean;
24
+ readonly feedbackType: SelectionFeedbackType | null;
25
+ };
20
26
  };
21
27
  readonly selectionLegend: {
22
28
  readonly isHighlightVisible: boolean;
23
29
  readonly markersOutsideSelectionVisibility: MarkersOutsideSelectionVisibility;
24
30
  };
31
+ readonly shouldDelayPopoverUpdate: boolean;
25
32
  };
26
33
  export interface LegendUIStoreActions {
27
34
  toggleAccordion: (legendId: LegendId, newValue: boolean) => void;
@@ -45,6 +52,11 @@ export interface LegendUIStoreActions {
45
52
  setSelectionLegendIsHighlightVisible: (visible: boolean) => void;
46
53
  setActivePopoverId: (popoverId: MarkerId | undefined) => void;
47
54
  setActivePopoverElements: (elements: ReadonlyArray<React.ReactElement>) => void;
55
+ setPopoverSelectionFeedback: (feedback: {
56
+ isLoading: boolean;
57
+ feedbackType: SelectionFeedbackType | null;
58
+ } | undefined) => void;
59
+ setShouldDelayPopoverUpdate: (delay: boolean) => void;
48
60
  setAccordionFeedback: (legendId: LegendId, feedback: {
49
61
  message: string;
50
62
  variant?: LegendFeedbackVariant;
@@ -59,15 +59,14 @@ export declare const useLegendVisibleDataStore: import("zustand").UseBoundStore<
59
59
  data: {
60
60
  Tag: {
61
61
  [x: string]: ({
62
- tagNo: string;
63
62
  instCode: string;
63
+ tagNo: string;
64
+ } | {
64
65
  internalTagType: import("../../../globalSelection").PdmsInternalTagType;
65
66
  plantNo: string;
66
67
  plantCode: string;
67
- } | {
68
68
  instCode: string;
69
69
  tagNo: string;
70
- internalTagType?: never | undefined;
71
70
  })[];
72
71
  };
73
72
  Equipment: {
@@ -6,13 +6,18 @@ export interface Marker {
6
6
  getDisplayKey: () => string;
7
7
  getHighlightColor: () => string;
8
8
  badges: ReadonlyArray<Badge>;
9
+ /**
10
+ * When true, renders as plain text instead of a colored chip in the legend panel.
11
+ * Typically used to display informational messages to the user, such as enable syncing.
12
+ */
9
13
  showAsPlainLabel?: boolean;
10
14
  }
11
15
  export interface Badge {
12
16
  getTitle: () => string;
13
17
  getColor: () => string;
14
18
  /**
15
- * Returns a key that can be used for clustering or grouping badges together if they share the same key.
19
+ * Returns a unique identity key used to track which badges are hidden/toggled off in the legend panel.
20
+ * Typically implemented as a combination of title and color to ensure uniqueness.
16
21
  */
17
22
  getDisplayKey: () => string;
18
23
  getItemId: () => LegendDataId;
@@ -1,4 +1,3 @@
1
- import { GlobalSelectionTypes } from '../../globalSelection';
2
1
  import { Marker } from './legendMarkerBadge.type';
3
2
  import { LegendDataId, LegendId, LegendOptionConfig } from './legendType';
4
3
  /**
@@ -36,10 +35,10 @@ export interface LegendStrategy {
36
35
  * This function is asynchronous because the popover content may depend on data that needs to be fetched before rendering,
37
36
  * such as related equipment, work orders, or other resources.
38
37
  * @param {LegendDataId} legendDataId - The identifier for the legend item for which to render popover content.
39
- * @param {ReadonlyArray<GlobalSelectionTypes.ItemId>} itemIds - The item ids to be included in the popover content.
38
+ * @param {ReadonlyArray<LegendDataId>} itemIds - The item ids to be included in the popover content.
40
39
  * @returns A Promise resolving to one or more React elements to display in the popover.
41
40
  */
42
- popoverContent: (legendDataId: LegendDataId, itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>) => Promise<React.ReactElement | ReadonlyArray<React.ReactElement>>;
41
+ popoverContent: (legendDataId: LegendDataId, itemIds: ReadonlyArray<LegendDataId>) => Promise<React.ReactElement | ReadonlyArray<React.ReactElement>>;
43
42
  /**
44
43
  * Returns the custom legend component for the legend, if this is omitted the default basicLegendRenderer will be used
45
44
  */
@@ -1,11 +1,13 @@
1
1
  import { Brand } from '@equinor/echo-utils';
2
2
  import { GlobalSelectionTypes } from '../../globalSelection';
3
- export type KnownLegendIds = 'Equipment Legend' | 'Tag Legend' | 'Work Order Legend';
3
+ export type KnownLegendIds = 'Equipment Legend' | 'Tag Legend' | 'Work Order Legend' | 'Notification Legend';
4
4
  export type LegendId = KnownLegendIds | Brand<string, 'LegendId'>;
5
+ export type LegendDataIdString = Brand<string, 'LegendDataIdString'>;
5
6
  export declare const knownLegendIds: {
6
7
  equipmentLegendId: LegendId;
7
8
  tagLegendId: LegendId;
8
9
  workOrderLegendId: LegendId;
10
+ notificationLegendId: LegendId;
9
11
  };
10
12
  export interface LegendState {
11
13
  readonly legendId: LegendId;
@@ -18,7 +20,20 @@ export interface LegendState {
18
20
  export type LegendTagId = GlobalSelectionTypes.TagId;
19
21
  export type LegendEquipmentId = GlobalSelectionTypes.EquipmentId;
20
22
  export type LegendWorkOrderId = GlobalSelectionTypes.WorkOrderId;
21
- export type LegendDataId = LegendTagId | LegendEquipmentId | LegendWorkOrderId;
23
+ export type LegendNotificationId = {
24
+ testId: string;
25
+ };
26
+ /**
27
+ * Union of LegendDataId types that correspond to global selection item IDs.
28
+ * These can be safely used with globalSelectionUtils.
29
+ *
30
+ * **Adding a new selection-based legend?**
31
+ * 1. Add its type to here
32
+ * 2. Go to legendDataId.utils.ts and update selectionGuards (this will cause a compile error until you add a guard for the new type)
33
+ */
34
+ export type GlobalSelectionLegendDataId = LegendTagId | LegendEquipmentId | LegendWorkOrderId;
35
+ type NonGlobalSelectionLegendDataId = LegendNotificationId;
36
+ export type LegendDataId = GlobalSelectionLegendDataId | NonGlobalSelectionLegendDataId;
22
37
  export interface LegendOptionConfig<T = string> {
23
38
  propertyName: T;
24
39
  /**
@@ -31,3 +46,4 @@ export interface LegendOptionConfig<T = string> {
31
46
  displayName: string;
32
47
  showChipsInViewportOnly?: boolean;
33
48
  }
49
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { MeasurementDto } from '../../types/measuringPoint';
2
2
  export type LastRecordedMeasurementData = {
3
- conditionAsText?: string;
4
- measurementDateTime: string | null;
5
- codeAsText?: string;
3
+ conditionAsText: string | undefined;
4
+ measurementDateTime: string | undefined;
5
+ codeAsText: string | undefined;
6
6
  lastRecordedMeasurement: MeasurementDto | undefined;
7
7
  };
8
8
  export declare const getLastRecordedMeasurement: (measurements: MeasurementDto[]) => LastRecordedMeasurementData;
@@ -0,0 +1,12 @@
1
+ export interface WorkOrderNotificationStatus {
2
+ readonly workOrderId: string;
3
+ readonly maintenanceRecordTypes: string[];
4
+ readonly hasB30Document: boolean;
5
+ }
6
+ /**
7
+ * Fetches maintenance record types and attachment type information for a work order.
8
+ *
9
+ * @param workOrderId - Unique work order identifier.
10
+ * @returns The notification data for the given work order, or `undefined` if the request returns no data.
11
+ */
12
+ export declare function fetchNotificationStatusByWorkOrderId(workOrderId: string): Promise<WorkOrderNotificationStatus | undefined>;
@@ -1,16 +1,17 @@
1
1
  import { WritableDraft } from 'immer';
2
2
  export interface PanelUserSettings {
3
- isTagsVisible: boolean;
4
- isTagsFromDocumentVisible: boolean;
5
- isTagsFromSelectionVisible: boolean;
6
- isWorkOrdersVisible: boolean;
7
- isWorkOrdersFromDocumentVisible: boolean;
8
- isWorkOrdersFromSelectionVisible: boolean;
9
- isEquipmentsVisible: boolean;
10
- isEquipmentsFromDocumentVisible: boolean;
11
- isEquipmentsFromSelectionVisible: boolean;
12
- isIocAnnotationsVisible: boolean;
13
- isDataFromStidAnnoDetails: boolean;
3
+ readonly isTagsVisible: boolean;
4
+ readonly isTagsFromDocumentVisible: boolean;
5
+ readonly isTagsFromSelectionVisible: boolean;
6
+ readonly isWorkOrdersVisible: boolean;
7
+ readonly isWorkOrdersFromDocumentVisible: boolean;
8
+ readonly isWorkOrdersFromSelectionVisible: boolean;
9
+ readonly isEquipmentsVisible: boolean;
10
+ readonly isEquipmentsFromDocumentVisible: boolean;
11
+ readonly isEquipmentsFromSelectionVisible: boolean;
12
+ readonly isIocAnnotationsVisible: boolean;
13
+ readonly isDataFromStidAnnoDetails: boolean;
14
+ readonly isNotificationsVisible: boolean;
14
15
  }
15
16
  export interface DataLayerPanelState {
16
17
  isOpen: boolean;
@@ -59,6 +60,7 @@ export declare const useDataLayerPanelStore: import("zustand").UseBoundStore<Omi
59
60
  isEquipmentsFromSelectionVisible: boolean;
60
61
  isIocAnnotationsVisible: boolean;
61
62
  isDataFromStidAnnoDetails: boolean;
63
+ isNotificationsVisible: boolean;
62
64
  };
63
65
  togglePanel: () => void;
64
66
  toggleTags: () => void;
@@ -1,8 +0,0 @@
1
- import { Guid } from '@equinor/echo-utils';
2
- import { SelectionGroup } from '../../selectionMenu/selectionTreeStore/selectionTree.store.types';
3
- interface AddToSelectionMenuItemProps {
4
- group: SelectionGroup;
5
- onAddToSelection: (groupId: Guid) => void;
6
- }
7
- export declare const AddToSelectionMenuItem: (props: AddToSelectionMenuItemProps) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,6 +0,0 @@
1
- import { Guid } from '@equinor/echo-utils';
2
- interface AddToSelectionMenuTriggerProps {
3
- onAddToSelection: (groupId: Guid) => void;
4
- }
5
- export declare const AddToSelectionMenuTrigger: (props: AddToSelectionMenuTriggerProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,6 +0,0 @@
1
- import { GlobalSelectionTypes } from '../../globalSelection';
2
- import { Marker } from '../types/legendMarkerBadge.type';
3
- /**
4
- * Returns unique item ID strings from all badges on the marker.
5
- */
6
- export declare const useUniqueBadgeItemIdStrings: (marker?: Marker) => GlobalSelectionTypes.ItemIdString[];
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { LastRecordedMeasurementData } from './lastRecordedMeasurement.logic';
3
- type LastRecordedMeasurementProps = {
4
- lastRecordedMeasurement: LastRecordedMeasurementData;
5
- failureMechanismDescription: string;
6
- };
7
- export declare const LastRecordedMeasurement: React.FC<LastRecordedMeasurementProps>;
8
- export {};