crosstalk-comments-livechat-sdk 0.0.5-beta.1 → 0.0.5-beta.2
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.js +442 -0
- package/dist/crosstalk_sdk.js.map +1 -0
- package/dist/crosstalk_sdk.min.js +1 -1
- package/package.json +6 -7
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["crosstalk-comments-livechat-sdk"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["crosstalk-comments-livechat-sdk"] = factory();
|
|
10
|
+
})(this, () => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
|
|
15
|
+
// UNUSED EXPORTS: CrossTalkAISummaryEmbed, CrossTalkCommentsEmbed, CrossTalkPollEmbed, CrossTalkVideoPlayerEmbed, autoInitAISummaries, autoInitComments, autoInitPlayers, autoInitPolls, initAISummary, initComments, initPlayer, initPoll
|
|
16
|
+
|
|
17
|
+
;// ./src/CrossTalkAISummaryEmbed.ts
|
|
18
|
+
function buildIframeUrl(config) {
|
|
19
|
+
const baseUrl = 'https://widgets.crosstalk.cc/ai_summary';
|
|
20
|
+
const params = new URLSearchParams();
|
|
21
|
+
if (config.wp)
|
|
22
|
+
params.append('wp', config.wp);
|
|
23
|
+
if (config.url)
|
|
24
|
+
params.append('url', config.url);
|
|
25
|
+
if (config.theme)
|
|
26
|
+
params.append('theme', config.theme);
|
|
27
|
+
return `${baseUrl}?${params.toString()}`;
|
|
28
|
+
}
|
|
29
|
+
class CrossTalkAISummaryEmbed {
|
|
30
|
+
constructor(container, config) {
|
|
31
|
+
this.container = container;
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.iframe = null;
|
|
34
|
+
this.messageHandler = null;
|
|
35
|
+
this.render();
|
|
36
|
+
}
|
|
37
|
+
setupMessageListener() {
|
|
38
|
+
if (this.messageHandler) {
|
|
39
|
+
window.removeEventListener('message', this.messageHandler);
|
|
40
|
+
}
|
|
41
|
+
this.messageHandler = (event) => {
|
|
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.asize)
|
|
49
|
+
this.iframe.style.height = `${msg.asize}px`;
|
|
50
|
+
}
|
|
51
|
+
catch (_a) { }
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
window.addEventListener('message', this.messageHandler);
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
this.container.innerHTML = '';
|
|
58
|
+
this.iframe = document.createElement('iframe');
|
|
59
|
+
this.iframe.src = buildIframeUrl(this.config);
|
|
60
|
+
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
61
|
+
this.iframe.setAttribute("frameborder", "0");
|
|
62
|
+
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
63
|
+
this.iframe.scrolling = "no";
|
|
64
|
+
this.container.appendChild(this.iframe);
|
|
65
|
+
this.setupMessageListener();
|
|
66
|
+
}
|
|
67
|
+
update(config) {
|
|
68
|
+
this.config = { ...this.config, ...config };
|
|
69
|
+
this.render();
|
|
70
|
+
}
|
|
71
|
+
destroy() {
|
|
72
|
+
if (this.messageHandler) {
|
|
73
|
+
window.removeEventListener('message', this.messageHandler);
|
|
74
|
+
this.messageHandler = null;
|
|
75
|
+
}
|
|
76
|
+
if (this.iframe && this.iframe.parentNode) {
|
|
77
|
+
this.iframe.parentNode.removeChild(this.iframe);
|
|
78
|
+
this.iframe = null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getIframe() {
|
|
82
|
+
return this.iframe;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function initAISummary(container, config) {
|
|
86
|
+
return new CrossTalkAISummaryEmbed(container, config);
|
|
87
|
+
}
|
|
88
|
+
function autoInitAISummaries() {
|
|
89
|
+
const aiDivs = document.querySelectorAll('div[data-crosstalk-ai-summary]');
|
|
90
|
+
const aiEmbeds = [];
|
|
91
|
+
aiDivs.forEach(aiDiv => {
|
|
92
|
+
const config = {
|
|
93
|
+
wp: aiDiv.dataset.wp || "",
|
|
94
|
+
url: aiDiv.dataset.url || "",
|
|
95
|
+
theme: aiDiv.dataset.theme || "light"
|
|
96
|
+
};
|
|
97
|
+
const instance = initAISummary(aiDiv, config);
|
|
98
|
+
if (instance)
|
|
99
|
+
aiEmbeds.push(instance);
|
|
100
|
+
});
|
|
101
|
+
return aiEmbeds;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
;// ./src/CrossTalkCommentsEmbed.ts
|
|
105
|
+
function CrossTalkCommentsEmbed_buildIframeUrl(config) {
|
|
106
|
+
const baseUrl = 'https://widgets.crosstalk.cc/comments';
|
|
107
|
+
const params = new URLSearchParams();
|
|
108
|
+
params.append('wp', config.wp);
|
|
109
|
+
if (config.url)
|
|
110
|
+
params.append('url', config.url);
|
|
111
|
+
else if (config.pageID)
|
|
112
|
+
params.append('pageID', config.pageID);
|
|
113
|
+
if (config.theme)
|
|
114
|
+
params.append('theme', config.theme);
|
|
115
|
+
if (config.reactions !== undefined)
|
|
116
|
+
params.append('reactions', String(config.reactions));
|
|
117
|
+
return `${baseUrl}?${params.toString()}`;
|
|
118
|
+
}
|
|
119
|
+
class CrossTalkCommentsEmbed {
|
|
120
|
+
constructor(container, config) {
|
|
121
|
+
this.container = container;
|
|
122
|
+
this.config = config;
|
|
123
|
+
this.iframe = null;
|
|
124
|
+
this.messageHandler = null;
|
|
125
|
+
this.render();
|
|
126
|
+
}
|
|
127
|
+
setupMessageListener() {
|
|
128
|
+
// Remove existing listener if any
|
|
129
|
+
if (this.messageHandler) {
|
|
130
|
+
window.removeEventListener('message', this.messageHandler);
|
|
131
|
+
}
|
|
132
|
+
this.messageHandler = (event) => {
|
|
133
|
+
// Basic security check - verify the message is from our iframe
|
|
134
|
+
if (this.iframe && event.source !== this.iframe.contentWindow) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (event.origin.includes('.crosstalk.cc')) {
|
|
138
|
+
try {
|
|
139
|
+
const msg = JSON.parse(event.data);
|
|
140
|
+
if (msg.csize)
|
|
141
|
+
this.iframe.style.height = `${msg.csize}px`;
|
|
142
|
+
}
|
|
143
|
+
catch (_a) { }
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
window.addEventListener('message', this.messageHandler);
|
|
147
|
+
}
|
|
148
|
+
render() {
|
|
149
|
+
this.container.innerHTML = '';
|
|
150
|
+
this.iframe = document.createElement('iframe');
|
|
151
|
+
this.iframe.src = CrossTalkCommentsEmbed_buildIframeUrl(this.config);
|
|
152
|
+
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
153
|
+
this.iframe.setAttribute("frameborder", "0");
|
|
154
|
+
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
155
|
+
this.iframe.scrolling = "no";
|
|
156
|
+
this.container.appendChild(this.iframe);
|
|
157
|
+
this.setupMessageListener();
|
|
158
|
+
}
|
|
159
|
+
update(config) {
|
|
160
|
+
this.config = { ...this.config, ...config };
|
|
161
|
+
this.render();
|
|
162
|
+
}
|
|
163
|
+
destroy() {
|
|
164
|
+
if (this.messageHandler) {
|
|
165
|
+
window.removeEventListener('message', this.messageHandler);
|
|
166
|
+
this.messageHandler = null;
|
|
167
|
+
}
|
|
168
|
+
if (this.iframe && this.iframe.parentNode) {
|
|
169
|
+
this.iframe.parentNode.removeChild(this.iframe);
|
|
170
|
+
this.iframe = null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
getIframe() {
|
|
174
|
+
return this.iframe;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function initComments(container, config) {
|
|
178
|
+
return new CrossTalkCommentsEmbed(container, config);
|
|
179
|
+
}
|
|
180
|
+
function autoInitComments() {
|
|
181
|
+
const commentDivs = document.querySelectorAll('div[data-crosstalk-comments]');
|
|
182
|
+
const commentEmbeds = [];
|
|
183
|
+
commentDivs.forEach(commentsDiv => {
|
|
184
|
+
const config = {
|
|
185
|
+
wp: commentsDiv.dataset.wp,
|
|
186
|
+
url: commentsDiv.dataset.url || "",
|
|
187
|
+
pageID: commentsDiv.dataset.pageId || "",
|
|
188
|
+
theme: commentsDiv.dataset.theme || "light",
|
|
189
|
+
reactions: commentsDiv.dataset.reactions === "true" ? true : false
|
|
190
|
+
};
|
|
191
|
+
const instance = initComments(commentsDiv, config);
|
|
192
|
+
if (instance)
|
|
193
|
+
commentEmbeds.push(instance);
|
|
194
|
+
});
|
|
195
|
+
return commentEmbeds;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
;// ./src/CrossTalkPollEmbed.ts
|
|
199
|
+
function CrossTalkPollEmbed_buildIframeUrl(config) {
|
|
200
|
+
const baseUrl = 'https://widgets.crosstalk.cc/poll';
|
|
201
|
+
const params = new URLSearchParams();
|
|
202
|
+
params.append('wp', config.wp);
|
|
203
|
+
if (config.url)
|
|
204
|
+
params.append('url', config.url);
|
|
205
|
+
else if (config.pageID)
|
|
206
|
+
params.append('pageID', config.pageID);
|
|
207
|
+
if (config.theme)
|
|
208
|
+
params.append('theme', config.theme);
|
|
209
|
+
if (config.pollID)
|
|
210
|
+
params.append('pollID', config.pollID);
|
|
211
|
+
return `${baseUrl}?${params.toString()}`;
|
|
212
|
+
}
|
|
213
|
+
class CrossTalkPollEmbed {
|
|
214
|
+
constructor(container, config) {
|
|
215
|
+
this.container = container;
|
|
216
|
+
this.config = config;
|
|
217
|
+
this.iframe = null;
|
|
218
|
+
this.messageHandler = null;
|
|
219
|
+
this.render();
|
|
220
|
+
}
|
|
221
|
+
setupMessageListener() {
|
|
222
|
+
// Remove existing listener if any
|
|
223
|
+
if (this.messageHandler) {
|
|
224
|
+
window.removeEventListener('message', this.messageHandler);
|
|
225
|
+
}
|
|
226
|
+
this.messageHandler = (event) => {
|
|
227
|
+
// Basic security check - verify the message is from our iframe
|
|
228
|
+
if (this.iframe && event.source !== this.iframe.contentWindow) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (event.origin.includes('.crosstalk.cc')) {
|
|
232
|
+
try {
|
|
233
|
+
const msg = JSON.parse(event.data);
|
|
234
|
+
if (msg.psize)
|
|
235
|
+
this.iframe.style.height = `${msg.psize}px`;
|
|
236
|
+
}
|
|
237
|
+
catch (_a) { }
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
window.addEventListener('message', this.messageHandler);
|
|
241
|
+
}
|
|
242
|
+
render() {
|
|
243
|
+
this.container.innerHTML = '';
|
|
244
|
+
this.iframe = document.createElement('iframe');
|
|
245
|
+
this.iframe.src = CrossTalkPollEmbed_buildIframeUrl(this.config);
|
|
246
|
+
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
247
|
+
this.iframe.setAttribute("frameborder", "0");
|
|
248
|
+
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
249
|
+
this.iframe.scrolling = "no";
|
|
250
|
+
this.container.appendChild(this.iframe);
|
|
251
|
+
this.setupMessageListener();
|
|
252
|
+
}
|
|
253
|
+
update(config) {
|
|
254
|
+
this.config = { ...this.config, ...config };
|
|
255
|
+
this.render();
|
|
256
|
+
}
|
|
257
|
+
destroy() {
|
|
258
|
+
if (this.messageHandler) {
|
|
259
|
+
window.removeEventListener('message', this.messageHandler);
|
|
260
|
+
this.messageHandler = null;
|
|
261
|
+
}
|
|
262
|
+
if (this.iframe && this.iframe.parentNode) {
|
|
263
|
+
this.iframe.parentNode.removeChild(this.iframe);
|
|
264
|
+
this.iframe = null;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
getIframe() {
|
|
268
|
+
return this.iframe;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function initPoll(container, config) {
|
|
272
|
+
return new CrossTalkPollEmbed(container, config);
|
|
273
|
+
}
|
|
274
|
+
function autoInitPolls() {
|
|
275
|
+
const pollDivs = document.querySelectorAll('div[data-crosstalk-poll]');
|
|
276
|
+
const pollEmbeds = [];
|
|
277
|
+
pollDivs.forEach(pollDiv => {
|
|
278
|
+
const config = {
|
|
279
|
+
wp: pollDiv.dataset.wp,
|
|
280
|
+
url: pollDiv.dataset.url || "",
|
|
281
|
+
pageID: pollDiv.dataset.pageId || "",
|
|
282
|
+
theme: pollDiv.dataset.theme || "light",
|
|
283
|
+
pollID: pollDiv.dataset.pollId || ""
|
|
284
|
+
};
|
|
285
|
+
const instance = initPoll(pollDiv, config);
|
|
286
|
+
if (instance)
|
|
287
|
+
pollEmbeds.push(instance);
|
|
288
|
+
});
|
|
289
|
+
return pollEmbeds;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
;// ./src/CrossTalkVideoPlayerEmbed.ts
|
|
293
|
+
function CrossTalkVideoPlayerEmbed_buildIframeUrl(config) {
|
|
294
|
+
const baseUrl = 'https://widgets.crosstalk.cc/video';
|
|
295
|
+
const params = new URLSearchParams();
|
|
296
|
+
params.append('wp', config.wp);
|
|
297
|
+
if (config.url)
|
|
298
|
+
params.append('url', config.url);
|
|
299
|
+
else if (config.pageID)
|
|
300
|
+
params.append('pageID', config.pageID);
|
|
301
|
+
if (config.theme)
|
|
302
|
+
params.append('theme', config.theme);
|
|
303
|
+
if (config.src && config.srcType) {
|
|
304
|
+
params.append('src', config.src);
|
|
305
|
+
params.append('srcType', config.srcType);
|
|
306
|
+
}
|
|
307
|
+
if (config.ytvid)
|
|
308
|
+
params.append('ytvid', config.ytvid);
|
|
309
|
+
if (config.rtvid)
|
|
310
|
+
params.append('rtvid', config.rtvid);
|
|
311
|
+
if (config.vkvid)
|
|
312
|
+
params.append('vkvid', config.vkvid);
|
|
313
|
+
if (config.vklive)
|
|
314
|
+
params.append('vklive', config.vklive);
|
|
315
|
+
if (config.vimeoid)
|
|
316
|
+
params.append('vimeoid', config.vimeoid);
|
|
317
|
+
return `${baseUrl}?${params.toString()}`; //params are auto encoded
|
|
318
|
+
}
|
|
319
|
+
class CrossTalkVideoPlayerEmbed {
|
|
320
|
+
constructor(container, config) {
|
|
321
|
+
this.container = container;
|
|
322
|
+
this.config = config;
|
|
323
|
+
this.iframe = null;
|
|
324
|
+
this.messageHandler = null;
|
|
325
|
+
this.render();
|
|
326
|
+
}
|
|
327
|
+
setupMessageListener() {
|
|
328
|
+
// Remove existing listener if any
|
|
329
|
+
if (this.messageHandler) {
|
|
330
|
+
window.removeEventListener('message', this.messageHandler);
|
|
331
|
+
}
|
|
332
|
+
this.messageHandler = (event) => {
|
|
333
|
+
// Basic security check - verify the message is from our iframe
|
|
334
|
+
if (this.iframe && event.source !== this.iframe.contentWindow) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (event.origin.includes('.crosstalk.cc')) {
|
|
338
|
+
try {
|
|
339
|
+
const msg = JSON.parse(event.data);
|
|
340
|
+
if (msg.vsize)
|
|
341
|
+
this.iframe.style.height = `${msg.vsize}px`;
|
|
342
|
+
}
|
|
343
|
+
catch (_a) { }
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
window.addEventListener('message', this.messageHandler);
|
|
347
|
+
}
|
|
348
|
+
render() {
|
|
349
|
+
this.container.innerHTML = '';
|
|
350
|
+
this.iframe = document.createElement('iframe');
|
|
351
|
+
this.iframe.src = CrossTalkVideoPlayerEmbed_buildIframeUrl(this.config);
|
|
352
|
+
this.iframe.setAttribute("style", "width: 100%; scrollbar-width:thin !important");
|
|
353
|
+
this.iframe.setAttribute("frameborder", "0");
|
|
354
|
+
this.iframe.sandbox = "allow-storage-access-by-user-activation allow-scripts allow-same-origin allow-popups";
|
|
355
|
+
this.iframe.scrolling = "auto";
|
|
356
|
+
this.container.appendChild(this.iframe);
|
|
357
|
+
this.setupMessageListener();
|
|
358
|
+
}
|
|
359
|
+
update(config) {
|
|
360
|
+
this.config = { ...this.config, ...config };
|
|
361
|
+
this.render();
|
|
362
|
+
}
|
|
363
|
+
destroy() {
|
|
364
|
+
if (this.messageHandler) {
|
|
365
|
+
window.removeEventListener('message', this.messageHandler);
|
|
366
|
+
this.messageHandler = null;
|
|
367
|
+
}
|
|
368
|
+
if (this.iframe && this.iframe.parentNode) {
|
|
369
|
+
this.iframe.parentNode.removeChild(this.iframe);
|
|
370
|
+
this.iframe = null;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
getIframe() {
|
|
374
|
+
return this.iframe;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function initPlayer(container, config) {
|
|
378
|
+
return new CrossTalkVideoPlayerEmbed(container, config);
|
|
379
|
+
}
|
|
380
|
+
function autoInitPlayers() {
|
|
381
|
+
const playerDivs = document.querySelectorAll('div[data-crosstalk-video-player]');
|
|
382
|
+
const playerEmbeds = [];
|
|
383
|
+
playerDivs.forEach(playerDiv => {
|
|
384
|
+
const config = {
|
|
385
|
+
wp: playerDiv.dataset.wp,
|
|
386
|
+
url: playerDiv.dataset.url || "",
|
|
387
|
+
pageID: playerDiv.dataset.pageId || "",
|
|
388
|
+
theme: playerDiv.dataset.theme || "light",
|
|
389
|
+
src: playerDiv.dataset.src || "",
|
|
390
|
+
srcType: playerDiv.dataset.srcType || "",
|
|
391
|
+
ytvid: playerDiv.dataset.ytId || "",
|
|
392
|
+
rtvid: playerDiv.dataset.rtId || "",
|
|
393
|
+
vkvid: playerDiv.dataset.vkId || "",
|
|
394
|
+
vklive: playerDiv.dataset.vkLive || "",
|
|
395
|
+
vimeoid: playerDiv.dataset.vimeoId || ""
|
|
396
|
+
};
|
|
397
|
+
const instance = initPlayer(playerDiv, config);
|
|
398
|
+
if (instance)
|
|
399
|
+
playerEmbeds.push(instance);
|
|
400
|
+
});
|
|
401
|
+
return playerEmbeds;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
;// ./src/index.ts
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
const CTCore = {
|
|
410
|
+
// Core functions
|
|
411
|
+
initComments: initComments,
|
|
412
|
+
initPlayer: initPlayer,
|
|
413
|
+
initPoll: initPoll,
|
|
414
|
+
initAISummary: initAISummary,
|
|
415
|
+
initAll() {
|
|
416
|
+
console.log('crosstalk initialised');
|
|
417
|
+
autoInitComments();
|
|
418
|
+
autoInitPlayers();
|
|
419
|
+
autoInitPolls();
|
|
420
|
+
autoInitAISummaries();
|
|
421
|
+
return this;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
if (typeof window !== 'undefined') {
|
|
429
|
+
console.log("in browser");
|
|
430
|
+
window.CTCore = CTCore;
|
|
431
|
+
if (document.readyState === 'loading')
|
|
432
|
+
document.addEventListener('DOMContentLoaded', () => CTCore.initAll());
|
|
433
|
+
else
|
|
434
|
+
CTCore.initAll();
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
__webpack_exports__ = __webpack_exports__["default"];
|
|
438
|
+
/******/ return __webpack_exports__;
|
|
439
|
+
/******/ })()
|
|
440
|
+
;
|
|
441
|
+
});
|
|
442
|
+
//# sourceMappingURL=crosstalk_sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crosstalk_sdk.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ,GAAG,kBAAkB;AAC3C;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,UAAU;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;ACpFA,SAAS,qCAAc;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ,GAAG,kBAAkB;AAC3C;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,UAAU;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qCAAc;AACxC,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AC3FA,SAAS,iCAAc;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ,GAAG,kBAAkB;AAC3C;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,UAAU;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,iCAAc;AACxC,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AC3FA,SAAS,wCAAc;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ,GAAG,kBAAkB,GAAG;AAC9C;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,UAAU;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wCAAc;AACxC,wDAAwD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AC7G+E;AACL;AACX;AACW;AAC1E;AACA;AACA,gBAAgB;AAChB,cAAc;AACd,YAAY;AACZ,iBAAiB;AACjB;AACA;AACA,QAAQ,gBAAgB;AACxB,QAAQ,eAAe;AACvB,QAAQ,aAAa;AACrB,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACyC;AACG;AACP;AACK;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA","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":[],"ignoreList":[],"sourceRoot":""}
|
|
@@ -1,2 +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})());
|
|
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=e.default})());
|
|
2
2
|
//# sourceMappingURL=crosstalk_sdk.min.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crosstalk-comments-livechat-sdk",
|
|
3
|
-
"version": "0.0.5-beta.
|
|
3
|
+
"version": "0.0.5-beta.2",
|
|
4
4
|
"description": "Add Comments, Live Chat, and Video Player Embeds to your website with CrossTalk Comments and Live Chat!",
|
|
5
5
|
"main": "dist/crosstalk_sdk.js",
|
|
6
6
|
"module": "dist/crosstalk_sdk.js",
|
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
"type": "commonjs",
|
|
22
22
|
"displayName": "CrossTalk Comments & Live Chat Embed SDK",
|
|
23
23
|
"homepage": "https://crosstalk.cc",
|
|
24
|
-
|
|
25
|
-
"build": "npm run build:types &&
|
|
26
|
-
"build:types": "tsc --
|
|
27
|
-
"build:
|
|
28
|
-
"
|
|
29
|
-
"prepublishOnly": "npm run build"
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "npm run build:types && npm run build:regular && npm run build:minified",
|
|
26
|
+
"build:types": "tsc --declaration --outDir dist/types --emitDeclarationOnly",
|
|
27
|
+
"build:regular": "webpack --mode production",
|
|
28
|
+
"build:minified": "webpack --mode production --env minify"
|
|
30
29
|
},
|
|
31
30
|
"keywords": [
|
|
32
31
|
"comments",
|