@redhat-cloud-services/types 0.0.15 → 0.0.17

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 +21 -14
  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
  /**
@@ -94,6 +96,8 @@ declare function OnChromeEvent<K extends 'APP_NAVIGATION' | 'NAVIGATION_TOGGLE'
94
96
  callback: OnEventCallbacks[K]
95
97
  ): undefined | (() => void) | (() => undefined) | (() => boolean);
96
98
 
99
+ export type EnableTopicsArgs = [{ names: string[]; append?: boolean }] | string[];
100
+
97
101
  export interface ChromeAPI {
98
102
  /** @deprecated will be removed from useChrome hook */
99
103
  $internal: any;
@@ -110,15 +114,15 @@ export interface ChromeAPI {
110
114
  Catalog: typeof QuickStartCatalogPage;
111
115
  };
112
116
  chromeHistory: History;
113
- isProd: boolean;
117
+ isProd: () => boolean;
114
118
  appAction: (action: string) => void;
115
119
  appNavClick: (payload: any) => void;
116
120
  appObjectId: (objectId: string) => void;
117
121
  auth: {
118
122
  doOffline: () => void;
119
123
  getOfflineToken: () => Promise<any>;
120
- getToken: () => Promise<string>;
121
- getUser: () => Promise<ChromeUser>;
124
+ getToken: () => Promise<string | undefined>;
125
+ getUser: () => Promise<ChromeUser | void>;
122
126
  login: () => Promise<any>;
123
127
  logout: () => void;
124
128
  /** @deprecated will be removed from useChrome hook */
@@ -144,11 +148,13 @@ export interface ChromeAPI {
144
148
  getApp: () => string;
145
149
  getBundle: () => string;
146
150
  getEnvironment: () => string;
147
- getEnvironmentDetails: () => {
148
- url: string[];
149
- sso: string;
150
- portal: string;
151
- };
151
+ getEnvironmentDetails: () =>
152
+ | undefined
153
+ | {
154
+ url: string[];
155
+ sso: string;
156
+ portal: string;
157
+ };
152
158
  getUserPermissions: (applicationName?: string, disableCache?: boolean) => Promise<Access[]>;
153
159
  globalFilterScope: (scope: string) => {
154
160
  type: string;
@@ -156,7 +162,7 @@ export interface ChromeAPI {
156
162
  };
157
163
  helpTopics: {
158
164
  addHelpTopics: (topics: HelpTopic[], enabled?: boolean) => void;
159
- enableTopics: (...topicsNames: string[]) => Promise<HelpTopic[]>;
165
+ enableTopics: (...topicsNames: EnableTopicsArgs) => Promise<HelpTopic[]>;
160
166
  disableTopics: (...topicsNames: string[]) => void;
161
167
  setActiveTopic: (name: string) => Promise<void>;
162
168
  closeHelpTopic: () => void;
@@ -164,7 +170,8 @@ export interface ChromeAPI {
164
170
  hideGlobalFilter: (isHidden: boolean) => void;
165
171
  /** @deprecated This function server no purpse. For document title update use "updateDocumentTitle" function instead. */
166
172
  identifyApp: (data: any, appTitle?: string, noSuffix?: boolean) => Promise<any>;
167
- init: () => ChromeAPI;
173
+ /** @deprecated this function has no effect */
174
+ init: () => void;
168
175
  isBeta: () => boolean;
169
176
  isChrome2: boolean;
170
177
  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.15",
4
+ "version": "0.0.17",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
7
7
  "publishConfig": {