bigbluebutton-html-plugin-sdk 0.0.23 → 0.0.25

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
@@ -26,6 +26,11 @@ SDK for developing BigBlueButton plugins, examples of implementations can be fou
26
26
 
27
27
  - User list item additional information (item, label)
28
28
 
29
+ ### Getters available through the API:
30
+ - `getSessionToken`: returns the user session token located on the user's URL.
31
+
32
+ - `getJoinUrl`: returns the join url associated with the parameters passed as an argument. Since it fetches the BigBlueButton API, this getter method is asynchronous.
33
+
29
34
  ### Realtime data consumption
30
35
  - `useCurrentPresentation` hook: provides information regarding the current presentation;
31
36
 
@@ -35,5 +40,7 @@ SDK for developing BigBlueButton plugins, examples of implementations can be fou
35
40
 
36
41
  - `useUsersBasicInfo` hook: provides information regarding all users (only crucial information: userId, name and role);
37
42
 
43
+ - `useCustomSubscription` hook: with this hook, the developer can query pretty much anything graphql can provide. Note: Make sure that, on BBB version change, the custom subscriptions you make will work as expected.
44
+
38
45
  ### Real time data exchange
39
46
  - `useDataChannel` hook: this will allow you to exchange information (Send and receive) amongst different users through the same plugin;
@@ -7,6 +7,8 @@ var hooks_3 = require("../../data-consumption/domain/shared/custom-subscription/
7
7
  var hooks_4 = require("../../data-consumption/domain/users/loaded-user-list/hooks");
8
8
  var hooks_5 = require("../../data-consumption/domain/users/current-user/hooks");
9
9
  var hooks_6 = require("../../data-consumption/domain/users/users-basic-info/hooks");
10
+ var getter_1 = require("../auxiliar/session-token/getter");
11
+ var getter_2 = require("../auxiliar/join-url/getter");
10
12
  /**
11
13
  * Class responsible for either initialize or get the PluginApi
12
14
  *
@@ -75,6 +77,8 @@ var BbbPluginSdk = /** @class */ (function () {
75
77
  mapOfDispatchers: {
76
78
  '': function () { },
77
79
  },
80
+ getSessionToken: function () { return (0, getter_1.getSessionToken)(); },
81
+ getJoinUrl: function (params) { return (0, getter_2.getJoinUrl)(params); },
78
82
  pluginName: pluginName,
79
83
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D,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG;gBACzB,wBAAwB,EAAE,cAAO,CAAC;gBAClC,2BAA2B,EAAE,cAAO,CAAC;gBACrC,4BAA4B,EAAE,cAAO,CAAC;gBACtC,kBAAkB,EAAE,cAAO,CAAC;gBAC5B,6BAA6B,EAAE,cAAO,CAAC;gBACvC,4BAA4B,EAAE,cAAO,CAAC;gBACtC,cAAc,EAAE,cAAO,CAAC;gBACxB,uBAAuB,EAAE,cAAO,CAAC;gBACjC,8BAA8B,EAAE,cAAO,CAAC;gBACxC,0BAA0B,EAAE,cAAO,CAAC;gBACpC,oCAAoC,EAAE,cAAO,CAAC;gBAC9C,gBAAgB,EAAE;oBAChB,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,AAzED,IAyEC;AAzEqB,oCAAY"}
@@ -15,6 +15,8 @@ import { UseCurrentUserFunction } from '../../data-consumption/domain/users/curr
15
15
  import { UseUsersBasicInfoFunction } from '../../data-consumption/domain/users/users-basic-info/types';
16
16
  import { UseCustomSubscriptionFunction } from '../../data-consumption/domain/shared/custom-subscription/types';
17
17
  import { MapOfDispatchers, UseDataChannelFunctionFromPluginApi } from '../../data-channel/types';
18
+ import { GetSessionTokenFunction } from '../auxiliar/session-token/types';
19
+ import { GetJoinUrlFunction } from '../auxiliar/join-url/types';
18
20
  export type SetPresentationToolbarItems = (presentationToolbarItem: PresentationToolbarItem[]) => void;
19
21
  export type SetUserListDropdownItems = (userListDropdownItem: UserListDropdownItem[]) => void;
20
22
  export type SetActionButtonDropdownItems = (actionButtonDropdownItem: ActionButtonDropdownItem[]) => void;
@@ -94,6 +96,8 @@ export interface PluginApi {
94
96
  */
95
97
  useDataChannel?: UseDataChannelFunctionFromPluginApi;
96
98
  mapOfDispatchers: MapOfDispatchers;
99
+ getSessionToken?: GetSessionTokenFunction;
100
+ getJoinUrl?: GetJoinUrlFunction;
97
101
  }
98
102
  export interface PluginBrowserWindow extends Window {
99
103
  bbb_plugins: {
@@ -0,0 +1,3 @@
1
+ export declare function getJoinUrl(parameters: {
2
+ [key: string]: string;
3
+ }): Promise<string>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getJoinUrl = void 0;
40
+ var getter_1 = require("../session-token/getter");
41
+ function objectToUrlParameters(parameters) {
42
+ var queryString = Object.entries(parameters)
43
+ .map(function (_a) {
44
+ var key = _a[0], value = _a[1];
45
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
46
+ })
47
+ .join('&');
48
+ return queryString;
49
+ }
50
+ function getJoinUrl(parameters) {
51
+ return __awaiter(this, void 0, void 0, function () {
52
+ var urlParameters, url, response, responseUrl;
53
+ return __generator(this, function (_a) {
54
+ switch (_a.label) {
55
+ case 0:
56
+ urlParameters = objectToUrlParameters(parameters);
57
+ url = "".concat(document.location.origin, "/bigbluebutton/api/getJoinUrl?sessionToken=").concat((0, getter_1.getSessionToken)(), "&").concat(urlParameters);
58
+ return [4 /*yield*/, fetch(url)];
59
+ case 1:
60
+ response = _a.sent();
61
+ return [4 /*yield*/, response.json()];
62
+ case 2:
63
+ responseUrl = _a.sent();
64
+ return [2 /*return*/, responseUrl.response.url];
65
+ }
66
+ });
67
+ });
68
+ }
69
+ exports.getJoinUrl = getJoinUrl;
70
+ //# sourceMappingURL=getter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getter.js","sourceRoot":"","sources":["../../../../../src/core/auxiliar/join-url/getter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0D;AAE1D,SAAS,qBAAqB,CAAC,UAAmC;IAChE,IAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;SAC3C,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAAM,OAAA,UAAG,kBAAkB,CAAC,GAAG,CAAC,cAAI,kBAAkB,CAAC,KAAK,CAAC,CAAE;IAAzD,CAAyD,CAAC;SAChF,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAsB,UAAU,CAAC,UAAmC;;;;;;oBAC5D,aAAa,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;oBAClD,GAAG,GAAG,UAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,wDAA8C,IAAA,wBAAe,GAAE,cAAI,aAAa,CAAE,CAAC;oBACzG,qBAAM,KAAK,CAAC,GAAG,CAAC,EAAA;;oBAA3B,QAAQ,GAAG,SAAgB;oBACb,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;oBAAnC,WAAW,GAAG,SAAqB;oBACzC,sBAAO,WAAW,CAAC,QAAQ,CAAC,GAAa,EAAC;;;;CAC3C;AAND,gCAMC"}
@@ -0,0 +1,3 @@
1
+ export type GetJoinUrlFunction = (params: {
2
+ [key: string]: string;
3
+ }) => Promise<string>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/auxiliar/join-url/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare function getSessionToken(): string | undefined;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSessionToken = void 0;
4
+ function getSessionToken() {
5
+ var params = new URLSearchParams(window.location.search);
6
+ return params.get('sessionToken') || undefined;
7
+ }
8
+ exports.getSessionToken = getSessionToken;
9
+ //# sourceMappingURL=getter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getter.js","sourceRoot":"","sources":["../../../../../src/core/auxiliar/session-token/getter.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe;IAC7B,IAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC;AACjD,CAAC;AAHD,0CAGC"}
@@ -0,0 +1 @@
1
+ export type GetSessionTokenFunction = () => string | undefined;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/auxiliar/session-token/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bigbluebutton-html-plugin-sdk",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
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",