@redhat-cloud-services/types 1.0.11 → 1.0.13

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 +23 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { History } from 'history';
3
3
  import { Access } from '@redhat-cloud-services/rbac-client';
4
4
  import { AnalyticsBrowser } from '@segment/analytics-next';
5
5
  import { Method } from 'axios';
6
+ import type { AxiosRequestConfig } from 'axios';
6
7
 
7
8
  export declare type HelpTopicLink = {
8
9
  href: string;
@@ -32,6 +33,14 @@ export declare type PDFRequestOptions = {
32
33
  filename?: string;
33
34
  };
34
35
 
36
+ type CreateAxiosRequest<T = any> = (service: string, config: AxiosRequestConfig) => Promise<T>;
37
+
38
+ type FetchData = (createAsyncRequest: CreateAxiosRequest) => Promise<any>;
39
+
40
+ type AsyncState<T = any> = {
41
+ data: T;
42
+ };
43
+
35
44
  declare type ChromeUser = {
36
45
  entitlements: {
37
46
  [key: string]: {
@@ -111,9 +120,23 @@ declare function OnChromeEvent<K extends 'APP_NAVIGATION' | 'NAVIGATION_TOGGLE'
111
120
 
112
121
  export type EnableTopicsArgs = [{ names: string[]; append?: boolean }] | string[];
113
122
 
123
+ export type ChromeWsEventTypes = 'com.redhat.console.notifications.drawer';
124
+ export type ChromeWsPayload<T> = {
125
+ data: T;
126
+ type: ChromeWsEventTypes;
127
+ source: string;
128
+ datacontenttype: string;
129
+ specversion: string;
130
+ time: string;
131
+ };
132
+ export type ChromeWsEventListener<T> = (event: ChromeWsPayload<T>) => void;
133
+ export type UnSubscribeFromChromeWsEvent = () => void;
134
+ export type AddChromeWsEventListener = <T>(type: ChromeWsEventTypes, listener: ChromeWsEventListener<T>) => UnSubscribeFromChromeWsEvent;
135
+
114
136
  export interface ChromeAPI {
115
137
  /** @deprecated will be removed from useChrome hook */
116
138
  $internal: any;
139
+ addWsEventListener: AddChromeWsEventListener;
117
140
  initialized: boolean;
118
141
  experimentalApi: boolean;
119
142
  /** Return true if current environment is fedramp */
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": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "main": "",
6
6
  "types": "index.d.ts",
7
7
  "publishConfig": {