@equinor/subsurface-app-management 1.0.9 → 1.1.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.
Files changed (47) hide show
  1. package/dist/api/core/CancelablePromise.d.ts +2 -8
  2. package/dist/api/core/CancelablePromise.js +1 -1
  3. package/dist/api/core/request.d.ts +18 -0
  4. package/dist/api/core/request.js +1 -1
  5. package/dist/api/index.d.ts +8 -7
  6. package/dist/api/models/{Applications.d.ts → AmplifyApplication.d.ts} +7 -2
  7. package/dist/api/models/ApplicationCategory.d.ts +6 -0
  8. package/dist/api/models/Chapter.d.ts +6 -0
  9. package/dist/api/models/ContentTab.d.ts +5 -0
  10. package/dist/api/models/ImpersonateUser.d.ts +10 -0
  11. package/dist/api/models/ReleaseNote.d.ts +4 -4
  12. package/dist/api/models/ServiceNowIncidentAttachmentResponse.d.ts +5 -5
  13. package/dist/api/models/ServiceNowIncidentResponse.d.ts +10 -10
  14. package/dist/api/models/Step.d.ts +9 -0
  15. package/dist/api/models/Tutorial.d.ts +3 -4
  16. package/dist/api/services/AmplifyApplicationService.d.ts +10 -0
  17. package/dist/api/services/AmplifyApplicationService.js +1 -0
  18. package/dist/api/services/FeatureToggleService.d.ts +11 -0
  19. package/dist/api/services/FeatureToggleService.js +1 -0
  20. package/dist/api/services/ImpersonateUserService.d.ts +61 -0
  21. package/dist/api/services/ImpersonateUserService.js +1 -0
  22. package/dist/api/services/ReleaseNotesService.d.ts +2 -1
  23. package/dist/api/services/ReleaseNotesService.js +1 -1
  24. package/dist/api/services/ServiceNowService.d.ts +17 -0
  25. package/dist/api/services/ServiceNowService.js +1 -0
  26. package/dist/api/services/SlackService.d.ts +27 -0
  27. package/dist/api/services/SlackService.js +1 -0
  28. package/dist/api/services/TutorialService.d.ts +5 -0
  29. package/dist/components/Feature/Feature.js +1 -1
  30. package/dist/hooks/index.d.ts +2 -1
  31. package/dist/hooks/useFeatureToggling.d.ts +2 -1
  32. package/dist/hooks/useFeatureToggling.js +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/providers/FeatureToggleProvider.js +1 -1
  35. package/dist/providers/TutorialProvider/TutorialProvider.d.ts +2 -2
  36. package/dist/providers/TutorialProvider/TutorialProvider.js +1 -1
  37. package/dist/providers/TutorialProvider/TutorialStepIndicator.d.ts +2 -2
  38. package/dist/types/index.d.ts +1 -1
  39. package/package.json +7 -4
  40. package/dist/api/models/CustomTutorialStep.d.ts +0 -4
  41. package/dist/api/models/GenericTutorialStep.d.ts +0 -7
  42. package/dist/api/models/ReleaseNotePatch.d.ts +0 -8
  43. package/dist/api/models/TutorialStepBase.d.ts +0 -4
  44. package/dist/api/models/index.d.ts +0 -15
  45. package/dist/api/services/PortalService.d.ts +0 -35
  46. package/dist/api/services/PortalService.js +0 -1
  47. /package/dist/api/models/{AccessRole.d.ts → AccessRoles.d.ts} +0 -0
@@ -9,15 +9,9 @@ export interface OnCancel {
9
9
  (cancelHandler: () => void): void;
10
10
  }
11
11
  export declare class CancelablePromise<T> implements Promise<T> {
12
- readonly [Symbol.toStringTag]: string;
13
- private _isResolved;
14
- private _isRejected;
15
- private _isCancelled;
16
- private readonly _cancelHandlers;
17
- private readonly _promise;
18
- private _resolve?;
19
- private _reject?;
12
+ #private;
20
13
  constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
14
+ get [Symbol.toStringTag](): string;
21
15
  then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
22
16
  catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
23
17
  finally(onFinally?: (() => void) | null): Promise<T>;
@@ -1 +1 @@
1
- class e extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}}class s{[Symbol.toStringTag];_isResolved;_isRejected;_isCancelled;_cancelHandlers;_promise;_resolve;_reject;constructor(e){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this._cancelHandlers=[],this._promise=new Promise(((s,t)=>{this._resolve=s,this._reject=t;const i=e=>{this._isResolved||this._isRejected||this._isCancelled||this._cancelHandlers.push(e)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),e((e=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve?.(e))}),(e=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject?.(e))}),i)}))}then(e,s){return this._promise.then(e,s)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this._cancelHandlers.length)try{for(const e of this._cancelHandlers)e()}catch(e){return void console.warn("Cancellation threw an error",e)}this._cancelHandlers.length=0,this._reject?.(new e("Request aborted"))}}get isCancelled(){return this._isCancelled}}export{e as CancelError,s as CancelablePromise};
1
+ class e extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}}class s{#e;#s;#t;#i;#l;#r;#c;constructor(e){this.#e=!1,this.#s=!1,this.#t=!1,this.#i=[],this.#l=new Promise(((s,t)=>{this.#r=s,this.#c=t;const i=e=>{this.#e||this.#s||this.#t||this.#i.push(e)};return Object.defineProperty(i,"isResolved",{get:()=>this.#e}),Object.defineProperty(i,"isRejected",{get:()=>this.#s}),Object.defineProperty(i,"isCancelled",{get:()=>this.#t}),e((e=>{this.#e||this.#s||this.#t||(this.#e=!0,this.#r&&this.#r(e))}),(e=>{this.#e||this.#s||this.#t||(this.#s=!0,this.#c&&this.#c(e))}),i)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,s){return this.#l.then(e,s)}catch(e){return this.#l.catch(e)}finally(e){return this.#l.finally(e)}cancel(){if(!(this.#e||this.#s||this.#t)){if(this.#t=!0,this.#i.length)try{for(const e of this.#i)e()}catch(e){return void console.warn("Cancellation threw an error",e)}this.#i.length=0,this.#c&&this.#c(new e("Request aborted"))}}get isCancelled(){return this.#t}}export{e as CancelError,s as CancelablePromise};
@@ -1,8 +1,25 @@
1
1
  import type { ApiRequestOptions } from './ApiRequestOptions';
2
+ import type { ApiResult } from './ApiResult';
2
3
  import { CancelablePromise } from './CancelablePromise';
3
4
  import type { OnCancel } from './CancelablePromise';
4
5
  import type { OpenAPIConfig } from './OpenAPI';
6
+ export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
7
+ export declare const isString: (value: any) => value is string;
8
+ export declare const isStringWithValue: (value: any) => value is string;
9
+ export declare const isBlob: (value: any) => value is Blob;
10
+ export declare const isFormData: (value: any) => value is FormData;
11
+ export declare const isSuccess: (status: number) => boolean;
12
+ export declare const base64: (str: string) => string;
13
+ export declare const getQueryString: (params: Record<string, any>) => string;
14
+ export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
15
+ type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
16
+ export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
17
+ export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Headers>;
18
+ export declare const getRequestBody: (options: ApiRequestOptions) => any;
5
19
  export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<XMLHttpRequest>;
20
+ export declare const getResponseHeader: (xhr: XMLHttpRequest, responseHeader?: string) => string | undefined;
21
+ export declare const getResponseBody: (xhr: XMLHttpRequest) => any;
22
+ export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
6
23
  /**
7
24
  * Request method
8
25
  * @param config The OpenAPI configuration object
@@ -11,3 +28,4 @@ export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOpt
11
28
  * @throws ApiError
12
29
  */
13
30
  export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
31
+ export {};
@@ -1 +1 @@
1
- import{ApiError as e}from"./ApiError.js";import{CancelablePromise as t}from"./CancelablePromise.js";const r=e=>null!=e,o=e=>"string"==typeof e,n=e=>o(e)&&""!==e,a=e=>"object"==typeof e&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.arrayBuffer&&"function"==typeof e.constructor&&"string"==typeof e.constructor.name&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag]),s=e=>e instanceof FormData,i=e=>{const t=[],o=(e,n)=>{r(n)&&(Array.isArray(n)?n.forEach((t=>{o(e,t)})):"object"==typeof n?Object.entries(n).forEach((([t,r])=>{o(`${e}[${t}]`,r)})):((e,r)=>{t.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(r))}`)})(e,n))};return Object.entries(e).forEach((([e,t])=>{o(e,t)})),t.length>0?`?${t.join("&")}`:""},c=async(e,t)=>"function"==typeof t?t(e):t,p=async(e,t)=>{const i=await c(t,e.TOKEN),p=await c(t,e.USERNAME),y=await c(t,e.PASSWORD),f=await c(t,e.HEADERS),d=Object.entries({Accept:"application/json",...f,...t.headers}).filter((([e,t])=>r(t))).reduce(((e,[t,r])=>({...e,[t]:String(r)})),{});if(n(i)&&(d.Authorization=`Bearer ${i}`),n(p)&&n(y)){const e=(e=>{try{return btoa(e)}catch(t){return Buffer.from(e).toString("base64")}})(`${p}:${y}`);d.Authorization=`Basic ${e}`}return t.body&&(t.mediaType?d["Content-Type"]=t.mediaType:a(t.body)?d["Content-Type"]=t.body.type||"application/octet-stream":o(t.body)?d["Content-Type"]="text/plain":s(t.body)||(d["Content-Type"]="application/json")),new Headers(d)},y=async(e,t,r,o,n,a,s)=>{const i=new XMLHttpRequest;return i.open(t.method,r,!0),i.withCredentials=e.WITH_CREDENTIALS,a.forEach(((e,t)=>{i.setRequestHeader(t,e)})),new Promise(((e,t)=>{i.onload=()=>e(i),i.onabort=()=>t(new Error("Request aborted")),i.onerror=()=>t(new Error("Network error")),i.send(o??n),s((()=>i.abort()))}))},f=(n,c)=>new t((async(t,f,d)=>{try{const f=((e,t)=>{const r=e.ENCODE_PATH||encodeURI,o=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,((e,o)=>t.path?.hasOwnProperty(o)?r(String(t.path[o])):e)),n=`${e.BASE}${o}`;return t.query?`${n}${i(t.query)}`:n})(n,c),b=(e=>{if(e.formData){const t=new FormData,n=(e,r)=>{o(r)||a(r)?t.append(e,r):t.append(e,JSON.stringify(r))};return Object.entries(e.formData).filter((([e,t])=>r(t))).forEach((([e,t])=>{Array.isArray(t)?t.forEach((t=>n(e,t))):n(e,t)})),t}})(c),l=(e=>{if(e.body)return e.mediaType?.includes("/json")?JSON.stringify(e.body):o(e.body)||a(e.body)||s(e.body)?e.body:JSON.stringify(e.body)})(c),h=await p(n,c);if(!d.isCancelled){const r=await y(n,c,f,l,b,h,d),a=(e=>{if(204!==e.status)try{const t=e.getResponseHeader("Content-Type");if(t)return t.toLowerCase().startsWith("application/json")?JSON.parse(e.responseText):e.responseText}catch(e){console.error(e)}})(r),s=((e,t)=>{if(t){const r=e.getResponseHeader(t);if(o(r))return r}})(r,c.responseHeader),i={url:f,ok:(u=r.status,u>=200&&u<300),status:r.status,statusText:r.statusText,body:s??a};((t,r)=>{const o={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[r.status];if(o)throw new e(t,r,o);if(!r.ok)throw new e(t,r,"Generic Error")})(c,i),t(i.body)}}catch(e){f(e)}var u}));export{f as request,y as sendRequest};
1
+ import{ApiError as t}from"./ApiError.js";import{CancelablePromise as e}from"./CancelablePromise.js";const r=t=>null!=t,o=t=>"string"==typeof t,n=t=>o(t)&&""!==t,a=t=>"object"==typeof t&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.arrayBuffer&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),s=t=>t instanceof FormData,i=t=>t>=200&&t<300,c=t=>{try{return btoa(t)}catch(e){return Buffer.from(t).toString("base64")}},p=t=>{const e=[],o=(t,n)=>{r(n)&&(Array.isArray(n)?n.forEach((e=>{o(t,e)})):"object"==typeof n?Object.entries(n).forEach((([e,r])=>{o(`${t}[${e}]`,r)})):((t,r)=>{e.push(`${encodeURIComponent(t)}=${encodeURIComponent(String(r))}`)})(t,n))};return Object.entries(t).forEach((([t,e])=>{o(t,e)})),e.length>0?`?${e.join("&")}`:""},y=t=>{if(t.formData){const e=new FormData,n=(t,r)=>{o(r)||a(r)?e.append(t,r):e.append(t,JSON.stringify(r))};return Object.entries(t.formData).filter((([t,e])=>r(e))).forEach((([t,e])=>{Array.isArray(e)?e.forEach((e=>n(t,e))):n(t,e)})),e}},u=async(t,e)=>"function"==typeof e?e(t):e,d=async(t,e)=>{const[i,p,y,d]=await Promise.all([u(e,t.TOKEN),u(e,t.USERNAME),u(e,t.PASSWORD),u(e,t.HEADERS)]),f=Object.entries({Accept:"application/json",...d,...e.headers}).filter((([t,e])=>r(e))).reduce(((t,[e,r])=>({...t,[e]:String(r)})),{});if(n(i)&&(f.Authorization=`Bearer ${i}`),n(p)&&n(y)){const t=c(`${p}:${y}`);f.Authorization=`Basic ${t}`}return void 0!==e.body&&(e.mediaType?f["Content-Type"]=e.mediaType:a(e.body)?f["Content-Type"]=e.body.type||"application/octet-stream":o(e.body)?f["Content-Type"]="text/plain":s(e.body)||(f["Content-Type"]="application/json")),new Headers(f)},f=t=>{if(void 0!==t.body)return t.mediaType?.includes("/json")?JSON.stringify(t.body):o(t.body)||a(t.body)||s(t.body)?t.body:JSON.stringify(t.body)},l=async(t,e,r,o,n,a,s)=>{const i=new XMLHttpRequest;return i.open(e.method,r,!0),i.withCredentials=t.WITH_CREDENTIALS,a.forEach(((t,e)=>{i.setRequestHeader(e,t)})),new Promise(((t,e)=>{i.onload=()=>t(i),i.onabort=()=>e(new Error("Request aborted")),i.onerror=()=>e(new Error("Network error")),i.send(o??n),s((()=>i.abort()))}))},b=(t,e)=>{if(e){const r=t.getResponseHeader(e);if(o(r))return r}},m=t=>{if(204!==t.status)try{const e=t.getResponseHeader("Content-Type");if(e){return["application/json","application/problem+json"].some((t=>e.toLowerCase().startsWith(t)))?JSON.parse(t.responseText):t.responseText}}catch(t){console.error(t)}},h=(e,r)=>{const o={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...e.errors}[r.status];if(o)throw new t(e,r,o);if(!r.ok){const o=r.status??"unknown",n=r.statusText??"unknown",a=(()=>{try{return JSON.stringify(r.body,null,2)}catch(t){return}})();throw new t(e,r,`Generic Error: status: ${o}; status text: ${n}; body: ${a}`)}},E=(t,r)=>new e((async(e,o,n)=>{try{const o=((t,e)=>{const r=t.ENCODE_PATH||encodeURI,o=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,((t,o)=>e.path?.hasOwnProperty(o)?r(String(e.path[o])):t)),n=`${t.BASE}${o}`;return e.query?`${n}${p(e.query)}`:n})(t,r),a=y(r),s=f(r),c=await d(t,r);if(!n.isCancelled){const p=await l(t,r,o,s,a,c,n),y=m(p),u=b(p,r.responseHeader),d={url:o,ok:i(p.status),status:p.status,statusText:p.statusText,body:u??y};h(r,d),e(d.body)}}catch(t){o(t)}}));export{c as base64,h as catchErrorCodes,y as getFormData,d as getHeaders,p as getQueryString,f as getRequestBody,m as getResponseBody,b as getResponseHeader,a as isBlob,r as isDefined,s as isFormData,o as isString,n as isStringWithValue,i as isSuccess,E as request,u as resolve,l as sendRequest};
@@ -3,21 +3,22 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise';
3
3
  export { OpenAPI_SAM, getPortalToken } from './core/OpenAPI';
4
4
  export { request } from './core/request';
5
5
  export type { OpenAPIConfig } from './core/OpenAPI';
6
- export type { CustomTutorialStep } from './models/CustomTutorialStep';
7
- export type { AccessRoles } from './models/AccessRole';
8
- export type { AmplifyApplication } from './models/Applications';
6
+ export type { AmplifyApplication } from './models/AmplifyApplication';
9
7
  export type { FeatureAPIType } from './models/FeatureAPIType';
10
8
  export type { FeatureToggleDto } from './models/FeatureToggleDto';
11
- export type { GenericTutorialStep } from './models/GenericTutorialStep';
12
9
  export type { GraphUser } from './models/GraphUser';
10
+ export type { ImpersonateUser } from './models/ImpersonateUser';
13
11
  export type { ReleaseNote } from './models/ReleaseNote';
14
- export type { ReleaseNotePatch } from './models/ReleaseNotePatch';
15
12
  export type { ServiceNowIncidentAttachmentResponse } from './models/ServiceNowIncidentAttachmentResponse';
16
13
  export type { ServiceNowIncidentResponse } from './models/ServiceNowIncidentResponse';
17
14
  export { ServiceNowUrgency } from './models/ServiceNowUrgency';
15
+ export type { Step } from './models/Step';
18
16
  export type { Tutorial } from './models/Tutorial';
19
17
  export { TutorialPosition } from './models/TutorialPosition';
20
- export type { TutorialStepBase } from './models/TutorialStepBase';
21
- export { PortalService } from './services/PortalService';
18
+ export { AmplifyApplicationService } from './services/AmplifyApplicationService';
19
+ export { FeatureToggleService } from './services/FeatureToggleService';
20
+ export { ImpersonateUserService } from './services/ImpersonateUserService';
22
21
  export { ReleaseNotesService } from './services/ReleaseNotesService';
22
+ export { ServiceNowService } from './services/ServiceNowService';
23
+ export { SlackService } from './services/SlackService';
23
24
  export { TutorialService } from './services/TutorialService';
@@ -1,4 +1,6 @@
1
- import { AccessRoles } from './AccessRole';
1
+ import type { AccessRoles } from './AccessRoles';
2
+ import type { ApplicationCategory } from './ApplicationCategory';
3
+ import type { ContentTab } from './ContentTab';
2
4
  export type AmplifyApplication = {
3
5
  id: string;
4
6
  name: string;
@@ -6,12 +8,15 @@ export type AmplifyApplication = {
6
8
  url: string;
7
9
  accessRoles: Array<AccessRoles>;
8
10
  description: string;
11
+ contentTabs: Array<ContentTab>;
9
12
  longDescription: string;
10
- category: string;
13
+ category: ApplicationCategory;
11
14
  version: string;
12
15
  applicationInsightAPI: string;
13
16
  apI_Id: string;
14
17
  apiurl: string;
15
18
  monitored: boolean;
19
+ partnerAccess: boolean;
16
20
  productOwners: Array<string>;
21
+ sponsors: Array<string>;
17
22
  };
@@ -0,0 +1,6 @@
1
+ export declare enum ApplicationCategory {
2
+ JSDigitalFrontrunner = "JS Digital Frontrunner",
3
+ Upscaling = "Upscaling",
4
+ Toolbox = "Toolbox",
5
+ External = "External"
6
+ }
@@ -0,0 +1,6 @@
1
+ export type Chapter = {
2
+ order: number;
3
+ title: string;
4
+ subTitle: string;
5
+ content: string;
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { Chapter } from './Chapter';
2
+ export type ContentTab = {
3
+ name: string;
4
+ chapters: Array<Chapter>;
5
+ };
@@ -0,0 +1,10 @@
1
+ export type ImpersonateUser = {
2
+ id?: string | null;
3
+ name: string;
4
+ firstName: string;
5
+ lastName: string;
6
+ uniqueName: string;
7
+ appName: string;
8
+ roles: Array<string>;
9
+ activeUsers: Array<string>;
10
+ };
@@ -1,9 +1,9 @@
1
1
  export type ReleaseNote = {
2
2
  releaseId?: string | null;
3
- applicationName?: string | null;
3
+ applicationName: string;
4
4
  version?: string | null;
5
- title?: string | null;
6
- body?: string | null;
5
+ title: string;
6
+ body: string;
7
7
  tags?: Array<string> | null;
8
- createdDate?: string;
8
+ createdDate: string;
9
9
  };
@@ -1,7 +1,7 @@
1
1
  export type ServiceNowIncidentAttachmentResponse = {
2
- tableName?: string | null;
3
- tableSysId?: string | null;
4
- sysId?: string | null;
5
- contentType?: string | null;
6
- fileName?: string | null;
2
+ tableName: string;
3
+ tableSysId: string;
4
+ sysId: string;
5
+ contentType: string;
6
+ fileName: string;
7
7
  };
@@ -1,13 +1,13 @@
1
1
  import type { ServiceNowIncidentAttachmentResponse } from './ServiceNowIncidentAttachmentResponse';
2
2
  export type ServiceNowIncidentResponse = {
3
- number?: string | null;
4
- assignmentGroup?: string | null;
5
- configurationItem?: string | null;
6
- title?: string | null;
7
- description?: string | null;
8
- caller?: string | null;
9
- state?: string | null;
10
- urgency?: string | null;
11
- sysId?: string | null;
12
- attachmentResponse?: ServiceNowIncidentAttachmentResponse;
3
+ number: string;
4
+ assignmentGroup: string;
5
+ configurationItem: string;
6
+ title: string;
7
+ description: string;
8
+ caller: string;
9
+ state: string;
10
+ urgency: string;
11
+ sysId: string;
12
+ attachmentResponse?: Array<ServiceNowIncidentAttachmentResponse> | null;
13
13
  };
@@ -0,0 +1,9 @@
1
+ import type { TutorialPosition } from './TutorialPosition';
2
+ export type Step = {
3
+ id?: string | null;
4
+ title?: string | null;
5
+ body?: string | null;
6
+ key?: string | null;
7
+ position?: TutorialPosition;
8
+ imgUrl?: string | null;
9
+ };
@@ -1,12 +1,11 @@
1
- import { CustomTutorialStep } from './CustomTutorialStep';
2
- import { GenericTutorialStep } from './GenericTutorialStep';
1
+ import type { Step } from './Step';
3
2
  export type Tutorial = {
4
- id: string;
3
+ id?: string | null;
5
4
  name: string;
6
5
  shortName: string;
7
6
  path: string;
8
7
  application: string;
9
- steps: Array<CustomTutorialStep | GenericTutorialStep>;
8
+ steps: Array<Step>;
10
9
  showInProd: boolean;
11
10
  willPopUp: boolean;
12
11
  dynamicPositioning?: boolean | null;
@@ -0,0 +1,10 @@
1
+ import type { AmplifyApplication } from '../models/AmplifyApplication';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
3
+ export declare class AmplifyApplicationService {
4
+ /**
5
+ * Get all applications that user has access to
6
+ * @returns AmplifyApplication Success
7
+ * @throws ApiError
8
+ */
9
+ static userApplications(): CancelablePromise<Array<AmplifyApplication>>;
10
+ }
@@ -0,0 +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};
@@ -0,0 +1,11 @@
1
+ import type { FeatureToggleDto } from '../models/FeatureToggleDto';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
3
+ export declare class FeatureToggleService {
4
+ /**
5
+ * Gets a Feature Toggle from Application name
6
+ * @param applicationName name
7
+ * @returns FeatureToggleDto Success
8
+ * @throws ApiError
9
+ */
10
+ static getFeatureToggleFromApplicationName(applicationName: string): CancelablePromise<FeatureToggleDto>;
11
+ }
@@ -0,0 +1 @@
1
+ import{OpenAPI_Portal_Prod as e}from"../core/OpenAPI.js";import{request as r}from"../core/request.js";class o{static getFeatureToggleFromApplicationName(o){return r(e,{method:"GET",url:"/api/v1/FeatureToggle/{applicationName}",path:{applicationName:o},errors:{400:"Bad Request",404:"Not Found",500:"Server Error"}})}}export{o as FeatureToggleService};
@@ -0,0 +1,61 @@
1
+ import type { ImpersonateUser } from '../models/ImpersonateUser';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
3
+ export declare class ImpersonateUserService {
4
+ /**
5
+ * Get all impersonate users
6
+ * @returns ImpersonateUser Success
7
+ * @throws ApiError
8
+ */
9
+ static getApiV1ImpersonateUser(): CancelablePromise<ImpersonateUser>;
10
+ /**
11
+ * @param requestBody
12
+ * @returns ImpersonateUser Success
13
+ * @throws ApiError
14
+ */
15
+ static createImpersonateUser(requestBody?: ImpersonateUser): CancelablePromise<ImpersonateUser>;
16
+ /**
17
+ * Edits or Creates a impersonate user if it doesnt exist.
18
+ * @param requestBody
19
+ * @returns ImpersonateUser Success
20
+ * @throws ApiError
21
+ */
22
+ static putImpersonateUser(requestBody?: ImpersonateUser): CancelablePromise<ImpersonateUser>;
23
+ /**
24
+ * Get all active users
25
+ * @returns ImpersonateUser Success
26
+ * @throws ApiError
27
+ */
28
+ static getAllActiveUsers(): CancelablePromise<ImpersonateUser>;
29
+ /**
30
+ * Get active user by username
31
+ * @param username
32
+ * @returns ImpersonateUser Success
33
+ * @throws ApiError
34
+ */
35
+ static getActiveUserByUsername(username?: string): CancelablePromise<ImpersonateUser>;
36
+ /**
37
+ * Get impersonate user by id
38
+ * @param id
39
+ * @returns ImpersonateUser Success
40
+ * @throws ApiError
41
+ */
42
+ static getImpersonateUserById(id?: string): CancelablePromise<ImpersonateUser>;
43
+ /**
44
+ * Get impersonate user by username
45
+ * @param username
46
+ * @returns ImpersonateUser Success
47
+ * @throws ApiError
48
+ */
49
+ static getImpersonateUserByUserName(username?: string): CancelablePromise<ImpersonateUser>;
50
+ /**
51
+ * @param username
52
+ * @returns ImpersonateUser Success
53
+ * @throws ApiError
54
+ */
55
+ static startImpersonating(username?: string): CancelablePromise<ImpersonateUser>;
56
+ /**
57
+ * @returns ImpersonateUser Success
58
+ * @throws ApiError
59
+ */
60
+ static stopImpersonating(): CancelablePromise<ImpersonateUser>;
61
+ }
@@ -0,0 +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};
@@ -9,10 +9,11 @@ export declare class ReleaseNotesService {
9
9
  */
10
10
  static getReleasenoteList(applicationName?: string, version?: string, tags?: Array<string>): CancelablePromise<any>;
11
11
  /**
12
+ * @param tags
12
13
  * @returns any Success
13
14
  * @throws ApiError
14
15
  */
15
- static getMyReleasenotes(): CancelablePromise<any>;
16
+ static getMyReleasenotes(tags?: Array<string>): CancelablePromise<any>;
16
17
  /**
17
18
  * @param applicationName
18
19
  * @param releaseId
@@ -1 +1 @@
1
- import{OpenAPI_Portal as e}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class a{static getReleasenoteList(a,r,s){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes",query:{applicationName:a,version:r,tags:s}})}static getMyReleasenotes(){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/myreleasenotes"})}static getReleasenote(a,r){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/{applicationName}/{releaseId}",path:{applicationName:a,releaseId:r}})}static getContainerSasUri(){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/GetContainerSasUri",errors:{401:"Unauthorized"}})}}export{a as ReleaseNotesService};
1
+ import{OpenAPI_Portal as e}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class a{static getReleasenoteList(a,r,s){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes",query:{applicationName:a,version:r,tags:s}})}static getMyReleasenotes(a){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/myreleasenotes",query:{tags:a}})}static getReleasenote(a,r){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/{applicationName}/{releaseId}",path:{applicationName:a,releaseId:r}})}static getContainerSasUri(){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/GetContainerSasUri",errors:{401:"Unauthorized"}})}}export{a as ReleaseNotesService};
@@ -0,0 +1,17 @@
1
+ import type { ServiceNowUrgency } from '../models/ServiceNowUrgency';
2
+ import type { CancelablePromise } from '../core/CancelablePromise';
3
+ export declare class ServiceNowService {
4
+ /**
5
+ * @param formData
6
+ * @returns any Success
7
+ * @throws ApiError
8
+ */
9
+ static createIncident(formData?: {
10
+ ConfigurationItem: string;
11
+ Title: string;
12
+ Description: string;
13
+ CallerEmail: string;
14
+ urgency?: ServiceNowUrgency;
15
+ Images?: Array<Blob>;
16
+ }): CancelablePromise<any>;
17
+ }
@@ -0,0 +1 @@
1
+ import{OpenAPI_Portal as e}from"../core/OpenAPI.js";import{request as r}from"../core/request.js";class t{static createIncident(t){return r(e,{method:"POST",url:"/api/v1/ServiceNow/incident",formData:t,mediaType:"multipart/form-data"})}}export{t as ServiceNowService};
@@ -0,0 +1,27 @@
1
+ import type { CancelablePromise } from '../core/CancelablePromise';
2
+ export declare class SlackService {
3
+ /**
4
+ * Uploads file to slack and links it to a channel defined in config
5
+ * @param formData
6
+ * @returns any Success
7
+ * @throws ApiError
8
+ */
9
+ static fileUpload(formData?: {
10
+ ContentType?: string;
11
+ ContentDisposition?: string;
12
+ Headers?: Record<string, Array<string>>;
13
+ Length?: number;
14
+ Name?: string;
15
+ FileName?: string;
16
+ comment?: string;
17
+ }): CancelablePromise<any>;
18
+ /**
19
+ * Creates a message in the slack channel defined in config
20
+ * @param formData
21
+ * @returns any Success
22
+ * @throws ApiError
23
+ */
24
+ static postMessage(formData?: {
25
+ comment?: string;
26
+ }): CancelablePromise<any>;
27
+ }
@@ -0,0 +1 @@
1
+ import{OpenAPI_Portal as a}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class e{static fileUpload(e){return t(a,{method:"POST",url:"/api/v1/Slack/fileUpload",formData:e,mediaType:"multipart/form-data"})}static postMessage(e){return t(a,{method:"POST",url:"/api/v1/Slack/postmessage",formData:e,mediaType:"multipart/form-data"})}}export{e as SlackService};
@@ -8,5 +8,10 @@ export declare class TutorialService {
8
8
  * @throws ApiError
9
9
  */
10
10
  static getTutorialsForApplication(applicationName: string): CancelablePromise<Array<Tutorial>>;
11
+ /**
12
+ * Get A SAS token for Tutorial image container
13
+ * @returns string Success
14
+ * @throws ApiError
15
+ */
11
16
  static getTutorialSasToken(): CancelablePromise<string>;
12
17
  }
@@ -1 +1 @@
1
- import{jsx as e,Fragment as r}from"react/jsx-runtime";import{useFeatureToggling as t}from"../../hooks/useFeatureToggling.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";const o=({featureKey:o,children:s,fallback:n,showIfKeyIsMissing:i=!0})=>{const{showContent:a}=t({featureKey:o,showIfKeyIsMissing:i});return e(r,a?{children:s}:{children:n??null})};export{o as Feature};
1
+ import{jsx as e,Fragment as r}from"react/jsx-runtime";import"../../providers/FeatureToggleProvider.js";import{useFeatureToggling as o}from"../../hooks/useFeatureToggling.js";import"@tanstack/react-query";import"../../api/core/OpenAPI.js";const t=({featureKey:t,children:s,fallback:i,showIfKeyIsMissing:n=!0})=>{const{showContent:a}=o({featureKey:t,showIfKeyIsMissing:n});return e(r,a?{children:s}:{children:i??null})};export{t as Feature};
@@ -1,3 +1,4 @@
1
+ import { useFeatureToggleContext } from "../providers/FeatureToggleProvider";
1
2
  import { useFeatureToggling } from './useFeatureToggling';
2
3
  import { useReleaseNotesQuery } from './useReleaseNotesQuery';
3
- export { useFeatureToggling, useReleaseNotesQuery };
4
+ export { useFeatureToggling, useReleaseNotesQuery, useFeatureToggleContext };
@@ -2,8 +2,9 @@ interface UseFeatureTogglingOptions {
2
2
  featureKey: string;
3
3
  username?: string;
4
4
  showIfKeyIsMissing?: boolean;
5
+ showIfIsLoading?: boolean;
5
6
  }
6
- export declare function useFeatureToggling({ featureKey, username, showIfKeyIsMissing, }: UseFeatureTogglingOptions): {
7
+ export declare function useFeatureToggling({ featureKey, username, showIfKeyIsMissing, showIfIsLoading, }: UseFeatureTogglingOptions): {
7
8
  showContent: boolean;
8
9
  };
9
10
  export {};
@@ -1 +1 @@
1
- import{useMemo as e}from"react";import{useFeatureToggleContext as r,isUserInActiveUserArray as t}from"../providers/FeatureToggleProvider.js";function s({featureKey:s,username:n,showIfKeyIsMissing:i}){const o=i??!0,{features:a,isError:u,environmentName:v}=r(),c=a?.find((e=>e.featureKey===s));return{showContent:e((()=>c?(void 0===n&&c.activeUsers&&c.activeUsers.length>0&&console.warn(`[FeatureToggle] Feature ${c.featureKey} has activeUsers set but username wasn't provided! Was this intentional?`),!!t(n,c.activeUsers)||c.activeEnvironments.includes(v)):!u&&o),[v,o,c,u,n])}}export{s as useFeatureToggling};
1
+ import{useMemo as e}from"react";import{useFeatureToggleContext as t,isUserInActiveUserArray as r}from"../providers/FeatureToggleProvider.js";function n({featureKey:n,username:o,showIfKeyIsMissing:s=!0,showIfIsLoading:a=!1}){const{features:i,isError:u,environmentName:g,isLoading:l}=t();s||console.warn(`[FeatureToggle] Feature: ${n} will not show when the feature toggle is removed! Was this intentional?`);return{showContent:e((()=>{if(!a&&l||u)return!1;const e=i?.find((e=>e.featureKey===n));return e?(void 0===o&&e.activeUsers&&e.activeUsers.length>0&&console.warn(`[FeatureToggle] Feature ${e.featureKey} has activeUsers set but username wasn't provided! Was this intentional?`),!!r(o,e.activeUsers)||e.activeEnvironments.includes(g)):(console.warn(`[FeatureToggle] Feature ${n} was not found, has it been removed?`),s)}),[a,l,u,i,s,n,o,g])}}export{n as useFeatureToggling};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{Feature}from"./components/Feature/Feature.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{TutorialProvider}from"./providers/TutorialProvider/TutorialProvider.js";export{FeatureToggleProvider}from"./providers/FeatureToggleProvider.js";export{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_SAM,getPortalToken}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
+ export{Feature}from"./components/Feature/Feature.js";export{FeatureToggleProvider,useFeatureToggleContext}from"./providers/FeatureToggleProvider.js";export{useFeatureToggling}from"./hooks/useFeatureToggling.js";export{useReleaseNotesQuery}from"./hooks/useReleaseNotesQuery.js";export{TutorialProvider}from"./providers/TutorialProvider/TutorialProvider.js";export{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_SAM,getPortalToken}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{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";
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as o}from"react";import{useQuery as t}from"@tanstack/react-query";import{PortalService as i}from"../api/services/PortalService.js";import*as n from"../utils/environment.js";import{getEnvironmentName as a}from"../utils/environment.js";const{getAppName:m}=n,s=(e,r)=>!!(e&&r&&r.length>0)&&r.map((e=>e.mail.toLowerCase())).includes(e.toLowerCase()),p=r(void 0);function u(){const e=o(p);if(void 0===e)throw new Error("'useFeatureToggleContext' must be used within provider");return e}const c=({children:r,loadingComponent:o,overrideAppName:n,overrideEnvironment:s})=>{const u=n??m(import.meta.env.VITE_NAME),c=s??a(import.meta.env.VITE_ENVIRONMENT_NAME),{data:v,isLoading:d,isError:l}=t({queryKey:["getFeatureToggleFromAppName"],queryFn:async()=>i.getFeatureToggleFromApplicationName(u)});return d&&o?o:e(p.Provider,{value:{features:v?.features,isLoading:d,isError:l,environmentName:c},children:r})};export{c as FeatureToggleProvider,s as isUserInActiveUserArray,u as useFeatureToggleContext};
1
+ import{jsx as e}from"react/jsx-runtime";import{createContext as r,useContext as o}from"react";import{useQuery as t}from"@tanstack/react-query";import{FeatureToggleService as i}from"../api/services/FeatureToggleService.js";import*as n from"../utils/environment.js";import{getEnvironmentName as a}from"../utils/environment.js";const{getAppName:m}=n,s=(e,r)=>!!(e&&r&&r.length>0)&&r.map((e=>e.mail.toLowerCase())).includes(e.toLowerCase()),p=r(void 0);function u(){const e=o(p);if(void 0===e)throw new Error("'useFeatureToggleContext' must be used within provider");return e}const c=({children:r,loadingComponent:o,overrideAppName:n,overrideEnvironment:s})=>{const u=n??m(import.meta.env.VITE_NAME),c=s??a(import.meta.env.VITE_ENVIRONMENT_NAME),{data:g,isLoading:v,isError:d}=t({queryKey:["getFeatureToggleFromAppName"],queryFn:async()=>i.getFeatureToggleFromApplicationName(u)});return v&&o?o:e(p.Provider,{value:{features:g?.features,isLoading:v,isError:d,environmentName:c},children:r})};export{c as FeatureToggleProvider,s as isUserInActiveUserArray,u as useFeatureToggleContext};
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, FC, MutableRefObject, ReactNode, SetStateAction } from 'react';
2
2
  import { CustomTutorialComponent } from './TutorialProvider.types';
3
- import { CustomTutorialStep, GenericTutorialStep, Tutorial } from '../../api';
3
+ import { Step, Tutorial } from '../../api';
4
4
  import { EnvironmentType } from '../../types';
5
5
  export interface TutorialContextType {
6
6
  activeTutorial: Tutorial | undefined;
@@ -10,7 +10,7 @@ export interface TutorialContextType {
10
10
  allElementsToHighlight: HTMLElement[] | undefined;
11
11
  setAllElementsToHighlight: Dispatch<SetStateAction<HTMLElement[] | undefined>>;
12
12
  customStepComponents: CustomTutorialComponent[] | undefined;
13
- currentStepObject: GenericTutorialStep | CustomTutorialStep | undefined;
13
+ currentStepObject: Step | undefined;
14
14
  isLastStep: boolean;
15
15
  dialogRef: MutableRefObject<HTMLDialogElement | null>;
16
16
  clearSearchParam: () => void;
@@ -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=>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 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,7 +1,7 @@
1
1
  import { FC } from 'react';
2
- import { CustomTutorialStep, GenericTutorialStep } from '../../api';
2
+ import { Step } from '../../api';
3
3
  interface TutorialStepIndicatorProps {
4
- steps: (GenericTutorialStep | CustomTutorialStep)[];
4
+ steps: Step[];
5
5
  currentStep: number;
6
6
  }
7
7
  declare const TutorialStepIndicator: FC<TutorialStepIndicatorProps>;
@@ -1,3 +1,3 @@
1
1
  export * from './Environment';
2
2
  export * from './ReleaseNotes';
3
- export type * from '../api/models';
3
+ export type * from '../api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -8,6 +8,10 @@
8
8
  "author": "Amplify Team",
9
9
  "license": "ISC",
10
10
  "homepage": "https://github.com/equinor/subsurface-app-management#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/equinor/subsurface-app-management.git"
14
+ },
11
15
  "bugs": {
12
16
  "url": "https://github.com/equinor/subsurface-app-management/issues"
13
17
  },
@@ -19,8 +23,8 @@
19
23
  "start": "NODE_OPTIONS=--openssl-legacy-provider && storybook dev -p 6006",
20
24
  "build-storybook": "NODE_OPTIONS='--openssl-legacy-provider --max-old-space-size=2048' storybook build",
21
25
  "setup": "npm install",
22
- "pretty": "prettier --check ./config ./src",
23
- "pretty:fix": "prettier --write ./config ./src",
26
+ "pretty": "prettier --check ./src",
27
+ "pretty:fix": "prettier --write ./src",
24
28
  "lint": "eslint ./src --ext .ts,.tsx",
25
29
  "lint:fix": "eslint ./src --ext .ts,.tsx --fix",
26
30
  "test": "vitest watch",
@@ -29,7 +33,6 @@
29
33
  "setup-husky": "husky install",
30
34
  "precommit": "npx lint-staged",
31
35
  "build": "rollup -c && tsc --project tsconfig.build.json && resolve-tspaths --project tsconfig.build.json",
32
- "build:ci": "rm -rf lib dist && npm run build-components",
33
36
  "build-and-use": "node tooling/build-and-use.mjs",
34
37
  "brute-coverage": "node tooling/brute-coverage.mjs"
35
38
  },
@@ -1,4 +0,0 @@
1
- import { TutorialStepBase } from './TutorialStepBase';
2
- export type CustomTutorialStep = TutorialStepBase & {
3
- key: string;
4
- };
@@ -1,7 +0,0 @@
1
- import { TutorialStepBase } from './TutorialStepBase';
2
- export type GenericTutorialStep = TutorialStepBase & {
3
- title: string;
4
- body: string;
5
- key?: undefined;
6
- imgUrl?: string;
7
- };
@@ -1,8 +0,0 @@
1
- export type ReleaseNotePatch = {
2
- releaseId?: string;
3
- applicationName?: string | null;
4
- version?: string | null;
5
- title?: string | null;
6
- body?: string | null;
7
- tags?: Array<string> | null;
8
- };
@@ -1,4 +0,0 @@
1
- import type { TutorialPosition } from './TutorialPosition';
2
- export type TutorialStepBase = {
3
- position?: TutorialPosition;
4
- };
@@ -1,15 +0,0 @@
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,35 +0,0 @@
1
- import type { CancelablePromise } from './..';
2
- import { FeatureToggleDto } from './..';
3
- import { ServiceNowIncidentResponse } from '../models/ServiceNowIncidentResponse';
4
- import { AmplifyApplication } from '../models/Applications';
5
- export declare class PortalService {
6
- /**
7
- * Creates a incident report in service now
8
- * @param formData
9
- * @returns any Success
10
- * @throws ApiError
11
- */
12
- static createIncident(formData?: FormData): CancelablePromise<ServiceNowIncidentResponse>;
13
- /**
14
- * Uploads file to slack and links it to a channel defined in config
15
- * @param formData
16
- * @returns any Success
17
- * @throws ApiError
18
- */
19
- static fileUpload(formData?: FormData): CancelablePromise<unknown>;
20
- /**
21
- * Posts a slack message to channel defined in config
22
- * @param formData
23
- * @returns any Success
24
- * @throws ApiError
25
- */
26
- static postmessage(formData?: FormData): CancelablePromise<unknown>;
27
- /**
28
- * Gets a Feature Toggle from Application name
29
- * @param applicationName name
30
- * @returns FeatureToggleDto Success
31
- * @throws ApiError
32
- */
33
- static getFeatureToggleFromApplicationName(applicationName: string): CancelablePromise<FeatureToggleDto>;
34
- static userApplications(): CancelablePromise<Array<AmplifyApplication>>;
35
- }
@@ -1 +0,0 @@
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};