crosstalk-comments-livechat-sdk 0.0.4 → 0.0.5-beta.1
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/dist/crosstalk_sdk.min.js +2 -0
- package/dist/crosstalk_sdk.min.js.map +1 -0
- package/dist/types/CrossTalkAISummaryEmbed.d.ts +15 -0
- package/dist/{CrossTalkCommentsEmbed.d.ts → types/CrossTalkCommentsEmbed.d.ts} +1 -0
- package/dist/types/CrossTalkPollEmbed.d.ts +15 -0
- package/dist/{CrossTalkVideoPlayerEmbed.d.ts → types/CrossTalkVideoPlayerEmbed.d.ts} +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/{types.d.ts → types/types.d.ts} +12 -0
- package/package.json +37 -7
- package/dist/CrossTalkCommentsEmbed.js +0 -78
- package/dist/CrossTalkVideoPlayerEmbed.js +0 -90
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/types.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["crosstalk-comments-livechat-sdk"]=t():e["crosstalk-comments-livechat-sdk"]=t()}(this,()=>(()=>{"use strict";var e={};class t{constructor(e,t){this.container=e,this.config=t,this.iframe=null,this.messageHandler=null,this.render()}setupMessageListener(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.messageHandler=e=>{if((!this.iframe||e.source===this.iframe.contentWindow)&&e.origin.includes(".crosstalk.cc"))try{const t=JSON.parse(e.data);t.asize&&(this.iframe.style.height=`${t.asize}px`)}catch(e){}},window.addEventListener("message",this.messageHandler)}render(){this.container.innerHTML="",this.iframe=document.createElement("iframe"),this.iframe.src=function(e){const t=new URLSearchParams;return e.wp&&t.append("wp",e.wp),e.url&&t.append("url",e.url),e.theme&&t.append("theme",e.theme),`https://widgets.crosstalk.cc/ai_summary?${t.toString()}`}(this.config),this.iframe.setAttribute("style","width: 100%; scrollbar-width:thin !important"),this.iframe.setAttribute("frameborder","0"),this.iframe.sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups",this.iframe.scrolling="no",this.container.appendChild(this.iframe),this.setupMessageListener()}update(e){this.config={...this.config,...e},this.render()}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.iframe.parentNode&&(this.iframe.parentNode.removeChild(this.iframe),this.iframe=null)}getIframe(){return this.iframe}}function s(e,s){return new t(e,s)}class i{constructor(e,t){this.container=e,this.config=t,this.iframe=null,this.messageHandler=null,this.render()}setupMessageListener(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.messageHandler=e=>{if((!this.iframe||e.source===this.iframe.contentWindow)&&e.origin.includes(".crosstalk.cc"))try{const t=JSON.parse(e.data);t.csize&&(this.iframe.style.height=`${t.csize}px`)}catch(e){}},window.addEventListener("message",this.messageHandler)}render(){this.container.innerHTML="",this.iframe=document.createElement("iframe"),this.iframe.src=function(e){const t=new URLSearchParams;return t.append("wp",e.wp),e.url?t.append("url",e.url):e.pageID&&t.append("pageID",e.pageID),e.theme&&t.append("theme",e.theme),void 0!==e.reactions&&t.append("reactions",String(e.reactions)),`https://widgets.crosstalk.cc/comments?${t.toString()}`}(this.config),this.iframe.setAttribute("style","width: 100%; scrollbar-width:thin !important"),this.iframe.setAttribute("frameborder","0"),this.iframe.sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups",this.iframe.scrolling="no",this.container.appendChild(this.iframe),this.setupMessageListener()}update(e){this.config={...this.config,...e},this.render()}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.iframe.parentNode&&(this.iframe.parentNode.removeChild(this.iframe),this.iframe=null)}getIframe(){return this.iframe}}function a(e,t){return new i(e,t)}class r{constructor(e,t){this.container=e,this.config=t,this.iframe=null,this.messageHandler=null,this.render()}setupMessageListener(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.messageHandler=e=>{if((!this.iframe||e.source===this.iframe.contentWindow)&&e.origin.includes(".crosstalk.cc"))try{const t=JSON.parse(e.data);t.psize&&(this.iframe.style.height=`${t.psize}px`)}catch(e){}},window.addEventListener("message",this.messageHandler)}render(){this.container.innerHTML="",this.iframe=document.createElement("iframe"),this.iframe.src=function(e){const t=new URLSearchParams;return t.append("wp",e.wp),e.url?t.append("url",e.url):e.pageID&&t.append("pageID",e.pageID),e.theme&&t.append("theme",e.theme),e.pollID&&t.append("pollID",e.pollID),`https://widgets.crosstalk.cc/poll?${t.toString()}`}(this.config),this.iframe.setAttribute("style","width: 100%; scrollbar-width:thin !important"),this.iframe.setAttribute("frameborder","0"),this.iframe.sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups",this.iframe.scrolling="no",this.container.appendChild(this.iframe),this.setupMessageListener()}update(e){this.config={...this.config,...e},this.render()}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.iframe.parentNode&&(this.iframe.parentNode.removeChild(this.iframe),this.iframe=null)}getIframe(){return this.iframe}}function n(e,t){return new r(e,t)}class o{constructor(e,t){this.container=e,this.config=t,this.iframe=null,this.messageHandler=null,this.render()}setupMessageListener(){this.messageHandler&&window.removeEventListener("message",this.messageHandler),this.messageHandler=e=>{if((!this.iframe||e.source===this.iframe.contentWindow)&&e.origin.includes(".crosstalk.cc"))try{const t=JSON.parse(e.data);t.vsize&&(this.iframe.style.height=`${t.vsize}px`)}catch(e){}},window.addEventListener("message",this.messageHandler)}render(){this.container.innerHTML="",this.iframe=document.createElement("iframe"),this.iframe.src=function(e){const t=new URLSearchParams;return t.append("wp",e.wp),e.url?t.append("url",e.url):e.pageID&&t.append("pageID",e.pageID),e.theme&&t.append("theme",e.theme),e.src&&e.srcType&&(t.append("src",e.src),t.append("srcType",e.srcType)),e.ytvid&&t.append("ytvid",e.ytvid),e.rtvid&&t.append("rtvid",e.rtvid),e.vkvid&&t.append("vkvid",e.vkvid),e.vklive&&t.append("vklive",e.vklive),e.vimeoid&&t.append("vimeoid",e.vimeoid),`https://widgets.crosstalk.cc/video?${t.toString()}`}(this.config),this.iframe.setAttribute("style","width: 100%; scrollbar-width:thin !important"),this.iframe.setAttribute("frameborder","0"),this.iframe.sandbox="allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups",this.iframe.scrolling="auto",this.container.appendChild(this.iframe),this.setupMessageListener()}update(e){this.config={...this.config,...e},this.render()}destroy(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.iframe&&this.iframe.parentNode&&(this.iframe.parentNode.removeChild(this.iframe),this.iframe=null)}getIframe(){return this.iframe}}function d(e,t){return new o(e,t)}const l={initComments:a,initPlayer:d,initPoll:n,initAISummary:s,initAll(){return console.log("crosstalk initialised"),function(){const e=document.querySelectorAll("div[data-crosstalk-comments]"),t=[];e.forEach(e=>{const s=a(e,{wp:e.dataset.wp,url:e.dataset.url||"",pageID:e.dataset.pageId||"",theme:e.dataset.theme||"light",reactions:"true"===e.dataset.reactions});s&&t.push(s)})}(),function(){const e=document.querySelectorAll("div[data-crosstalk-video-player]"),t=[];e.forEach(e=>{const s=d(e,{wp:e.dataset.wp,url:e.dataset.url||"",pageID:e.dataset.pageId||"",theme:e.dataset.theme||"light",src:e.dataset.src||"",srcType:e.dataset.srcType||"",ytvid:e.dataset.ytId||"",rtvid:e.dataset.rtId||"",vkvid:e.dataset.vkId||"",vklive:e.dataset.vkLive||"",vimeoid:e.dataset.vimeoId||""});s&&t.push(s)})}(),function(){const e=document.querySelectorAll("div[data-crosstalk-poll]"),t=[];e.forEach(e=>{const s=n(e,{wp:e.dataset.wp,url:e.dataset.url||"",pageID:e.dataset.pageId||"",theme:e.dataset.theme||"light",pollID:e.dataset.pollId||""});s&&t.push(s)})}(),function(){const e=document.querySelectorAll("div[data-crosstalk-ai-summary]"),t=[];e.forEach(e=>{const i=s(e,{wp:e.dataset.wp||"",url:e.dataset.url||"",theme:e.dataset.theme||"light"});i&&t.push(i)})}(),this}};return"undefined"!=typeof window&&(console.log("in browser"),window.CTCore=l,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>l.initAll()):l.initAll()),e.default})());
|
|
2
|
+
//# sourceMappingURL=crosstalk_sdk.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crosstalk_sdk.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAQ,mCAAqCD,IAE7CD,EAAK,mCAAqCC,GAC3C,CATD,CASGK,KAAM,I,4BCEF,MAAMC,EACT,WAAAC,CAAYC,EAAWC,GACnBJ,KAAKG,UAAYA,EACjBH,KAAKI,OAASA,EACdJ,KAAKK,OAAS,KACdL,KAAKM,eAAiB,KACtBN,KAAKO,QACT,CACA,oBAAAC,GACQR,KAAKM,gBACLG,OAAOC,oBAAoB,UAAWV,KAAKM,gBAE/CN,KAAKM,eAAkBK,IACnB,KAAIX,KAAKK,QAAUM,EAAMC,SAAWZ,KAAKK,OAAOQ,gBAG5CF,EAAMG,OAAOC,SAAS,iBACtB,IACI,MAAMC,EAAMC,KAAKC,MAAMP,EAAMQ,MACzBH,EAAII,QACJpB,KAAKK,OAAOgB,MAAMC,OAAS,GAAGN,EAAII,UAC1C,CACA,MAAOG,GAAM,GAGrBd,OAAOe,iBAAiB,UAAWxB,KAAKM,eAC5C,CACA,MAAAC,GACIP,KAAKG,UAAUsB,UAAY,GAC3BzB,KAAKK,OAASqB,SAASC,cAAc,UACrC3B,KAAKK,OAAOuB,IAzCpB,SAAwBxB,GACpB,MACMyB,EAAS,IAAIC,gBAOnB,OANI1B,EAAO2B,IACPF,EAAOG,OAAO,KAAM5B,EAAO2B,IAC3B3B,EAAO6B,KACPJ,EAAOG,OAAO,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+D,EAAMpB,QAAQ3C,OAAS,UAG9B0C,GACAoB,EAASjB,KAAKH,IAG1B,CIrEQsB,GACOlG,IACX,G,MAMkB,oBAAXS,SACP4D,QAAQC,IAAI,cACZ7D,OAAO0D,OAASA,EACY,YAAxBzC,SAASyE,WACTzE,SAASF,iBAAiB,mBAAoB,IAAM2C,EAAOC,WAE3DD,EAAOC,W","sources":["webpack://crosstalk-comments-livechat-sdk/webpack/universalModuleDefinition","webpack://crosstalk-comments-livechat-sdk/./src/CrossTalkAISummaryEmbed.ts","webpack://crosstalk-comments-livechat-sdk/./src/CrossTalkCommentsEmbed.ts","webpack://crosstalk-comments-livechat-sdk/./src/CrossTalkPollEmbed.ts","webpack://crosstalk-comments-livechat-sdk/./src/CrossTalkVideoPlayerEmbed.ts","webpack://crosstalk-comments-livechat-sdk/./src/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"crosstalk-comments-livechat-sdk\"] = factory();\n\telse\n\t\troot[\"crosstalk-comments-livechat-sdk\"] = factory();\n})(this, () => {\nreturn ","function buildIframeUrl(config) {\n const baseUrl = 'https://widgets.crosstalk.cc/ai_summary';\n const params = new URLSearchParams();\n if (config.wp)\n params.append('wp', config.wp);\n if (config.url)\n params.append('url', config.url);\n if (config.theme)\n params.append('theme', config.theme);\n return `${baseUrl}?${params.toString()}`;\n}\nexport class CrossTalkAISummaryEmbed {\n constructor(container, config) {\n this.container = container;\n this.config = config;\n this.iframe = null;\n this.messageHandler = null;\n this.render();\n }\n setupMessageListener() {\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n }\n this.messageHandler = (event) => {\n if (this.iframe && event.source !== this.iframe.contentWindow) {\n return;\n }\n if (event.origin.includes('.crosstalk.cc')) {\n try {\n const msg = JSON.parse(event.data);\n if (msg.asize)\n this.iframe.style.height = `${msg.asize}px`;\n }\n catch (_a) { }\n }\n };\n window.addEventListener('message', this.messageHandler);\n }\n render() {\n this.container.innerHTML = '';\n this.iframe = document.createElement('iframe');\n this.iframe.src = buildIframeUrl(this.config);\n this.iframe.setAttribute(\"style\", \"width: 100%; scrollbar-width:thin !important\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.sandbox = \"allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups\";\n this.iframe.scrolling = \"no\";\n this.container.appendChild(this.iframe);\n this.setupMessageListener();\n }\n update(config) {\n this.config = { ...this.config, ...config };\n this.render();\n }\n destroy() {\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n this.messageHandler = null;\n }\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n }\n getIframe() {\n return this.iframe;\n }\n}\nexport function initAISummary(container, config) {\n return new CrossTalkAISummaryEmbed(container, config);\n}\nexport function autoInitAISummaries() {\n const aiDivs = document.querySelectorAll('div[data-crosstalk-ai-summary]');\n const aiEmbeds = [];\n aiDivs.forEach(aiDiv => {\n const config = {\n wp: aiDiv.dataset.wp || \"\",\n url: aiDiv.dataset.url || \"\",\n theme: aiDiv.dataset.theme || \"light\"\n };\n const instance = initAISummary(aiDiv, config);\n if (instance)\n aiEmbeds.push(instance);\n });\n return aiEmbeds;\n}\n","function buildIframeUrl(config) {\n const baseUrl = 'https://widgets.crosstalk.cc/comments';\n const params = new URLSearchParams();\n params.append('wp', config.wp);\n if (config.url)\n params.append('url', config.url);\n else if (config.pageID)\n params.append('pageID', config.pageID);\n if (config.theme)\n params.append('theme', config.theme);\n if (config.reactions !== undefined)\n params.append('reactions', String(config.reactions));\n return `${baseUrl}?${params.toString()}`;\n}\nexport class CrossTalkCommentsEmbed {\n constructor(container, config) {\n this.container = container;\n this.config = config;\n this.iframe = null;\n this.messageHandler = null;\n this.render();\n }\n setupMessageListener() {\n // Remove existing listener if any\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n }\n this.messageHandler = (event) => {\n // Basic security check - verify the message is from our iframe\n if (this.iframe && event.source !== this.iframe.contentWindow) {\n return;\n }\n if (event.origin.includes('.crosstalk.cc')) {\n try {\n const msg = JSON.parse(event.data);\n if (msg.csize)\n this.iframe.style.height = `${msg.csize}px`;\n }\n catch (_a) { }\n }\n };\n window.addEventListener('message', this.messageHandler);\n }\n render() {\n this.container.innerHTML = '';\n this.iframe = document.createElement('iframe');\n this.iframe.src = buildIframeUrl(this.config);\n this.iframe.setAttribute(\"style\", \"width: 100%; scrollbar-width:thin !important\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.sandbox = \"allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups\";\n this.iframe.scrolling = \"no\";\n this.container.appendChild(this.iframe);\n this.setupMessageListener();\n }\n update(config) {\n this.config = { ...this.config, ...config };\n this.render();\n }\n destroy() {\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n this.messageHandler = null;\n }\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n }\n getIframe() {\n return this.iframe;\n }\n}\nexport function initComments(container, config) {\n return new CrossTalkCommentsEmbed(container, config);\n}\nexport function autoInitComments() {\n const commentDivs = document.querySelectorAll('div[data-crosstalk-comments]');\n const commentEmbeds = [];\n commentDivs.forEach(commentsDiv => {\n const config = {\n wp: commentsDiv.dataset.wp,\n url: commentsDiv.dataset.url || \"\",\n pageID: commentsDiv.dataset.pageId || \"\",\n theme: commentsDiv.dataset.theme || \"light\",\n reactions: commentsDiv.dataset.reactions === \"true\" ? true : false\n };\n const instance = initComments(commentsDiv, config);\n if (instance)\n commentEmbeds.push(instance);\n });\n return commentEmbeds;\n}\n","function buildIframeUrl(config) {\n const baseUrl = 'https://widgets.crosstalk.cc/poll';\n const params = new URLSearchParams();\n params.append('wp', config.wp);\n if (config.url)\n params.append('url', config.url);\n else if (config.pageID)\n params.append('pageID', config.pageID);\n if (config.theme)\n params.append('theme', config.theme);\n if (config.pollID)\n params.append('pollID', config.pollID);\n return `${baseUrl}?${params.toString()}`;\n}\nexport class CrossTalkPollEmbed {\n constructor(container, config) {\n this.container = container;\n this.config = config;\n this.iframe = null;\n this.messageHandler = null;\n this.render();\n }\n setupMessageListener() {\n // Remove existing listener if any\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n }\n this.messageHandler = (event) => {\n // Basic security check - verify the message is from our iframe\n if (this.iframe && event.source !== this.iframe.contentWindow) {\n return;\n }\n if (event.origin.includes('.crosstalk.cc')) {\n try {\n const msg = JSON.parse(event.data);\n if (msg.psize)\n this.iframe.style.height = `${msg.psize}px`;\n }\n catch (_a) { }\n }\n };\n window.addEventListener('message', this.messageHandler);\n }\n render() {\n this.container.innerHTML = '';\n this.iframe = document.createElement('iframe');\n this.iframe.src = buildIframeUrl(this.config);\n this.iframe.setAttribute(\"style\", \"width: 100%; scrollbar-width:thin !important\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.sandbox = \"allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups\";\n this.iframe.scrolling = \"no\";\n this.container.appendChild(this.iframe);\n this.setupMessageListener();\n }\n update(config) {\n this.config = { ...this.config, ...config };\n this.render();\n }\n destroy() {\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n this.messageHandler = null;\n }\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n }\n getIframe() {\n return this.iframe;\n }\n}\nexport function initPoll(container, config) {\n return new CrossTalkPollEmbed(container, config);\n}\nexport function autoInitPolls() {\n const pollDivs = document.querySelectorAll('div[data-crosstalk-poll]');\n const pollEmbeds = [];\n pollDivs.forEach(pollDiv => {\n const config = {\n wp: pollDiv.dataset.wp,\n url: pollDiv.dataset.url || \"\",\n pageID: pollDiv.dataset.pageId || \"\",\n theme: pollDiv.dataset.theme || \"light\",\n pollID: pollDiv.dataset.pollId || \"\"\n };\n const instance = initPoll(pollDiv, config);\n if (instance)\n pollEmbeds.push(instance);\n });\n return pollEmbeds;\n}\n","function buildIframeUrl(config) {\n const baseUrl = 'https://widgets.crosstalk.cc/video';\n const params = new URLSearchParams();\n params.append('wp', config.wp);\n if (config.url)\n params.append('url', config.url);\n else if (config.pageID)\n params.append('pageID', config.pageID);\n if (config.theme)\n params.append('theme', config.theme);\n if (config.src && config.srcType) {\n params.append('src', config.src);\n params.append('srcType', config.srcType);\n }\n if (config.ytvid)\n params.append('ytvid', config.ytvid);\n if (config.rtvid)\n params.append('rtvid', config.rtvid);\n if (config.vkvid)\n params.append('vkvid', config.vkvid);\n if (config.vklive)\n params.append('vklive', config.vklive);\n if (config.vimeoid)\n params.append('vimeoid', config.vimeoid);\n return `${baseUrl}?${params.toString()}`; //params are auto encoded\n}\nexport class CrossTalkVideoPlayerEmbed {\n constructor(container, config) {\n this.container = container;\n this.config = config;\n this.iframe = null;\n this.messageHandler = null;\n this.render();\n }\n setupMessageListener() {\n // Remove existing listener if any\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n }\n this.messageHandler = (event) => {\n // Basic security check - verify the message is from our iframe\n if (this.iframe && event.source !== this.iframe.contentWindow) {\n return;\n }\n if (event.origin.includes('.crosstalk.cc')) {\n try {\n const msg = JSON.parse(event.data);\n if (msg.vsize)\n this.iframe.style.height = `${msg.vsize}px`;\n }\n catch (_a) { }\n }\n };\n window.addEventListener('message', this.messageHandler);\n }\n render() {\n this.container.innerHTML = '';\n this.iframe = document.createElement('iframe');\n this.iframe.src = buildIframeUrl(this.config);\n this.iframe.setAttribute(\"style\", \"width: 100%; scrollbar-width:thin !important\");\n this.iframe.setAttribute(\"frameborder\", \"0\");\n this.iframe.sandbox = \"allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups\";\n this.iframe.scrolling = \"auto\";\n this.container.appendChild(this.iframe);\n this.setupMessageListener();\n }\n update(config) {\n this.config = { ...this.config, ...config };\n this.render();\n }\n destroy() {\n if (this.messageHandler) {\n window.removeEventListener('message', this.messageHandler);\n this.messageHandler = null;\n }\n if (this.iframe && this.iframe.parentNode) {\n this.iframe.parentNode.removeChild(this.iframe);\n this.iframe = null;\n }\n }\n getIframe() {\n return this.iframe;\n }\n}\nexport function initPlayer(container, config) {\n return new CrossTalkVideoPlayerEmbed(container, config);\n}\nexport function autoInitPlayers() {\n const playerDivs = document.querySelectorAll('div[data-crosstalk-video-player]');\n const playerEmbeds = [];\n playerDivs.forEach(playerDiv => {\n const config = {\n wp: playerDiv.dataset.wp,\n url: playerDiv.dataset.url || \"\",\n pageID: playerDiv.dataset.pageId || \"\",\n theme: playerDiv.dataset.theme || \"light\",\n src: playerDiv.dataset.src || \"\",\n srcType: playerDiv.dataset.srcType || \"\",\n ytvid: playerDiv.dataset.ytId || \"\",\n rtvid: playerDiv.dataset.rtId || \"\",\n vkvid: playerDiv.dataset.vkId || \"\",\n vklive: playerDiv.dataset.vkLive || \"\",\n vimeoid: playerDiv.dataset.vimeoId || \"\"\n };\n const instance = initPlayer(playerDiv, config);\n if (instance)\n playerEmbeds.push(instance);\n });\n return playerEmbeds;\n}\n","import { autoInitAISummaries, initAISummary } from './CrossTalkAISummaryEmbed';\nimport { autoInitComments, initComments } from './CrossTalkCommentsEmbed';\nimport { autoInitPolls, initPoll } from './CrossTalkPollEmbed';\nimport { autoInitPlayers, initPlayer } from './CrossTalkVideoPlayerEmbed';\nconst CTCore = {\n // Core functions\n initComments,\n initPlayer,\n initPoll,\n initAISummary,\n initAll() {\n console.log('crosstalk initialised');\n autoInitComments();\n autoInitPlayers();\n autoInitPolls();\n autoInitAISummaries();\n return this;\n }\n};\nexport * from './CrossTalkCommentsEmbed';\nexport * from './CrossTalkVideoPlayerEmbed';\nexport * from './CrossTalkPollEmbed';\nexport * from './CrossTalkAISummaryEmbed';\nif (typeof window !== 'undefined') {\n console.log(\"in browser\");\n window.CTCore = CTCore;\n if (document.readyState === 'loading')\n document.addEventListener('DOMContentLoaded', () => CTCore.initAll());\n else\n CTCore.initAll();\n}\n"],"names":["root","factory","exports","module","define","amd","this","CrossTalkAISummaryEmbed","constructor","container","config","iframe","messageHandler","render","setupMessageListener","window","removeEventListener","event","source","contentWindow","origin","includes","msg","JSON","parse","data","asize","style","height","_a","addEventListener","innerHTML","document","createElement","src","params","URLSearchParams","wp","append","url","theme","toString","buildIframeUrl","setAttribute","sandbox","scrolling","appendChild","update","destroy","parentNode","removeChild","getIframe","initAISummary","CrossTalkCommentsEmbed","csize","pageID","undefined","reactions","String","initComments","CrossTalkPollEmbed","psize","pollID","initPoll","CrossTalkVideoPlayerEmbed","vsize","srcType","ytvid","rtvid","vkvid","vklive","vimeoid","initPlayer","CTCore","initAll","console","log","commentDivs","querySelectorAll","commentEmbeds","forEach","commentsDiv","instance","dataset","pageId","push","autoInitComments","playerDivs","playerEmbeds","playerDiv","ytId","rtId","vkId","vkLive","vimeoId","autoInitPlayers","pollDivs","pollEmbeds","pollDiv","pollId","autoInitPolls","aiDivs","aiEmbeds","aiDiv","autoInitAISummaries","readyState"],"ignoreList":[],"sourceRoot":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AISummaryOptions } from './types';
|
|
2
|
+
export declare class CrossTalkAISummaryEmbed {
|
|
3
|
+
private container;
|
|
4
|
+
private config;
|
|
5
|
+
private iframe;
|
|
6
|
+
private messageHandler;
|
|
7
|
+
constructor(container: HTMLElement, config: AISummaryOptions);
|
|
8
|
+
private setupMessageListener;
|
|
9
|
+
render(): void;
|
|
10
|
+
update(config: Partial<AISummaryOptions>): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
getIframe(): HTMLIFrameElement | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function initAISummary(container: HTMLElement, config: AISummaryOptions): CrossTalkAISummaryEmbed;
|
|
15
|
+
export declare function autoInitAISummaries(): CrossTalkAISummaryEmbed[];
|
|
@@ -12,3 +12,4 @@ export declare class CrossTalkCommentsEmbed {
|
|
|
12
12
|
getIframe(): HTMLIFrameElement | null;
|
|
13
13
|
}
|
|
14
14
|
export declare function initComments(container: HTMLElement, config: CommentsEmbedOptions): CrossTalkCommentsEmbed;
|
|
15
|
+
export declare function autoInitComments(): CrossTalkCommentsEmbed[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PollEmbedOptions } from './types';
|
|
2
|
+
export declare class CrossTalkPollEmbed {
|
|
3
|
+
private container;
|
|
4
|
+
private config;
|
|
5
|
+
private iframe;
|
|
6
|
+
private messageHandler;
|
|
7
|
+
constructor(container: HTMLElement, config: PollEmbedOptions);
|
|
8
|
+
private setupMessageListener;
|
|
9
|
+
render(): void;
|
|
10
|
+
update(config: Partial<PollEmbedOptions>): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
getIframe(): HTMLIFrameElement | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function initPoll(container: HTMLElement, config: PollEmbedOptions): CrossTalkPollEmbed;
|
|
15
|
+
export declare function autoInitPolls(): CrossTalkPollEmbed[];
|
|
@@ -12,3 +12,4 @@ export declare class CrossTalkVideoPlayerEmbed {
|
|
|
12
12
|
getIframe(): HTMLIFrameElement | null;
|
|
13
13
|
}
|
|
14
14
|
export declare function initPlayer(container: HTMLElement, config: VideoPlayerEmbedOptions): CrossTalkVideoPlayerEmbed;
|
|
15
|
+
export declare function autoInitPlayers(): CrossTalkVideoPlayerEmbed[];
|
|
@@ -18,3 +18,15 @@ export interface VideoPlayerEmbedOptions {
|
|
|
18
18
|
vklive?: string;
|
|
19
19
|
vimeoid?: string;
|
|
20
20
|
}
|
|
21
|
+
export interface PollEmbedOptions {
|
|
22
|
+
wp?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
pageID?: string;
|
|
25
|
+
theme?: string;
|
|
26
|
+
pollID?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AISummaryOptions {
|
|
29
|
+
wp?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
theme?: string;
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crosstalk-comments-livechat-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-beta.1",
|
|
4
4
|
"description": "Add Comments, Live Chat, and Video Player Embeds to your website with CrossTalk Comments and Live Chat!",
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/crosstalk_sdk.js",
|
|
6
|
+
"module": "dist/crosstalk_sdk.js",
|
|
7
|
+
"browser": "dist/crosstalk_sdk.js",
|
|
8
|
+
"unpkg": "dist/crosstalk_sdk.min.js",
|
|
9
|
+
"jsdelivr": "dist/crosstalk_sdk.min.js",
|
|
10
|
+
"types": "dist/types/index.d.ts",
|
|
11
|
+
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"import": "./dist/crosstalk_sdk.js",
|
|
16
|
+
"require": "./dist/crosstalk_sdk.js",
|
|
17
|
+
"browser": "./dist/crosstalk_sdk.js",
|
|
18
|
+
"default": "./dist/crosstalk_sdk.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"type": "commonjs",
|
|
7
22
|
"displayName": "CrossTalk Comments & Live Chat Embed SDK",
|
|
8
23
|
"homepage": "https://crosstalk.cc",
|
|
9
|
-
|
|
10
|
-
"build": "
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "npm run build:types && webpack --mode production",
|
|
26
|
+
"build:types": "tsc --project tsconfig.json --outDir dist/types --declaration --emitDeclarationOnly",
|
|
27
|
+
"build:dev": "webpack --mode development",
|
|
28
|
+
"watch": "webpack --mode development --watch",
|
|
11
29
|
"prepublishOnly": "npm run build"
|
|
12
30
|
},
|
|
13
|
-
"keywords": [
|
|
31
|
+
"keywords": [
|
|
32
|
+
"comments",
|
|
33
|
+
"live chat",
|
|
34
|
+
"crosstalk",
|
|
35
|
+
"hyvor talk",
|
|
36
|
+
"audience Engagement",
|
|
37
|
+
"disqus",
|
|
38
|
+
"video player",
|
|
39
|
+
"polls"
|
|
40
|
+
],
|
|
14
41
|
"author": "CrossTalk Audience Engagement Platform",
|
|
15
42
|
"license": "ISC",
|
|
16
43
|
"devDependencies": {
|
|
17
|
-
"typescript": "^5.
|
|
44
|
+
"typescript": "^5.9.3",
|
|
45
|
+
"webpack": "^5.104.1",
|
|
46
|
+
"webpack-cli": "^6.0.1",
|
|
47
|
+
"ts-loader": "^9.5.4"
|
|
18
48
|
},
|
|
19
49
|
"files": [
|
|
20
50
|
"dist",
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
function buildIframeUrl(config) {
|
|
2
|
-
const baseUrl = 'https://widgets.crosstalk.cc/comments';
|
|
3
|
-
const params = new URLSearchParams();
|
|
4
|
-
params.append('wp', config.wp);
|
|
5
|
-
if (config.url)
|
|
6
|
-
params.append('url', config.url);
|
|
7
|
-
else if (config.pageID)
|
|
8
|
-
params.append('pageID', config.pageID);
|
|
9
|
-
if (config.theme)
|
|
10
|
-
params.append('theme', config.theme);
|
|
11
|
-
if (config.reactions !== undefined)
|
|
12
|
-
params.append('reactions', String(config.reactions));
|
|
13
|
-
return `${baseUrl}?${params.toString()}`;
|
|
14
|
-
}
|
|
15
|
-
export class CrossTalkCommentsEmbed {
|
|
16
|
-
constructor(container, config) {
|
|
17
|
-
this.container = container;
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.iframe = null;
|
|
20
|
-
this.messageHandler = null;
|
|
21
|
-
this.render();
|
|
22
|
-
}
|
|
23
|
-
setupMessageListener() {
|
|
24
|
-
// Remove existing listener if any
|
|
25
|
-
if (this.messageHandler) {
|
|
26
|
-
window.removeEventListener('message', this.messageHandler);
|
|
27
|
-
}
|
|
28
|
-
this.messageHandler = (event) => {
|
|
29
|
-
// Basic security check - verify the message is from our iframe
|
|
30
|
-
if (this.iframe && event.source !== this.iframe.contentWindow) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (event.origin.includes('.crosstalk.cc')) {
|
|
34
|
-
try {
|
|
35
|
-
const msg = JSON.parse(event.data);
|
|
36
|
-
if (msg.csize)
|
|
37
|
-
this.iframe.style.height = `${msg.csize}px`;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.warn('Invalid message received:', error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
window.addEventListener('message', this.messageHandler);
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
this.container.innerHTML = '';
|
|
48
|
-
this.iframe = document.createElement('iframe');
|
|
49
|
-
this.iframe.src = buildIframeUrl(this.config);
|
|
50
|
-
this.iframe.id = 'ctcommentsiframe';
|
|
51
|
-
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
52
|
-
this.iframe.setAttribute("frameborder", "0");
|
|
53
|
-
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
54
|
-
this.iframe.scrolling = "no";
|
|
55
|
-
this.container.appendChild(this.iframe);
|
|
56
|
-
this.setupMessageListener();
|
|
57
|
-
}
|
|
58
|
-
update(config) {
|
|
59
|
-
this.config = Object.assign(Object.assign({}, this.config), config);
|
|
60
|
-
this.render();
|
|
61
|
-
}
|
|
62
|
-
destroy() {
|
|
63
|
-
if (this.messageHandler) {
|
|
64
|
-
window.removeEventListener('message', this.messageHandler);
|
|
65
|
-
this.messageHandler = null;
|
|
66
|
-
}
|
|
67
|
-
if (this.iframe && this.iframe.parentNode) {
|
|
68
|
-
this.iframe.parentNode.removeChild(this.iframe);
|
|
69
|
-
this.iframe = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
getIframe() {
|
|
73
|
-
return this.iframe;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
export function initComments(container, config) {
|
|
77
|
-
return new CrossTalkCommentsEmbed(container, config);
|
|
78
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
function buildIframeUrl(config) {
|
|
2
|
-
const baseUrl = 'https://widgets.crosstalk.cc/video';
|
|
3
|
-
const params = new URLSearchParams();
|
|
4
|
-
params.append('wp', config.wp);
|
|
5
|
-
if (config.url)
|
|
6
|
-
params.append('url', config.url);
|
|
7
|
-
else if (config.pageID)
|
|
8
|
-
params.append('pageID', config.pageID);
|
|
9
|
-
if (config.theme)
|
|
10
|
-
params.append('theme', config.theme);
|
|
11
|
-
if (config.src && config.srcType) {
|
|
12
|
-
params.append('src', config.src);
|
|
13
|
-
params.append('srcType', config.srcType);
|
|
14
|
-
}
|
|
15
|
-
if (config.ytvid)
|
|
16
|
-
params.append('ytvid', config.ytvid);
|
|
17
|
-
if (config.rtvid)
|
|
18
|
-
params.append('rtvid', config.rtvid);
|
|
19
|
-
if (config.vkvid)
|
|
20
|
-
params.append('vkvid', config.vkvid);
|
|
21
|
-
if (config.vklive)
|
|
22
|
-
params.append('vklive', config.vklive);
|
|
23
|
-
if (config.vimeoid)
|
|
24
|
-
params.append('vimeoid', config.vimeoid);
|
|
25
|
-
return `${baseUrl}?${params.toString()}`;
|
|
26
|
-
}
|
|
27
|
-
export class CrossTalkVideoPlayerEmbed {
|
|
28
|
-
constructor(container, config) {
|
|
29
|
-
this.container = container;
|
|
30
|
-
this.config = config;
|
|
31
|
-
this.iframe = null;
|
|
32
|
-
this.messageHandler = null;
|
|
33
|
-
this.render();
|
|
34
|
-
}
|
|
35
|
-
setupMessageListener() {
|
|
36
|
-
// Remove existing listener if any
|
|
37
|
-
if (this.messageHandler) {
|
|
38
|
-
window.removeEventListener('message', this.messageHandler);
|
|
39
|
-
}
|
|
40
|
-
this.messageHandler = (event) => {
|
|
41
|
-
// Basic security check - verify the message is from our iframe
|
|
42
|
-
if (this.iframe && event.source !== this.iframe.contentWindow) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (event.origin.includes('.crosstalk.cc')) {
|
|
46
|
-
try {
|
|
47
|
-
const msg = JSON.parse(event.data);
|
|
48
|
-
if (msg.vsize)
|
|
49
|
-
this.iframe.style.height = `${msg.vsize}px`;
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
console.warn('Invalid message received:', error);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
window.addEventListener('message', this.messageHandler);
|
|
57
|
-
}
|
|
58
|
-
render() {
|
|
59
|
-
this.container.innerHTML = '';
|
|
60
|
-
this.iframe = document.createElement('iframe');
|
|
61
|
-
this.iframe.src = buildIframeUrl(this.config);
|
|
62
|
-
this.iframe.id = 'ctvidchatiframe';
|
|
63
|
-
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
64
|
-
this.iframe.setAttribute("frameborder", "0");
|
|
65
|
-
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
66
|
-
this.iframe.scrolling = "auto";
|
|
67
|
-
this.container.appendChild(this.iframe);
|
|
68
|
-
this.setupMessageListener();
|
|
69
|
-
}
|
|
70
|
-
update(config) {
|
|
71
|
-
this.config = Object.assign(Object.assign({}, this.config), config);
|
|
72
|
-
this.render();
|
|
73
|
-
}
|
|
74
|
-
destroy() {
|
|
75
|
-
if (this.messageHandler) {
|
|
76
|
-
window.removeEventListener('message', this.messageHandler);
|
|
77
|
-
this.messageHandler = null;
|
|
78
|
-
}
|
|
79
|
-
if (this.iframe && this.iframe.parentNode) {
|
|
80
|
-
this.iframe.parentNode.removeChild(this.iframe);
|
|
81
|
-
this.iframe = null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
getIframe() {
|
|
85
|
-
return this.iframe;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
export function initPlayer(container, config) {
|
|
89
|
-
return new CrossTalkVideoPlayerEmbed(container, config);
|
|
90
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|