@equinor/echo-framework 4.3.0 → 4.3.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 (24) hide show
  1. package/index.cjs.js +2 -2
  2. package/package.json +6 -6
  3. package/src/lib/feature/globalSelection/globalSelectionStore/globalSelectionStore.d.ts +8 -0
  4. package/src/lib/feature/globalSelection/hooks/useIsInGlobalSelection.d.ts +0 -1
  5. package/src/lib/feature/globalSelection/hooks/useSelectionCategoriesByGroupId.d.ts +3 -2
  6. package/src/lib/feature/globalSelection/selectionMenu/hooks/useSelectionColorFrequency.d.ts +5 -2
  7. package/src/lib/feature/legend/legendFacade.d.ts +8 -0
  8. package/src/lib/feature/legend/legendStrategies/notificationStrategy/api/fetchNotificationDetailsByIds.d.ts +8 -0
  9. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationDetailsByIds.d.ts +2 -0
  10. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationLegendData.d.ts +5 -0
  11. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/useNotificationMarkers.d.ts +5 -1
  12. package/src/lib/feature/legend/legendStrategies/notificationStrategy/hooks/{useNotificationsByTagIds.d.ts → useOpenNotificationsByTagIds.d.ts} +2 -2
  13. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/getNotificationPopover.d.ts +1 -7
  14. package/src/lib/feature/legend/legendStrategies/notificationStrategy/logic/notificationLegend.logic.d.ts +5 -5
  15. package/src/lib/feature/legend/legendStrategies/notificationStrategy/notificationStrategy.types.d.ts +10 -2
  16. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationBadgeLegendOptionConfig.d.ts +1 -4
  17. package/src/lib/feature/legend/legendStrategies/notificationStrategy/optionConfigs/notificationMarkerLegendOptionConfig.d.ts +1 -2
  18. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/getNotificationTitlesByPropertyName.d.ts +2 -2
  19. package/src/lib/feature/legend/legendStrategies/notificationStrategy/utils/notificationLegend.utils.d.ts +8 -3
  20. package/src/lib/feature/legend/stores/legendVisibleDataAsTagsStore/legendVisibleDataAsTagsStore.d.ts +8 -0
  21. package/src/lib/feature/measuringPoint/index.d.ts +1 -1
  22. package/src/lib/feature/openItemsIn3d/logic/createEcho3dInternalLink.d.ts +1 -0
  23. package/src/lib/utils/index.d.ts +1 -0
  24. package/src/lib/utils/notification.utils.d.ts +2 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "peerDependencies": {
5
- "@equinor/echo-base": ">= 4.3.0 < 5.0.0",
6
- "@equinor/echo-components": ">= 4.3.0 < 5.0.0",
7
- "@equinor/echo-core": ">= 4.3.0 < 5.0.0",
8
- "@equinor/echo-search": ">= 4.3.0 < 5.0.0",
9
- "@equinor/echo-utils": ">= 4.3.0 < 5.0.0",
5
+ "@equinor/echo-base": ">= 4.3.1 < 5.0.0",
6
+ "@equinor/echo-components": ">= 4.3.1 < 5.0.0",
7
+ "@equinor/echo-core": ">= 4.3.1 < 5.0.0",
8
+ "@equinor/echo-search": ">= 4.3.1 < 5.0.0",
9
+ "@equinor/echo-utils": ">= 4.3.1 < 5.0.0",
10
10
  "@equinor/eds-core-react": "0.49.0",
11
11
  "@equinor/eds-icons": "0.22.0",
12
12
  "@equinor/eds-tokens": "2.1.0",
@@ -160,6 +160,14 @@ export declare const useGlobalSelectionStore: import("zustand").UseBoundStore<Om
160
160
  type: string;
161
161
  value: string;
162
162
  }[];
163
+ coordinates: {
164
+ tagSeqNo: number;
165
+ xEasting: number;
166
+ yNorthing: number;
167
+ zElevation: number;
168
+ uom: string;
169
+ linePosition: number | undefined;
170
+ }[];
163
171
  tagNo: string;
164
172
  description: string;
165
173
  projectCode: string;
@@ -2,7 +2,6 @@ import { GlobalSelectionTypes } from '../globalSelectionStore/globalSelectionSto
2
2
  /**
3
3
  * Hook to check if an item is in the global selection
4
4
  * @param {GlobalSelectionTypes.ItemId} itemId - The itemId
5
- * @param {GlobalSelectionItemType} itemType - The item type
6
5
  * @returns {boolean} - True if the item is in global selection, false otherwise
7
6
  */
8
7
  export declare function useIsInGlobalSelection(itemId: GlobalSelectionTypes.ItemId): boolean;
@@ -1,9 +1,10 @@
1
1
  import { Guid } from '@equinor/echo-utils';
2
2
  import { SelectionTreeTypes } from '../selectionMenu/selectionTreeStore/selectionTree.store.types';
3
3
  /**
4
- * Custom hook to get the selection categories by group ID from the global selection tree hiearchy.
4
+ * Custom hook to get the selection categories by group ID from the global selection tree hierarchy.
5
5
  *
6
- * This hook retrieves the categories for a given group ID from the selection tree store.
6
+ * Zustand's Object.is equality check on the selector return value ensures re-renders only
7
+ * happen when this specific group's categories change, not on unrelated group mutations.
7
8
  *
8
9
  * @param {Guid} groupId - The ID of the group to get categories for.
9
10
  * @returns {SelectionTreeTypes.Category[] | undefined} The categories for the given group ID, or undefined if not found.
@@ -5,14 +5,17 @@ import { GlobalSelectionTypes } from '../../globalSelectionStore/globalSelection
5
5
  * This hook retrieves the global selection items and filters them based on the provided item IDs,
6
6
  * extracts their associated colors, and sorts the colors by frequency.
7
7
  *
8
+ * Callers must provide a referentially stable `itemIds` array (e.g. via `useMemo`)
9
+ * to avoid unnecessary recomputation on every render.
10
+ *
8
11
  * @param itemIds - An array of item IDs to match against global selection items.
9
12
  * @returns An array of color strings sorted by frequency, most frequent first.
10
13
  */
11
- export declare function useSelectionColorFrequencyByIds(itemIds: GlobalSelectionTypes.ItemId[]): string[];
14
+ export declare function useSelectionColorFrequencyByIds(itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>): readonly string[];
12
15
  /**
13
16
  * Returns the most frequently used selection color from the provided item IDs.
14
17
  *
15
18
  * @param itemIds - An array of item IDs to analyze for color frequency.
16
19
  * @returns The most used selection color as a string, or `undefined` if no colors are present.
17
20
  */
18
- export declare function useMostUsedSelectionColorByIds(itemIds: GlobalSelectionTypes.ItemId[]): string | undefined;
21
+ export declare function useMostUsedSelectionColorByIds(itemIds: ReadonlyArray<GlobalSelectionTypes.ItemId>): string | undefined;
@@ -126,6 +126,14 @@ export declare const legendFacade: Readonly<{
126
126
  type: string;
127
127
  value: string;
128
128
  }[];
129
+ coordinates: {
130
+ tagSeqNo: number;
131
+ xEasting: number;
132
+ yNorthing: number;
133
+ zElevation: number;
134
+ uom: string;
135
+ linePosition: number | undefined;
136
+ }[];
129
137
  tagNo: string;
130
138
  description: string;
131
139
  projectCode: string;
@@ -0,0 +1,8 @@
1
+ import type { NotificationDetails } from '@equinor/echo-search';
2
+ import type { LegendNotificationId } from '../../../types/legendType';
3
+ export declare const notificationDetailsQueryOptions: (notificationIds: ReadonlyArray<LegendNotificationId>) => {
4
+ queryKey: readonly ["notificationDetails", readonly LegendNotificationId[]];
5
+ queryFn: () => Promise<readonly NotificationDetails[]>;
6
+ staleTime: number;
7
+ gcTime: number;
8
+ };
@@ -0,0 +1,2 @@
1
+ import type { LegendDataId } from '../../../types/legendType';
2
+ export declare const useNotificationDetailsByIds: (itemIds: ReadonlyArray<LegendDataId>, isEnabled: boolean) => import("@tanstack/react-query").UseQueryResult<readonly import("@equinor/echo-search").NotificationDetails[], Error>;
@@ -0,0 +1,5 @@
1
+ export declare const useNotificationLegendData: () => {
2
+ isEnabled: boolean;
3
+ selectedMarkerOption: import("../../../types/legendType").LegendMarkerOptionConfig<string>;
4
+ selectedBadgeOption: import("../../../types/legendType").LegendBadgeOptionConfig<string>;
5
+ } | undefined;
@@ -1,6 +1,10 @@
1
1
  import type { Marker } from '../../../types/legendMarkerBadge.type';
2
2
  import { type LegendDataId } from '../../../types/legendType';
3
3
  /**
4
- * Orchestrates fetching notifications for the given tag IDs and transforms them into markers for the notification legend.
4
+ * Creates notification markers from two sources:
5
+ * 1. Tag-based: fetches open notifications for selected tags
6
+ * 2. ID-based: fetches notification details by direct notification IDs
7
+ *
8
+ * Both sources are merged into a single marker array.
5
9
  */
6
10
  export declare const useNotificationMarkers: (itemIds: ReadonlyArray<LegendDataId>) => ReadonlyArray<Marker>;
@@ -4,11 +4,11 @@ export interface TagNotificationGroup {
4
4
  readonly tagId: TagNo;
5
5
  readonly notifications: ReadonlyArray<NotificationDto>;
6
6
  }
7
- interface UseNotificationsByTagIdsResult {
7
+ interface UseOpenNotificationsByTagIdsResult {
8
8
  readonly data: ReadonlyArray<TagNotificationGroup>;
9
9
  readonly error: Error | undefined;
10
10
  readonly isFetching: boolean;
11
11
  }
12
- export declare const useNotificationsByTagIds: (enabled: boolean, tagIds: ReadonlyArray<LegendTagId>) => UseNotificationsByTagIdsResult;
12
+ export declare const useOpenNotificationsByTagIds: (tagIds: ReadonlyArray<LegendTagId>, enabled: boolean) => UseOpenNotificationsByTagIdsResult;
13
13
  export declare const groupNotificationsByTagId: (notifications: ReadonlyArray<NotificationDto>) => ReadonlyArray<TagNotificationGroup>;
14
14
  export {};
@@ -1,12 +1,6 @@
1
1
  import { type NotificationItemCardData } from '@equinor/echo-components';
2
2
  import type { NotificationDetails } from '@equinor/echo-search';
3
3
  import { Explicit } from '@equinor/echo-utils';
4
- import { type LegendDataId, type LegendNotificationId } from '../../../types/legendType';
5
- /**
6
- * Notification is not a selection-based legend, so the dataId is not directly tied to global selection item IDs.
7
- * Instead, we define a specific type for notification legend data IDs (LegendNotificationId) and use a type guard (isNotificationDataId) to identify them.
8
- * This allows us to safely handle notification data IDs without relying on global selection structures.
9
- */
10
- export declare const isNotificationDataId: (dataId: LegendDataId) => dataId is LegendNotificationId;
4
+ import { type LegendDataId } from '../../../types/legendType';
11
5
  export declare const getPopoverContent: (_legendDataId: LegendDataId, itemIds: ReadonlyArray<LegendDataId>) => Promise<JSX.Element[]>;
12
6
  export declare const mapNotificationToNotificationItemCard: (notification: NotificationDetails) => Explicit<NotificationItemCardData>;
@@ -1,12 +1,12 @@
1
- import { NotificationDto } from '@equinor/echo-search';
2
1
  import type { Badge, Marker } from '../../../types/legendMarkerBadge.type';
3
2
  import type { LegendBadgeOptionConfig, LegendMarkerOptionConfig } from '../../../types/legendType';
3
+ import type { NotificationLegendData } from '../notificationStrategy.types';
4
4
  interface CreateMarkerFromNotificationsArgs {
5
- readonly notifications: ReadonlyArray<NotificationDto>;
5
+ readonly notifications: ReadonlyArray<NotificationLegendData>;
6
6
  readonly selectedMarkerOption: LegendMarkerOptionConfig;
7
7
  readonly selectedBadgeOption: LegendBadgeOptionConfig;
8
8
  }
9
- export declare const createMarkerFromNotifications: ({ notifications, selectedMarkerOption, selectedBadgeOption }: CreateMarkerFromNotificationsArgs) => Marker;
10
- export declare const createMarkerTitle: (notifications: ReadonlyArray<NotificationDto>, selectedMarkerOption: LegendMarkerOptionConfig) => string;
11
- export declare const createBadges: (notifications: ReadonlyArray<NotificationDto>, selectedBadgeOption: LegendBadgeOptionConfig) => ReadonlyArray<Badge>;
9
+ export declare const createMarkerFromNotifications: ({ notifications, selectedMarkerOption, selectedBadgeOption }: CreateMarkerFromNotificationsArgs) => Marker | undefined;
10
+ export declare const createMarkerTitle: (notifications: ReadonlyArray<NotificationLegendData>, selectedMarkerOption: LegendMarkerOptionConfig) => string;
11
+ export declare const createBadges: (notifications: ReadonlyArray<NotificationLegendData>, selectedBadgeOption: LegendBadgeOptionConfig) => ReadonlyArray<Badge>;
12
12
  export {};
@@ -1,5 +1,13 @@
1
+ import type { NotificationDto } from '@equinor/echo-search';
1
2
  import type { LegendStatus } from '../../../legacyLegend/legend';
2
- import type { NotificationBadgeOptions } from './optionConfigs/notificationBadgeLegendOptionConfig';
3
- import type { NotificationMarkerOptions } from './optionConfigs/notificationMarkerLegendOptionConfig';
3
+ /**
4
+ * The subset of notification fields actually used in the legend marker pipeline.
5
+ * Only these fields are accessed by property accessors, icon resolution, and badge creation.
6
+ */
7
+ export type NotificationLegendData = Pick<NotificationDto, 'maintenanceRecordId' | 'recordTypeId' | 'activeStatusIds' | 'requiredEndDateTime'>;
8
+ type BadgeKeysFromNotificationLegendData = Pick<NotificationLegendData, 'maintenanceRecordId' | 'recordTypeId'>;
9
+ export type NotificationBadgeOptions = keyof BadgeKeysFromNotificationLegendData | 'count';
10
+ export type NotificationMarkerOptions = keyof Pick<NotificationLegendData, 'activeStatusIds' | 'requiredEndDateTime' | 'recordTypeId'>;
4
11
  export type AllNotificationPropertyOptions = NotificationMarkerOptions | NotificationBadgeOptions;
5
12
  export type EndDateStatusText = 'Expired' | '0-7 days' | '8 days - 1 month' | '1-3 months' | '3-6 months' | '6-12 months' | '> 1 year' | LegendStatus.Unknown;
13
+ export {};
@@ -1,6 +1,3 @@
1
- import { NotificationDto } from '@equinor/echo-search';
2
1
  import { LegendBadgeOptionConfig } from '../../../types/legendType';
3
- type KeysFromNotificationDto = Pick<NotificationDto, 'maintenanceRecordId' | 'recordTypeId'>;
4
- export type NotificationBadgeOptions = keyof KeysFromNotificationDto | 'count';
2
+ import type { NotificationBadgeOptions } from '../notificationStrategy.types';
5
3
  export declare const NOTIFICATION_LEGEND_BADGE_OPTIONS: ReadonlyArray<LegendBadgeOptionConfig<NotificationBadgeOptions>>;
6
- export {};
@@ -1,4 +1,3 @@
1
- import { NotificationDto } from '@equinor/echo-search';
2
1
  import { type LegendMarkerOptionConfig } from '../../../types/legendType';
3
- export type NotificationMarkerOptions = keyof Pick<NotificationDto, 'activeStatusIds' | 'requiredEndDateTime' | 'recordTypeId'>;
2
+ import type { NotificationMarkerOptions } from '../notificationStrategy.types';
4
3
  export declare const NOTIFICATION_LEGEND_MARKER_OPTIONS: ReadonlyArray<LegendMarkerOptionConfig<NotificationMarkerOptions>>;
@@ -1,2 +1,2 @@
1
- import { NotificationDto } from '@equinor/echo-search';
2
- export declare function getNotificationTitlesByPropertyName(propertyName: string, notification: NotificationDto, notifications: ReadonlyArray<NotificationDto>): ReadonlyArray<string>;
1
+ import type { NotificationLegendData } from '../notificationStrategy.types';
2
+ export declare function getNotificationTitlesByPropertyName(propertyName: string, notification: NotificationLegendData, notifications: ReadonlyArray<NotificationLegendData>): ReadonlyArray<string>;
@@ -1,11 +1,16 @@
1
- import { NotificationDto } from '@equinor/echo-search';
2
- import type { EndDateStatusText } from '../notificationStrategy.types';
1
+ import { type LegendDataId, type LegendNotificationId } from '../../../types/legendType';
2
+ import type { EndDateStatusText, NotificationLegendData } from '../notificationStrategy.types';
3
+ /**
4
+ * Type guard for notification legend data IDs.
5
+ * Notification is not a selection-based legend, so the dataId is not directly tied to global selection item IDs.
6
+ */
7
+ export declare const isNotificationDataId: (dataId: LegendDataId) => dataId is LegendNotificationId;
3
8
  /**
4
9
  * Determines the appropriate icon name for a marker based on the record types of the provided notifications.
5
10
  * If there are multiple record types or no notifications, it returns a generic icon.
6
11
  * Otherwise, it returns a specific icon based on the record type.
7
12
  */
8
- export declare const getIconForMarker: (notifications: ReadonlyArray<NotificationDto>) => string;
13
+ export declare const getIconForMarker: (notifications: ReadonlyArray<NotificationLegendData>) => string;
9
14
  /**
10
15
  * Returns user-friendly end date status text based on the required end date of a notification.
11
16
  */
@@ -56,6 +56,14 @@ export declare const useVisibleDataAsTagsStore: import("zustand").UseBoundStore<
56
56
  type: string;
57
57
  value: string;
58
58
  }[];
59
+ coordinates: {
60
+ tagSeqNo: number;
61
+ xEasting: number;
62
+ yNorthing: number;
63
+ zElevation: number;
64
+ uom: string;
65
+ linePosition: number | undefined;
66
+ }[];
59
67
  tagNo: string;
60
68
  description: string;
61
69
  projectCode: string;
@@ -1,4 +1,4 @@
1
- export { failureMechanismConfig, MeasuringPointDetails, MeasuringPointHeader } from './components';
1
+ export { MeasuringPointDetails, MeasuringPointHeader, failureMechanismConfig } from './components';
2
2
  export { MeasuringPointListItem } from './components/MeasuringPointListItem';
3
3
  export { useOpenMeasuringPointDetails } from './hooks';
4
4
  export type { DocumentRelationships } from './types/documentRelationships';
@@ -5,6 +5,7 @@ export declare function createEcho3dInternalLink(instCode: string, params: {
5
5
  e3dRef?: string;
6
6
  tagArea?: string;
7
7
  measuringPointIds?: ReadonlyArray<string>;
8
+ selectedMeasuringPointId?: string;
8
9
  }): {
9
10
  echo3d: string;
10
11
  params: string;
@@ -4,6 +4,7 @@ export * from './endDateStatus/getEndDateStatus';
4
4
  export * from './formatTimeHelpers';
5
5
  export * from './highlightTextUtil';
6
6
  export * from './navigationUtils';
7
+ export * from './notification.utils';
7
8
  export * from './openIn3d';
8
9
  export * from './plantInfo';
9
10
  export * from './previousUtils';
@@ -0,0 +1,2 @@
1
+ export declare function isNotificationClosed(systemStatusIds: string[]): boolean;
2
+ export declare function isNotificationOpen(systemStatusIds: string[]): boolean;