bigbluebutton-html-plugin-sdk 0.0.42 → 0.0.46

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/README.md CHANGED
@@ -1,11 +1,82 @@
1
- # BigBlueButton SDK for HTML plugins
1
+ # BigBlueButton SDK for HTML5 Client Plugins
2
2
 
3
- ## Information
3
+ This repository contains the SDK for developing BigBlueButton plugins.
4
+ Plugins are React components that can be loaded from external sources
5
+ by the BigBlueButton HTML5 client to extend its functionalities.
4
6
 
5
- SDK for developing BigBlueButton plugins, examples of implementations can be found in `./samples/sample-presentation-toolbar-plugin` (Refer to `./samples/sample-presentation-toolbar-plugin/README.md`) or `./samples/sample-user-list-dropdown-plugin`.
7
+ ## Examples
8
+
9
+ A variety of example implementations to manipulate different parts of the
10
+ BBB client can be found in the [`samples`](samples) folder.
11
+
12
+ ## Usage
13
+
14
+ This is a general instruction on how to use a plugin.
15
+ For a detailed configuration example of each use case,
16
+ have a look at the READMEs in the respective [samples](samples)-folders.
17
+
18
+ ### Running the Plugin from Source
19
+
20
+ For development purposes you can run a plugin locally from source.
21
+
22
+ For example if you take the [`sample-action-button-dropdown-plugin`](samples/sample-action-button-dropdown-plugin),
23
+ you do the following:
24
+
25
+ 1. Start the development server:
26
+ ```bash
27
+ cd $HOME/src/bigbluebutton-html-plugin-sdk/samples/sample-action-button-dropdown-plugin
28
+ npm install
29
+ npm start
30
+ ```
31
+
32
+ 2. Add reference to it on BigBlueButton's `settings.yml`:
33
+ ```yaml
34
+ public:
35
+ plugins:
36
+ - name: SampleActionButtonDropdownPlugin
37
+ url: http://127.0.0.1:4701/static/SampleActionButtonDropdownPlugin.js
38
+ ```
39
+
40
+ _N.B.:_ Be aware that in this case the url is interpreted from the plugin in the browser,
41
+ so the localhost is actually your local development machine.
42
+
43
+ ### Building the Plugin
44
+
45
+ To build a plugin for production use
46
+ (again, using the example of [`sample-action-button-dropdown-plugin`](samples/sample-action-button-dropdown-plugin)),
47
+ follow these steps:
48
+
49
+ ```bash
50
+ cd $HOME/src/bigbluebutton-html-plugin-sdk/samples/sample-action-button-dropdown-plugin
51
+ npm install
52
+ npm run build-bundle
53
+ ```
54
+
55
+ The above command will generate the `dist` folder, containing the bundled JavaScript file named `SampleActionButtonDropdownPlugin.js`.
56
+ This file can be hosted on any HTTPS server.
57
+
58
+ To use the plugin with BigBlueButton, add the plugin's URL to `settings.yml` as shown below:
59
+
60
+ ```yaml
61
+ public:
62
+ app:
63
+ ... // All app configurations
64
+ plugins:
65
+ - name: SampleActionButtonDropdownPlugin
66
+ url: <<PLUGIN_URL>>
67
+ ... // All other configurations
68
+ ```
69
+
70
+ #### Hosting the Plugin on a BBB Server
71
+
72
+ While the plugin can be hosted on any Server, it is also possible to host the bundled file directly on
73
+ a BigBlueButton server. For that you copy the `dist/SampleActionButtonDropdownPlugin.js` to the folder `/var/www/bigbluebutton-default/assets/plugins`.
74
+ In this case, the `<<PLUGIN_URL>>` will be `https://<your-host>/plugins/SampleActionButtonDropdownPlugin.js`.
6
75
 
7
76
  ## API
77
+
8
78
  ### Extensible UI areas
79
+
9
80
  - Action bar items (button, separator)
10
81
 
11
82
  - Action Button Dropdown Items (option, separator)
@@ -16,7 +87,7 @@ SDK for developing BigBlueButton plugins, examples of implementations can be fou
16
87
 
17
88
  - Nav bar items (button, info)
18
89
 
19
- - Presentation dropdown items (option, separator)
90
+ - Presentation dropdown items (option, separator)
20
91
 
21
92
  - Presentation toolbar items (button, separator, spinner)
22
93
 
@@ -31,11 +102,13 @@ SDK for developing BigBlueButton plugins, examples of implementations can be fou
31
102
  - Generic component (genericComponent)
32
103
 
33
104
  ### Getters available through the API:
105
+
34
106
  - `getSessionToken`: returns the user session token located on the user's URL.
35
107
 
36
108
  - `getJoinUrl`: returns the join url associated with the parameters passed as an argument. Since it fetches the BigBlueButton API, this getter method is asynchronous.
37
109
 
38
110
  ### Realtime data consumption
111
+
39
112
  - `useCurrentPresentation` hook: provides information regarding the current presentation;
40
113
 
41
114
  - `useLoadedUserList` hook: provides information regarding the loaded user list (displayed in the screen);
@@ -53,6 +126,7 @@ SDK for developing BigBlueButton plugins, examples of implementations can be fou
53
126
  - `useTalkingIndicator` hook: it gives you invormation on the user-voice data, that is, who is talking or muted.
54
127
 
55
128
  ### Real time data exchange
129
+
56
130
  - `useDataChannel` hook: this will allow you to exchange information (Send and receive) amongst different users through the same plugin;
57
131
 
58
132
  So for this hook to read the data from the data channel, the developer will be able to choose the format in which they want it.The possible formats are described down below:
@@ -70,7 +144,7 @@ const [
70
144
  deleteEntryFunction, // Function to delete specific item or wipe all
71
145
  ] = useDataChannel(
72
146
  channelName, // Defined according to what is on settings.yml from bbb-htlm5
73
- DataChannelTypes.All_ITEMS, // | LATEST_ITEM | NEW_ITEMS -> ALL_ITEMS is default
147
+ DataChannelTypes.All_ITEMS, // | LATEST_ITEM | NEW_ITEMS -> ALL_ITEMS is default
74
148
  subChannelName = 'default', // If no subchannelName is specified, it will be 'default'
75
149
  );
76
150
  ```
@@ -82,6 +156,7 @@ The data-channel name must be written in the settings.yml.
82
156
  All the permission for writing and deleting must be in the yaml too just like the example below:
83
157
 
84
158
  ```yaml
159
+ public:
85
160
  plugins:
86
161
  - name: PluginName
87
162
  url: http://<your-hosted-plugin>/PluginName.js
@@ -112,6 +187,7 @@ export type ObjectTo = ToUserId | ToRole;
112
187
  ```
113
188
 
114
189
  ### Real time ui data consumption
190
+
115
191
  - `useUiData` hook: This will return certain data from the UI depending on the parameter the developer uses. It works just like the useUiEvent hook, but instead of passing a callback as a parameter to be run everytime the event occurs, it will return the data directly, keep in mind that the second parameter is the default value that this function will assume. Possible choices:
116
192
  - IntlLocaleUiDataNames.CURRENT_LOCALE;
117
193
  - ChatFormUiDataNames.CURRENT_CHAT_INPUT_TEXT;
@@ -128,11 +204,11 @@ const currentLocale = pluginApi.useUiData(IntlLocaleUiDataNames.CURRENT_LOCALE,
128
204
  });
129
205
  ```
130
206
 
131
-
132
207
  ### Ui Commands to automatize tasks in BBB
208
+
133
209
  `uiCommands` object: It basically contains all the possible commands available to the developer to interact with the core BBB UI, see the ones implemented down below:
134
210
  - chat:
135
- - form:
211
+ - form:
136
212
  - open: this function will open the sidebar chat panel automatically;
137
213
  - fill: this function will fill the form input field of the chat passed in the argument as {text: string}
138
214
  - external-video:
@@ -143,4 +219,5 @@ const currentLocale = pluginApi.useUiData(IntlLocaleUiDataNames.CURRENT_LOCALE,
143
219
  - unset: This function unset the current layout with its argument (example: LayoutComponentListEnum.GENERIC_COMPONENT)
144
220
 
145
221
  ### Dom Element Manipulation
222
+
146
223
  - `useChatMessageDomElements` hook: This hook will return the dom element of a chat message reactively, so one can modify whatever is inside, such as text, css, js, etc.;
@@ -2,5 +2,4 @@ export * from './extensible-areas';
2
2
  export * from './data-consumption';
3
3
  export * from './data-channel';
4
4
  export * from './ui-data-hooks';
5
- export * from './ui-commands';
6
5
  export * from './core';
package/dist/cjs/index.js CHANGED
@@ -18,6 +18,5 @@ __exportStar(require("./extensible-areas"), exports);
18
18
  __exportStar(require("./data-consumption"), exports);
19
19
  __exportStar(require("./data-channel"), exports);
20
20
  __exportStar(require("./ui-data-hooks"), exports);
21
- __exportStar(require("./ui-commands"), exports);
22
21
  __exportStar(require("./core"), exports);
23
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AAEnC,qDAAmC;AAEnC,iDAA+B;AAE/B,kDAAgC;AAEhC,gDAA8B;AAE9B,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AAEnC,qDAAmC;AAEnC,iDAA+B;AAE/B,kDAAgC;AAEhC,yCAAuB"}
@@ -10,8 +10,4 @@ export declare const uiCommands: {
10
10
  set: (setExternalVideoVolumeCommandArguments: import("./external-video/volume/types").SetExternalVideoVolumeCommandArguments) => void;
11
11
  };
12
12
  };
13
- layout: {
14
- set: (layoutToBeSet: import(".").LayoutComponentListEnum) => void;
15
- unset: (layoutToBeSet: import(".").LayoutComponentListEnum) => void;
16
- };
17
13
  };
@@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uiCommands = void 0;
4
4
  var commands_1 = require("./chat/commands");
5
5
  var commands_2 = require("./external-video/commands");
6
- var commands_3 = require("./layout/commands");
7
6
  exports.uiCommands = {
8
7
  chat: commands_1.chat,
9
8
  externalVideo: commands_2.externalVideo,
10
- layout: commands_3.layout,
11
9
  };
12
10
  //# sourceMappingURL=commands.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/ui-commands/commands.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,sDAA0D;AAC1D,8CAA2C;AAE9B,QAAA,UAAU,GAAG;IACxB,IAAI,iBAAA;IACJ,aAAa,0BAAA;IACb,MAAM,mBAAA;CACP,CAAC"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../src/ui-commands/commands.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,sDAA0D;AAE7C,QAAA,UAAU,GAAG;IACxB,IAAI,iBAAA;IACJ,aAAa,0BAAA;CACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/ui-commands/external-video/commands.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE9B,QAAA,aAAa,GAAG;IACzB,MAAM,mBAAA;CACT,CAAC"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/ui-commands/external-video/commands.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAE9B,QAAA,aAAa,GAAG;IAC3B,MAAM,mBAAA;CACP,CAAC"}
@@ -3,7 +3,8 @@ export declare const volume: {
3
3
  /**
4
4
  * Sets the volume of the external video to a certain level. Needs to be a value between 0 and 1.
5
5
  *
6
- * @param setExternalVideoVolumeCommandArguments the volume to which the core will set in the external video.
6
+ * @param setExternalVideoVolumeCommandArguments the volume to which the core will set in the
7
+ * external video.
7
8
  * Refer to {@link SetExternalVideoVolumeCommandArguments} to understand the argument structure.
8
9
  */
9
10
  set: (setExternalVideoVolumeCommandArguments: SetExternalVideoVolumeCommandArguments) => void;
@@ -6,7 +6,8 @@ exports.volume = {
6
6
  /**
7
7
  * Sets the volume of the external video to a certain level. Needs to be a value between 0 and 1.
8
8
  *
9
- * @param setExternalVideoVolumeCommandArguments the volume to which the core will set in the external video.
9
+ * @param setExternalVideoVolumeCommandArguments the volume to which the core will set in the
10
+ * external video.
10
11
  * Refer to {@link SetExternalVideoVolumeCommandArguments} to understand the argument structure.
11
12
  */
12
13
  set: function (setExternalVideoVolumeCommandArguments) {
@@ -17,7 +18,7 @@ exports.volume = {
17
18
  }));
18
19
  }
19
20
  else {
20
- console.warn('Not possible to set a volume less than zero or higher than 1.');
21
+ throw new Error('Not possible to set a volume less than zero or higher than one');
21
22
  }
22
23
  },
23
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../../src/ui-commands/external-video/volume/commands.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAG7C,QAAA,MAAM,GAAG;IACpB;;;;;OAKG;IACH,GAAG,EAAE,UAAC,sCAA8E;QAClF,IAAM,aAAa,GAAG,sCAAsC,CAAC,MAAM,CAAC;QACpE,IAAI,aAAa,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,EAAE;YAC5C,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAEb,uCAA+B,CAAC,GAAG,EAAE;gBACrC,MAAM,EAAE,sCAAsC;aAC/C,CAAC,CACH,CAAC;SACH;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;SAC/E;IAEH,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../../src/ui-commands/external-video/volume/commands.ts"],"names":[],"mappings":";;;AAAA,iCAA0D;AAG7C,QAAA,MAAM,GAAG;IACpB;;;;;;OAMG;IACH,GAAG,EAAE,UAAC,sCAA8E;QAClF,IAAM,aAAa,GAAG,sCAAsC,CAAC,MAAM,CAAC;QACpE,IAAI,aAAa,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,EAAE;YAC5C,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAEb,uCAA+B,CAAC,GAAG,EAAE;gBACrC,MAAM,EAAE,sCAAsC;aAC/C,CAAC,CACH,CAAC;SACH;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;IACH,CAAC;CACF,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { UiCommandsChatObject } from './chat/types';
2
2
  import { UiCommandsExternalVideoObject } from './external-video/types';
3
- import { UiCommandsLayoutObject } from './layout/types';
4
3
  export interface UiCommands {
5
4
  chat: UiCommandsChatObject;
6
5
  externalVideo: UiCommandsExternalVideoObject;
7
- layout: UiCommandsLayoutObject;
8
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigbluebutton-html-plugin-sdk",
3
- "version": "0.0.42",
3
+ "version": "0.0.46",
4
4
  "homepage": "https://github.com/bigbluebutton/bigbluebutton-html-plugin-sdk",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -37,7 +37,7 @@
37
37
  "prepublishOnly": "npm run build # runs before publish",
38
38
  "build": "rm -rf dist/cjs && tsc --module CommonJS --outDir dist/cjs",
39
39
  "build:watch": "rm -rf dist && tsc -w --module CommonJS",
40
- "lint": "eslint ./src/*.{ts,tsx}",
40
+ "lint": "eslint . --ignore-pattern node_modules",
41
41
  "lint:fix": "npm run lint -- --fix",
42
42
  "lint:watch": "watch 'yarn lint'"
43
43
  },
@@ -1 +0,0 @@
1
- export * from './layout/enums';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./layout/enums"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui-commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
@@ -1,5 +0,0 @@
1
- import { LayoutComponentListEnum } from "./enums";
2
- export declare const layout: {
3
- set: (layoutToBeSet: LayoutComponentListEnum) => void;
4
- unset: (layoutToBeSet: LayoutComponentListEnum) => void;
5
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.layout = void 0;
4
- var enums_1 = require("./enums");
5
- exports.layout = {
6
- set: function (layoutToBeSet) {
7
- window.dispatchEvent(new CustomEvent(enums_1.LayoutCommandsEnum.SET, {
8
- detail: layoutToBeSet
9
- }));
10
- },
11
- unset: function (layoutToBeSet) {
12
- window.dispatchEvent(new CustomEvent(enums_1.LayoutCommandsEnum.UNSET, {
13
- detail: layoutToBeSet
14
- }));
15
- }
16
- };
17
- //# sourceMappingURL=commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../src/ui-commands/layout/commands.ts"],"names":[],"mappings":";;;AAAA,iCAAsE;AAEzD,QAAA,MAAM,GAAG;IAClB,GAAG,EAAE,UAAC,aAAsC;QACxC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAChC,0BAAkB,CAAC,GAAG,EAAE;YACpB,MAAM,EAAE,aAAa;SACxB,CACJ,CAAC,CAAC;IACP,CAAC;IACD,KAAK,EAAE,UAAC,aAAsC;QAC1C,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAChC,0BAAkB,CAAC,KAAK,EAAE;YACtB,MAAM,EAAE,aAAa;SACxB,CACJ,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
@@ -1,7 +0,0 @@
1
- export declare enum LayoutCommandsEnum {
2
- SET = "SET_LAYOUT_COMMAND",
3
- UNSET = "UNSET_LAYOUT_COMMAND"
4
- }
5
- export declare enum LayoutComponentListEnum {
6
- GENERIC_COMPONENT = "GENERIC_COMPONENT"
7
- }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LayoutComponentListEnum = exports.LayoutCommandsEnum = void 0;
4
- var LayoutCommandsEnum;
5
- (function (LayoutCommandsEnum) {
6
- LayoutCommandsEnum["SET"] = "SET_LAYOUT_COMMAND";
7
- LayoutCommandsEnum["UNSET"] = "UNSET_LAYOUT_COMMAND";
8
- })(LayoutCommandsEnum || (exports.LayoutCommandsEnum = LayoutCommandsEnum = {}));
9
- var LayoutComponentListEnum;
10
- (function (LayoutComponentListEnum) {
11
- LayoutComponentListEnum["GENERIC_COMPONENT"] = "GENERIC_COMPONENT";
12
- })(LayoutComponentListEnum || (exports.LayoutComponentListEnum = LayoutComponentListEnum = {}));
13
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../../src/ui-commands/layout/enums.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,gDAA0B,CAAA;IAC1B,oDAA8B,CAAA;AAClC,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,uBAEX;AAFD,WAAY,uBAAuB;IAC/B,kEAAuC,CAAA;AAC3C,CAAC,EAFW,uBAAuB,uCAAvB,uBAAuB,QAElC"}
@@ -1,5 +0,0 @@
1
- import { LayoutComponentListEnum } from "./enums";
2
- export interface UiCommandsLayoutObject {
3
- set: (layoutToSet: LayoutComponentListEnum) => void;
4
- unset: (layoutToUnset: LayoutComponentListEnum) => void;
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui-commands/layout/types.ts"],"names":[],"mappings":""}