@equinor/subsurface-app-management 1.1.3 → 1.1.5

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.
@@ -0,0 +1 @@
1
+ export type JToken = Array<JToken>;
@@ -1,5 +1,6 @@
1
1
  import type { AmplifyApplication } from '../models/AmplifyApplication';
2
2
  import type { CancelablePromise } from '../core/CancelablePromise';
3
+ import { JToken } from '../models/JToken';
3
4
  export declare class AmplifyApplicationService {
4
5
  /**
5
6
  * Get all applications that user has access to
@@ -7,4 +8,10 @@ export declare class AmplifyApplicationService {
7
8
  * @throws ApiError
8
9
  */
9
10
  static userApplications(): CancelablePromise<Array<AmplifyApplication>>;
11
+ /**
12
+ * @param appClientId
13
+ * @returns JToken Success
14
+ * @throws ApiError
15
+ */
16
+ static getAllAppRoles(appClientId: string): CancelablePromise<Array<JToken>>;
10
17
  }
@@ -1 +1 @@
1
- import{OpenAPI_Portal_Prod as r}from"../core/OpenAPI.js";import{request as e}from"../core/request.js";class o{static userApplications(){return e(r,{method:"GET",url:"/api/v1/AmplifyApplication/userapplications",errors:{400:"Bad Request",500:"Server Error"}})}}export{o as AmplifyApplicationService};
1
+ import{OpenAPI_Portal_Prod as p,OpenAPI_Portal as r}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class e{static userApplications(){return t(p,{method:"GET",url:"/api/v1/AmplifyApplication/userapplications",errors:{400:"Bad Request",500:"Server Error"}})}static getAllAppRoles(p){return t(r,{method:"GET",url:"/api/v1/AmplifyApplication/application/{appClientId}/groups",path:{appClientId:p}})}}export{e as AmplifyApplicationService};
@@ -1,4 +1,5 @@
1
- import { CancelablePromise, ImpersonateUser } from './..';
1
+ import type { ImpersonateUser } from '../models/ImpersonateUser';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
2
3
  export declare class ImpersonateUserService {
3
4
  /**
4
5
  * Get all impersonate users
@@ -46,6 +47,11 @@ export declare class ImpersonateUserService {
46
47
  * @throws ApiError
47
48
  */
48
49
  static getImpersonateUserByUserName(username?: string): CancelablePromise<ImpersonateUser>;
50
+ /**
51
+ * @returns boolean Success
52
+ * @throws ApiError
53
+ */
54
+ static canImpersonate(): CancelablePromise<boolean>;
49
55
  /**
50
56
  * @param username
51
57
  * @returns ImpersonateUser Success
@@ -1 +1 @@
1
- import{OpenAPI_Portal as e}from"../core/OpenAPI.js";import{request as r}from"../core/request.js";class t{static getApiV1ImpersonateUser(){return r(e,{method:"GET",url:"/api/v1/ImpersonateUser",errors:{400:"Bad Request",500:"Server Error"}})}static createImpersonateUser(t){return r(e,{method:"POST",url:"/api/v1/ImpersonateUser",body:t,mediaType:"application/json-patch+json",errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static putImpersonateUser(t){return r(e,{method:"PUT",url:"/api/v1/ImpersonateUser",body:t,mediaType:"application/json-patch+json",errors:{400:"Bad Request"}})}static getAllActiveUsers(){return r(e,{method:"GET",url:"/api/v1/ImpersonateUser/ActiveUsers",errors:{400:"Bad Request",500:"Server Error"}})}static getActiveUserByUsername(t){return r(e,{method:"GET",url:"/api/v1/ImpersonateUser/ActiveUserByUsername",query:{username:t},errors:{400:"Bad Request",500:"Server Error"}})}static getImpersonateUserById(t){return r(e,{method:"GET",url:"/api/v1/ImpersonateUser/ImpersonateUser",query:{id:t},errors:{400:"Bad Request",500:"Server Error"}})}static getImpersonateUserByUserName(t){return r(e,{method:"GET",url:"/api/v1/ImpersonateUser/ImpersonateUserByUserName",query:{username:t},errors:{400:"Bad Request",500:"Server Error"}})}static startImpersonating(t){return r(e,{method:"PUT",url:"/api/v1/ImpersonateUser/StartImpersonating",query:{username:t},errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static stopImpersonating(){return r(e,{method:"PUT",url:"/api/v1/ImpersonateUser/StopImpersonating",errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}}export{t as ImpersonateUserService};
1
+ import{OpenAPI_Portal as r}from"../core/OpenAPI.js";import{request as e}from"../core/request.js";class t{static getApiV1ImpersonateUser(){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser",errors:{400:"Bad Request",500:"Server Error"}})}static createImpersonateUser(t){return e(r,{method:"POST",url:"/api/v1/ImpersonateUser",body:t,mediaType:"application/json-patch+json",errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static putImpersonateUser(t){return e(r,{method:"PUT",url:"/api/v1/ImpersonateUser",body:t,mediaType:"application/json-patch+json",errors:{400:"Bad Request"}})}static getAllActiveUsers(){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser/ActiveUsers",errors:{400:"Bad Request",500:"Server Error"}})}static getActiveUserByUsername(t){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser/ActiveUserByUsername",query:{username:t},errors:{400:"Bad Request",500:"Server Error"}})}static getImpersonateUserById(t){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser/ImpersonateUser",query:{id:t},errors:{400:"Bad Request",500:"Server Error"}})}static getImpersonateUserByUserName(t){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser/ImpersonateUserByUserName",query:{username:t},errors:{400:"Bad Request",500:"Server Error"}})}static canImpersonate(){return e(r,{method:"GET",url:"/api/v1/ImpersonateUser/CanImpersonate",errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static startImpersonating(t){return e(r,{method:"PUT",url:"/api/v1/ImpersonateUser/StartImpersonating",query:{username:t},errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}static stopImpersonating(){return e(r,{method:"PUT",url:"/api/v1/ImpersonateUser/StopImpersonating",errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}}export{t as ImpersonateUserService};
@@ -30,6 +30,17 @@ interface TutorialProviderProps {
30
30
  overrideEnvironmentName?: EnvironmentType;
31
31
  customStepComponents?: CustomTutorialComponent[];
32
32
  tutorials?: Tutorial[];
33
+ ignoredQueryKeys?: string[];
33
34
  }
35
+ /**
36
+ * Tutorial provider expects to be within a QueryClientProvider
37
+ * @param children Expects to wrap the application globally, typically in a providers file with multiple providers
38
+ * @param overrideAppName Overrides the "NAME" env variable, which is used to fetch the relevant tutorials for your app
39
+ * @param overrideEnvironmentName Overrides the "ENVIRONMENT_NAME" env variable, which is used for the possibility to hide tutorials in "production"
40
+ * @param customStepComponents Adds custom steps components with a key that can be used to link it to a step in a tutorial
41
+ * @param tutorials Passing tutorial object directly. This does not replace any tutorials found from API call, but rather is appended to them
42
+ * @param ignoredQueryKeys An array of query keys TutorialProviders will not wait to finish loading before looking for elements to highlight
43
+ * @constructor
44
+ */
34
45
  export declare const TutorialProvider: FC<TutorialProviderProps>;
35
46
  export {};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{createContext as r,useState as o,useRef as i,useMemo as n,useCallback as s,useEffect as l}from"react";import{useSearchParams as a}from"react-router-dom";import{TUTORIAL_SEARCH_PARAM_KEY as m}from"./TutorialProvider.const.js";import{getAllElementsToHighlight as u}from"./TutorialProvider.utils.js";import c from"./TutorialProviderInner.js";import{getAppName as d,getEnvironmentName as p}from"../../utils/environment.js";const h=r(void 0),v=({children:r,overrideAppName:v,overrideEnvironmentName:f,customStepComponents:g,tutorials:E})=>{const[T,w]=o(void 0),[y,N]=o(!1),[P,S]=a(),[k,j]=o(void 0),[C,A]=o(0),[x,I]=o(void 0),[F,H]=o(window.innerWidth),L=i(null),M=v??d(import.meta.env.VITE_NAME),V=f??p(import.meta.env.VITE_ENVIRONMENT_NAME),W=n((()=>{if(T)return T.steps.at(C)}),[T,C]),_=n((()=>!!T&&C>=T?.steps.length-1),[T,C]),z=s((()=>{P.delete(m),S(P),j(void 0)}),[P,S]);return l((()=>{if(k)return;const e=P.get(m);e&&j(e)}),[P,k]),l((()=>{const e=()=>{H(window.innerWidth)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),l((()=>{if(!T||y)return;const e=u(T);e.every((e=>null!==e))?I(e):(async()=>{await new Promise((e=>setTimeout(e,300)));const e=u(T);e.every((e=>null!==e))?I(e):(console.error("Could not find all elements to highlight for the tutorial. \n This is a list of elements that were found for each step: ",e),N(!0))})().catch((e=>{console.error("Error trying to get elements to highlight",e)}))}),[T,C,y,k]),l((()=>{if(!T||y)return;const e=T.steps.filter((e=>void 0!==e.key&&null!==e.key)).map((e=>e.key));if(0===e.length)return;const t=g?.map((e=>e.key));if(!t||0===t.length)return console.error("Could not find any custom components passed to the TutorialProvider \nExpected these keys for the active tutorial: ",e),void N(!0);e.map((e=>e&&t?.includes(e))).some((e=>!0!==e))&&(console.error("Could not find the custom components related to the active tutorial. \n The active tutorial expected to find these keys: ",e,"\n However in the custom components we only found these keys: ",t),N(!0))}),[T,g,y]),e(h.Provider,{value:{currentStepObject:W,activeTutorial:T,setActiveTutorial:w,currentStep:C,setCurrentStep:A,allElementsToHighlight:x,setAllElementsToHighlight:I,customStepComponents:g,isLastStep:_,dialogRef:L,clearSearchParam:z,shortNameFromParams:k,setShortNameFromParams:j,tutorialsFromProps:E??[],tutorialError:y,setTutorialError:N,viewportWidth:F,appName:M,environmentName:V},children:[t(c,{}),r]})};export{h as TutorialContext,v as TutorialProvider};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{createContext as r,useState as o,useRef as i,useMemo as n,useCallback as s,useEffect as a}from"react";import{useSearchParams as l}from"react-router-dom";import{useIsFetching as m}from"@tanstack/react-query";import{TUTORIAL_SEARCH_PARAM_KEY as u}from"./TutorialProvider.const.js";import{getAllElementsToHighlight as c}from"./TutorialProvider.utils.js";import d from"./TutorialProviderInner.js";import{getAppName as p,getEnvironmentName as h}from"../../utils/environment.js";const v=r(void 0),f=({children:r,overrideAppName:f,overrideEnvironmentName:y,customStepComponents:g,tutorials:E,ignoredQueryKeys:T})=>{const[w,N]=o(void 0),[P,k]=o(!1),[S,j]=l(),[C,A]=o(void 0),[x,I]=o(0),[F,H]=o(void 0),[L,M]=o(window.innerWidth),V=m({predicate:e=>!T?.some((t=>e.queryKey.includes(t)))})>0,W=i(null),_=f??p(import.meta.env.VITE_NAME),q=y??h(import.meta.env.VITE_ENVIRONMENT_NAME),z=n((()=>{if(w)return w.steps.at(x)}),[w,x]),K=n((()=>!!w&&x>=w?.steps.length-1),[w,x]),O=s((()=>{S.delete(u),j(S),A(void 0)}),[S,j]);return a((()=>{if(C)return;const e=S.get(u);e&&A(e)}),[S,C]),a((()=>{const e=()=>{M(window.innerWidth)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),a((()=>{if(!w||P||V)return;const e=c(w);e.every((e=>null!==e))?H(e):(async()=>{await new Promise((e=>setTimeout(e,300)));const e=c(w);e.every((e=>null!==e))?H(e):(console.error("Could not find all elements to highlight for the tutorial. \n This is a list of elements that were found for each step: ",e),k(!0))})().catch((e=>{console.error("Error trying to get elements to highlight",e)}))}),[w,x,P,C,V]),a((()=>{if(!w||P||V)return;const e=w.steps.filter((e=>void 0!==e.key&&null!==e.key)).map((e=>e.key));if(0===e.length)return;const t=g?.map((e=>e.key));if(!t||0===t.length)return console.error("Could not find any custom components passed to the TutorialProvider \nExpected these keys for the active tutorial: ",e),void k(!0);e.map((e=>e&&t?.includes(e))).some((e=>!0!==e))&&(console.error("Could not find the custom components related to the active tutorial. \n The active tutorial expected to find these keys: ",e,"\n However in the custom components we only found these keys: ",t),k(!0))}),[w,V,g,P]),e(v.Provider,{value:{currentStepObject:z,activeTutorial:w,setActiveTutorial:N,currentStep:x,setCurrentStep:I,allElementsToHighlight:F,setAllElementsToHighlight:H,customStepComponents:g,isLastStep:K,dialogRef:W,clearSearchParam:O,shortNameFromParams:C,setShortNameFromParams:A,tutorialsFromProps:E??[],tutorialError:P,setTutorialError:k,viewportWidth:L,appName:_,environmentName:q},children:[t(d,{}),r]})};export{v as TutorialContext,f as TutorialProvider};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",