@equinor/subsurface-app-management 1.0.2 → 1.0.4

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.
@@ -1,5 +1,5 @@
1
1
  import type { ApiRequestOptions } from './ApiRequestOptions';
2
- import { CancelablePromise } from './CancelablePromise';
2
+ import { CancelablePromise } from './..';
3
3
  type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
4
4
  type Headers = Record<string, string>;
5
5
  export type OpenAPIConfig = {
@@ -3,13 +3,21 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise';
3
3
  export { OpenAPI } from './core/OpenAPI';
4
4
  export { request } from './core/request';
5
5
  export type { OpenAPIConfig } from './core/OpenAPI';
6
- export type { Feature } from './models/Feature';
7
6
  export type { CustomTutorialStep } from './models/CustomTutorialStep';
8
- export type { GenericTutorialStep } from './models/GenericTutorialStep';
9
- export type { Tutorial } from './models/Tutorial';
7
+ export type { AccessRoles } from './models/AccessRole';
8
+ export type { AmplifyApplication } from './models/Applications';
9
+ export type { FeatureAPIType } from './models/FeatureAPIType';
10
10
  export type { FeatureToggleDto } from './models/FeatureToggleDto';
11
+ export type { GenericTutorialStep } from './models/GenericTutorialStep';
11
12
  export type { GraphUser } from './models/GraphUser';
12
- export type { ServiceNowIncidentResponse } from './models/ServiceNowIncidentResponse';
13
+ export type { ReleaseNote } from './models/ReleaseNote';
14
+ export type { ReleaseNotePatch } from './models/ReleaseNotePatch';
13
15
  export type { ServiceNowIncidentAttachmentResponse } from './models/ServiceNowIncidentAttachmentResponse';
14
- export { TutorialPosition } from './models/TutorialPosition';
16
+ export type { ServiceNowIncidentResponse } from './models/ServiceNowIncidentResponse';
15
17
  export { ServiceNowUrgency } from './models/ServiceNowUrgency';
18
+ export type { Tutorial } from './models/Tutorial';
19
+ export { TutorialPosition } from './models/TutorialPosition';
20
+ export type { TutorialStepBase } from './models/TutorialStepBase';
21
+ export { PortalService } from './services/PortalService';
22
+ export { ReleaseNotesService } from './services/ReleaseNotesService';
23
+ export { TutorialService } from './services/TutorialService';
@@ -1,5 +1,5 @@
1
1
  import type { GraphUser } from './GraphUser';
2
- export type Feature = {
2
+ export type FeatureAPIType = {
3
3
  uuid: string;
4
4
  featureKey: string;
5
5
  description: string;
@@ -1,5 +1,5 @@
1
- import type { Feature } from './Feature';
1
+ import type { FeatureAPIType } from './FeatureAPIType';
2
2
  export type FeatureToggleDto = {
3
3
  applicationName: string;
4
- features: Array<Feature>;
4
+ features: Array<FeatureAPIType>;
5
5
  };
@@ -0,0 +1,15 @@
1
+ export type * from './AccessRole';
2
+ export type * from './Applications';
3
+ export type * from './CustomTutorialStep';
4
+ export type * from './FeatureAPIType';
5
+ export type * from './FeatureToggleDto';
6
+ export type * from './GenericTutorialStep';
7
+ export type * from './GraphUser';
8
+ export type * from './ReleaseNote';
9
+ export type * from './ReleaseNotePatch';
10
+ export type * from './ServiceNowIncidentAttachmentResponse';
11
+ export type * from './ServiceNowIncidentResponse';
12
+ export type * from './ServiceNowUrgency';
13
+ export type * from './Tutorial';
14
+ export type * from './TutorialPosition';
15
+ export type * from './TutorialStepBase';
@@ -1 +1 @@
1
- import{OpenAPI_Portal as e,OpenAPI_Portal_Prod as r}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";import"../models/TutorialPosition.js";import"../models/ServiceNowUrgency.js";class o{static createIncident(r){return t(e,{method:"POST",url:"/api/v1/ServiceNow/incident",body:r})}static fileUpload(r){return t(e,{method:"POST",url:"/api/v1/Slack/fileUpload",body:r})}static postmessage(r){return t(e,{method:"POST",url:"/api/v1/Slack/postmessage",body:r})}static getFeatureToggleFromApplicationName(e){return t(r,{method:"GET",url:"/api/v1/FeatureToggle/{applicationName}",path:{applicationName:e},errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static userApplications(){return t(e,{method:"GET",url:"/api/v1/AmplifyApplication/userapplications",errors:{400:"Bad Request",500:"Server Error"}})}}export{o as PortalService};
1
+ import{OpenAPI_Portal as e,OpenAPI_Portal_Prod as r}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";import"../models/ServiceNowUrgency.js";import"../models/TutorialPosition.js";class o{static createIncident(r){return t(e,{method:"POST",url:"/api/v1/ServiceNow/incident",body:r})}static fileUpload(r){return t(e,{method:"POST",url:"/api/v1/Slack/fileUpload",body:r})}static postmessage(r){return t(e,{method:"POST",url:"/api/v1/Slack/postmessage",body:r})}static getFeatureToggleFromApplicationName(e){return t(r,{method:"GET",url:"/api/v1/FeatureToggle/{applicationName}",path:{applicationName:e},errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static userApplications(){return t(e,{method:"GET",url:"/api/v1/AmplifyApplication/userapplications",errors:{400:"Bad Request",500:"Server Error"}})}}export{o as PortalService};
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './hooks';
3
3
  export * from './providers';
4
4
  export * from './types';
5
5
  export * from './utils';
6
+ export * from './api';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{Feature}from"./components/Feature/Feature.js";export{default as AuthProvider,useAuth}from"./providers/AuthProvider/AuthProvider.js";export{default as ReleaseNotesProvider,useReleaseNotes}from"./providers/ReleaseNotesProvider.js";export{default as TutorialStepsProvider,useTutorialSteps}from"./providers/TutorialStepsProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useSignalRMessages}from"./hooks/useSignalRMessages.js";export{default as TutorialProvider}from"./providers/TutorialProvider/TutorialProvider.js";export{default as FeatureToggleProvider}from"./providers/FeatureToggleProvider.js";export{EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";export{auth,environment}from"./utils/auth_environment.js";
1
+ export{Feature}from"./components/Feature/Feature.js";export{default as AuthProvider,useAuth}from"./providers/AuthProvider/AuthProvider.js";export{default as ReleaseNotesProvider,useReleaseNotes}from"./providers/ReleaseNotesProvider.js";export{default as TutorialStepsProvider,useTutorialSteps}from"./providers/TutorialStepsProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{useSignalRMessages}from"./hooks/useSignalRMessages.js";export{default as TutorialProvider}from"./providers/TutorialProvider/TutorialProvider.js";export{default as FeatureToggleProvider}from"./providers/FeatureToggleProvider.js";export{EnvironmentType}from"./types/Environment.js";export{RELEASENOTE_TYPES_INFORMATION,ReleaseNoteType}from"./types/ReleaseNotes.js";export{auth,environment}from"./utils/auth_environment.js";export{ApiError}from"./api/core/ApiError.js";export{CancelError,CancelablePromise}from"./api/core/CancelablePromise.js";export{OpenAPI}from"./api/core/OpenAPI.js";export{request}from"./api/core/request.js";export{ServiceNowUrgency}from"./api/models/ServiceNowUrgency.js";export{TutorialPosition}from"./api/models/TutorialPosition.js";export{PortalService}from"./api/services/PortalService.js";export{ReleaseNotesService}from"./api/services/ReleaseNotesService.js";export{TutorialService}from"./api/services/TutorialService.js";
@@ -1,10 +1,10 @@
1
1
  import { FC, ReactNode } from 'react';
2
- import { Feature, GraphUser } from '../api';
2
+ import { FeatureAPIType, GraphUser } from '../api';
3
3
  export declare const isUserInActiveUserArray: (username: string, activeUsers: GraphUser[] | undefined | null) => boolean;
4
4
  interface FeatureToggleContextType {
5
5
  isLoading: boolean;
6
6
  isError: boolean;
7
- features?: Feature[] | null;
7
+ features?: FeatureAPIType[] | null;
8
8
  }
9
9
  export declare function useFeatureToggleContext(): FeatureToggleContextType;
10
10
  interface FeatureToggleProviderProps {
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as t}from"react";import{FullPageSpinner as o}from"@equinor/amplify-components";import{useQuery as i}from"@tanstack/react-query";import{PortalService as a}from"../api/services/PortalService.js";import{environment as n}from"../utils/auth_environment.js";const{getAppName:m}=n,s=(e,r)=>!!(r&&r.length>0)&&r.map((e=>e.mail.toLowerCase())).includes(e.toLowerCase()),u=r(void 0);function p(){const e=t(u);if(void 0===e)throw new Error("'useFeatureToggleContext' must be used within provider");return e}const c=({children:r})=>{const t=m(import.meta.env.VITE_NAME),{data:n,isLoading:s,isError:p}=i({queryKey:["getFeatureToggleFromAppName"],queryFn:async()=>a.getFeatureToggleFromApplicationName(t)});return s?e(o,{variant:"equinor",withoutScrim:!0}):e(u.Provider,{value:{features:n?.features,isLoading:s,isError:p},children:r})};export{c as default,s as isUserInActiveUserArray,p as useFeatureToggleContext};
1
+ import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as t}from"react";import{FullPageSpinner as o}from"@equinor/amplify-components";import{useQuery as i}from"@tanstack/react-query";import{environment as a}from"../utils/auth_environment.js";import{PortalService as n}from"../api/services/PortalService.js";const{getAppName:m}=a,s=(e,r)=>!!(r&&r.length>0)&&r.map((e=>e.mail.toLowerCase())).includes(e.toLowerCase()),u=r(void 0);function p(){const e=t(u);if(void 0===e)throw new Error("'useFeatureToggleContext' must be used within provider");return e}const c=({children:r})=>{const t=m(import.meta.env.VITE_NAME),{data:a,isLoading:s,isError:p}=i({queryKey:["getFeatureToggleFromAppName"],queryFn:async()=>n.getFeatureToggleFromApplicationName(t)});return s?e(o,{variant:"equinor",withoutScrim:!0}):e(u.Provider,{value:{features:a?.features,isLoading:s,isError:p},children:r})};export{c as default,s as isUserInActiveUserArray,p as useFeatureToggleContext};
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as r,jsx as e}from"react/jsx-runtime";import{useMemo as i}from"react";import{Typography as o,Button as n}from"@equinor/eds-core-react";import{DIALOG_EDGE_MARGIN as a,TUTORIAL_LOCALSTORAGE_VALUE_STRING as l}from"./TutorialProvider.const.js";import{useGetTutorialSasToken as s,useTutorial as m}from"./TutorialProvider.hooks.js";import{DialogImage as c,DialogWrapper as p,StyledTutorialDialog as d,DialogContent as u,DialogActions as g,NavigateSteps as T}from"./TutorialProvider.styles.js";import{getBestPositionWithoutOverlap as h}from"./TutorialProvider.utils.js";import f from"./TutorialStepIndicator.js";import"../../api/core/OpenAPI.js";import{TutorialPosition as v}from"../../api/models/TutorialPosition.js";import"../../api/models/ServiceNowUrgency.js";const P=()=>{const{data:P}=s(),{activeTutorial:x,currentStep:S,setCurrentStep:j,setActiveTutorial:k,dialogRef:y,allElementsToHighlight:O,customStepComponents:$,isLastStep:R,currentStepObject:C,setAllElementsToHighlight:B,shortNameFromParams:E,viewportWidth:I,clearSearchParam:w}=m(),H=i((()=>{if(C)return C.key&&$?$.find((t=>t.key===C.key))?.element:void 0===C.key||null===C.key?t(r,{children:[e(o,{children:C.title}),e(o,{children:C.body}),C.imgUrl&&P&&e(c,{"data-testid":"tutorial-image",alt:"tutorial-image",src:`${C.imgUrl}?${P}`})]}):void 0}),[C,$,P]),L=i((()=>{if(x&&I&&O&&y.current)return x.steps[S].position?x.steps[S].position:x.dynamicPositioning?h(O[S].getBoundingClientRect(),y.current.getBoundingClientRect()):v.BOTTOM_RIGHT}),[x,I,O,y,S]),N=i((()=>{if(L&&L!==v.CENTER)switch(L){case v.TOP_LEFT:return{marginTop:`${a}px`,marginLeft:`${a}px`};case v.TOP_RIGHT:return{marginTop:`${a}px`,marginRight:`${a}px`};case v.BOTTOM_LEFT:return{marginBottom:`${a}px`,marginLeft:`${a}px`};case v.BOTTOM_RIGHT:default:return{marginBottom:`${a}px`,marginRight:`${a}px`}}}),[L]),_=()=>{E&&w(),x&&(window.localStorage.setItem(x?.shortName,l),k(void 0),y.current?.close(),j(0),B(void 0))};return e(p,{children:e(d,{"data-testid":"tutorial-dialog",ref:y,style:N??void 0,children:t(u,{children:[H,e(f,{steps:x?.steps??[],currentStep:S}),t(g,{children:[e(n,{variant:"ghost",onClick:()=>{_()},children:"Skip"}),t(T,{children:[S&&0!==S?e(n,{variant:"ghost",onClick:()=>{j((t=>t-1))},children:"Previous"}):null,e(n,{variant:"outlined",onClick:()=>{R?_():j((t=>t+1))},children:R?"Done":"Next"})]})]})]})})})};export{P as default};
1
+ import{jsxs as t,Fragment as r,jsx as e}from"react/jsx-runtime";import{useMemo as i}from"react";import{Typography as o,Button as n}from"@equinor/eds-core-react";import{DIALOG_EDGE_MARGIN as a,TUTORIAL_LOCALSTORAGE_VALUE_STRING as l}from"./TutorialProvider.const.js";import{useGetTutorialSasToken as s,useTutorial as m}from"./TutorialProvider.hooks.js";import{DialogImage as c,DialogWrapper as p,StyledTutorialDialog as d,DialogContent as u,DialogActions as g,NavigateSteps as T}from"./TutorialProvider.styles.js";import{getBestPositionWithoutOverlap as h}from"./TutorialProvider.utils.js";import f from"./TutorialStepIndicator.js";import"../../api/core/OpenAPI.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as v}from"../../api/models/TutorialPosition.js";const P=()=>{const{data:P}=s(),{activeTutorial:x,currentStep:S,setCurrentStep:j,setActiveTutorial:k,dialogRef:y,allElementsToHighlight:O,customStepComponents:$,isLastStep:R,currentStepObject:C,setAllElementsToHighlight:B,shortNameFromParams:E,viewportWidth:I,clearSearchParam:w}=m(),H=i((()=>{if(C)return C.key&&$?$.find((t=>t.key===C.key))?.element:void 0===C.key||null===C.key?t(r,{children:[e(o,{children:C.title}),e(o,{children:C.body}),C.imgUrl&&P&&e(c,{"data-testid":"tutorial-image",alt:"tutorial-image",src:`${C.imgUrl}?${P}`})]}):void 0}),[C,$,P]),L=i((()=>{if(x&&I&&O&&y.current)return x.steps[S].position?x.steps[S].position:x.dynamicPositioning?h(O[S].getBoundingClientRect(),y.current.getBoundingClientRect()):v.BOTTOM_RIGHT}),[x,I,O,y,S]),N=i((()=>{if(L&&L!==v.CENTER)switch(L){case v.TOP_LEFT:return{marginTop:`${a}px`,marginLeft:`${a}px`};case v.TOP_RIGHT:return{marginTop:`${a}px`,marginRight:`${a}px`};case v.BOTTOM_LEFT:return{marginBottom:`${a}px`,marginLeft:`${a}px`};case v.BOTTOM_RIGHT:default:return{marginBottom:`${a}px`,marginRight:`${a}px`}}}),[L]),_=()=>{E&&w(),x&&(window.localStorage.setItem(x?.shortName,l),k(void 0),y.current?.close(),j(0),B(void 0))};return e(p,{children:e(d,{"data-testid":"tutorial-dialog",ref:y,style:N??void 0,children:t(u,{children:[H,e(f,{steps:x?.steps??[],currentStep:S}),t(g,{children:[e(n,{variant:"ghost",onClick:()=>{_()},children:"Skip"}),t(T,{children:[S&&0!==S?e(n,{variant:"ghost",onClick:()=>{j((t=>t-1))},children:"Previous"}):null,e(n,{variant:"outlined",onClick:()=>{R?_():j((t=>t+1))},children:R?"Done":"Next"})]})]})]})})})};export{P as default};
@@ -1,3 +1,3 @@
1
- export declare const useGetTutorialsForApp: () => import("@tanstack/react-query").UseQueryResult<import("../../api").Tutorial[], Error>;
1
+ export declare const useGetTutorialsForApp: () => import("@tanstack/react-query").UseQueryResult<import("../..").Tutorial[], Error>;
2
2
  export declare const useGetTutorialSasToken: () => import("@tanstack/react-query").UseQueryResult<string, Error>;
3
3
  export declare const useTutorial: () => import("./TutorialProvider").TutorialContextType;
@@ -1 +1 @@
1
- import{DIALOG_EDGE_MARGIN as T}from"./TutorialProvider.const.js";import"../../api/core/OpenAPI.js";import{TutorialPosition as t}from"../../api/models/TutorialPosition.js";import"../../api/models/ServiceNowUrgency.js";const o=(T,t)=>!(T.top>t.bottom||T.bottom<t.top||T.right<t.left||T.left>t.right),e=(o,e)=>{const i=e===t.BOTTOM_RIGHT||e===t.BOTTOM_LEFT,O=e===t.TOP_RIGHT||e===t.BOTTOM_RIGHT,r=innerWidth-T-o.width,m=innerHeight-T-o.height;return new DOMRect(O?r:T,i?m:T,o.width,o.height)},i=(T,i)=>o(T,e(i,t.BOTTOM_RIGHT))?o(T,e(i,t.BOTTOM_LEFT))?o(T,e(i,t.TOP_RIGHT))?o(T,e(i,t.TOP_LEFT))?t.BOTTOM_RIGHT:t.TOP_LEFT:t.TOP_RIGHT:t.BOTTOM_LEFT:t.BOTTOM_RIGHT,O=T=>T.steps.map(((t,o)=>document.getElementById(`${T.shortName}-${o}`)));export{O as getAllElementsToHighlight,i as getBestPositionWithoutOverlap};
1
+ import{DIALOG_EDGE_MARGIN as T}from"./TutorialProvider.const.js";import"../../api/core/OpenAPI.js";import"../../api/models/ServiceNowUrgency.js";import{TutorialPosition as t}from"../../api/models/TutorialPosition.js";const o=(T,t)=>!(T.top>t.bottom||T.bottom<t.top||T.right<t.left||T.left>t.right),e=(o,e)=>{const i=e===t.BOTTOM_RIGHT||e===t.BOTTOM_LEFT,O=e===t.TOP_RIGHT||e===t.BOTTOM_RIGHT,r=innerWidth-T-o.width,m=innerHeight-T-o.height;return new DOMRect(O?r:T,i?m:T,o.width,o.height)},i=(T,i)=>o(T,e(i,t.BOTTOM_RIGHT))?o(T,e(i,t.BOTTOM_LEFT))?o(T,e(i,t.TOP_RIGHT))?o(T,e(i,t.TOP_LEFT))?t.BOTTOM_RIGHT:t.TOP_LEFT:t.TOP_RIGHT:t.BOTTOM_LEFT:t.BOTTOM_RIGHT,O=T=>T.steps.map(((t,o)=>document.getElementById(`${T.shortName}-${o}`)));export{O as getAllElementsToHighlight,i as getBestPositionWithoutOverlap};
@@ -1,2 +1,3 @@
1
1
  export * from './Environment';
2
2
  export * from './ReleaseNotes';
3
+ export type * from '../api/models';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",