Socket
Socket
Sign inDemoInstall

@bcaster/bcaster-lite-widget

Package Overview
Dependencies
0
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.14 to 0.0.15

2

dist/bcaster-lite-widget.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("BCasterLiteWidget",[],e):"object"==typeof exports?exports.BCasterLiteWidget=e():t.BCasterLiteWidget=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(1);var r=n(5),i=function(){function t(t){var e=t.appId,n=t.mobileView,i=t.mode,o=t.lang,a=t.tag;if(null==e)throw new Error("Missing appId in configurations options");if(void 0!==i&&"development"!==i&&"production"!==i)throw new Error("Mode option must be a string of either development or production");if(void 0!==o&&!r.SUPPORTED_LANGUAGES.includes(o))throw new Error("Lang option must be one of "+r.SUPPORTED_LANGUAGES);if(void 0!==n&&!0!==n&&!1!==n)throw new Error("mobileView option must be a boolean value");this.appId=e.toString(),this.mobileView=n||!0,this.mode=i||"production",this.lang=o||"en",this.tag=a||!1,this.appUrl="production"===this.mode?"https://lite.bcaster.com/"+this.appId+"-"+this.lang:"https://dev-lite.bcaster.com/"+this.appId+"-"+this.lang,this.redirectUrl=a?this.appUrl+"-"+this.tag:""+this.appUrl,this.widgetSvg='\n <svg width="78" height="78" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <circle id="b" cx="30" cy="30" r="30"/>\n <filter x="-29.2%" y="-17.5%" width="155%" height="155%" filterUnits="objectBoundingBox" id="a">\n <feMorphology radius="1.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>\n <feOffset dx="-1" dy="6" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>\n <feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0" in="shadowBlurOuter1"/>\n </filter>\n </defs>\n <g fill="none" fill-rule="evenodd">\n <g fill-rule="nonzero" transform="translate(10 3)">\n <use fill="#000" filter="url(#a)" xlink:href="#b"/>\n <use fill="#FFF" xlink:href="#b"/>\n </g>\n <g fill="#F7941D" fill-rule="nonzero">\n <path d="M53.907 25.575c-.73-.69-1.61-1.036-2.64-1.036H48l-.743-1.88c-.185-.452-.523-.84-1.014-1.168-.49-.327-.994-.491-1.51-.491h-7.466c-.516 0-1.019.164-1.51.49-.49.328-.828.717-1.013 1.169L34 24.539h-3.267c-1.03 0-1.91.345-2.64 1.036C27.366 26.266 27 27.1 27 28.077v12.384c0 .977.365 1.811 1.094 2.502.729.691 1.609 1.037 2.64 1.037h20.533c1.03 0 1.91-.346 2.64-1.037.728-.69 1.093-1.525 1.093-2.502V28.077c0-.977-.364-1.81-1.093-2.502zm-8.291 13.069c-1.279 1.212-2.817 1.818-4.616 1.818-1.799 0-3.337-.606-4.616-1.818-1.278-1.212-1.917-2.67-1.917-4.374 0-1.705.64-3.163 1.917-4.375 1.279-1.212 2.817-1.818 4.616-1.818 1.799 0 3.337.606 4.616 1.818 1.278 1.212 1.918 2.67 1.918 4.375 0 1.704-.64 3.162-1.918 4.374z"/>\n <path d="M41.06 30.177c-1.15 0-2.131.388-2.947 1.164-.816.776-1.224 1.71-1.224 2.802s.408 2.026 1.224 2.802c.816.776 1.798 1.163 2.947 1.163 1.148 0 2.13-.387 2.946-1.163.816-.776 1.224-1.71 1.224-2.802s-.408-2.026-1.224-2.802c-.815-.776-1.798-1.164-2.946-1.164z"/>\n </g>\n <path d="M41 12.66A2.83 2.83 0 1 1 41 7a2.83 2.83 0 0 1 0 5.66zM41 57a2.83 2.83 0 1 1 0-5.66A2.83 2.83 0 0 1 41 57zM18.83 34.358a2.83 2.83 0 1 1 0-5.66 2.83 2.83 0 0 1 0 5.66zm44.34 0a2.83 2.83 0 1 1 0-5.66 2.83 2.83 0 0 1 0 5.66zM57.749 22.33a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm-38.4 22.17a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm8.524-30.52a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm22.17 38.399a2.83 2.83 0 1 1 4.901-2.83 2.83 2.83 0 0 1-4.902 2.83zm.627-37.128a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm-22.17 38.4a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm-7.879-30.693a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm38.4 22.17a2.83 2.83 0 1 1 2.83-4.903 2.83 2.83 0 0 1-2.83 4.902z" fill="#F7941D" fill-rule="nonzero"/>\n </g>\n </svg>\n ',this.floatingBtn='\n <a href="#" class="bcaster-widget" onClick="(function(){ window.open(\''+this.redirectUrl+"');})();return false;\">\n "+this.widgetSvg+"\n </a>\n "}return t.prototype.mountFloatingBtn=function(){var t=document.getElementById("bcaster-floating-widget");if(!t){var e="Missing bcaster lite widget floating div. Ensure you have a div with the id 'bcaster-floating-widget' in your page";throw alert(e),new Error(e)}this.mobileView?/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)&&(t.innerHTML=this.floatingBtn):t.innerHTML=this.floatingBtn},t.prototype.mount=function(){this.mountFloatingBtn()},t}();t.exports=i},function(t,e,n){var r=n(2);"string"==typeof r&&(r=[[t.i,r,""]]);var i={insert:"head",singleton:!1};n(4)(r,i);r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(3)(!1)).push([t.i,"#bcaster-floating-widget {\n position: fixed;\n bottom: 10%;\n right: 1%;\n}\n.bcaster-widget img {\n width: 80px;\n height: 80px;\n}\n@media only screen and (min-width: 600px) {\n .bcaster-widget img {\n width: 120px;\n height: 120px;\n }\n}",""])},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(a=r,s=btoa(unescape(encodeURIComponent(JSON.stringify(a)))),u="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(u," */")),o=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot).concat(t," */")}));return[n].concat(o).concat([i]).join("\n")}var a,s,u;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(n,"}"):n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];null!=o&&(r[o]=!0)}for(var a=0;a<t.length;a++){var s=t[a];null!=s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="(".concat(s[2],") and (").concat(n,")")),e.push(s))}},e}},function(t,e,n){"use strict";var r,i={},o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},a=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}();function s(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function u(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=i[r.id],a=0;if(o){for(o.refs++;a<o.parts.length;a++)o.parts[a](r.parts[a]);for(;a<r.parts.length;a++)o.parts.push(v(r.parts[a],e))}else{for(var s=[];a<r.parts.length;a++)s.push(v(r.parts[a],e));i[r.id]={id:r.id,refs:1,parts:s}}}}function l(t){var e=document.createElement("style");if(void 0===t.attributes.nonce){var r=n.nc;r&&(t.attributes.nonce=r)}if(Object.keys(t.attributes).forEach((function(n){e.setAttribute(n,t.attributes[n])})),"function"==typeof t.insert)t.insert(e);else{var i=a(t.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(e)}return e}var c,f=(c=[],function(t,e){return c[t]=e,c.filter(Boolean).join("\n")});function d(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=f(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}function p(t,e,n){var r=n.css,i=n.media,o=n.sourceMap;if(i&&t.setAttribute("media",i),o&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var h=null,g=0;function v(t,e){var n,r,i;if(e.singleton){var o=g++;n=h||(h=l(e)),r=d.bind(null,n,o,!1),i=d.bind(null,n,o,!0)}else n=l(e),r=p.bind(null,n,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).attributes="object"==typeof e.attributes?e.attributes:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=o());var n=s(t,e);return u(n,e),function(t){for(var r=[],o=0;o<n.length;o++){var a=n[o],l=i[a.id];l&&(l.refs--,r.push(l))}t&&u(s(t,e),e);for(var c=0;c<r.length;c++){var f=r[c];if(0===f.refs){for(var d=0;d<f.parts.length;d++)f.parts[d]();delete i[f.id]}}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SUPPORTED_LANGUAGES=["en","fi"]}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("BCasterLiteWidget",[],t):"object"==typeof exports?exports.BCasterLiteWidget=t():e.BCasterLiteWidget=t()}(window,(function(){return n={},e.m=t=[function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(1);var r=n(5),i=(o.prototype.generateRandomCharacters=function(e){for(var t="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length,i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*r));return t},o.prototype.setRedirectUrl=function(){var e=this.appUrl+"-"+this.userUniqueID+"-"+this.lang;this.redirectUrl=this.tag?e+"-"+this.tag:e},o.prototype.mountFloatingBtn=function(){var e=this.elementToMount,t='\n <a href="#" class="bcaster-widget" onClick="(function(){ window.open(\''+this.redirectUrl+"');})();return false;\">\n "+this.widgetSvg+"\n </a>\n ";e.id="bcaster-floating-widget",this.mobileView?/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)&&(e.innerHTML=t):e.innerHTML=t},o.prototype.mountUserDefinedWidget=function(){var e=this.elementToMount,t=this.redirectUrl;if(!Array.from(e.attributes).map((function(e){return e.name})).includes("href"))throw new Error("The element with the bcaster-widget is not a HTML <a> Tag with a href attribute. Please use an <a> tag with href attribute. See the documentation for examples.");e.href=t,e.target="_blank"},o.prototype.getUserUniqueID=function(){var e=void 0;try{e=localStorage.getItem("bcasterBrowserID")}catch(e){console.log("Generating unique ID for bcaster camera")}if(null!=e&&""!==e)return e;var t=this.generateRandomCharacters(20);return localStorage.setItem("bcasterBrowserID",t),t},o.prototype.mount=function(){var e=document.getElementById("bcaster-widget");if(!e){var t="Missing bcaster mounting element. Ensure you have an element with the id 'bcaster-widget' in your page";throw alert(t),new Error(t)}this.elementToMount=e,this.userUniqueID=this.getUserUniqueID(),this.setRedirectUrl(),this.userDefinedWidget?this.mountUserDefinedWidget():this.mountFloatingBtn()},o);function o(e){var t=e.appId,n=e.mobileView,i=e.mode,o=e.lang,a=e.tag,s=e.userDefinedWidget;if(null==t)throw new Error("Missing appId in configurations options");if(void 0!==i&&"development"!==i&&"production"!==i)throw new Error("Mode option must be a string of either development or production");if(void 0!==o&&!r.SUPPORTED_LANGUAGES.includes(o))throw new Error("Lang option must be one of "+r.SUPPORTED_LANGUAGES);if(void 0!==n&&!0!==n&&!1!==n)throw new Error("mobileView option must be a boolean value");if(void 0!==s&&!0!==s&&!1!==s)throw new Error("userDefinedWidget option must be a boolean value");this.appId=t.toString(),this.mobileView=n||!0,this.userDefinedWidget=s||!1,this.mode=i||"production",this.lang=o||"en",this.tag=a||!1,this.elementToMount=null,this.appUrl="production"===this.mode?"https://lite.bcaster.com/"+this.appId:"https://dev-lite.bcaster.com/"+this.appId,this.redirectUrl="",this.widgetSvg='\n <svg width="78" height="78" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <circle id="b" cx="30" cy="30" r="30"/>\n <filter x="-29.2%" y="-17.5%" width="155%" height="155%" filterUnits="objectBoundingBox" id="a">\n <feMorphology radius="1.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>\n <feOffset dx="-1" dy="6" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>\n <feGaussianBlur stdDeviation="3" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>\n <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0" in="shadowBlurOuter1"/>\n </filter>\n </defs>\n <g fill="none" fill-rule="evenodd">\n <g fill-rule="nonzero" transform="translate(10 3)">\n <use fill="#000" filter="url(#a)" xlink:href="#b"/>\n <use fill="#FFF" xlink:href="#b"/>\n </g>\n <g fill="#F7941D" fill-rule="nonzero">\n <path d="M53.907 25.575c-.73-.69-1.61-1.036-2.64-1.036H48l-.743-1.88c-.185-.452-.523-.84-1.014-1.168-.49-.327-.994-.491-1.51-.491h-7.466c-.516 0-1.019.164-1.51.49-.49.328-.828.717-1.013 1.169L34 24.539h-3.267c-1.03 0-1.91.345-2.64 1.036C27.366 26.266 27 27.1 27 28.077v12.384c0 .977.365 1.811 1.094 2.502.729.691 1.609 1.037 2.64 1.037h20.533c1.03 0 1.91-.346 2.64-1.037.728-.69 1.093-1.525 1.093-2.502V28.077c0-.977-.364-1.81-1.093-2.502zm-8.291 13.069c-1.279 1.212-2.817 1.818-4.616 1.818-1.799 0-3.337-.606-4.616-1.818-1.278-1.212-1.917-2.67-1.917-4.374 0-1.705.64-3.163 1.917-4.375 1.279-1.212 2.817-1.818 4.616-1.818 1.799 0 3.337.606 4.616 1.818 1.278 1.212 1.918 2.67 1.918 4.375 0 1.704-.64 3.162-1.918 4.374z"/>\n <path d="M41.06 30.177c-1.15 0-2.131.388-2.947 1.164-.816.776-1.224 1.71-1.224 2.802s.408 2.026 1.224 2.802c.816.776 1.798 1.163 2.947 1.163 1.148 0 2.13-.387 2.946-1.163.816-.776 1.224-1.71 1.224-2.802s-.408-2.026-1.224-2.802c-.815-.776-1.798-1.164-2.946-1.164z"/>\n </g>\n <path d="M41 12.66A2.83 2.83 0 1 1 41 7a2.83 2.83 0 0 1 0 5.66zM41 57a2.83 2.83 0 1 1 0-5.66A2.83 2.83 0 0 1 41 57zM18.83 34.358a2.83 2.83 0 1 1 0-5.66 2.83 2.83 0 0 1 0 5.66zm44.34 0a2.83 2.83 0 1 1 0-5.66 2.83 2.83 0 0 1 0 5.66zM57.749 22.33a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm-38.4 22.17a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm8.524-30.52a2.83 2.83 0 1 1 4.902-2.83 2.83 2.83 0 0 1-4.902 2.83zm22.17 38.399a2.83 2.83 0 1 1 4.901-2.83 2.83 2.83 0 0 1-4.902 2.83zm.627-37.128a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm-22.17 38.4a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm-7.879-30.693a2.83 2.83 0 1 1 2.83-4.902 2.83 2.83 0 0 1-2.83 4.902zm38.4 22.17a2.83 2.83 0 1 1 2.83-4.903 2.83 2.83 0 0 1-2.83 4.902z" fill="#F7941D" fill-rule="nonzero"/>\n </g>\n </svg>\n '}e.exports=i},function(e,t,n){var r=n(2);"string"==typeof r&&(r=[[e.i,r,""]]);n(4)(r,{insert:"head",singleton:!1}),r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(3)(!1)).push([e.i,"#bcaster-floating-widget {\n position: fixed;\n bottom: 10%;\n right: 1%;\n}\n.bcaster-widget img {\n width: 80px;\n height: 80px;\n}\n@media only screen and (min-width: 600px) {\n .bcaster-widget img {\n width: 120px;\n height: 120px;\n }\n}",""])},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=function(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}(r),o=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")}));return[n].concat(o).concat([i]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];null!=o&&(r[o]=!0)}for(var a=0;a<e.length;a++){var s=e[a];null!=s[0]&&r[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="(".concat(s[2],") and (").concat(n,")")),t.push(s))}},t}},function(e,t,n){"use strict";var r,i,o={},a=(i={},function(e){if(void 0===i[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}i[e]=t}return i[e]});function s(e,t){for(var n=[],r={},i=0;i<e.length;i++){var o=e[i],a=t.base?o[0]+t.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function u(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=o[r.id],a=0;if(i){for(i.refs++;a<i.parts.length;a++)i.parts[a](r.parts[a]);for(;a<r.parts.length;a++)i.parts.push(g(r.parts[a],t))}else{for(var s=[];a<r.parts.length;a++)s.push(g(r.parts[a],t));o[r.id]={id:r.id,refs:1,parts:s}}}}function l(e){var t=document.createElement("style");if(void 0===e.attributes.nonce){var r=n.nc;r&&(e.attributes.nonce=r)}if(Object.keys(e.attributes).forEach((function(n){t.setAttribute(n,e.attributes[n])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var c,d=(c=[],function(e,t){return c[e]=t,c.filter(Boolean).join("\n")});function f(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var o=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(o,a[t]):e.appendChild(o)}}var p=null,h=0;function g(e,t){var n,r,i;if(t.singleton){var o=h++;n=p=p||l(t),r=f.bind(null,n,o,!1),i=f.bind(null,n,o,!0)}else n=l(t),r=function(e,t,n){var r=n.css,i=n.media,o=n.sourceMap;if(i&&e.setAttribute("media",i),o&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}.bind(null,n,t),i=function(){!function(e){null!==e.parentNode&&e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).attributes="object"==typeof t.attributes?t.attributes:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r));var n=s(e,t);return u(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var a=n[i],l=o[a.id];l&&(l.refs--,r.push(l))}e&&u(s(e,t),t);for(var c=0;c<r.length;c++){var d=r[c];if(0===d.refs){for(var f=0;f<d.parts.length;f++)d.parts[f]();delete o[d.id]}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SUPPORTED_LANGUAGES=["en","fi"]}],e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(e){return t[e]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e.p="",e(e.s=0);function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var t,n}));
{
"name": "@bcaster/bcaster-lite-widget",
"version": "0.0.14",
"version": "0.0.15",
"description": "> An Embeddable web widget for the Bcaster Lite App",

@@ -29,2 +29,3 @@ "main": "dist/bcaster-lite-widget.js",

"typescript": "^3.7.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.40.2",

@@ -31,0 +32,0 @@ "webpack-cli": "^3.3.9"

@@ -8,4 +8,4 @@ # bcaster-lite-widget

The BCaster Lite Widget can be installed/imported via
* [CDN UNPKG](https://unpkg.com/@bcaster/bcaster-lite-widget@0.0.14/dist/bcaster-lite-widget.js)
* [CDN JSDELIVR](https://cdn.jsdelivr.net/npm/@bcaster/bcaster-lite-widget@0.0.14/dist/bcaster-lite-widget.min.js)
* [CDN UNPKG](https://unpkg.com/@bcaster/bcaster-lite-widget@0.0.15/dist/bcaster-lite-widget.js)
* [CDN JSDELIVR](https://cdn.jsdelivr.net/npm/@bcaster/bcaster-lite-widget@0.0.15/dist/bcaster-lite-widget.min.js)
* [NPM](https://www.npmjs.com/package/@bcaster/bcaster-lite-widget)

@@ -17,14 +17,23 @@

To get the BCaster Lite Widget working, copy any of the following code snippet examples that apply, into your web project and `replace the appId value with your unique bcaster lite app Id` and the label with your `unique default label` gotten from the BCaster Dashboard Credentials section.
To get the BCaster Lite Widget working, copy any of the following code snippet examples that apply, into your web project and `replace the appId value with your unique bcaster lite app Id` gotten from the BCaster Dashboard Credentials section.
> ⚠️ In order for the widget to mount, you are required to have an empty div with an id `bcaster-floating-widget` in your html page. The div should be on the page before `mount` event is triggered
> ⚠️ In order for the widget to mount, you are required to have an empty div (if using the default widget) or an anchor tag (if providing your own custom widget) with an id `bcaster-widget` in your html page. The div or anchor tag should be on the page before the `mount` function is triggered.
```html
```html{1}
// For default widget
<div id="bcaster-floating-widget"></div>
```
or
```html{1}
// For a user custom widget - ensure the <a> tag has a blank href attribute
<a id="bcaster-widget" href="">
// Custom user html
</a>
```
### Embedding via CDN
```html
<script src="https://unpkg.com/@bcaster/bcaster-lite-widget@0.0.14/dist/bcaster-lite-widget.js"></script>
```html{1}
/* Using the default widget */
<script src="https://unpkg.com/@bcaster/bcaster-lite-widget@0.0.15/dist/bcaster-lite-widget.js"></script>
<script>

@@ -37,2 +46,14 @@ const widget = new BCasterLiteWidget({

```
or
```html{1}
/* Using a custom defined widget */
<script src="https://unpkg.com/@bcaster/bcaster-lite-widget@0.0.15/dist/bcaster-lite-widget.js"></script>
<script>
const widget = new BCasterLiteWidget({
appId: '7ddc01afa5f5e4d10d80eff0d173a8d1e0a3',
userDefinedWidget: true,
});
widget.mount();
</script>
```

@@ -43,3 +64,4 @@ ### Embedding via NPM (ES5 and older)

```javascript
```javascript{1}
/* Using the default widget */
const BCasterLiteWidget = require('@bcaster/bcaster-lite-widget')

@@ -51,5 +73,13 @@ const widget = new BCasterLiteWidget({

```
or
```javascript{1}
/* Using a custom defined widget */
const BCasterLiteWidget = require('@bcaster/bcaster-lite-widget')
const widget = new BCasterLiteWidget({
appId:'7ddc01afa5f5e4d10d80eff0d173a8d1e0a3',
userDefinedWidget: true,
});
widget.mount();
```
### Embedding via NPM (ES6 and later)

@@ -59,3 +89,4 @@

```typescript
```typescript{1}
/* Using the default widget */
import BCasterLiteWidget from '@bcaster/bcaster-lite-widget'

@@ -68,3 +99,14 @@

```
or
```typescript{1}
/* Using a custom defined widget */
import BCasterLiteWidget from '@bcaster/bcaster-lite-widget'
const widget = new BCasterLiteWidget({
appId:'7ddc01afa5f5e4d10d80eff0d173a8d1e0a3',
userDefinedWidget: true,
});
widget.mount();
```
## Configuration Options

@@ -81,2 +123,3 @@

@param {String} args.tag (Optional) {Defaults to the unique label} Tag defined for media categorization - Retrieved from the BCaster Dashboard
@param {Boolean} args.userDefinedWidget (Optional) {Default False} A boolean value to determine of the user would prefer to use thier own widget

@@ -90,2 +133,3 @@ @example

tag: 'bcaster',
userDefinedWidget: false
})

@@ -172,1 +216,7 @@ ```

2. Improve custom error messages output.
## Version 0.0.15
1. Introduce optional `userDefinedWidget` option to enable users define custom widgets.
2. Add accessibility check to ensure all user defined widgets are wrapped in an anchor tag.
3. Update documentation examples to show how to use user defined widgets.

@@ -6,5 +6,8 @@ require('./styles/style.css');

class BCasterLiteWidget {
public floatingBtn: string;
public mobileView: boolean;
private mobileView: boolean;
private userDefinedWidget: boolean;
private redirectUrl: string;
private appUrl: string;
private userUniqueID: string;
private elementToMount: HTMLElement;
private appId: string;

@@ -14,4 +17,2 @@ private mode: string;

private tag: string | boolean;
private appUrl: string;
private redirectUrl: string;
private widgetSvg: string;

@@ -26,2 +27,3 @@

* @param {String} args.tag (Optional) {Defaults to the unique label} Tag defined for media categorization - Retrieved from the BCaster Dashboard
* @param {Boolean} args.userDefinedWidget (Optional) {Default False} A boolean value to determine of the user would prefer to use thier own widget
* @example

@@ -34,2 +36,3 @@ * const widget = new BCasterLiteWidget({

* tag: 'bcaster',
* userDefinedWidget: false,
* })

@@ -40,3 +43,3 @@ * @example

constructor(args: argsType) {
const { appId, mobileView, mode, lang, tag } = args
const { appId, mobileView, mode, lang, tag, userDefinedWidget } = args
if (appId === null || appId === undefined) {

@@ -60,12 +63,19 @@ throw new Error('Missing appId in configurations options');

}
if (userDefinedWidget !== undefined) {
if (userDefinedWidget !== true && userDefinedWidget !== false) {
throw new Error('userDefinedWidget option must be a boolean value');
}
}
this.appId = appId.toString();
this.mobileView = mobileView || true;
this.userDefinedWidget = userDefinedWidget || false;
this.mode = mode || 'production';
this.lang = lang || 'en';
this.tag = tag || false;
this.elementToMount = null;
this.appUrl =
this.mode === 'production'
? `https://lite.bcaster.com/${this.appId}-${this.lang}`
: `https://dev-lite.bcaster.com/${this.appId}-${this.lang}`
this.redirectUrl = tag ? `${this.appUrl}-${this.tag}` : `${this.appUrl}`
? `https://lite.bcaster.com/${this.appId}`
: `https://dev-lite.bcaster.com/${this.appId}`;
this.redirectUrl = '';
this.widgetSvg = `

@@ -94,4 +104,24 @@ <svg width="78" height="78" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

</svg>
`
this.floatingBtn = `
`;
}
private generateRandomCharacters(length: number) {
let result = ''
const characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const charactersLength = characters.length
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength))
}
return result
}
private setRedirectUrl() {
const url = `${this.appUrl}-${this.userUniqueID}-${this.lang}`
this.redirectUrl = this.tag ? `${url}-${this.tag}` : `${url}`
}
private mountFloatingBtn() {
const floatingBtnDiv = this.elementToMount
const floatingBtn = `
<a href="#" class="bcaster-widget" onClick="(function(){ window.open('${this.redirectUrl}');})();return false;">

@@ -101,22 +131,56 @@ ${this.widgetSvg}

`;
}
private mountFloatingBtn() {
const floatingBtnDiv = document.getElementById('bcaster-floating-widget');
if (!floatingBtnDiv) {
const ErrMsg = `Missing bcaster lite widget floating div. Ensure you have a div with the id 'bcaster-floating-widget' in your page`;
alert(ErrMsg)
throw new Error(ErrMsg);
}
floatingBtnDiv.id = "bcaster-floating-widget"
if (this.mobileView) {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
floatingBtnDiv.innerHTML = this.floatingBtn;
floatingBtnDiv.innerHTML = floatingBtn;
}
} else {
floatingBtnDiv.innerHTML = this.floatingBtn;
floatingBtnDiv.innerHTML = floatingBtn;
}
}
private mountUserDefinedWidget() {
const elementToMount = this.elementToMount
const redirectUrl = this.redirectUrl
const elementIsAnAnchorTag = Array.from(elementToMount.attributes).map(attribute => attribute.name).includes('href')
if (elementIsAnAnchorTag) {
// @ts-ignore
elementToMount.href = redirectUrl
// @ts-ignore
elementToMount.target = "_blank"
} else {
throw new Error(
`The element with the bcaster-widget is not a HTML <a> Tag with a href attribute. Please use an <a> tag with href attribute. See the documentation for examples.`
)
}
}
private getUserUniqueID() {
let userUniqueId: string | undefined | null = undefined
try {
userUniqueId = localStorage.getItem('bcasterBrowserID')
} catch (error) {
console.log('Generating unique ID for bcaster camera')
}
if ((userUniqueId === undefined) || (userUniqueId === null) || (userUniqueId === '')) {
const uniqueID = this.generateRandomCharacters(20)
localStorage.setItem('bcasterBrowserID', uniqueID)
return uniqueID
} else {
return userUniqueId
}
}
public mount() {
this.mountFloatingBtn();
const elementToMount = document.getElementById('bcaster-widget');
if (!elementToMount) {
const ErrMsg = `Missing bcaster mounting element. Ensure you have an element with the id 'bcaster-widget' in your page`;
alert(ErrMsg)
throw new Error(ErrMsg);
} else {
this.elementToMount = elementToMount;
this.userUniqueID = this.getUserUniqueID();
this.setRedirectUrl();
this.userDefinedWidget ? this.mountUserDefinedWidget() : this.mountFloatingBtn();
}
}

@@ -123,0 +187,0 @@ }

@@ -18,2 +18,3 @@ enum ModeOption {

tag: string
userDefinedWidget: boolean
}
const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

@@ -13,2 +14,3 @@ module.exports = {

},
plugins: [new UglifyJsPlugin()],
module: {

@@ -15,0 +17,0 @@ rules: [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc