@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.
@@ -31,7 +31,7 @@ export interface MenuEntry {
31
31
  plugin_id: string;
32
32
  action_key: string;
33
33
  text: string;
34
- icon?: React.ReactNode;
34
+ iconUrl?: string;
35
35
  }
36
36
  export type MainPanelAction = {
37
37
  plugin_id: string;
@@ -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
- if (actionsToListen.includes(data.action)) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
@@ -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
- icon?: React.ReactNode;
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
- if (actionsToListen.includes(data.action)) {
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
  });