@redhat-cloud-services/types 0.0.14 → 0.0.16

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 (2) hide show
  1. package/index.d.ts +18 -13
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { QuickStart, QuickStartCatalogPage } from '@patternfly/quickstarts';
2
2
  import { History } from 'history';
3
3
  import { Access } from '@redhat-cloud-services/rbac-client';
4
4
  import { AnalyticsBrowser } from '@segment/analytics-next';
5
+ import { Method } from 'axios';
5
6
 
6
7
  export declare type HelpTopicLink = {
7
8
  href: string;
@@ -50,23 +51,24 @@ declare type VisibilityFunctions = {
50
51
  isOrgAdmin: () => Promise<boolean>;
51
52
  isActive: () => Promise<boolean>;
52
53
  isInternal: () => Promise<boolean>;
53
- isEntitled: () => Promise<boolean>;
54
+ isEntitled: (appName?: string) => Promise<{ [key: string]: boolean }>;
54
55
  isProd: () => boolean;
55
56
  isBeta: () => boolean;
56
57
  isHidden: () => true;
57
58
  withEmail: (toHave: string) => Promise<boolean>;
58
- loosePermissions: (permissions: string[]) => boolean;
59
- hasPermissions: (permissions: string[]) => boolean;
59
+ loosePermissions: (permissions: string[]) => Promise<boolean>;
60
+ hasPermissions: (permissions: string[]) => Promise<boolean>;
60
61
  hasLocalStorage: (key: string, value: any) => boolean;
61
62
  hasCookie: (key: string, value: any) => boolean;
62
63
  /** TODO: Extends FEC axios instance config */
63
64
  apiRequest: (config: {
64
65
  [key: string]: any;
65
66
  url: string;
66
- method?: 'string';
67
+ method?: Method;
67
68
  accessor?: string;
68
69
  matcher?: 'isEmpty' | 'isNotEmpty';
69
70
  }) => Promise<boolean>;
71
+ featureFlag: (flagName: string, expectedValue: boolean) => boolean;
70
72
  };
71
73
 
72
74
  /**
@@ -117,8 +119,8 @@ export interface ChromeAPI {
117
119
  auth: {
118
120
  doOffline: () => void;
119
121
  getOfflineToken: () => Promise<any>;
120
- getToken: () => Promise<string>;
121
- getUser: () => Promise<ChromeUser>;
122
+ getToken: () => Promise<string | undefined>;
123
+ getUser: () => Promise<ChromeUser | void>;
122
124
  login: () => Promise<any>;
123
125
  logout: () => void;
124
126
  /** @deprecated will be removed from useChrome hook */
@@ -144,11 +146,13 @@ export interface ChromeAPI {
144
146
  getApp: () => string;
145
147
  getBundle: () => string;
146
148
  getEnvironment: () => string;
147
- getEnvironmentDetails: () => {
148
- url: string[];
149
- sso: string;
150
- portal: string;
151
- };
149
+ getEnvironmentDetails: () =>
150
+ | undefined
151
+ | {
152
+ url: string[];
153
+ sso: string;
154
+ portal: string;
155
+ };
152
156
  getUserPermissions: (applicationName?: string, disableCache?: boolean) => Promise<Access[]>;
153
157
  globalFilterScope: (scope: string) => {
154
158
  type: string;
@@ -156,7 +160,7 @@ export interface ChromeAPI {
156
160
  };
157
161
  helpTopics: {
158
162
  addHelpTopics: (topics: HelpTopic[], enabled?: boolean) => void;
159
- enableTopics: (...topicsNames: string[]) => Promise<void[]>;
163
+ enableTopics: (...topicsNames: string[]) => Promise<HelpTopic[]>;
160
164
  disableTopics: (...topicsNames: string[]) => void;
161
165
  setActiveTopic: (name: string) => Promise<void>;
162
166
  closeHelpTopic: () => void;
@@ -164,7 +168,8 @@ export interface ChromeAPI {
164
168
  hideGlobalFilter: (isHidden: boolean) => void;
165
169
  /** @deprecated This function server no purpse. For document title update use "updateDocumentTitle" function instead. */
166
170
  identifyApp: (data: any, appTitle?: string, noSuffix?: boolean) => Promise<any>;
167
- init: () => ChromeAPI;
171
+ /** @deprecated this function has no effect */
172
+ init: () => void;
168
173
  isBeta: () => boolean;
169
174
  isChrome2: boolean;
170
175
  isDemo: () => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/types",
3
3
  "description": "TypeScript definitions for @redhat-cloud-services common typings",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
7
7
  "publishConfig": {