@rimori/client 2.1.7 → 2.1.8
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/dist/fromRimori/PluginTypes.d.ts +1 -1
- package/dist/plugin/CommunicationHandler.d.ts +9 -2
- package/dist/plugin/RimoriClient.d.ts +2 -1
- package/dist/plugin/RimoriClient.js +16 -1
- package/package.json +1 -1
- package/src/fromRimori/PluginTypes.ts +1 -1
- package/src/plugin/CommunicationHandler.ts +9 -2
- package/src/plugin/RimoriClient.ts +18 -2
|
@@ -2,9 +2,16 @@ import { SupabaseClient } from '@supabase/supabase-js';
|
|
|
2
2
|
import { UserInfo } from '../controller/SettingsController';
|
|
3
3
|
import { ActivePlugin, Plugin } from '../fromRimori/PluginTypes';
|
|
4
4
|
export interface Guild {
|
|
5
|
-
id: string;
|
|
6
|
-
longTermGoalOverride: string;
|
|
7
5
|
allowUserPluginSettings: boolean;
|
|
6
|
+
city: string | null;
|
|
7
|
+
country: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
id: string;
|
|
10
|
+
isPublic: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
ownerId: string;
|
|
13
|
+
primaryLanguage: string;
|
|
14
|
+
scope: string;
|
|
8
15
|
}
|
|
9
16
|
export interface RimoriInfo {
|
|
10
17
|
url: string;
|
|
@@ -131,7 +131,8 @@ export declare class RimoriClient {
|
|
|
131
131
|
* @param text Optional text to be used for the action like for example text that the translator would look up.
|
|
132
132
|
*/
|
|
133
133
|
emitSidebarAction: (pluginId: string, actionKey: string, text?: string) => void;
|
|
134
|
-
onMainPanelAction: (callback: (data: MainPanelAction) => void, actionsToListen?: string[]) => void;
|
|
134
|
+
onMainPanelAction: (callback: (data: MainPanelAction) => void, actionsToListen?: string | string[]) => void;
|
|
135
|
+
onSidePanelAction: (callback: (data: MainPanelAction) => void, actionsToListen?: string | string[]) => void;
|
|
135
136
|
};
|
|
136
137
|
navigation: {
|
|
137
138
|
toDashboard: () => void;
|
|
@@ -97,10 +97,25 @@ export class RimoriClient {
|
|
|
97
97
|
this.event.emit('global.sidebar.triggerAction', { plugin_id: pluginId, action_key: actionKey, text });
|
|
98
98
|
},
|
|
99
99
|
onMainPanelAction: (callback, actionsToListen = []) => {
|
|
100
|
+
const listeningActions = Array.isArray(actionsToListen) ? actionsToListen : [actionsToListen];
|
|
100
101
|
// this needs to be a emit and on because the main panel action is triggered by the user and not by the plugin
|
|
101
102
|
this.event.emit('action.requestMain');
|
|
102
103
|
this.event.on('action.requestMain', ({ data }) => {
|
|
103
|
-
|
|
104
|
+
console.log('Received action ' + data.action);
|
|
105
|
+
console.log('Listening to actions', listeningActions);
|
|
106
|
+
if (actionsToListen.length === 0 || actionsToListen.includes(data.action)) {
|
|
107
|
+
callback(data);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
onSidePanelAction: (callback, actionsToListen = []) => {
|
|
112
|
+
const listeningActions = Array.isArray(actionsToListen) ? actionsToListen : [actionsToListen];
|
|
113
|
+
// this needs to be a emit and on because the main panel action is triggered by the user and not by the plugin
|
|
114
|
+
this.event.emit('action.requestSidebar');
|
|
115
|
+
this.event.on('action.requestSidebar', ({ data }) => {
|
|
116
|
+
console.log('Received action ' + data.action);
|
|
117
|
+
console.log('Listening to actions', listeningActions);
|
|
118
|
+
if (actionsToListen.length === 0 || actionsToListen.includes(data.action)) {
|
|
104
119
|
callback(data);
|
|
105
120
|
}
|
|
106
121
|
});
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ export interface MenuEntry {
|
|
|
49
49
|
// text of the menu entry. Shown in the context menu
|
|
50
50
|
text: string;
|
|
51
51
|
// icon of the menu entry. Shown in the context menu
|
|
52
|
-
|
|
52
|
+
iconUrl?: string;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// an action from the main panel that can be triggered and performs an action in the main panel
|
|
@@ -7,9 +7,16 @@ import { ActivePlugin, Plugin } from '../fromRimori/PluginTypes';
|
|
|
7
7
|
declare const WorkerGlobalScope: any;
|
|
8
8
|
|
|
9
9
|
export interface Guild {
|
|
10
|
-
id: string;
|
|
11
|
-
longTermGoalOverride: string;
|
|
12
10
|
allowUserPluginSettings: boolean;
|
|
11
|
+
city: string | null;
|
|
12
|
+
country: string | null;
|
|
13
|
+
description: string | null;
|
|
14
|
+
id: string;
|
|
15
|
+
isPublic: boolean;
|
|
16
|
+
name: string;
|
|
17
|
+
ownerId: string;
|
|
18
|
+
primaryLanguage: string;
|
|
19
|
+
scope: string;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
export interface RimoriInfo {
|
|
@@ -238,11 +238,27 @@ export class RimoriClient {
|
|
|
238
238
|
this.event.emit('global.sidebar.triggerAction', { plugin_id: pluginId, action_key: actionKey, text });
|
|
239
239
|
},
|
|
240
240
|
|
|
241
|
-
onMainPanelAction: (callback: (data: MainPanelAction) => void, actionsToListen: string[] = []) => {
|
|
241
|
+
onMainPanelAction: (callback: (data: MainPanelAction) => void, actionsToListen: string | string[] = []) => {
|
|
242
|
+
const listeningActions = Array.isArray(actionsToListen) ? actionsToListen : [actionsToListen];
|
|
242
243
|
// this needs to be a emit and on because the main panel action is triggered by the user and not by the plugin
|
|
243
244
|
this.event.emit('action.requestMain');
|
|
244
245
|
this.event.on<MainPanelAction>('action.requestMain', ({ data }) => {
|
|
245
|
-
|
|
246
|
+
console.log('Received action ' + data.action);
|
|
247
|
+
console.log('Listening to actions', listeningActions);
|
|
248
|
+
if (actionsToListen.length === 0 || actionsToListen.includes(data.action)) {
|
|
249
|
+
callback(data);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
onSidePanelAction: (callback: (data: MainPanelAction) => void, actionsToListen: string | string[] = []) => {
|
|
255
|
+
const listeningActions = Array.isArray(actionsToListen) ? actionsToListen : [actionsToListen];
|
|
256
|
+
// this needs to be a emit and on because the main panel action is triggered by the user and not by the plugin
|
|
257
|
+
this.event.emit('action.requestSidebar');
|
|
258
|
+
this.event.on<MainPanelAction>('action.requestSidebar', ({ data }) => {
|
|
259
|
+
console.log('Received action ' + data.action);
|
|
260
|
+
console.log('Listening to actions', listeningActions);
|
|
261
|
+
if (actionsToListen.length === 0 || actionsToListen.includes(data.action)) {
|
|
246
262
|
callback(data);
|
|
247
263
|
}
|
|
248
264
|
});
|