@equinor/subsurface-app-management 5.2.3 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,11 @@ export type { ImpactMetric } from './models/ImpactMetric';
29
29
  export type { ImpactMetricDto } from './models/ImpactMetricDto';
30
30
  export type { ImpactUrl } from './models/ImpactUrl';
31
31
  export type { ImpactUrlDto } from './models/ImpactUrlDto';
32
+ export type { WorkItem } from './models/WorkItem';
33
+ export type { WorkItemAttachment } from './models/WorkItemAttachment';
34
+ export { WorkItemType } from './models/WorkItemType';
35
+ export { BugSeverity } from './models/BugSeverity';
36
+ export { SamWorkItemState } from './models/SamWorkItemState';
32
37
  export { AmplifyApplicationService } from './services/AmplifyApplicationService';
33
38
  export { FeatureToggleService } from './services/FeatureToggleService';
34
39
  export { ImpersonateUserService } from './services/ImpersonateUserService';
@@ -38,3 +43,4 @@ export { SlackService } from './services/SlackService';
38
43
  export { TutorialService } from './services/TutorialService';
39
44
  export { FaqService } from './services/FaqService';
40
45
  export { AppAnalyticsService } from './services/AppAnalyticsService';
46
+ export { WorkItemsService } from './services/WorkItemsService';
@@ -0,0 +1,5 @@
1
+ export declare enum BugSeverity {
2
+ UNABLE_TO_WORK = "UnableToWork",
3
+ DOES_NOT_AFFECT_ME = "DoesNotAffectMe",
4
+ IMPEDES_MY_PROGRESS = "ImpedesMyProgress"
5
+ }
@@ -0,0 +1 @@
1
+ var e;!function(e){e.UNABLE_TO_WORK="UnableToWork",e.DOES_NOT_AFFECT_ME="DoesNotAffectMe",e.IMPEDES_MY_PROGRESS="ImpedesMyProgress"}(e||(e={}));export{e as BugSeverity};
@@ -0,0 +1,6 @@
1
+ export declare enum SamWorkItemState {
2
+ NEW = "New",
3
+ IN_PROGRESS = "InProgress",
4
+ CLOSED = "Closed",
5
+ REJECTED = "Rejected"
6
+ }
@@ -0,0 +1 @@
1
+ var e;!function(e){e.NEW="New",e.IN_PROGRESS="InProgress",e.CLOSED="Closed",e.REJECTED="Rejected"}(e||(e={}));export{e as SamWorkItemState};
@@ -0,0 +1,24 @@
1
+ import type { BugSeverity } from './BugSeverity';
2
+ import type { SamWorkItemState } from './SamWorkItemState';
3
+ import type { WorkItemAttachment } from './WorkItemAttachment';
4
+ import type { WorkItemType } from './WorkItemType';
5
+ export type WorkItem = {
6
+ updatedBy?: string | null;
7
+ updatedByName?: string | null;
8
+ updatedDate?: string | null;
9
+ createdBy: string;
10
+ createdByName: string;
11
+ createdDate: string;
12
+ title: string;
13
+ description: string;
14
+ applicationName: string;
15
+ browser?: string | null;
16
+ field?: string | null;
17
+ handler?: string | null;
18
+ severity?: BugSeverity;
19
+ workItemType: WorkItemType;
20
+ id: string;
21
+ state: SamWorkItemState;
22
+ userStoryUrl?: string | null;
23
+ attachments: Array<WorkItemAttachment>;
24
+ };
@@ -0,0 +1,12 @@
1
+ export type WorkItemAttachment = {
2
+ updatedBy?: string | null;
3
+ updatedByName?: string | null;
4
+ updatedDate?: string | null;
5
+ createdBy: string;
6
+ createdByName: string;
7
+ createdDate: string;
8
+ id: string;
9
+ fkWorkItemId: string;
10
+ fileName: string;
11
+ filePath: string;
12
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum WorkItemType {
2
+ SUGGESTION = "Suggestion",
3
+ BUG = "Bug"
4
+ }
@@ -0,0 +1 @@
1
+ var g;!function(g){g.SUGGESTION="Suggestion",g.BUG="Bug"}(g||(g={}));export{g as WorkItemType};
@@ -0,0 +1,30 @@
1
+ import type { BugSeverity } from '../models/BugSeverity';
2
+ import type { WorkItem } from '../models/WorkItem';
3
+ import type { WorkItemType } from '../models/WorkItemType';
4
+ import type { CancelablePromise } from '../core/CancelablePromise';
5
+ export declare class WorkItemsService {
6
+ /**
7
+ * Creates a workItem in SAM, and creates a userstory or bug in Azure devops.
8
+ * Slack comment is always forwarding the slack message first, and then saves in db and creates userstory.
9
+ * Information can be found in the SAM Azure Devops wiki, in the Upscaling wiki.
10
+ * @param slackComment Creates a slack comment in the feedback channel. If empty, no message will be sent.
11
+ * @param attachmentComment Creates a comment to one of the attachments. If empty, no message will be sent.
12
+ * @param formData
13
+ * @returns WorkItem OK
14
+ * @throws ApiError
15
+ */
16
+ static createWorkItemWithAttachment(slackComment?: string, attachmentComment?: string, formData?: {
17
+ /**
18
+ * Files to attach to the user stories.
19
+ */
20
+ fileList?: Array<Blob>;
21
+ Title?: string;
22
+ Description?: string;
23
+ ApplicationName?: string;
24
+ Browser?: string;
25
+ Field?: string;
26
+ IssueUrl?: string;
27
+ Severity?: BugSeverity;
28
+ WorkItemType?: WorkItemType;
29
+ }): CancelablePromise<WorkItem>;
30
+ }
@@ -0,0 +1 @@
1
+ import{OpenAPI_SAM as t}from"../core/OpenAPI.js";import{request as e}from"../core/request.js";class m{static createWorkItemWithAttachment(m,r,a){return e(t,{method:"POST",url:"/api/v1/WorkItems/workitem-with-attachment",query:{slackComment:m,attachmentComment:r},formData:a,mediaType:"multipart/form-data"})}}export{m as WorkItemsService};
@@ -1 +1 @@
1
- import{jsx as o,Fragment as r}from"react/jsx-runtime";import"../../providers/FeatureToggleProvider.js";import{useFeatureToggling as e}from"../../hooks/useFeatureToggling.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import"../../api/models/TutorialPosition.js";import"../../types/Environment.js";import"../../types/ReleaseNotes.js";import"react";import"@microsoft/signalr";const t=({children:t,fallback:i,...s})=>{const{showContent:p}=e({...s});return p?o(r,{children:t}):void 0===i?null:o(r,{children:i})};export{t as Feature};
1
+ import{jsx as o,Fragment as r}from"react/jsx-runtime";import"../../providers/FeatureToggleProvider.js";import{useFeatureToggling as e}from"../../hooks/useFeatureToggling.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import"../../api/models/TutorialPosition.js";import"../../api/models/WorkItemType.js";import"../../api/models/BugSeverity.js";import"../../api/models/SamWorkItemState.js";import"../../types/Environment.js";import"../../types/ReleaseNotes.js";import"react";import"@microsoft/signalr";const t=({children:t,fallback:i,...s})=>{const{showContent:p}=e({...s});return p?o(r,{children:t}):void 0===i?null:o(r,{children:i})};export{t as Feature};
@@ -1 +1 @@
1
- import{useRef as e,useState as r,useMemo as t,useEffect as n}from"react";import*as o from"@microsoft/signalr";import{LogLevel as s}from"@microsoft/signalr";import{useQuery as i}from"@tanstack/react-query";import{getSAMToken as c}from"../api/core/OpenAPI.js";import"../api/models/ApplicationCategory.js";import"../api/models/ServiceNowUrgency.js";import"../api/models/TutorialPosition.js";import{EnvironmentType as a}from"../types/Environment.js";import"../types/ReleaseNotes.js";import{getEnvironmentName as u}from"../utils/environment.js";function m(m){const p=e(void 0),[d,l]=r([]),[g,f]=r(),[b,v]=r(),w=e(void 0),N=e(void 0),{data:S}=i({queryKey:["get-sam-token"],queryFn:()=>c()}),y=t((()=>{const e=u(import.meta.env.VITE_ENVIRONMENT_NAME);return`wss://api-sam-backend-${e===a.LOCALHOST?a.DEVELOP:e}.radix.equinor.com`}),[]);n((()=>{(async function(){if(void 0===S||w.current===m&&N.current===S)return;void 0!==p.current&&w.current&&N.current&&(w.current!==m||N.current!==S)&&await p.current.stop(),N.current=S,w.current=m;const e=(new o.HubConnectionBuilder).configureLogging(s.Error).withUrl(`${y}/hubs/notifications`,{accessTokenFactory:()=>S,withCredentials:!1,skipNegotiation:!0,transport:o.HttpTransportType.WebSockets}).withAutomaticReconnect().build();try{await e.start(),e.on("ActiveMessages",((e,r)=>{l(r.map((r=>({...r,Subject:e}))).reverse())})),e.onreconnected((()=>e.invoke("Subscribe",m))),e.on("NewMessage",((e,r)=>{l((t=>[{...r,Subject:e},...t]))})),e.on("UpdateMessage",((e,r)=>{v({...r,Subject:e})})),e.on("Delete",((e,r)=>{f(r)})),e.on("Error",(e=>{throw new Error("Connection error: "+e)})),await e.invoke("Subscribe",m),await e.invoke("PeekMessages")}catch(e){console.error("Connection failed",e)}p.current=e})().catch((e=>{console.error("Error setting up connection",e)}))}),[y,m,S]),n((()=>{if(b){const e=d.findIndex((e=>e.SequenceNumber===b.SequenceNumber)),r=[...d];e>-1&&(r[e]=b,l(r),v(void 0))}}),[b,d]),n((()=>{if(g){const e=d.findIndex((e=>e.SequenceNumber===g)),r=[...d];e>-1&&(r.splice(e,1),l(r),f(void 0))}}),[g,d]);const E=e=>{p.current&&(e.Read=!e.Read,p.current.invoke("PatchMessage",e.SequenceNumber,e).catch((e=>{console.error("Error setting message as read",e)})))},k=t((()=>d.some((e=>!1===e.Read))),[d]);return{messages:d,hasUnreadMessages:k,setMessageAsRead:E,setAllMessagesAsRead:()=>{d.forEach((e=>{e.Read||E(e)}))},deleteMessage:async function(e){p.current&&null!==e.SequenceNumber&&(await p.current.invoke("DeleteMessage",e.SequenceNumber),f(e.SequenceNumber))},closeConnection:async()=>{if(p.current)return await p.current.stop()}}}export{m as useSignalRMessages};
1
+ import{useRef as e,useState as r,useMemo as t,useEffect as o}from"react";import*as n from"@microsoft/signalr";import{LogLevel as s}from"@microsoft/signalr";import{useQuery as i}from"@tanstack/react-query";import{getSAMToken as c}from"../api/core/OpenAPI.js";import"../api/models/ApplicationCategory.js";import"../api/models/ServiceNowUrgency.js";import"../api/models/TutorialPosition.js";import"../api/models/WorkItemType.js";import"../api/models/BugSeverity.js";import"../api/models/SamWorkItemState.js";import{EnvironmentType as a}from"../types/Environment.js";import"../types/ReleaseNotes.js";import{getEnvironmentName as u}from"../utils/environment.js";function m(m){const p=e(void 0),[d,l]=r([]),[g,f]=r(),[b,v]=r(),S=e(void 0),y=e(void 0),{data:w}=i({queryKey:["get-sam-token"],queryFn:()=>c()}),N=t((()=>{const e=u(import.meta.env.VITE_ENVIRONMENT_NAME);return`wss://api-sam-backend-${e===a.LOCALHOST?a.DEVELOP:e}.radix.equinor.com`}),[]);o((()=>{(async function(){if(void 0===w||S.current===m&&y.current===w)return;void 0!==p.current&&S.current&&y.current&&(S.current!==m||y.current!==w)&&await p.current.stop(),y.current=w,S.current=m;const e=(new n.HubConnectionBuilder).configureLogging(s.Error).withUrl(`${N}/hubs/notifications`,{accessTokenFactory:()=>w,withCredentials:!1,skipNegotiation:!0,transport:n.HttpTransportType.WebSockets}).withAutomaticReconnect().build();try{await e.start(),e.on("ActiveMessages",((e,r)=>{l(r.map((r=>({...r,Subject:e}))).reverse())})),e.onreconnected((()=>e.invoke("Subscribe",m))),e.on("NewMessage",((e,r)=>{l((t=>[{...r,Subject:e},...t]))})),e.on("UpdateMessage",((e,r)=>{v({...r,Subject:e})})),e.on("Delete",((e,r)=>{f(r)})),e.on("Error",(e=>{throw new Error("Connection error: "+e)})),await e.invoke("Subscribe",m),await e.invoke("PeekMessages")}catch(e){console.error("Connection failed",e)}p.current=e})().catch((e=>{console.error("Error setting up connection",e)}))}),[N,m,w]),o((()=>{if(b){const e=d.findIndex((e=>e.SequenceNumber===b.SequenceNumber)),r=[...d];e>-1&&(r[e]=b,l(r),v(void 0))}}),[b,d]),o((()=>{if(g){const e=d.findIndex((e=>e.SequenceNumber===g)),r=[...d];e>-1&&(r.splice(e,1),l(r),f(void 0))}}),[g,d]);const k=e=>{p.current&&(e.Read=!e.Read,p.current.invoke("PatchMessage",e.SequenceNumber,e).catch((e=>{console.error("Error setting message as read",e)})))},j=t((()=>d.some((e=>!1===e.Read))),[d]);return{messages:d,hasUnreadMessages:j,setMessageAsRead:k,setAllMessagesAsRead:()=>{d.forEach((e=>{e.Read||k(e)}))},deleteMessage:async function(e){p.current&&null!==e.SequenceNumber&&(await p.current.invoke("DeleteMessage",e.SequenceNumber),f(e.SequenceNumber))},closeConnection:async()=>{if(p.current)return await p.current.stop()}}}export{m as useSignalRMessages};
@@ -1 +1 @@
1
- import{useQuery as r}from"@tanstack/react-query";import"../api/core/OpenAPI.js";import"../api/models/ApplicationCategory.js";import"../api/models/ServiceNowUrgency.js";import"../api/models/TutorialPosition.js";import{EnvironmentType as t}from"../types/Environment.js";import"../types/ReleaseNotes.js";import{TutorialService as e}from"../api/services/TutorialService.js";import{GET_TUTORIALS_FOR_APP as o}from"../constants/queryKeys.js";import{getEnvironmentName as i,getAppName as s}from"../utils/environment.js";function p(){return r({queryKey:[o],queryFn:async()=>{if(i(import.meta.env.VITE_ENVIRONMENT_NAME)===t.PRODUCTION){return(await e.getMyTutorialsForApplication(s(import.meta.env.VITE_NAME),!1)).map((r=>({...r,id:r.tutorialDraftId?r.tutorialDraftId:r.id,steps:r.steps.sort(((r,t)=>(r.orderBy??0)-(t.orderBy??0)))})))}return(await e.getDraftTutorialsForApplication(s(import.meta.env.VITE_NAME))).map((r=>({...r,steps:r.steps.sort(((r,t)=>(r.orderBy??0)-(t.orderBy??0)))})))}})}export{p as useTutorialsQuery};
1
+ import{useQuery as t}from"@tanstack/react-query";import"../api/core/OpenAPI.js";import"../api/models/ApplicationCategory.js";import"../api/models/ServiceNowUrgency.js";import"../api/models/TutorialPosition.js";import"../api/models/WorkItemType.js";import"../api/models/BugSeverity.js";import"../api/models/SamWorkItemState.js";import{EnvironmentType as r}from"../types/Environment.js";import"../types/ReleaseNotes.js";import{TutorialService as e}from"../api/services/TutorialService.js";import{GET_TUTORIALS_FOR_APP as o}from"../constants/queryKeys.js";import{getEnvironmentName as i,getAppName as s}from"../utils/environment.js";function p(){return t({queryKey:[o],queryFn:async()=>{if(i(import.meta.env.VITE_ENVIRONMENT_NAME)===r.PRODUCTION){return(await e.getMyTutorialsForApplication(s(import.meta.env.VITE_NAME),!1)).map((t=>({...t,id:t.tutorialDraftId?t.tutorialDraftId:t.id,steps:t.steps.sort(((t,r)=>(t.orderBy??0)-(r.orderBy??0)))})))}return(await e.getDraftTutorialsForApplication(s(import.meta.env.VITE_NAME))).map((t=>({...t,steps:t.steps.sort(((t,r)=>(t.orderBy??0)-(r.orderBy??0)))})))}})}export{p as useTutorialsQuery};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{Feature}from"./components/Feature/Feature.js";export{FeatureRoute}from"./components/FeatureRoute/FeatureRoute.js";export{FeatureToggleProvider,useFeatureToggleContext}from"./providers/FeatureToggleProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useTutorialsQuery}from"./hooks/useTutorialsQuery.js";export{useTutorialStepImage}from"./hooks/useTutorialStepImage.js";export{useSignalRMessages}from"./hooks/useSignalRMessages.js";export{TutorialProvider,useTutorials}from"./providers/TutorialProvider/TutorialProvider.js";export{ApplicationInsightsProvider}from"./providers/ApplicationInsightsProvider/ApplicationInsightsProvider.js";export{samTrackEvent,samTrackMetric}from"./providers/ApplicationInsightsProvider/ApplicationInsightsProvider.utils.js";export{EnvironmentToggleFeatures,EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";import*as e from"./utils/environment.js";export{e as environment};export{ApiError}from"./api/core/ApiError.js";export{CancelError,CancelablePromise}from"./api/core/CancelablePromise.js";export{OpenAPI_APP,getSAMToken}from"./api/core/OpenAPI.js";export{request}from"./api/core/request.js";export{ApplicationCategory}from"./api/models/ApplicationCategory.js";export{ServiceNowUrgency}from"./api/models/ServiceNowUrgency.js";export{TutorialPosition}from"./api/models/TutorialPosition.js";export{AmplifyApplicationService}from"./api/services/AmplifyApplicationService.js";export{FeatureToggleService}from"./api/services/FeatureToggleService.js";export{ImpersonateUserService}from"./api/services/ImpersonateUserService.js";export{ReleaseNotesService}from"./api/services/ReleaseNotesService.js";export{ServiceNowService}from"./api/services/ServiceNowService.js";export{SlackService}from"./api/services/SlackService.js";export{TutorialService}from"./api/services/TutorialService.js";export{FaqService}from"./api/services/FaqService.js";export{AppAnalyticsService}from"./api/services/AppAnalyticsService.js";export{GET_FEATURE_TOGGLES_FOR_APP,GET_RELEASE_NOTES,GET_TUTORIALS_FOR_APP,GET_TUTORIALS_SAS_TOKEN,GET_TUTORIAL_STEP_IMAGE,SAM_QUERIES}from"./constants/queryKeys.js";export{ENVIRONMENT_TOGGLE_KEY}from"./constants/environmentToggle.js";
1
+ export{Feature}from"./components/Feature/Feature.js";export{FeatureRoute}from"./components/FeatureRoute/FeatureRoute.js";export{FeatureToggleProvider,useFeatureToggleContext}from"./providers/FeatureToggleProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useTutorialsQuery}from"./hooks/useTutorialsQuery.js";export{useTutorialStepImage}from"./hooks/useTutorialStepImage.js";export{useSignalRMessages}from"./hooks/useSignalRMessages.js";export{TutorialProvider,useTutorials}from"./providers/TutorialProvider/TutorialProvider.js";export{ApplicationInsightsProvider}from"./providers/ApplicationInsightsProvider/ApplicationInsightsProvider.js";export{samTrackEvent,samTrackMetric}from"./providers/ApplicationInsightsProvider/ApplicationInsightsProvider.utils.js";export{EnvironmentToggleFeatures,EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";import*as e from"./utils/environment.js";export{e as environment};export{ApiError}from"./api/core/ApiError.js";export{CancelError,CancelablePromise}from"./api/core/CancelablePromise.js";export{OpenAPI_APP,getSAMToken}from"./api/core/OpenAPI.js";export{request}from"./api/core/request.js";export{ApplicationCategory}from"./api/models/ApplicationCategory.js";export{ServiceNowUrgency}from"./api/models/ServiceNowUrgency.js";export{TutorialPosition}from"./api/models/TutorialPosition.js";export{WorkItemType}from"./api/models/WorkItemType.js";export{BugSeverity}from"./api/models/BugSeverity.js";export{SamWorkItemState}from"./api/models/SamWorkItemState.js";export{AmplifyApplicationService}from"./api/services/AmplifyApplicationService.js";export{FeatureToggleService}from"./api/services/FeatureToggleService.js";export{ImpersonateUserService}from"./api/services/ImpersonateUserService.js";export{ReleaseNotesService}from"./api/services/ReleaseNotesService.js";export{ServiceNowService}from"./api/services/ServiceNowService.js";export{SlackService}from"./api/services/SlackService.js";export{TutorialService}from"./api/services/TutorialService.js";export{FaqService}from"./api/services/FaqService.js";export{AppAnalyticsService}from"./api/services/AppAnalyticsService.js";export{WorkItemsService}from"./api/services/WorkItemsService.js";export{GET_FEATURE_TOGGLES_FOR_APP,GET_RELEASE_NOTES,GET_TUTORIALS_FOR_APP,GET_TUTORIALS_SAS_TOKEN,GET_TUTORIAL_STEP_IMAGE,SAM_QUERIES}from"./constants/queryKeys.js";export{ENVIRONMENT_TOGGLE_KEY}from"./constants/environmentToggle.js";
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{createContext as r,useState as t,useMemo as i,useContext as e}from"react";import{useMatchRoute as s}from"@tanstack/react-router";import{useSeenTutorials as a}from"./useSeenTutorials.js";import"../FeatureToggleProvider.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";import{useTutorialsQuery as n}from"../../hooks/useTutorialsQuery.js";import"../../types/Environment.js";import"../../types/ReleaseNotes.js";import"@microsoft/signalr";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import"../../api/models/TutorialPosition.js";import{usePrefetchTutorialStepImages as u}from"./hooks/usePrefetchTutorialStepImages.js";const p=r(void 0);function l(){const o=e(p);if(void 0===o)throw new Error("'useTutorials' must be used within provider");return o}const d=({children:r})=>{const{data:e=[]}=n(),[l,d]=t(void 0),[m,c]=t(void 0),[v,f]=a();u();const T=s(),h=e?.filter((o=>!!T({to:o.path}))),w=i((()=>h?.filter((o=>!v.includes(o.id)&&o.willPopUp))),[v,h]);return o(p.Provider,{value:{allTutorials:e,tutorialsOnThisPage:h,unseenTutorialsOnThisPage:w,activeTutorial:l,activeStep:m,seenTutorialIDs:v,startTutorial:o=>{if(!e?.some((r=>o===r.id)))throw new Error("Tutorial not found");d(e.find((r=>o===r.id))),c(0)},skipTutorial:o=>{l&&l.id===o&&(d(void 0),c(void 0)),f(o)},goToNextStep:()=>{if(!l)throw new Error("No currently active tutorial!");if(void 0===m)throw new Error("activeStep is undefined!");m+1>=l.steps.length?(f(l.id),d(void 0),c(void 0)):c(m+1)},goToPreviousStep:()=>{if(!l)throw new Error("No currently active tutorial!");if(void 0===m)throw new Error("activeStep is undefined!");0===m?(d(void 0),c(void 0)):c(m-1)}},children:r})};export{p as TutorialDataContext,d as TutorialProvider,l as useTutorials};
1
+ import{jsx as o}from"react/jsx-runtime";import{createContext as r,useState as t,useMemo as i,useContext as e}from"react";import{useMatchRoute as s}from"@tanstack/react-router";import{useSeenTutorials as a}from"./useSeenTutorials.js";import"../FeatureToggleProvider.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";import{useTutorialsQuery as n}from"../../hooks/useTutorialsQuery.js";import"../../types/Environment.js";import"../../types/ReleaseNotes.js";import"@microsoft/signalr";import"../../api/models/ApplicationCategory.js";import"../../api/models/ServiceNowUrgency.js";import"../../api/models/TutorialPosition.js";import"../../api/models/WorkItemType.js";import"../../api/models/BugSeverity.js";import"../../api/models/SamWorkItemState.js";import{usePrefetchTutorialStepImages as p}from"./hooks/usePrefetchTutorialStepImages.js";const m=r(void 0);function u(){const o=e(m);if(void 0===o)throw new Error("'useTutorials' must be used within provider");return o}const l=({children:r})=>{const{data:e=[]}=n(),[u,l]=t(void 0),[d,c]=t(void 0),[v,f]=a();p();const T=s(),h=e?.filter((o=>!!T({to:o.path}))),w=i((()=>h?.filter((o=>!v.includes(o.id)&&o.willPopUp))),[v,h]);return o(m.Provider,{value:{allTutorials:e,tutorialsOnThisPage:h,unseenTutorialsOnThisPage:w,activeTutorial:u,activeStep:d,seenTutorialIDs:v,startTutorial:o=>{if(!e?.some((r=>o===r.id)))throw new Error("Tutorial not found");l(e.find((r=>o===r.id))),c(0)},skipTutorial:o=>{u&&u.id===o&&(l(void 0),c(void 0)),f(o)},goToNextStep:()=>{if(!u)throw new Error("No currently active tutorial!");if(void 0===d)throw new Error("activeStep is undefined!");d+1>=u.steps.length?(f(u.id),l(void 0),c(void 0)):c(d+1)},goToPreviousStep:()=>{if(!u)throw new Error("No currently active tutorial!");if(void 0===d)throw new Error("activeStep is undefined!");0===d?(l(void 0),c(void 0)):c(d-1)}},children:r})};export{m as TutorialDataContext,l as TutorialProvider,u as useTutorials};
@@ -1 +1 @@
1
- import{useRef as r,useEffect as o}from"react";import{useQueryClient as e}from"@tanstack/react-query";import{TutorialService as t}from"../../../api/services/TutorialService.js";import{GET_TUTORIAL_STEP_IMAGE as i}from"../../../constants/queryKeys.js";import"../../FeatureToggleProvider.js";import"../../../api/core/OpenAPI.js";import{useTutorialsQuery as s}from"../../../hooks/useTutorialsQuery.js";import"@microsoft/signalr";import"../../../api/models/ApplicationCategory.js";import"../../../api/models/ServiceNowUrgency.js";import"../../../api/models/TutorialPosition.js";import"../../../types/Environment.js";import"../../../types/ReleaseNotes.js";function m(){const{data:m=[]}=s(),p=e(),a=r([]);o((()=>{const r=r=>{for(const o of r.steps)o.imgUrl&&p.prefetchQuery({queryKey:[i,o.imgUrl],queryFn:()=>t.getTutorialImage(o.imgUrl),staleTime:1/0,gcTime:1/0})};for(const o of m)a.current.includes(o.id)||(a.current.push(o.id),r(o))}),[p,m])}export{m as usePrefetchTutorialStepImages};
1
+ import{useRef as r,useEffect as o}from"react";import{useQueryClient as e}from"@tanstack/react-query";import{TutorialService as t}from"../../../api/services/TutorialService.js";import{GET_TUTORIAL_STEP_IMAGE as i}from"../../../constants/queryKeys.js";import"../../FeatureToggleProvider.js";import"../../../api/core/OpenAPI.js";import{useTutorialsQuery as s}from"../../../hooks/useTutorialsQuery.js";import"@microsoft/signalr";import"../../../api/models/ApplicationCategory.js";import"../../../api/models/ServiceNowUrgency.js";import"../../../api/models/TutorialPosition.js";import"../../../api/models/WorkItemType.js";import"../../../api/models/BugSeverity.js";import"../../../api/models/SamWorkItemState.js";import"../../../types/Environment.js";import"../../../types/ReleaseNotes.js";function m(){const{data:m=[]}=s(),p=e(),a=r([]);o((()=>{const r=r=>{for(const o of r.steps)o.imgUrl&&p.prefetchQuery({queryKey:[i,o.imgUrl],queryFn:()=>t.getTutorialImage(o.imgUrl),staleTime:1/0,gcTime:1/0})};for(const o of m)a.current.includes(o.id)||(a.current.push(o.id),r(o))}),[p,m])}export{m as usePrefetchTutorialStepImages};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "5.2.3",
3
+ "version": "5.3.0",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",