@redhat-cloud-services/types 0.0.3 → 0.0.6
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/index.d.ts +52 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -55,6 +55,28 @@ declare type VisibilityFunctions = {
|
|
|
55
55
|
/**
|
|
56
56
|
* TODO: Once chrome is migrated to TS, sychronize with chrome typings
|
|
57
57
|
*/
|
|
58
|
+
export type NavDOMEvent = {
|
|
59
|
+
href: string;
|
|
60
|
+
id: string;
|
|
61
|
+
navId: string;
|
|
62
|
+
type: string;
|
|
63
|
+
target?: HTMLAnchorElement | null;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type AppNavigationCB = (navEvent: { navId?: string; domEvent: NavDOMEvent }) => void;
|
|
67
|
+
export type GenericCB = (...args: unknown[]) => void;
|
|
68
|
+
|
|
69
|
+
export type OnEventCallbacks = {
|
|
70
|
+
APP_NAVIGATION: AppNavigationCB;
|
|
71
|
+
NAVIGATION_TOGGLE: GenericCB;
|
|
72
|
+
GLOBAL_FILTER_UPDATE: GenericCB;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare function OnChromeEvent<K extends 'APP_NAVIGATION' | 'NAVIGATION_TOGGLE' | 'GLOBAL_FILTER_UPDATE'>(
|
|
76
|
+
event: K,
|
|
77
|
+
callback: OnEventCallbacks[K]
|
|
78
|
+
): () => void;
|
|
79
|
+
|
|
58
80
|
export interface ChromeAPI {
|
|
59
81
|
/** @deprecated will be removed from useChrome hook */
|
|
60
82
|
$internal: any;
|
|
@@ -111,11 +133,14 @@ export interface ChromeAPI {
|
|
|
111
133
|
portal: string;
|
|
112
134
|
};
|
|
113
135
|
getUserPermissions: (applicationName?: string, disableCache?: boolean) => Promise<Access[]>;
|
|
114
|
-
globalFilterScope: (scope
|
|
115
|
-
|
|
136
|
+
globalFilterScope: (scope: string) => {
|
|
137
|
+
type: string;
|
|
138
|
+
payload: string;
|
|
139
|
+
};
|
|
140
|
+
hideGlobalFilter: (isHidden: boolean) => void;
|
|
116
141
|
/** @deprecated This function server no purpse. For document title update use "updateDocumentTitle" function instead. */
|
|
117
|
-
identifyApp: (data: any, appTitle?: string) => Promise<
|
|
118
|
-
init: () =>
|
|
142
|
+
identifyApp: (data: any, appTitle?: string, noSuffix?: boolean) => Promise<any>;
|
|
143
|
+
init: () => ChromeAPI;
|
|
119
144
|
isBeta: () => boolean;
|
|
120
145
|
isChrome2: boolean;
|
|
121
146
|
isDemo: () => boolean;
|
|
@@ -124,11 +149,30 @@ export interface ChromeAPI {
|
|
|
124
149
|
mapGlobalFilter: (...args: any[]) => any;
|
|
125
150
|
/** @deprecated this function has no effect. */
|
|
126
151
|
navigation: () => void;
|
|
127
|
-
/**
|
|
128
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Example usage
|
|
154
|
+
* on<'APP_NAVIGATION'>('APP_NAVIGATION', (navEvent) => {
|
|
155
|
+
* navEvent.domEvent.href;
|
|
156
|
+
* navEvent.navId;
|
|
157
|
+
* });
|
|
158
|
+
*/
|
|
159
|
+
on: typeof OnChromeEvent;
|
|
129
160
|
registerModule: (module: string, manifest: string) => void;
|
|
130
161
|
/** @duplicate of "hideGlobalFilter" TODO: deprecate this function */
|
|
131
|
-
removeGlobalFilter: (isHidden
|
|
132
|
-
|
|
162
|
+
removeGlobalFilter: (isHidden: boolean) => {
|
|
163
|
+
type: string;
|
|
164
|
+
payload: {
|
|
165
|
+
isHidden: boolean;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
updateDocumentTitle: (title: string, noSuffix?: boolean) => void;
|
|
133
169
|
visibilityFunctions: VisibilityFunctions;
|
|
134
170
|
}
|
|
171
|
+
|
|
172
|
+
declare global {
|
|
173
|
+
interface Window {
|
|
174
|
+
insights: {
|
|
175
|
+
chrome: ChromeAPI;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|