From 5c0bef6ca3a00430f7d53459dd6eacbd9b0a63f4 Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Mon, 3 Nov 2025 13:47:06 -0300 Subject: [PATCH 1/5] [new-logger-structure] added new logger structure set by the client to have more possibilities of configurations --- README.md | 2 +- package-lock.json | 222 +++++++++++++----- .../sample-data-channel-plugin/manifest.json | 18 +- .../component.tsx | 2 +- .../sample-data-channel-plugin/src/index.tsx | 4 + src/core/api/BbbPluginSdk.ts | 5 + src/core/api/types.ts | 26 ++ 7 files changed, 216 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 3b3baddb..94e25e3c 100644 --- a/README.md +++ b/README.md @@ -350,7 +350,7 @@ The data-channel name must be in the `manifest.json` along with all the permissi { "name": "channel-name", "pushPermission": ["moderator","presenter"], - "replaceOrDeletePermission": ["moderator", "sender"] + "replaceOrDeletePermission": ["moderator", "creator"] } ] } diff --git a/package-lock.json b/package-lock.json index 57ea56af..41a8d95f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -376,13 +376,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.51.1.tgz", - "integrity": "sha512-nM+kEaTSAoVlXmMPH10017vn3FSiFqr/bh4fKg9vmAdMfd9SDqRZNvPSiAHADc/itWak+qPvMPZQOPwCBW7k7Q==", + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.56.1.tgz", + "integrity": "sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright": "1.51.1" + "playwright": "1.56.1" }, "bin": { "playwright": "cli.js" @@ -976,10 +975,13 @@ "license": "MIT" }, "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -997,14 +999,13 @@ } }, "node_modules/axios": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", - "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.1.tgz", + "integrity": "sha512-hU4EGxxt+j7TQijx1oYdAjw4xuIp1wRQSsbMFwSthCWeBQur1eF+qJ5iQ5sN3Tw8YRzQNKb8jszgBdMDVqwJcw==", "dev": true, - "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", + "form-data": "^4.0.4", "proxy-from-env": "^1.1.0" } }, @@ -1066,13 +1067,18 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1092,6 +1098,22 @@ "node": ">= 0.4" } }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1289,6 +1311,23 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-properties": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", @@ -2137,12 +2176,18 @@ } }, "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", "dev": true, "dependencies": { - "is-callable": "^1.1.3" + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/form-data": { @@ -2446,12 +2491,12 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.1" + "es-define-property": "^1.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2864,16 +2909,12 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -2894,6 +2935,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3633,13 +3680,12 @@ } }, "node_modules/playwright": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.51.1.tgz", - "integrity": "sha512-kkx+MB2KQRkyxjYPc3a0wLZZoDczmppyGJIvQ43l+aZihkaVvmu/21kiyaHeHjiFxjxNNFnUncKmcGIyOojsaw==", + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", + "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.51.1" + "playwright-core": "1.56.1" }, "bin": { "playwright": "cli.js" @@ -3652,11 +3698,10 @@ } }, "node_modules/playwright-core": { - "version": "1.51.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.51.1.tgz", - "integrity": "sha512-/crRMj8+j/Nq5s8QcvegseuyeZPxpQCZb6HNk3Sos3BlZyAknRjoyJPFWkpNn8v0+P3WiwqFF8P+zQo4eqiNuw==", + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", + "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", "dev": true, - "license": "Apache-2.0", "bin": { "playwright-core": "cli.js" }, @@ -3673,6 +3718,15 @@ "semver-compare": "^1.0.0" } }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -3976,18 +4030,41 @@ "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", "dev": true }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", "dev": true, - "license": "(MIT AND BSD-3-Clause)", "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/shebang-command": { @@ -4247,6 +4324,20 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, + "node_modules/to-buffer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", + "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", + "dev": true, + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -4311,6 +4402,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/typed-array-length": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", @@ -4409,17 +4514,18 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", "dev": true, "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" diff --git a/samples/sample-data-channel-plugin/manifest.json b/samples/sample-data-channel-plugin/manifest.json index e4431be4..839c2930 100644 --- a/samples/sample-data-channel-plugin/manifest.json +++ b/samples/sample-data-channel-plugin/manifest.json @@ -1,13 +1,25 @@ { "requiredSdkVersion": "~0.0.59", "name": "SampleDataChannelPlugin", + "version": "0.0.8-beta1", "javascriptEntrypointUrl": "SampleDataChannelPlugin.js", "localesBaseUrl": "https://cdn.dominio.com/pluginabc/", - "dataChannels":[ + "loggerSettings": { + "console": { + "level": "error" + } + }, + "dataChannels": [ { "name": "public-channel", - "pushPermission": ["moderator","presenter"], - "replaceOrDeletePermission": ["moderator", "sender"] + "pushPermission": [ + "moderator", + "presenter" + ], + "replaceOrDeletePermission": [ + "moderator", + "creator" + ] } ] } diff --git a/samples/sample-data-channel-plugin/src/components/sample-data-channel-plugin-item/component.tsx b/samples/sample-data-channel-plugin/src/components/sample-data-channel-plugin-item/component.tsx index 371a528c..d68bd062 100644 --- a/samples/sample-data-channel-plugin/src/components/sample-data-channel-plugin-item/component.tsx +++ b/samples/sample-data-channel-plugin/src/components/sample-data-channel-plugin-item/component.tsx @@ -4,9 +4,9 @@ import { useEffect } from 'react'; import { BbbPluginSdk, PluginApi, ActionButtonDropdownOption, RESET_DATA_CHANNEL, DataChannelTypes, - pluginLogger, } from 'bigbluebutton-html-plugin-sdk'; import { SampleDataChannelPluginProps } from './types'; +import { pluginLogger } from '../..'; interface DataExampleType { first_example_field: number; diff --git a/samples/sample-data-channel-plugin/src/index.tsx b/samples/sample-data-channel-plugin/src/index.tsx index 643762d8..f254e277 100644 --- a/samples/sample-data-channel-plugin/src/index.tsx +++ b/samples/sample-data-channel-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleDataChannelPlugin from './components/sample-data-channel-plugin-item/component'; @@ -7,6 +8,9 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; const root = ReactDOM.createRoot(document.getElementById(uuid)); + +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + root.render( { }, }, getSessionToken: () => getSessionToken(), + logger: pluginLogger, pluginName, localesBaseUrl, }; } + if (!window.bbb_plugins[uuid].logger) { + window.bbb_plugins[uuid].logger = pluginLogger; + } return window.bbb_plugins[uuid]; } diff --git a/src/core/api/types.ts b/src/core/api/types.ts index 48a66821..6af176c7 100644 --- a/src/core/api/types.ts +++ b/src/core/api/types.ts @@ -1,3 +1,4 @@ +import { Logger } from 'browser-bunyan'; import { UiCommands } from '../../ui-commands/types'; import { UseChatMessageDomElementsFunction } from '../../dom-element-manipulation/chat/message/types'; import { ActionButtonDropdownInterface } from '../../extensible-areas/action-button-dropdown-item/types'; @@ -308,6 +309,30 @@ export interface PluginApi { * */ persistEvent?: PersistEventFunction; + /** + * Function used to log in the console. + */ + logger: Logger; +} + +export interface Console { + enabled: boolean + level: string +} + +export interface External { + enabled: boolean + level: string + url: string + method: string + throttleInterval: number + flushOnClose: boolean + logTag: string +} + +export interface ClientLog { + console: Console + external: External } export interface MeetingClientSettings { @@ -315,6 +340,7 @@ export interface MeetingClientSettings { app: { bbbWebBase: string; } + clientLog: ClientLog; } } From 453398590bd2a2ec638db877452c7a6490d71031 Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Mon, 3 Nov 2025 15:44:27 -0300 Subject: [PATCH 2/5] [new-logger-structure] changed logger used in the samples --- .../component.tsx | 3 +- .../src/index.tsx | 3 + .../sample-actions-bar-plugin/src/index.tsx | 3 + .../sample-actions-bar-plugin/component.tsx | 3 +- .../src/index.tsx | 3 + .../component.tsx | 3 +- .../component.tsx | 2 +- .../src/index.tsx | 3 + .../component.tsx | 2 +- .../src/index.tsx | 3 + samples/sample-nav-bar-plugin/src/index.tsx | 3 + .../sample-nav-bar-plugin-item/component.tsx | 2 +- .../src/index.tsx | 3 + .../component.tsx | 2 +- .../user-aggregator-query/component.tsx | 2 +- .../component.tsx | 2 +- .../src/index.tsx | 3 + .../src/index.tsx | 3 + .../src/index.tsx | 3 + .../component.tsx | 4 +- samples/sample-ui-events-plugin/src/index.tsx | 3 + .../component.tsx | 2 +- samples/sample-use-meeting/src/index.tsx | 3 + .../src/sample-use-meeting/component.tsx | 4 +- .../src/index.tsx | 3 + .../component.tsx | 4 +- .../src/index.tsx | 3 + .../component.tsx | 4 +- .../src/index.tsx | 3 + .../component.tsx | 78 +++++++++---------- .../locale-messages/useLocaleMessages.ts | 2 +- 31 files changed, 106 insertions(+), 58 deletions(-) diff --git a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx index 1f01a1ec..7d11f64f 100644 --- a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx +++ b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx @@ -5,10 +5,11 @@ import { PluginApi, ActionButtonDropdownSeparator, ActionButtonDropdownOption, - pluginLogger, ChangeEnforcedLayoutTypeEnum, } from 'bigbluebutton-html-plugin-sdk'; +import { pluginLogger } from '../../index'; + import { SampleActionButtonDropdownPluginProps } from './types'; export interface DataExampleType { diff --git a/samples/sample-action-button-dropdown-plugin/src/index.tsx b/samples/sample-action-button-dropdown-plugin/src/index.tsx index b5620cac..c78cb9e2 100644 --- a/samples/sample-action-button-dropdown-plugin/src/index.tsx +++ b/samples/sample-action-button-dropdown-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleActionButtonDropdownPlugin from './components/sample-action-button-dropdown-plugin/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { + React.ReactElement { BbbPluginSdk.initialize(uuid); const pluginApi: PluginApi = BbbPluginSdk.getPluginApi(uuid); diff --git a/samples/sample-ui-events-plugin/src/index.tsx b/samples/sample-ui-events-plugin/src/index.tsx index c9aa5b06..25f5e69b 100644 --- a/samples/sample-ui-events-plugin/src/index.tsx +++ b/samples/sample-ui-events-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUiEventsPlugin from './sample-ui-events-plugin-item/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { + React.ReactElement { BbbPluginSdk.initialize(uuid); const pluginApi: PluginApi = BbbPluginSdk.getPluginApi(uuid); const userListOpened = pluginApi diff --git a/samples/sample-use-meeting/src/index.tsx b/samples/sample-use-meeting/src/index.tsx index 89c8531d..602abca0 100644 --- a/samples/sample-use-meeting/src/index.tsx +++ b/samples/sample-use-meeting/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUseMeetingPlugin from './sample-use-meeting/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { + React.ReactElement { BbbPluginSdk.initialize(uuid); const pluginApi: PluginApi = BbbPluginSdk.getPluginApi(uuid); const meetingInfoGraphqlResponse = pluginApi.useMeeting(); diff --git a/samples/sample-user-camera-dropdown-plugin/src/index.tsx b/samples/sample-user-camera-dropdown-plugin/src/index.tsx index db8382cb..f6182b85 100644 --- a/samples/sample-user-camera-dropdown-plugin/src/index.tsx +++ b/samples/sample-user-camera-dropdown-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserCameraDropdownPlugin from './sample-user-camera-dropdown-plugin-item/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { + React.ReactElement { BbbPluginSdk.initialize(uuid); const pluginApi: PluginApi = BbbPluginSdk.getPluginApi(uuid); diff --git a/samples/sample-user-camera-helper-plugin/src/index.tsx b/samples/sample-user-camera-helper-plugin/src/index.tsx index f30f5044..3d5c3026 100644 --- a/samples/sample-user-camera-helper-plugin/src/index.tsx +++ b/samples/sample-user-camera-helper-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserCameraHelperPlugin from './sample-user-camera-helper-plugin/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { + React.ReactElement { BbbPluginSdk.initialize(uuid); const pluginApi: PluginApi = BbbPluginSdk.getPluginApi(uuid); diff --git a/samples/sample-user-list-dropdown-plugin/src/index.tsx b/samples/sample-user-list-dropdown-plugin/src/index.tsx index 7c312f31..47801395 100644 --- a/samples/sample-user-list-dropdown-plugin/src/index.tsx +++ b/samples/sample-user-list-dropdown-plugin/src/index.tsx @@ -1,3 +1,4 @@ +import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserListDropdownPlugin from './sample-user-list-dropdown-plugin-item/component'; @@ -6,6 +7,8 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; +export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); + const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { if (loadedUserList !== undefined && loadedUserList.length > 0) { const listOfInformationToSend: - Array = loadedUserList.map( - (user) => { - const buttonToUserListItem: - UserListDropdownInterface = new UserListDropdownFixedContentInformation({ - label: 'Warning test', - iconRight: 'warning', - userId: user.userId, - textColor: 'red', - allowed: true, - }); - return buttonToUserListItem as UserListDropdownInterface; - }, - ); + Array = loadedUserList.map( + (user) => { + const buttonToUserListItem: + UserListDropdownInterface = new UserListDropdownFixedContentInformation({ + label: 'Warning test', + iconRight: 'warning', + userId: user.userId, + textColor: 'red', + allowed: true, + }); + return buttonToUserListItem as UserListDropdownInterface; + }, + ); const listOfOptionsToSend: - Array = loadedUserList.map( - (user) => { - const buttonToUserListItem: - UserListDropdownInterface = new UserListDropdownOption({ - label: 'Click to log something in the console', - icon: 'user', - userId: user.userId, - tooltip: 'This will log something in the console', - allowed: true, - onClick: () => { - pluginLogger.info('Log from sample user-list-dropdown-plugin'); - }, - }); - return buttonToUserListItem as UserListDropdownInterface; - }, - ); + Array = loadedUserList.map( + (user) => { + const buttonToUserListItem: + UserListDropdownInterface = new UserListDropdownOption({ + label: 'Click to log something in the console', + icon: 'user', + userId: user.userId, + tooltip: 'This will log something in the console', + allowed: true, + onClick: () => { + pluginLogger.info('Log from sample user-list-dropdown-plugin'); + }, + }); + return buttonToUserListItem as UserListDropdownInterface; + }, + ); const listOfDropdownsToSend: - Array = loadedUserList.map( - (user) => { - const dropdownToUserListItem: - UserListDropdownInterface = new UserListDropdownSeparator({ - userId: user.userId, - }); - return dropdownToUserListItem as UserListDropdownInterface; - }, - ); + Array = loadedUserList.map( + (user) => { + const dropdownToUserListItem: + UserListDropdownInterface = new UserListDropdownSeparator({ + userId: user.userId, + }); + return dropdownToUserListItem as UserListDropdownInterface; + }, + ); pluginApi.setUserListDropdownItems( [...listOfInformationToSend, ...listOfDropdownsToSend, ...listOfOptionsToSend], ); diff --git a/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts b/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts index 15dfb56a..51f88181 100644 --- a/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts +++ b/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts @@ -1,11 +1,11 @@ import { useEffect, useState } from 'react'; -import { pluginLogger } from '../../../../utils'; import { IntlMessages, UseLocaleMessagesProps } from './types'; import { fetchLocaleAndStore, mergeLocaleMessages, useGetNormalizedLocale } from './utils'; function useLocaleMessagesAuxiliary( { pluginApi, fetchConfigs }: UseLocaleMessagesProps, ): IntlMessages { + const { logger: pluginLogger } = pluginApi; const [loading, setLoading] = useState(true); const [messages, setMessages] = useState>({}); const [fallbackMessages, setFallbackMessages] = useState>(); From 1db3e625b0c44718fc41f9685461e166b0fbc579 Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Wed, 12 Nov 2025 13:23:55 -0300 Subject: [PATCH 3/5] [new-logger-structure] created exported singleton logger that proxies all methods to that defined by the pluginApi logger --- .../component.tsx | 3 +- .../src/index.tsx | 3 - src/core/api/BbbPluginSdk.ts | 4 -- src/utils/logger/logger.ts | 58 ++++++++++++++++++- 4 files changed, 56 insertions(+), 12 deletions(-) diff --git a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx index 7d11f64f..1f01a1ec 100644 --- a/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx +++ b/samples/sample-action-button-dropdown-plugin/src/components/sample-action-button-dropdown-plugin/component.tsx @@ -5,11 +5,10 @@ import { PluginApi, ActionButtonDropdownSeparator, ActionButtonDropdownOption, + pluginLogger, ChangeEnforcedLayoutTypeEnum, } from 'bigbluebutton-html-plugin-sdk'; -import { pluginLogger } from '../../index'; - import { SampleActionButtonDropdownPluginProps } from './types'; export interface DataExampleType { diff --git a/samples/sample-action-button-dropdown-plugin/src/index.tsx b/samples/sample-action-button-dropdown-plugin/src/index.tsx index c78cb9e2..b5620cac 100644 --- a/samples/sample-action-button-dropdown-plugin/src/index.tsx +++ b/samples/sample-action-button-dropdown-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleActionButtonDropdownPlugin from './components/sample-action-button-dropdown-plugin/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( ; + +function logWith(level: T, ...args: LoggerArgument[]): void { + const logger = getLogger(); + const method = logger[level] as (...params: LoggerArgument[]) => void; + + try { + method.call(logger, ...args); + } catch (err) { + console.error(`[pluginLogger.${String(level)}] fallback`, err, ...args); + } +} + +const pluginLogger = { + error: (...args: LoggerArgument[]) => logWith('error', ...args), + warn: (...args: LoggerArgument[]) => logWith('warn', ...args), + info: (...args: LoggerArgument[]) => logWith('info', ...args), + debug: (...args: LoggerArgument[]) => logWith('debug', ...args), + trace: (...args: LoggerArgument[]) => logWith('trace', ...args), + addStream(stream: StreamOptions) { + const logger = getLogger(); + logger.addStream.call(logger, stream); + }, +} as Logger; + export default pluginLogger; From aafeaadd94ae40e59b18720b7144c6c3e3018c3a Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Wed, 12 Nov 2025 13:39:21 -0300 Subject: [PATCH 4/5] [new-logger-structure] restore previous way of importing logger --- samples/sample-actions-bar-plugin/src/index.tsx | 3 --- .../src/sample-actions-bar-plugin/component.tsx | 2 +- samples/sample-audio-settings-dropdown-plugin/src/index.tsx | 3 --- .../src/sample-audio-settings-dropdown-plugin/component.tsx | 3 +-- .../sample-camera-settings-dropdown-plugin-item/component.tsx | 2 +- samples/sample-camera-settings-dropdown-plugin/src/index.tsx | 3 --- .../component.tsx | 2 +- samples/sample-custom-subscription-hook/src/index.tsx | 3 --- .../components/sample-data-channel-plugin-item/component.tsx | 2 +- samples/sample-data-channel-plugin/src/index.tsx | 4 ---- samples/sample-nav-bar-plugin/src/index.tsx | 3 --- .../src/sample-nav-bar-plugin-item/component.tsx | 2 +- samples/sample-options-dropdown-plugin/src/index.tsx | 3 --- .../src/sample-options-dropdown-plugin-item/component.tsx | 2 +- .../user-aggregator-query/component.tsx | 2 +- .../sample-presentation-dropdown-plugin/component.tsx | 2 +- samples/sample-presentation-dropdown-plugin/src/index.tsx | 3 --- samples/sample-presentation-toolbar-plugin/src/index.tsx | 3 --- samples/sample-screenshare-helper-plugin/src/index.tsx | 3 --- .../src/sample-screenshare-helper-plugin/component.tsx | 2 +- samples/sample-ui-events-plugin/src/index.tsx | 3 --- samples/sample-use-meeting/src/index.tsx | 3 --- .../sample-use-meeting/src/sample-use-meeting/component.tsx | 2 +- samples/sample-user-camera-dropdown-plugin/src/index.tsx | 3 --- .../src/sample-user-camera-dropdown-plugin-item/component.tsx | 2 +- samples/sample-user-camera-helper-plugin/src/index.tsx | 3 --- .../src/sample-user-camera-helper-plugin/component.tsx | 2 +- samples/sample-user-list-dropdown-plugin/src/index.tsx | 3 --- .../src/sample-user-list-dropdown-plugin-item/component.tsx | 2 +- 29 files changed, 14 insertions(+), 61 deletions(-) diff --git a/samples/sample-actions-bar-plugin/src/index.tsx b/samples/sample-actions-bar-plugin/src/index.tsx index c44d2d5b..04402997 100644 --- a/samples/sample-actions-bar-plugin/src/index.tsx +++ b/samples/sample-actions-bar-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleActionsBarPlugin from './sample-actions-bar-plugin/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { diff --git a/samples/sample-ui-events-plugin/src/index.tsx b/samples/sample-ui-events-plugin/src/index.tsx index 25f5e69b..c9aa5b06 100644 --- a/samples/sample-ui-events-plugin/src/index.tsx +++ b/samples/sample-ui-events-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUiEventsPlugin from './sample-ui-events-plugin-item/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { diff --git a/samples/sample-user-camera-dropdown-plugin/src/index.tsx b/samples/sample-user-camera-dropdown-plugin/src/index.tsx index f6182b85..db8382cb 100644 --- a/samples/sample-user-camera-dropdown-plugin/src/index.tsx +++ b/samples/sample-user-camera-dropdown-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserCameraDropdownPlugin from './sample-user-camera-dropdown-plugin-item/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { diff --git a/samples/sample-user-camera-helper-plugin/src/index.tsx b/samples/sample-user-camera-helper-plugin/src/index.tsx index 3d5c3026..f30f5044 100644 --- a/samples/sample-user-camera-helper-plugin/src/index.tsx +++ b/samples/sample-user-camera-helper-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserCameraHelperPlugin from './sample-user-camera-helper-plugin/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( { diff --git a/samples/sample-user-list-dropdown-plugin/src/index.tsx b/samples/sample-user-list-dropdown-plugin/src/index.tsx index 47801395..7c312f31 100644 --- a/samples/sample-user-list-dropdown-plugin/src/index.tsx +++ b/samples/sample-user-list-dropdown-plugin/src/index.tsx @@ -1,4 +1,3 @@ -import { BbbPluginSdk } from 'bigbluebutton-html-plugin-sdk'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import SampleUserListDropdownPlugin from './sample-user-list-dropdown-plugin-item/component'; @@ -7,8 +6,6 @@ const uuid = document.currentScript?.getAttribute('uuid') || 'root'; const pluginName = document.currentScript?.getAttribute('pluginName') || 'plugin'; -export const { logger: pluginLogger } = BbbPluginSdk.getPluginApi(uuid); - const root = ReactDOM.createRoot(document.getElementById(uuid)); root.render( Date: Wed, 12 Nov 2025 14:39:37 -0300 Subject: [PATCH 5/5] [new-logger-structure] resolve multiple runs of setLogger when new renders --- src/core/api/BbbPluginSdk.ts | 2 -- src/core/api/types.ts | 2 +- .../plugin-information/locale-messages/useLocaleMessages.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/core/api/BbbPluginSdk.ts b/src/core/api/BbbPluginSdk.ts index 22c02332..52bf5f38 100644 --- a/src/core/api/BbbPluginSdk.ts +++ b/src/core/api/BbbPluginSdk.ts @@ -56,7 +56,6 @@ import { useCustomQuery } from '../../data-consumption/domain/shared/custom-quer import { UseCustomQueryFunction } from '../../data-consumption/domain/shared/custom-query/types'; import { useCustomMutation } from '../../data-creation/hook'; import { UseCustomMutationFunction } from '../../data-creation/types'; -import pluginLogger from '../../utils/logger/logger'; declare const window: PluginBrowserWindow; @@ -203,7 +202,6 @@ export abstract class BbbPluginSdk { '': () => { }, }, getSessionToken: () => getSessionToken(), - logger: pluginLogger, pluginName, localesBaseUrl, }; diff --git a/src/core/api/types.ts b/src/core/api/types.ts index 6af176c7..b34a4b11 100644 --- a/src/core/api/types.ts +++ b/src/core/api/types.ts @@ -312,7 +312,7 @@ export interface PluginApi { /** * Function used to log in the console. */ - logger: Logger; + logger?: Logger; } export interface Console { diff --git a/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts b/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts index 51f88181..15dfb56a 100644 --- a/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts +++ b/src/core/auxiliary/plugin-information/locale-messages/useLocaleMessages.ts @@ -1,11 +1,11 @@ import { useEffect, useState } from 'react'; +import { pluginLogger } from '../../../../utils'; import { IntlMessages, UseLocaleMessagesProps } from './types'; import { fetchLocaleAndStore, mergeLocaleMessages, useGetNormalizedLocale } from './utils'; function useLocaleMessagesAuxiliary( { pluginApi, fetchConfigs }: UseLocaleMessagesProps, ): IntlMessages { - const { logger: pluginLogger } = pluginApi; const [loading, setLoading] = useState(true); const [messages, setMessages] = useState>({}); const [fallbackMessages, setFallbackMessages] = useState>();