-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
45 lines (38 loc) · 1.24 KB
/
index.tsx
File metadata and controls
45 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import {getConfig} from 'client';
import manifest from 'manifest';
import type {Store} from 'redux';
import type {GlobalState} from '@mattermost/types/store';
import HeaderCenter from 'components/header_center';
import {Icon} from 'components/icon';
import MainApp from 'components/main_app';
import type {PluginRegistry} from 'types/mattermost-webapp';
export default class Plugin {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
public async initialize(registry: PluginRegistry, store: Store<GlobalState>) {
try {
const config = await getConfig();
if (!config.enable_ui) {
return;
}
} catch {
// If config fetch fails, default to not registering (safe default).
return;
}
registry.registerProduct(
`/plug/${manifest.id}`,
Icon,
'Channel Automation',
`/plug/${manifest.id}`,
MainApp,
HeaderCenter,
undefined,
false,
);
}
}
declare global {
interface Window {
registerPlugin(pluginId: string, plugin: Plugin): void;
}
}
window.registerPlugin(manifest.id, new Plugin());