bigbluebutton-html-plugin-sdk
Version:
This repository contains the SDK for developing BigBlueButton plugins. Plugins are React components that can be loaded from external sources by the BigBlueButton HTML5 client to extend its functionalities.
72 lines • 3.33 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.chat = void 0;
var constants_1 = require("./constants");
var enum_1 = require("./enum");
var chat = function (pluginName) { return ({
/**
* Sends chat message to specific chat.
*
* @param SendChatMessageArguments the text, custom metadata(optional), optional flag
* to tell whether or not the message will be custom, and the chatId;
* Refer to {@link SendChatMessageArguments} to understand the argument
* structure.
*/
sendChatMessage: function (chatMessageArguments) {
window.dispatchEvent(new CustomEvent(enum_1.ChatCommandsEnum.SEND_MESSAGE, {
detail: __assign(__assign({ pluginName: pluginName }, chatMessageArguments), { custom: (chatMessageArguments === null || chatMessageArguments === void 0 ? void 0 : chatMessageArguments.custom) || false }),
}));
},
/**
* Sends chat message to the public chat.
*
* @param chatSendMessageCommandArguments the text and custom metadata(optional)
* to be sent in the public chat message.
* Refer to {@link ChatSendMessageCommandArguments} to understand the argument
* structure.
*/
sendPublicChatMessage: function (chatSendPublicChatMessageCommandArguments) {
window.dispatchEvent(new CustomEvent(enum_1.ChatCommandsEnum.SEND_MESSAGE, {
detail: __assign({ chatId: constants_1.PUBLIC_CHAT_ID, pluginName: pluginName, custom: false }, chatSendPublicChatMessageCommandArguments),
}));
},
/**
* Sends custom chat message to the public chat. Custom messages are not rendered by
* the BBB client and are meant to be rendered in a custom manner by the plugin.
*
* @param chatSendMessageCommandArguments the text and custom metadata(optional)
* to be sent in the public chat message.
* Refer to {@link ChatSendMessageCommandArguments} to understand the argument
* structure.
*/
sendCustomPublicChatMessage: function (chatSendCustomPublicChatMessageCommandArguments) {
window.dispatchEvent(new CustomEvent(enum_1.ChatCommandsEnum.SEND_MESSAGE, {
detail: __assign({ chatId: constants_1.PUBLIC_CHAT_ID, pluginName: pluginName, custom: true }, chatSendCustomPublicChatMessageCommandArguments),
}));
},
/**
* Creates a private chat with a specific user.
*
* @param createPrivateChatCommandArguments the userId of the user to create a private chat with.
* Refer to {@link CreatePrivateChatCommandArguments} to understand the argument
* structure.
*/
createPrivateChat: function (createPrivateChatCommandArguments) {
window.dispatchEvent(new CustomEvent(enum_1.ChatCommandsEnum.CREATE_PRIVATE_CHAT, {
detail: __assign({}, createPrivateChatCommandArguments),
}));
},
}); };
exports.chat = chat;
//# sourceMappingURL=commands.js.map