@equinor/subsurface-app-management 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/core/OpenAPI.js +1 -1
- package/dist/api/services/FeatureToggleService.d.ts +2 -1
- package/dist/api/services/FeatureToggleService.js +1 -1
- package/dist/api/services/ReleaseNotesService.d.ts +0 -21
- package/dist/api/services/ReleaseNotesService.js +1 -1
- package/dist/hooks/useFeatureToggling.d.ts +1 -1
- package/dist/hooks/useFeatureToggling.js +1 -1
- package/dist/providers/FeatureToggleProvider.d.ts +0 -1
- package/dist/providers/FeatureToggleProvider.js +1 -1
- package/package.json +1 -1
package/dist/api/core/OpenAPI.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"../../utils/environment.js";import{request as t}from"./request.js";import{getLocalStorage as i,updateLocalStorage as r}from"../../utils/localStorage.js";import{jwtDecode as E}from"jwt-decode";const{getEnvironmentName:e,getApiUrl:a}=o,n=e(import.meta.env.VITE_ENVIRONMENT_NAME),d="localhost"===n?"development":n;class
|
|
1
|
+
import*as o from"../../utils/environment.js";import{request as t}from"./request.js";import{getLocalStorage as i,updateLocalStorage as r}from"../../utils/localStorage.js";import{jwtDecode as E}from"jwt-decode";const{getEnvironmentName:e,getApiUrl:a}=o,n=e(import.meta.env.VITE_ENVIRONMENT_NAME),d="localhost"===n?"development":n;class S{static getAmplifyPortalToken(){return t(p,{method:"GET",url:"/api/v1/Token/AmplifyPortal"})}static getAmplifyPortalProductionToken(){return t(p,{method:"GET",url:"/api/v1/Token/AmplifyPortal/Production"})}static getSamPortalToken(){return t(p,{method:"GET",url:"/api/v1/Token/SamPortal"})}static getSamPortalProductionToken(){return t(p,{method:"GET",url:"/api/v1/Token/SamPortal/Production"})}}const l=o=>{if(0===o.length)return!1;try{return!(o=>{const t=E(o),i=(new Date).getTime()/1e3;return t.exp&&i>t.exp})(o)}catch(o){return!1}},m=async(o,t)=>{const E=i(o,"");if(l(E))return E;const e=await t();return r(o,e),e},T=async()=>m(`amplify-portal-${n}`,S.getAmplifyPortalToken),A=()=>T(),c=async()=>m(`sam-${n}`,S.getSamPortalToken),p={BASE:a(import.meta.env.VITE_API_URL),VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},u={BASE:`https://api-amplify-portal-${d}.radix.equinor.com`,VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:T,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},N={BASE:"https://api-amplify-portal-production.radix.equinor.com",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async()=>m("amplify-portal-production",S.getAmplifyPortalProductionToken),USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},s={BASE:`https://api-sam-backend-${d}.radix.equinor.com`,VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:c,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},R={BASE:"https://api-sam-backend-production.radix.equinor.com",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:async()=>m("sam-production",S.getSamPortalProductionToken),USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};export{p as OpenAPI_APP,u as OpenAPI_JSEMBARK,N as OpenAPI_JSEMBARK_Prod,s as OpenAPI_SAM,R as OpenAPI_SAM_Prod,S as TokenService,T as getJSEmbarkToken,A as getPortalToken,c as getSAMToken};
|
|
@@ -3,8 +3,9 @@ export declare class FeatureToggleService {
|
|
|
3
3
|
/**
|
|
4
4
|
* Get my features
|
|
5
5
|
* @param applicationName name
|
|
6
|
+
* @param currentEnvironment name
|
|
6
7
|
* @returns MyFeatureDto OK
|
|
7
8
|
* @throws ApiError
|
|
8
9
|
*/
|
|
9
|
-
static getMyFeatures(applicationName: string): CancelablePromise<Array<MyFeatureDto>>;
|
|
10
|
+
static getMyFeatures(applicationName: string, currentEnvironment: string): CancelablePromise<Array<MyFeatureDto>>;
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OpenAPI_SAM_Prod as
|
|
1
|
+
import{OpenAPI_SAM_Prod as r}from"../core/OpenAPI.js";import{request as e}from"../core/request.js";class t{static getMyFeatures(t,o){return e(r,{method:"GET",url:"/api/v1/FeatureToggle/{applicationName}/{currentEnvironment}/myfeatures",path:{applicationName:t,currentEnvironment:o},errors:{400:"Bad Request",404:"Not Found",500:"Internal Server Error"}})}}export{t as FeatureToggleService};
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import type { CancelablePromise, ReleaseNote } from './..';
|
|
2
2
|
export declare class ReleaseNotesService {
|
|
3
|
-
/**
|
|
4
|
-
* @param applicationName
|
|
5
|
-
* @param version
|
|
6
|
-
* @param tags
|
|
7
|
-
* @returns any Success
|
|
8
|
-
* @throws ApiError
|
|
9
|
-
*/
|
|
10
|
-
static getReleasenoteList(applicationName?: string, version?: string, tags?: Array<string>): CancelablePromise<any>;
|
|
11
|
-
/**
|
|
12
|
-
* @param tags
|
|
13
|
-
* @returns any Success
|
|
14
|
-
* @throws ApiError
|
|
15
|
-
*/
|
|
16
|
-
static getMyReleasenotes(tags?: Array<string>): CancelablePromise<any>;
|
|
17
|
-
/**
|
|
18
|
-
* @param applicationName
|
|
19
|
-
* @param releaseId
|
|
20
|
-
* @returns any Success
|
|
21
|
-
* @throws ApiError
|
|
22
|
-
*/
|
|
23
|
-
static getReleasenote(applicationName: string, releaseId: string): CancelablePromise<any>;
|
|
24
3
|
/**
|
|
25
4
|
* @returns string Success
|
|
26
5
|
* @throws ApiError
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OpenAPI_SAM as e}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class a{static
|
|
1
|
+
import{OpenAPI_SAM as e}from"../core/OpenAPI.js";import{request as t}from"../core/request.js";class a{static getContainerSasUri(){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/GetContainerSasUri",errors:{401:"Unauthorized"}})}static getReleaseNoteImage(a){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/getreleasenoteimage/{path}",path:{path:a},errors:{404:"Not Found"}})}static getPublishedReleasenotes(a){return t(e,{method:"GET",url:"/api/v1/ReleaseNotes/{applicationName}",path:{applicationName:a}})}}export{a as ReleaseNotesService};
|
|
@@ -8,6 +8,6 @@ export interface UseFeatureTogglingOptions {
|
|
|
8
8
|
* @param showIfKeyIsMissing - Show/hide if the key was not found/has been deleted. Defaults to true
|
|
9
9
|
* @param ShowIfIsLoading - Show/hide if the feature toggles are still loading. Defaults to false
|
|
10
10
|
*/
|
|
11
|
-
export declare function useFeatureToggling(
|
|
11
|
+
export declare function useFeatureToggling(params: UseFeatureTogglingOptions | string): {
|
|
12
12
|
showContent: boolean;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMemo as e}from"react";import{useFeatureToggleContext as
|
|
1
|
+
import{useMemo as e}from"react";import{useFeatureToggleContext as r}from"../providers/FeatureToggleProvider.js";function o(o){const{featureUuid:t,showIfKeyIsMissing:i=!0,showIfIsLoading:s=!1}="string"==typeof o?{featureUuid:o}:o,{features:n,isError:u,isLoading:a}=r();i||console.warn(`[FeatureToggle] Feature: ${t} will not show when the feature toggle is removed! Was this intentional?`);return{showContent:e((()=>{if(!s&&a||u)return!1;const e=n?.some((e=>e.uuid===t));return!!e||i}),[s,a,u,n,i,t])}}export{o as useFeatureToggling};
|
|
@@ -4,7 +4,6 @@ import { EnvironmentType } from '../types';
|
|
|
4
4
|
interface FeatureToggleContextType {
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
isError: boolean;
|
|
7
|
-
environmentName: EnvironmentType;
|
|
8
7
|
features?: MyFeatureDto[] | null;
|
|
9
8
|
}
|
|
10
9
|
export declare function useFeatureToggleContext(): FeatureToggleContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{createContext as e,useContext as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{FeatureToggleService as i}from"../api/services/FeatureToggleService.js";import{GET_FEATURE_TOGGLES_FOR_APP as n}from"../constants/queryKeys.js";import*as s from"../utils/environment.js";import{getEnvironmentName as m}from"../utils/environment.js";const{getAppName:a}=s,u=e(void 0);function p(){const r=t(u);if(void 0===r)throw new Error("'useFeatureToggleContext' must be used within provider");return r}const c=({children:e,overrideAppName:t,overrideEnvironment:s})=>{const p=t??a(import.meta.env.VITE_NAME),c=s??m(import.meta.env.VITE_ENVIRONMENT_NAME),{data:v=[],isLoading:d,isError:f}=o({queryKey:[n],queryFn:async()=>i.getMyFeatures(p)});return r(u.Provider,{value:{features:v,isLoading:d,isError:f
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{createContext as e,useContext as t}from"react";import{useQuery as o}from"@tanstack/react-query";import{FeatureToggleService as i}from"../api/services/FeatureToggleService.js";import{GET_FEATURE_TOGGLES_FOR_APP as n}from"../constants/queryKeys.js";import*as s from"../utils/environment.js";import{getEnvironmentName as m}from"../utils/environment.js";const{getAppName:a}=s,u=e(void 0);function p(){const r=t(u);if(void 0===r)throw new Error("'useFeatureToggleContext' must be used within provider");return r}const c=({children:e,overrideAppName:t,overrideEnvironment:s})=>{const p=t??a(import.meta.env.VITE_NAME),c=s??m(import.meta.env.VITE_ENVIRONMENT_NAME),{data:v=[],isLoading:d,isError:f}=o({queryKey:[n],queryFn:async()=>i.getMyFeatures(p,c)});return r(u.Provider,{value:{features:v,isLoading:d,isError:f},children:e})};export{c as FeatureToggleProvider,p as useFeatureToggleContext};
|