bigbluebutton-html-plugin-sdk 0.0.47 → 0.0.50
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 +134 -5
- package/dist/cjs/core/api/BbbPluginSdk.d.ts +1 -0
- package/dist/cjs/core/api/BbbPluginSdk.js +18 -0
- package/dist/cjs/core/api/BbbPluginSdk.js.map +1 -1
- package/dist/cjs/data-channel/enums.d.ts +2 -1
- package/dist/cjs/data-channel/enums.js +1 -0
- package/dist/cjs/data-channel/enums.js.map +1 -1
- package/dist/cjs/data-channel/hooks.js +7 -1
- package/dist/cjs/data-channel/hooks.js.map +1 -1
- package/dist/cjs/data-channel/types.d.ts +9 -2
- package/dist/cjs/data-channel/utils.d.ts +1 -0
- package/dist/cjs/data-channel/utils.js +14 -1
- package/dist/cjs/data-channel/utils.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +2 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/logger/logger.d.ts +2 -0
- package/dist/cjs/utils/logger/logger.js +17 -0
- package/dist/cjs/utils/logger/logger.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -78,6 +78,21 @@ In this case, the `<<PLUGIN_URL>>` will be `https://<your-host>/plugins/SampleAc
|
|
|
78
78
|
|
|
79
79
|
### Extensible UI areas
|
|
80
80
|
|
|
81
|
+
Foreach of the following ui-extensible-area, we have a different setter function accessible via `pluginApi`.
|
|
82
|
+
|
|
83
|
+
Mind that, although each area has its own structure, all the functions follows a certain argument structure, and returns nothing, that would be:
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
pluginApi.setterFunctionExample([{
|
|
87
|
+
objectProperty1: 'string',
|
|
88
|
+
objectProperty2: 123,
|
|
89
|
+
}])
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
See, it is basicaly a function that requires an array as an argument, with which the more items you push to that array, the more of that extensible area you will have.
|
|
93
|
+
|
|
94
|
+
That being said, here are the extensible areas we have so far:
|
|
95
|
+
|
|
81
96
|
- Action bar items (button, separator)
|
|
82
97
|
- Action Button Dropdown Items (option, separator)
|
|
83
98
|
- Audio settings dropdown items (option, separator)
|
|
@@ -91,6 +106,8 @@ In this case, the `<<PLUGIN_URL>>` will be `https://<your-host>/plugins/SampleAc
|
|
|
91
106
|
- Floating window item (floatingWindow)
|
|
92
107
|
- Generic component (genericComponent)
|
|
93
108
|
|
|
109
|
+
Mind that no plugin will interfere into another's extensible area. So feel free to set whatever you need into a certain plugin with no worries.
|
|
110
|
+
|
|
94
111
|
### Getters available through the API:
|
|
95
112
|
|
|
96
113
|
- `getSessionToken`: returns the user session token located on the user's URL.
|
|
@@ -108,6 +125,19 @@ In this case, the `<<PLUGIN_URL>>` will be `https://<your-host>/plugins/SampleAc
|
|
|
108
125
|
- `useTalkingIndicator` hook: it gives you invormation on the user-voice data, that is, who is talking or muted.
|
|
109
126
|
- `useMeeting` hook: it gives you information on the current meeting that the user is on.
|
|
110
127
|
|
|
128
|
+
So for these types of hooks, the return will follow the same structure:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
export interface GraphqlResponseWrapper<TData> {
|
|
132
|
+
loading: boolean;
|
|
133
|
+
data?: TData;
|
|
134
|
+
error?: ApolloError;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
So we have the `data`, which is different for each hook, that's why it's a generic, the error, that will be set if, and only if, there is an error, otherwise it is undefined, and loading, which tells the developer if the query is still loading (being fetched) or not.
|
|
139
|
+
|
|
140
|
+
|
|
111
141
|
### Real time data exchange
|
|
112
142
|
|
|
113
143
|
- `useDataChannel` hook: this will allow you to exchange information (Send and receive) amongst different users through the same plugin;
|
|
@@ -181,13 +211,21 @@ export type ObjectTo = ToUserId | ToRole;
|
|
|
181
211
|
|
|
182
212
|
Example of usage:
|
|
183
213
|
|
|
184
|
-
```
|
|
185
|
-
const currentLocale = pluginApi.useUiData(IntlLocaleUiDataNames.CURRENT_LOCALE, {
|
|
214
|
+
```ts
|
|
215
|
+
const currentLocale = pluginApi.useUiData(IntlLocaleUiDataNames.CURRENT_LOCALE, {
|
|
186
216
|
locale: 'en',
|
|
187
217
|
fallbackLocale: 'en',
|
|
188
218
|
});
|
|
219
|
+
// Do something with the currentLocale:
|
|
220
|
+
currentLocale.locale;
|
|
221
|
+
currentLocale.fallbackLocale;
|
|
222
|
+
|
|
189
223
|
```
|
|
190
224
|
|
|
225
|
+
Mind that foreach enum we have, a different type of fallback is needed as the second argument. In the example above, we want the `intl`, so the second argument, will follow the structure depicted.
|
|
226
|
+
|
|
227
|
+
One other thing is that the type of the return is precisely the same type required as the second argument.
|
|
228
|
+
|
|
191
229
|
### Ui Commands to automatize tasks in BBB
|
|
192
230
|
|
|
193
231
|
`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:
|
|
@@ -199,10 +237,101 @@ const currentLocale = pluginApi.useUiData(IntlLocaleUiDataNames.CURRENT_LOCALE,
|
|
|
199
237
|
- external-video:
|
|
200
238
|
- volume:
|
|
201
239
|
- set: this function will set the external video volume to a certain number between 0 and 1 (that is 0% and);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
240
|
+
|
|
241
|
+
See usage ahead:
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
pluginApi.uiCommands.chat.form.open();
|
|
245
|
+
pluginApi.uiCommands.chat.form.fill({
|
|
246
|
+
text: 'Just an example message filled by the plugin',
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
So the idea is that we have a `uiCommands` object and at a point, there will be the command to do the intended action, such as open the chat form and/or fill it, as demonstrated above
|
|
205
251
|
|
|
206
252
|
### Dom Element Manipulation
|
|
207
253
|
|
|
208
254
|
- `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.;
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### Frequently Asked Questions (FAQ)
|
|
258
|
+
|
|
259
|
+
**How do I remove a certain extensible area that I don't want anymore?**
|
|
260
|
+
It is pretty simple: just set an empty array of elements of that specific extensible area.
|
|
261
|
+
Or simply remove the specific item of the array and set the new array to that extensible area in the next iteration.
|
|
262
|
+
|
|
263
|
+
See example below:
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
// First iteration:
|
|
267
|
+
// Define both variables:
|
|
268
|
+
const dropdownToUserListItem = { ... };
|
|
269
|
+
const buttonToUserListItem = { ... };
|
|
270
|
+
pluginApi.setActionsBarItems([dropdownToUserListItem, buttonToUserListItem]);
|
|
271
|
+
|
|
272
|
+
// Second iteration:
|
|
273
|
+
// Redefine variable(s):
|
|
274
|
+
const newButtonToUserListItem = { ... };
|
|
275
|
+
pluginApi.setActionsBarItems([newButtonToUserListItem]);
|
|
276
|
+
|
|
277
|
+
// Third iteration:
|
|
278
|
+
// I don't want any of this extensible-area:
|
|
279
|
+
pluginApi.setActionsBarItems([]);
|
|
280
|
+
// All set from this plugin will disappear from the UI;
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**How to propperly build a plugin?**
|
|
284
|
+
Just go to your plugin folder, install dependencies and run the build command as follows:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
cd my-plugin-folder/
|
|
288
|
+
npm i
|
|
289
|
+
npm run build-bundl
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
At this point, another folder will be created into the plugin directory called "dist/" inside of that folder you will find the plugin itself `MyPlugin.js`. Remember that the name of this file will be the same as defined in the `webpack.config.js`, such as:
|
|
293
|
+
|
|
294
|
+
```js
|
|
295
|
+
module.exports = {
|
|
296
|
+
// ... Other configurations
|
|
297
|
+
output: {
|
|
298
|
+
filename: 'MyPlugin.js'
|
|
299
|
+
}
|
|
300
|
+
// ... Other configurations
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Does the builded plugin need to be in the same BBB server?**
|
|
305
|
+
No, feel free to host it anywhere you want, just make sure to point the URL from `settings.yml`correctly.
|
|
306
|
+
|
|
307
|
+
**I am making my plugin based on a sample inside the SDK, but somehow, the sample is not working properly, what do I do to run it in dev mode and make it work?**
|
|
308
|
+
Well there are several motives to why the sample is not working properly, so I will go through each one of them briefly:
|
|
309
|
+
|
|
310
|
+
- The config has not been set properly inside `bbb-html5.yml`, see [this section to configure your plugin](#running-the-plugin-from-source);
|
|
311
|
+
- The plugin is not even running in dev mode, it could be the port already in use, or typescript and/or javascript errors (Make sure to initialize the `pluginApi` as any of the samples inside a react function component);
|
|
312
|
+
- It could be an error with that sample indeed, or that feature the plugin uses broke (it is not usual, but can happen since BBB is constantly changing and enhancing its features with its wonderful community). If that happens, just open an issue in the [SDK's github](https://github.com/bigbluebutton/bigbluebutton-html-plugin-sdk) detailing the error you are facing. And thank you in advance for reporting it back to us so we can improve each time.
|
|
313
|
+
|
|
314
|
+
**How to troubleshoot the plugins? See if it has loaded in the BBB, for instance.**
|
|
315
|
+
Well, each time a set of plugins are listed in the `bbb-html5.yml`, it will fire some logs based on the amount of plugins that it need to load inside the client. So open the console in the browser by pressing F12 key in your keyboard and search for the following log:
|
|
316
|
+
|
|
317
|
+
```log
|
|
318
|
+
<ratio of loaded plugins> plugins loaded
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
If 1 out of 5 plugins loaded, you'll see "1/5 plugins loaded", and so on.
|
|
322
|
+
|
|
323
|
+
Also, when a plugin loaded, the client will log it's name like:
|
|
324
|
+
|
|
325
|
+
```log
|
|
326
|
+
Loaded plugin MyPlugin
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Sometimes, there could be the case of a plugin to not load properly and an error will log with the following message:
|
|
330
|
+
|
|
331
|
+
```log
|
|
332
|
+
Error when loading plugin MyPlugin, error: {"isTrusted":true}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
In this case, the URL that leads to the plugin is not available or leads to an error. But it can log something different, so pay attention to what the error message will tell you.
|
|
336
|
+
|
|
337
|
+
Lastly, there are, of course, other scenarios and different informative logs, but these are the most common and important ones. Please contact us if you feel we left something out!
|
|
@@ -19,6 +19,7 @@ export declare abstract class BbbPluginSdk {
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
static initialize(uuid: string): void;
|
|
22
|
+
private static isReactEnvironment;
|
|
22
23
|
/**
|
|
23
24
|
* Returns the PluginApi. Use the PluginApi to access the hooks or setters functions for all the
|
|
24
25
|
* extensible areas. For a complete list of those, see README.md
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BbbPluginSdk = void 0;
|
|
4
|
+
/* eslint-disable no-console */
|
|
5
|
+
var react_1 = require("react");
|
|
4
6
|
var enums_1 = require("../../data-channel/enums");
|
|
5
7
|
var commands_1 = require("../../ui-commands/commands");
|
|
6
8
|
var hooks_1 = require("../../data-channel/hooks");
|
|
@@ -39,6 +41,8 @@ var BbbPluginSdk = /** @class */ (function () {
|
|
|
39
41
|
*
|
|
40
42
|
*/
|
|
41
43
|
BbbPluginSdk.initialize = function (uuid) {
|
|
44
|
+
if (!this.isReactEnvironment())
|
|
45
|
+
throw new Error('Initializing pluginApi outside of a react function component. It should be done inside');
|
|
42
46
|
var pluginApi = window.bbb_plugins[uuid];
|
|
43
47
|
pluginApi.useCustomSubscription = (function (query, variablesObjectWrapper) { return (0, hooks_3.useCustomSubscription)(query, variablesObjectWrapper); });
|
|
44
48
|
pluginApi.useCurrentPresentation = (function () { return (0, hooks_2.useCurrentPresentation)(); });
|
|
@@ -64,6 +68,20 @@ var BbbPluginSdk = /** @class */ (function () {
|
|
|
64
68
|
throw new Error('Plugin name not set');
|
|
65
69
|
}
|
|
66
70
|
};
|
|
71
|
+
BbbPluginSdk.isReactEnvironment = function () {
|
|
72
|
+
var fn = console.error;
|
|
73
|
+
try {
|
|
74
|
+
console.error = function () { };
|
|
75
|
+
(0, react_1.useEffect)(function () { }, []);
|
|
76
|
+
}
|
|
77
|
+
catch (_a) {
|
|
78
|
+
console.error = fn;
|
|
79
|
+
console.error('[PLUGIN-ERROR] Error: Initializing pluginApi outside of a react function component. It should be done inside');
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
console.error = fn;
|
|
83
|
+
return true;
|
|
84
|
+
};
|
|
67
85
|
/**
|
|
68
86
|
* Returns the PluginApi. Use the PluginApi to access the hooks or setters functions for all the
|
|
69
87
|
* extensible areas. For a complete list of those, see README.md
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BbbPluginSdk.js","sourceRoot":"","sources":["../../../../src/core/api/BbbPluginSdk.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"BbbPluginSdk.js","sourceRoot":"","sources":["../../../../src/core/api/BbbPluginSdk.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAkC;AAOlC,kDAA4D;AAO5D,uDAAwD;AAQxD,kDAAiE;AACjE,gGAEgF;AAChF,wFAEwE;AACxE,oFAA+F;AAC/F,gFAAwF;AACxF,oFAA+F;AAC/F,4DAAoE;AACpE,uDAA0D;AAC1D,mEAA2E;AAE3E,uFAAsG;AACtG,2EAA8F;AAE9F,0FAAuG;AACvG,oDAAsD;AAEtD,gFAAmF;AAInF;;;;;;GAMG;AACH;IAAA;IA2GA,CAAC;IA1GC;;;;;;;;;;OAUG;IACW,uBAAU,GAAxB,UAAyB,IAAY;QACnC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;QAC1I,IAAM,SAAS,GAAc,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACtD,SAAS,CAAC,qBAAqB,GAAG,CAAC,UACjC,KAAa,EACb,sBAAsD,IACnD,OA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5B,6BAA6B,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACvC,4BAA4B,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACtC,cAAc,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACxB,uBAAuB,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACjC,8BAA8B,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACxC,0BAA0B,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBACpC,oCAAoC,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBAC9C,kBAAkB,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBAC5B,oBAAoB,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;gBAC9B,uBAAuB,EAAE;oBACvB,EAAE,EAAE,cAAO,CAAC;iBACb;gBACD,eAAe,EAAE,cAAM,OAAA,IAAA,wBAAe,GAAE,EAAjB,CAAiB;gBACxC,UAAU,EAAE,UAAC,MAAM,IAAK,OAAA,IAAA,mBAAU,EAAC,MAAM,CAAC,EAAlB,CAAkB;gBAC1C,UAAU,YAAA;aACX,CAAC;SACH;QAED,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACH,mBAAC;AAAD,CAAC,AA3GD,IA2GC;AA3GqB,oCAAY"}
|
|
@@ -11,7 +11,8 @@ export declare enum DataChannelPushEntryFunctionUserRole {
|
|
|
11
11
|
export declare enum DataChannelHooks {
|
|
12
12
|
DATA_CHANNEL_BUILDER = "Hooks::DataChannelBuilder",
|
|
13
13
|
DATA_CHANNEL_RESET = "Hooks::DataChannelReset",
|
|
14
|
-
DATA_CHANNEL_DELETE = "Hooks::DataChannelDelete"
|
|
14
|
+
DATA_CHANNEL_DELETE = "Hooks::DataChannelDelete",
|
|
15
|
+
DATA_CHANNEL_REPLACE = "Hooks::DataChannelReplace"
|
|
15
16
|
}
|
|
16
17
|
export declare enum DataChannelTypes {
|
|
17
18
|
All_ITEMS = "Hooks::DataChannel::AllItems",
|
|
@@ -18,6 +18,7 @@ var DataChannelHooks;
|
|
|
18
18
|
DataChannelHooks["DATA_CHANNEL_BUILDER"] = "Hooks::DataChannelBuilder";
|
|
19
19
|
DataChannelHooks["DATA_CHANNEL_RESET"] = "Hooks::DataChannelReset";
|
|
20
20
|
DataChannelHooks["DATA_CHANNEL_DELETE"] = "Hooks::DataChannelDelete";
|
|
21
|
+
DataChannelHooks["DATA_CHANNEL_REPLACE"] = "Hooks::DataChannelReplace";
|
|
21
22
|
})(DataChannelHooks || (exports.DataChannelHooks = DataChannelHooks = {}));
|
|
22
23
|
var DataChannelTypes;
|
|
23
24
|
(function (DataChannelTypes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/data-channel/enums.ts"],"names":[],"mappings":";;;AAAA,OAAO;AACP;;;;GAIG;AACH,IAAY,oCAIX;AAJD,WAAY,oCAAoC;IAC9C,+DAAuB,CAAA;IACvB,+DAAuB,CAAA;IACvB,yDAAiB,CAAA;AACnB,CAAC,EAJW,oCAAoC,oDAApC,oCAAoC,QAI/C;AAED,IAAY,
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/data-channel/enums.ts"],"names":[],"mappings":";;;AAAA,OAAO;AACP;;;;GAIG;AACH,IAAY,oCAIX;AAJD,WAAY,oCAAoC;IAC9C,+DAAuB,CAAA;IACvB,+DAAuB,CAAA;IACvB,yDAAiB,CAAA;AACnB,CAAC,EAJW,oCAAoC,oDAApC,oCAAoC,QAI/C;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,sEAAkD,CAAA;IAClD,kEAA8C,CAAA;IAC9C,oEAAgD,CAAA;IAChD,sEAAkD,CAAA;AACpD,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,8DAA0C,CAAA;IAC1C,8DAA0C,CAAA;IAC1C,kEAA8C,CAAA;AAChD,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B"}
|
|
@@ -9,6 +9,7 @@ exports.useDataChannelGeneral = (function (channelName, subChannelName, pluginNa
|
|
|
9
9
|
var _a = (0, react_1.useState)({ loading: true }), data = _a[0], setData = _a[1];
|
|
10
10
|
var _b = (0, react_1.useState)(), pushEntryFunction = _b[0], setPushEntryFunction = _b[1];
|
|
11
11
|
var deleteEntryFunction = function (objectToDelete) { return (0, utils_1.deleteEntryFunctionUtil)(objectToDelete, channelName, subChannelName, pluginName); };
|
|
12
|
+
var replaceEntryFunction = function (entryId, payloadJson) { return (0, utils_1.replaceEntryFunctionUtil)(entryId, channelName, subChannelName, pluginName, payloadJson); };
|
|
12
13
|
var channelIdentifier = (0, utils_1.createChannelIdentifier)(channelName, subChannelName, pluginName);
|
|
13
14
|
var handleDataChange = (function (customEvent) {
|
|
14
15
|
var eventDetail = customEvent.detail;
|
|
@@ -50,6 +51,11 @@ exports.useDataChannelGeneral = (function (channelName, subChannelName, pluginNa
|
|
|
50
51
|
window.removeEventListener(channelIdentifier, handleDataChange);
|
|
51
52
|
};
|
|
52
53
|
}, []);
|
|
53
|
-
return [
|
|
54
|
+
return [
|
|
55
|
+
data,
|
|
56
|
+
pushEntryFunction,
|
|
57
|
+
deleteEntryFunction,
|
|
58
|
+
replaceEntryFunction,
|
|
59
|
+
];
|
|
54
60
|
});
|
|
55
61
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/data-channel/hooks.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/data-channel/hooks.ts"],"names":[],"mappings":";;;AAAA,+BAA4C;AAa5C,qCAEsB;AAKtB,iCAA6D;AAC7D,iCAAqG;AAExF,QAAA,qBAAqB,GAAG,CAAC,UACpC,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kB,CAAC;IACtB,IAAA,iBAAS,EAAC;QACR,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAC7D,MAAM,CAAC,gBAAgB,CACrB,UAAG,iBAAiB,wBAAqB,EACzC,qCAAqC,CACtC,CAAC;QAEF,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAyB,iBAAU,CAAC,UAAU,EAAE;YAClF,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAgB,CAAC,oBAAoB;gBAC3C,aAAa,EAAE;oBACb,WAAW,aAAA;oBAAE,UAAU,YAAA;oBAAE,eAAe,iBAAA;oBAAE,cAAc,gBAAA;iBACzD;aACF;SACF,CAAC,CAAC,CAAC;QACJ,OAAO;YACL,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAA2B,iBAAU,CAAC,YAAY,EAAE;gBACtF,MAAM,EAAE;oBACN,IAAI,EAAE,wBAAgB,CAAC,oBAAoB;oBAC3C,aAAa,EAAE;wBACb,WAAW,aAAA;wBAAE,UAAU,YAAA;wBAAE,eAAe,iBAAA;wBAAE,cAAc,gBAAA;qBACzD;iBACF;aACF,CAAC,CAAC,CAAC;YACJ,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;QAClE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO;QACL,IAAI;QACJ,iBAAiB;QACjB,mBAAmB;QACnB,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAiC,CAAC"}
|
|
@@ -23,6 +23,11 @@ export type ObjectTo = ToUserId | ToRole;
|
|
|
23
23
|
export type ObjectToDelete = typeof RESET_DATA_CHANNEL | string;
|
|
24
24
|
export type PushEntryFunction<T = object> = (objectToBePushed: T, receivers?: ObjectTo[]) => void;
|
|
25
25
|
export type DeleteEntryFunction = (objectToDelete: ObjectToDelete[]) => void;
|
|
26
|
+
export type ReplaceEntryFunction<T = object> = (entryId: string, payloadJson: T) => void;
|
|
27
|
+
export interface ReplaceEntryFunctionArguments<T> {
|
|
28
|
+
entryId: string;
|
|
29
|
+
payloadJson: T;
|
|
30
|
+
}
|
|
26
31
|
export interface MapOfPushEntryFunctions {
|
|
27
32
|
[key: string]: PushEntryFunction;
|
|
28
33
|
}
|
|
@@ -39,10 +44,12 @@ export interface DataChannelEntryResponseType<T> {
|
|
|
39
44
|
export type UseDataChannelFunctionFromPluginApi = <T>(channelName: string, dataChannelType?: DataChannelTypes, subChannelName?: string) => [
|
|
40
45
|
GraphqlResponseWrapper<DataChannelEntryResponseType<T>[]>,
|
|
41
46
|
PushEntryFunction<T>,
|
|
42
|
-
DeleteEntryFunction
|
|
47
|
+
DeleteEntryFunction,
|
|
48
|
+
ReplaceEntryFunction<T>
|
|
43
49
|
];
|
|
44
50
|
export type UseDataChannelStaticFunction = <T>(channelName: string, subChannelName: string, pluginName: string, pluginApi: PluginApi, dataChannelType: DataChannelTypes) => [
|
|
45
51
|
GraphqlResponseWrapper<DataChannelEntryResponseType<T>[]>,
|
|
46
52
|
PushEntryFunction<T>?,
|
|
47
|
-
DeleteEntryFunction
|
|
53
|
+
DeleteEntryFunction?,
|
|
54
|
+
ReplaceEntryFunction<T>?
|
|
48
55
|
];
|
|
@@ -3,3 +3,4 @@ import { GraphqlResponseWrapper } from '../core/types';
|
|
|
3
3
|
export declare const createChannelIdentifier: (channelName: string, subChannelName: string, pluginName: string) => string;
|
|
4
4
|
export declare const formatResponseForPubSubOrKeyValue: <T>(dataResult: GraphqlResponseWrapper<DataChannelEntryResponseType<T>[]>) => GraphqlResponseWrapper<DataChannelEntryResponseType<T>>;
|
|
5
5
|
export declare const deleteEntryFunctionUtil: (objectsToDelete: ObjectToDelete[], channelName: string, subChannelName: string, pluginName: string) => void;
|
|
6
|
+
export declare const replaceEntryFunctionUtil: <T>(entryId: string, channelName: string, subChannelName: string, pluginName: string, newPayloadJson: T) => void;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.deleteEntryFunctionUtil = exports.formatResponseForPubSubOrKeyValue = exports.createChannelIdentifier = void 0;
|
|
14
|
+
exports.replaceEntryFunctionUtil = exports.deleteEntryFunctionUtil = exports.formatResponseForPubSubOrKeyValue = exports.createChannelIdentifier = void 0;
|
|
15
15
|
var enum_1 = require("../core/enum");
|
|
16
16
|
var enums_1 = require("./enums");
|
|
17
17
|
var constants_1 = require("./constants");
|
|
@@ -42,4 +42,17 @@ var deleteEntryFunctionUtil = function (objectsToDelete, channelName, subChannel
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
exports.deleteEntryFunctionUtil = deleteEntryFunctionUtil;
|
|
45
|
+
var replaceEntryFunctionUtil = function (entryId, channelName, subChannelName, pluginName, newPayloadJson) {
|
|
46
|
+
window.dispatchEvent(new CustomEvent(enum_1.HookEvents.UPDATED, {
|
|
47
|
+
detail: {
|
|
48
|
+
hook: enums_1.DataChannelHooks.DATA_CHANNEL_REPLACE,
|
|
49
|
+
hookArguments: { channelName: channelName, pluginName: pluginName, subChannelName: subChannelName },
|
|
50
|
+
data: {
|
|
51
|
+
entryId: entryId,
|
|
52
|
+
payloadJson: newPayloadJson,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
exports.replaceEntryFunctionUtil = replaceEntryFunctionUtil;
|
|
45
58
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/data-channel/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/data-channel/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,qCAEsB;AAKtB,iCAA2C;AAC3C,yCAAiD;A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Ae,EACf,WAAmB,EACnB,cAAsB,EACtB,UAAkB,EAClB,cAAiB;IAEjB,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAwD,iBAAU,CAAC,OAAO,EAAE;QACzF,MAAM,EAAE;YACN,IAAI,EAAE,wBAAgB,CAAC,oBAAoB;YAC3C,aAAa,EAAE,EAAE,WAAW,aAAA,EAAE,UAAU,YAAA,EAAE,cAAc,gBAAA,EAAE;YAC1D,IAAI,EAAE;gBACJ,OAAO,SAAA;gBACP,WAAW,EAAE,cAAc;aAC5B;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,wBAAwB,4BAmBnC"}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./data-consumption"), exports);
|
|
|
19
19
|
__exportStar(require("./data-channel"), exports);
|
|
20
20
|
__exportStar(require("./ui-data-hooks"), exports);
|
|
21
21
|
__exportStar(require("./core"), exports);
|
|
22
|
+
__exportStar(require("./utils"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -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,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;AAEvB,0CAAwB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pluginLogger = void 0;
|
|
7
|
+
var logger_1 = __importDefault(require("./logger/logger"));
|
|
8
|
+
exports.pluginLogger = logger_1.default;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA2C;AAElC,uBAFF,gBAAY,CAEE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var browser_bunyan_1 = require("browser-bunyan");
|
|
4
|
+
var console_formatted_stream_1 = require("@browser-bunyan/console-formatted-stream");
|
|
5
|
+
var pluginLogger = (0, browser_bunyan_1.createLogger)({
|
|
6
|
+
name: 'PluginLogger',
|
|
7
|
+
streams: [
|
|
8
|
+
{
|
|
9
|
+
level: browser_bunyan_1.INFO,
|
|
10
|
+
stream: new console_formatted_stream_1.ConsoleFormattedStream(),
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
serializers: browser_bunyan_1.stdSerializers,
|
|
14
|
+
src: true,
|
|
15
|
+
});
|
|
16
|
+
exports.default = pluginLogger;
|
|
17
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/utils/logger/logger.ts"],"names":[],"mappings":";;AAAA,iDAAoE;AACpE,qFAAkF;AAElF,IAAM,YAAY,GAAG,IAAA,6BAAY,EAAC;IAChC,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE;QACP;YACE,KAAK,EAAE,qBAAI;YACX,MAAM,EAAE,IAAI,iDAAsB,EAAE;SACrC;KACF;IAED,WAAW,EAAE,+BAAc;IAC3B,GAAG,EAAE,IAAI;CACV,CAAC,CAAC;AAEH,kBAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigbluebutton-html-plugin-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
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",
|
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
"apollo"
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@apollo/client": "^3.8.7"
|
|
62
|
+
"@apollo/client": "^3.8.7",
|
|
63
|
+
"@browser-bunyan/console-formatted-stream": "^1.8.0",
|
|
64
|
+
"browser-bunyan": "^1.8.0"
|
|
63
65
|
}
|
|
64
66
|
}
|