uptalktv-plugin 0.0.0-stage → 1.0.0
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/README.md +208 -2
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +366 -0
- package/dist/index.d.mts +366 -0
- package/dist/index.iife.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +33 -4
package/README.md
CHANGED
|
@@ -1,3 +1,209 @@
|
|
|
1
|
-
#
|
|
1
|
+
# UpTalkTV Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/uptalktv-plugin)
|
|
4
|
+
[](https://www.npmjs.com/package/uptalktv-plugin)
|
|
5
|
+
|
|
6
|
+
> Lightweight, framework-agnostic TypeScript plugin for embedding and managing the UpTalkTV chat interface.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install uptalktv-plugin
|
|
14
|
+
# or using Yarn:
|
|
15
|
+
yarn add uptalktv-plugin
|
|
16
|
+
# or using pnpm
|
|
17
|
+
pnpm add uptalktv-plugin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### ES Modules / TypeScript
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { UpTalkTV } from 'uptalktv-plugin';
|
|
28
|
+
import type { Config } from 'uptalktv-plugin';
|
|
29
|
+
|
|
30
|
+
const container = document.getElementById('player-container');
|
|
31
|
+
const config: Config = {
|
|
32
|
+
apiKey: 'YOUR_API_KEY',
|
|
33
|
+
chatId: 'chat_room_123',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Initialize the plugin
|
|
37
|
+
const plugin = new UpTalkTV(container, config);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### CommonJS
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
const { UpTalkTV } = require('uptalktv-plugin');
|
|
44
|
+
|
|
45
|
+
const container = document.getElementById('player-container');
|
|
46
|
+
const plugin = new UpTalkTV(container, {
|
|
47
|
+
apiKey: 'YOUR_API_KEY',
|
|
48
|
+
chatId: 'chat_room_123',
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Type Definitions
|
|
55
|
+
|
|
56
|
+
### `Config`
|
|
57
|
+
|
|
58
|
+
Main configuration object required to initialize the UpTalkTV chat plugin.
|
|
59
|
+
|
|
60
|
+
| Parameter | Type | Required | Description |
|
|
61
|
+
| :--- | :--- | :---: | :--- |
|
|
62
|
+
| `apiKey` | `string` | **Yes** | Authentication API key for the UpTalkTV service. |
|
|
63
|
+
| `chatId` | `string` | Conditional | Unique identifier of the target chat room to join. Required if `content` is not specified. |
|
|
64
|
+
| `content` | [`Content`](#content) | Conditional | OpenRTB Content object describing the surrounding media context. Required if `chatId` is not specified. |
|
|
65
|
+
| `deviceId` | `string` | No | Unique device identifier. |
|
|
66
|
+
| `layout` | [`Layout`](#layout) | No | Visual positioning and rendering choices for the chat iframe. |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `Layout`
|
|
71
|
+
|
|
72
|
+
Layout configuration options for the UpTalkTV chat iframe.
|
|
73
|
+
|
|
74
|
+
| Property | Type | Default | Description |
|
|
75
|
+
| :--- | :--- | :---: | :--- |
|
|
76
|
+
| `left` | `boolean` | `false` | Whether the chat container should align to the left side of the screen. |
|
|
77
|
+
| `reversed` | `boolean` | `false` | Whether the interactive features should be shown on the top corner (false) or chat (true). |
|
|
78
|
+
| `zIndex` | `number` | `1000` | The CSS `z-index` applied to the iframe element. |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## OpenRTB Content Structure
|
|
83
|
+
|
|
84
|
+
### `Content`
|
|
85
|
+
|
|
86
|
+
Represents OpenRTB Content object (Section 3.2.16) describing the media in which the ad/chat is embedded.
|
|
87
|
+
|
|
88
|
+
| Parameter | Type | Required | Description |
|
|
89
|
+
| :--- | :--- | :---: | :--- |
|
|
90
|
+
| `id` | `string` | **Yes** | ID uniquely identifying the content. |
|
|
91
|
+
| `title` | `string` | **Yes** | Content title (e.g., `"Search Committee"`, `"A New Hope"`). |
|
|
92
|
+
| `genre` | `string` | No | Genre describing the content (e.g., `"rock"`, `"pop"`). |
|
|
93
|
+
| `episode` | `number` | No | Episode number. |
|
|
94
|
+
| `series` | `string` | No | Content series (e.g., `"The Office"`, `"Star Wars"`). |
|
|
95
|
+
| `season` | `string` | No | Content season (e.g., `"Season 3"`). |
|
|
96
|
+
| `artist` | `string` | No | Artist credited with the content. |
|
|
97
|
+
| `album` | `string` | No | Album to which the content belongs (typically for audio). |
|
|
98
|
+
| `isrc` | `string` | No | International Standard Recording Code conforming to ISO 3901. |
|
|
99
|
+
| `producer` | [`Producer`](#producer) | No | Details about the content Producer (OpenRTB Section 3.2.17). |
|
|
100
|
+
| `url` | `string` | No | URL of the content, for buy-side contextualization or review. |
|
|
101
|
+
| `cattax` | [`CategoryTaxonomy`](#categorytaxonomy) | No | The taxonomy in use (defaults to `1`: IAB Content Category Taxonomy 1.0). |
|
|
102
|
+
| `cat` | `string[]` | No | Array of IAB content categories describing the content (uses taxonomy from `cattax`). |
|
|
103
|
+
| `prodq` | [`ProductionQuality`](#productionquality) | No | Production quality rating per AdCOM 1.0. |
|
|
104
|
+
| `context` | [`Context`](#context) | No | Type of content context (e.g., game, video, text) per AdCOM 1.0 Content Contexts. |
|
|
105
|
+
| `contentrating` | `string` | No | Content rating (e.g., `"MPAA"`, `"TV-MA"`). |
|
|
106
|
+
| `userrating` | `string` | No | User rating of the content (e.g., number of stars, likes). |
|
|
107
|
+
| `qagmediarating` | [`MediaRating`](#mediarating) | No | Media rating per IQG guidelines. Refer to AdCOM 1.0 Media Ratings. |
|
|
108
|
+
| `keywords` | `string` | No | Comma-separated list of keywords. *Mutually exclusive with `kwarray`.* |
|
|
109
|
+
| `kwarray` | `string[]` | No | Array of keywords describing the content. *Mutually exclusive with `keywords`.* |
|
|
110
|
+
| `livestream` | `0 \| 1` | No | Live stream indicator: `0` = Not live, `1` = Content is live. |
|
|
111
|
+
| `sourcerelationship` | `0 \| 1` | No | Source relationship indicator: `0` = Indirect, `1` = Direct. |
|
|
112
|
+
| `len` | `number` | No | Length of content in seconds (appropriate for video or audio). |
|
|
113
|
+
| `language` | `string` | No | Content language using ISO-639-1-alpha-2 format. *Mutually exclusive with `langb`.* |
|
|
114
|
+
| `langb` | `string` | No | Content language using IETF BCP 47 format. *Mutually exclusive with `language`.* |
|
|
115
|
+
| `embeddable` | `0 \| 1` | No | Indicator of whether content is embeddable: `0` = No, `1` = Yes. |
|
|
116
|
+
| `data` | [`Data[]`](#data) | No | Additional content data objects (OpenRTB Section 3.2.21). |
|
|
117
|
+
| `network` | [`Network`](#network) | No | Details about the network (OpenRTB Section 3.2.23) the content is on. |
|
|
118
|
+
| `channel` | [`Channel`](#channel) | No | Details about the channel (OpenRTB Section 3.2.24) the content is on. |
|
|
119
|
+
| `ext` | `Record<string, unknown>` | No | Placeholder for exchange-specific extensions to OpenRTB. |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Auxiliary Interfaces
|
|
124
|
+
|
|
125
|
+
### `Producer`
|
|
126
|
+
| Property | Type | Description |
|
|
127
|
+
| :--- | :--- | :--- |
|
|
128
|
+
| `id` | `string` | Content producer ID |
|
|
129
|
+
| `name` | `string` | Content producer name |
|
|
130
|
+
| `cattax` | [`CategoryTaxonomy`](#categorytaxonomy) | Category taxonomy in use |
|
|
131
|
+
| `cat` | `string[]` | Producer content categories |
|
|
132
|
+
| `domain` | `string` | Producer domain |
|
|
133
|
+
| `ext` | `Record<string, unknown>` | Extension field |
|
|
134
|
+
|
|
135
|
+
### `Network`
|
|
136
|
+
| Property | Type | Description |
|
|
137
|
+
| :--- | :--- | :--- |
|
|
138
|
+
| `id` | `string` | Network identifier |
|
|
139
|
+
| `name` | `string` | Network name |
|
|
140
|
+
| `domain` | `string` | Network domain |
|
|
141
|
+
| `ext` | `Record<string, unknown>` | Extension field |
|
|
142
|
+
|
|
143
|
+
### `Channel`
|
|
144
|
+
| Property | Type | Description |
|
|
145
|
+
| :--- | :--- | :--- |
|
|
146
|
+
| `id` | `string` | Channel identifier |
|
|
147
|
+
| `name` | `string` | Channel name |
|
|
148
|
+
| `domain` | `string` | Channel domain |
|
|
149
|
+
| `ext` | `Record<string, unknown>` | Extension field |
|
|
150
|
+
|
|
151
|
+
### `Data`
|
|
152
|
+
| Property | Type | Description |
|
|
153
|
+
| :--- | :--- | :--- |
|
|
154
|
+
| `id` | `string` | Data provider ID |
|
|
155
|
+
| `name` | `string` | Data provider name |
|
|
156
|
+
| `segment` | [`Segment[]`](#segment) | Array of data segments |
|
|
157
|
+
| `cids` | `string[]` | Array of Extended Content IDs |
|
|
158
|
+
| `ext` | `Record<string, unknown>` | Extension field |
|
|
159
|
+
|
|
160
|
+
### `Segment`
|
|
161
|
+
| Property | Type | Description |
|
|
162
|
+
| :--- | :--- | :--- |
|
|
163
|
+
| `id` | `string` | Segment ID |
|
|
164
|
+
| `name` | `string` | Segment name |
|
|
165
|
+
| `value` | `string` | Segment value |
|
|
166
|
+
| `ext` | `Record<string, unknown>` | Extension field |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Enums
|
|
171
|
+
|
|
172
|
+
### `CategoryTaxonomy`
|
|
173
|
+
| Key | Value | Description |
|
|
174
|
+
| :--- | :---: | :--- |
|
|
175
|
+
| `AD_PRODUCT_TAXONOMY_1_0` | `3` | IAB Tech Lab Ad Product Taxonomy 1.0 |
|
|
176
|
+
| `AUDIENCE_TAXONOMY_1_1` | `4` | IAB Tech Lab Audience Taxonomy 1.1 |
|
|
177
|
+
| `CONTENT_TAXONOMY_2_1` | `5` | IAB Tech Lab Content Taxonomy 2.1 |
|
|
178
|
+
| `CONTENT_TAXONOMY_2_2` | `6` | IAB Tech Lab Content Taxonomy 2.2 |
|
|
179
|
+
| `CONTENT_TAXONOMY_3_0` | `7` | IAB Tech Lab Content Taxonomy 3.0 |
|
|
180
|
+
| `AD_PRODUCT_TAXONOMY_2_0` | `8` | IAB Tech Lab Ad Product Taxonomy 2.0 |
|
|
181
|
+
| `CONTENT_TAXONOMY_3_1` | `9` | IAB Tech Lab Content Taxonomy 3.1 |
|
|
182
|
+
|
|
183
|
+
### `ProductionQuality`
|
|
184
|
+
| Key | Value | Description |
|
|
185
|
+
| :--- | :---: | :--- |
|
|
186
|
+
| `UNKNOWN` | `0` | Unknown |
|
|
187
|
+
| `PROFESSIONAL` | `1` | Professionally Produced |
|
|
188
|
+
| `PROSUMER` | `2` | Prosumer |
|
|
189
|
+
| `USER_GENERATED` | `3` | User Generated Content (UGC) |
|
|
190
|
+
|
|
191
|
+
### `MediaRating`
|
|
192
|
+
| Key | Value | Description |
|
|
193
|
+
| :--- | :---: | :--- |
|
|
194
|
+
| `ALL_AUDIENCES` | `1` | All Audiences |
|
|
195
|
+
| `OVER_12` | `2` | Everyone Over Age 12 |
|
|
196
|
+
| `MATURE` | `3` | Mature Audiences |
|
|
197
|
+
|
|
198
|
+
### `Context`
|
|
199
|
+
| Key | Value | Description |
|
|
200
|
+
| :--- | :---: | :--- |
|
|
201
|
+
| `VIDEO` | `1` | Video file or stream such as Internet TV broadcasts |
|
|
202
|
+
| `GAME` | `2` | Interactive software game |
|
|
203
|
+
| `MUSIC` | `3` | Audio file or stream such as Internet radio broadcasts |
|
|
204
|
+
| `APPLICATION` | `4` | Interactive software application |
|
|
205
|
+
| `TEXT` | `5` | Primarily textual document such as a web page, eBook, or news article |
|
|
206
|
+
| `OTHER` | `6` | None of the other categories applies |
|
|
207
|
+
| `UNKNOWN` | `7` | Unknown content context |
|
|
208
|
+
|
|
209
|
+
---
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e,t){if(this.baseUrl=`https://iframe.uptalktv.com/chat`,this.iframeElement=null,!t.apiKey)throw Error(`API key is required`);if(!t.chatId&&(!t.content||!t.content.id||!t.content.title))throw Error(`Either Chat Id or Content object with Id and Title is required`);this.iframeElement=document.createElement(`iframe`),this.iframeElement.src=this.baseUrl,this.iframeElement.className=`uptalktv-plugin`,this.iframeElement.onload=()=>{this.iframeElement?.contentWindow?.postMessage({type:`INIT_CONFIG`,payload:t},this.baseUrl)},this.iframeElement.setAttribute(`allowtransparency`,`true`),this.iframeElement.setAttribute(`tabindex`,`-1`),Object.assign(this.iframeElement.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,border:`none`,zIndex:(t.layout?.zIndex??1e3).toString(),backgroundColor:`transparent`,pointerEvents:`none`}),e.appendChild(this.iframeElement)}destroy(){this.iframeElement&&=(this.iframeElement.remove(),null)}};exports.UpTalkTV=e;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Represents OpenRTB Content object (Section 3.2.16) describing the media in which the ad/chat is embedded.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf | OpenRTB 2.6 Specification}
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface Content {
|
|
9
|
+
/**
|
|
10
|
+
* ID uniquely identifying the content.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Content title.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* Video: "Search Committee", "A New Hope"
|
|
18
|
+
* @example
|
|
19
|
+
* Article: "Why an Antarctic Glacier Is Melting So Quickly"
|
|
20
|
+
*/
|
|
21
|
+
title: string;
|
|
22
|
+
/**
|
|
23
|
+
* Genre describing the content (e.g., `"rock"`, `"pop"`).
|
|
24
|
+
*/
|
|
25
|
+
genre?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Episode number.
|
|
28
|
+
*/
|
|
29
|
+
episode?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Content series.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* Video: "The Office", "Star Wars"
|
|
35
|
+
* @example
|
|
36
|
+
* Article/Blog: "Ecocentric"
|
|
37
|
+
*/
|
|
38
|
+
series?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Content season (e.g., `"Season 3"`).
|
|
41
|
+
*/
|
|
42
|
+
season?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Artist credited with the content.
|
|
45
|
+
*/
|
|
46
|
+
artist?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Album to which the content belongs (typically for audio).
|
|
49
|
+
*/
|
|
50
|
+
album?: string;
|
|
51
|
+
/**
|
|
52
|
+
* International Standard Recording Code conforming to ISO 3901.
|
|
53
|
+
*/
|
|
54
|
+
isrc?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Details about the content Producer (OpenRTB Section 3.2.17).
|
|
57
|
+
*/
|
|
58
|
+
producer?: Producer;
|
|
59
|
+
/**
|
|
60
|
+
* URL of the content, for buy-side contextualization or review.
|
|
61
|
+
*/
|
|
62
|
+
url?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The taxonomy in use. Refer to AdCOM 1.0 Category Taxonomies list.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `1` (IAB Content Category Taxonomy 1.0)
|
|
67
|
+
*/
|
|
68
|
+
cattax?: CategoryTaxonomy;
|
|
69
|
+
/**
|
|
70
|
+
* Array of IAB content categories that describe the content.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The taxonomy used is defined by {@link Content.cattax}. If no `cattax` is supplied,
|
|
74
|
+
* IAB Content Category Taxonomy 1.0 is assumed.
|
|
75
|
+
*/
|
|
76
|
+
cat?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Production quality rating per AdCOM 1.0.
|
|
79
|
+
*/
|
|
80
|
+
prodq?: ProductionQuality;
|
|
81
|
+
/**
|
|
82
|
+
* Type of content context (e.g., game, video, text). Refer to AdCOM 1.0 Content Contexts.
|
|
83
|
+
*/
|
|
84
|
+
context?: Context;
|
|
85
|
+
/**
|
|
86
|
+
* Content rating (e.g., `"MPAA"`, `"TV-MA"`).
|
|
87
|
+
*/
|
|
88
|
+
contentrating?: string;
|
|
89
|
+
/**
|
|
90
|
+
* User rating of the content (e.g., number of stars, likes).
|
|
91
|
+
*/
|
|
92
|
+
userrating?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Media rating per IQG guidelines. Refer to AdCOM 1.0 Media Ratings.
|
|
95
|
+
*/
|
|
96
|
+
qagmediarating?: MediaRating;
|
|
97
|
+
/**
|
|
98
|
+
* Comma-separated list of keywords describing the content.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Mutually exclusive with {@link Content.kwarray}. Only one should be present.
|
|
102
|
+
*/
|
|
103
|
+
keywords?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Array of keywords describing the content.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Mutually exclusive with {@link Content.keywords}. Only one should be present.
|
|
109
|
+
*/
|
|
110
|
+
kwarray?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Live stream indicator.
|
|
113
|
+
* - `0` = Not live
|
|
114
|
+
* - `1` = Content is live (e.g., stream, live blog)
|
|
115
|
+
*/
|
|
116
|
+
livestream?: 0 | 1;
|
|
117
|
+
/**
|
|
118
|
+
* Source relationship indicator.
|
|
119
|
+
* - `0` = Indirect
|
|
120
|
+
* - `1` = Direct
|
|
121
|
+
*/
|
|
122
|
+
sourcerelationship?: 0 | 1;
|
|
123
|
+
/**
|
|
124
|
+
* Length of content in seconds (appropriate for video or audio).
|
|
125
|
+
*/
|
|
126
|
+
len?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Content language using ISO-639-1-alpha-2 format.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* Mutually exclusive with {@link Content.langb}. Only one should be present.
|
|
132
|
+
*/
|
|
133
|
+
language?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Content language using IETF BCP 47 format.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Mutually exclusive with {@link Content.language}. Only one should be present.
|
|
139
|
+
*/
|
|
140
|
+
langb?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Indicator of whether the content is embeddable (e.g., embeddable video player).
|
|
143
|
+
* - `0` = No
|
|
144
|
+
* - `1` = Yes
|
|
145
|
+
*/
|
|
146
|
+
embeddable?: 0 | 1;
|
|
147
|
+
/**
|
|
148
|
+
* Additional content data objects (OpenRTB Section 3.2.21).
|
|
149
|
+
*/
|
|
150
|
+
data?: Data[];
|
|
151
|
+
/**
|
|
152
|
+
* Details about the network (OpenRTB Section 3.2.23) the content is on.
|
|
153
|
+
*/
|
|
154
|
+
network?: Network;
|
|
155
|
+
/**
|
|
156
|
+
* Details about the channel (OpenRTB Section 3.2.24) the content is on.
|
|
157
|
+
*/
|
|
158
|
+
channel?: Channel;
|
|
159
|
+
/**
|
|
160
|
+
* Placeholder for exchange-specific extensions to OpenRTB.
|
|
161
|
+
*/
|
|
162
|
+
ext?: Record<string, unknown>;
|
|
163
|
+
}
|
|
164
|
+
interface Producer {
|
|
165
|
+
/** Content producer ID */
|
|
166
|
+
id?: string;
|
|
167
|
+
/** Content producer name */
|
|
168
|
+
name?: string;
|
|
169
|
+
/** Category taxonomy in use */
|
|
170
|
+
cattax?: CategoryTaxonomy;
|
|
171
|
+
/** Producer content categories */
|
|
172
|
+
cat?: string[];
|
|
173
|
+
/** Producer domain */
|
|
174
|
+
domain?: string;
|
|
175
|
+
/** Extension field */
|
|
176
|
+
ext?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
declare const enum CategoryTaxonomy {
|
|
179
|
+
/** IAB Tech Lab Ad Product Taxonomy 1.0 */
|
|
180
|
+
AD_PRODUCT_TAXONOMY_1_0 = 3,
|
|
181
|
+
/** IAB Tech Lab Audience Taxonomy 1.1 */
|
|
182
|
+
AUDIENCE_TAXONOMY_1_1 = 4,
|
|
183
|
+
/** IAB Tech Lab Content Taxonomy 2.1 */
|
|
184
|
+
CONTENT_TAXONOMY_2_1 = 5,
|
|
185
|
+
/** IAB Tech Lab Content Taxonomy 2.2 */
|
|
186
|
+
CONTENT_TAXONOMY_2_2 = 6,
|
|
187
|
+
/** IAB Tech Lab Content Taxonomy 3.0 */
|
|
188
|
+
CONTENT_TAXONOMY_3_0 = 7,
|
|
189
|
+
/** IAB Tech Lab Ad Product Taxonomy 2.0 */
|
|
190
|
+
AD_PRODUCT_TAXONOMY_2_0 = 8,
|
|
191
|
+
/** IAB Tech Lab Content Taxonomy 3.1 */
|
|
192
|
+
CONTENT_TAXONOMY_3_1 = 9
|
|
193
|
+
}
|
|
194
|
+
declare const enum ProductionQuality {
|
|
195
|
+
/** Unknown */
|
|
196
|
+
UNKNOWN = 0,
|
|
197
|
+
/** Professionally Produced */
|
|
198
|
+
PROFESSIONAL = 1,
|
|
199
|
+
/** Prosumer */
|
|
200
|
+
PROSUMER = 2,
|
|
201
|
+
/** User Generated Content (UGC) */
|
|
202
|
+
USER_GENERATED = 3
|
|
203
|
+
}
|
|
204
|
+
declare const enum MediaRating {
|
|
205
|
+
ALL_AUDIENCES = 1,
|
|
206
|
+
/** Everyone Over Age 12 */
|
|
207
|
+
OVER_12 = 2,
|
|
208
|
+
/** Mature Audiences */
|
|
209
|
+
MATURE = 3
|
|
210
|
+
}
|
|
211
|
+
interface Network {
|
|
212
|
+
/** Network identifier */
|
|
213
|
+
id?: string;
|
|
214
|
+
/** Network name */
|
|
215
|
+
name?: string;
|
|
216
|
+
/** Network domain */
|
|
217
|
+
domain?: string;
|
|
218
|
+
/** Extension field */
|
|
219
|
+
ext?: Record<string, unknown>;
|
|
220
|
+
}
|
|
221
|
+
interface Channel {
|
|
222
|
+
/** Channel identifier */
|
|
223
|
+
id?: string;
|
|
224
|
+
/** Channel name */
|
|
225
|
+
name?: string;
|
|
226
|
+
/** Channel domain */
|
|
227
|
+
domain?: string;
|
|
228
|
+
/** Extension field */
|
|
229
|
+
ext?: Record<string, unknown>;
|
|
230
|
+
}
|
|
231
|
+
interface Segment {
|
|
232
|
+
/** Segment ID */
|
|
233
|
+
id?: string;
|
|
234
|
+
/** Segment name */
|
|
235
|
+
name?: string;
|
|
236
|
+
/** Segment value */
|
|
237
|
+
value?: string;
|
|
238
|
+
/** Extension field */
|
|
239
|
+
ext?: Record<string, unknown>;
|
|
240
|
+
}
|
|
241
|
+
interface Data {
|
|
242
|
+
/** Data provider ID */
|
|
243
|
+
id?: string;
|
|
244
|
+
/** Data provider name */
|
|
245
|
+
name?: string;
|
|
246
|
+
/** Array of data segments */
|
|
247
|
+
segment?: Segment[];
|
|
248
|
+
/** Array of Extended Content IDs */
|
|
249
|
+
cids?: string[];
|
|
250
|
+
/** Extension field */
|
|
251
|
+
ext?: Record<string, unknown>;
|
|
252
|
+
}
|
|
253
|
+
declare const enum Context {
|
|
254
|
+
/** Video (i.e., video file or stream such as Internet TV broadcasts) */
|
|
255
|
+
VIDEO = 1,
|
|
256
|
+
/** Game (i.e., an interactive software game) */
|
|
257
|
+
GAME = 2,
|
|
258
|
+
/** Music (i.e., audio file or stream such as Internet radio broadcasts) */
|
|
259
|
+
MUSIC = 3,
|
|
260
|
+
/** Application (i.e., an interactive software application) */
|
|
261
|
+
APPLICATION = 4,
|
|
262
|
+
/** Text (i.e., primarily textual document such as a web page, eBook, or news article) */
|
|
263
|
+
TEXT = 5,
|
|
264
|
+
/** Other (i.e., none of the other categories applies) */
|
|
265
|
+
OTHER = 6,
|
|
266
|
+
/** Unknown content context */
|
|
267
|
+
UNKNOWN = 7
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Layout configuration options for the UpTalkTV chat iframe.
|
|
271
|
+
*
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
interface Layout {
|
|
275
|
+
/**
|
|
276
|
+
* Whether the chat container should align to the left side of the screen.
|
|
277
|
+
*
|
|
278
|
+
* @defaultValue `false`
|
|
279
|
+
*/
|
|
280
|
+
left?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Whether the message thread order or UI layout should be reversed.
|
|
283
|
+
*
|
|
284
|
+
* @defaultValue `false`
|
|
285
|
+
*/
|
|
286
|
+
reversed?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* The CSS `z-index` applied to the iframe element.
|
|
289
|
+
*
|
|
290
|
+
* @defaultValue `1000`
|
|
291
|
+
*/
|
|
292
|
+
zIndex?: number;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Main configuration object required to initialize the UpTalkTV chat plugin.
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
interface Config {
|
|
300
|
+
/**
|
|
301
|
+
* Authentication API key for the UpTalkTV service.
|
|
302
|
+
*/
|
|
303
|
+
apiKey: string;
|
|
304
|
+
/**
|
|
305
|
+
* Unique identifier of the target chat room to join.
|
|
306
|
+
*
|
|
307
|
+
* @remarks
|
|
308
|
+
* Required if {@link Config.content} is not specified.
|
|
309
|
+
*/
|
|
310
|
+
chatId?: string;
|
|
311
|
+
/**
|
|
312
|
+
* OpenRTB Content object describing the surrounding media context.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* Required if {@link Config.chatId} is not specified.
|
|
316
|
+
*/
|
|
317
|
+
content?: Content;
|
|
318
|
+
/**
|
|
319
|
+
* Unique device identifier.
|
|
320
|
+
*/
|
|
321
|
+
deviceId?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Visual positioning and rendering choices for the chat iframe.
|
|
324
|
+
*/
|
|
325
|
+
layout?: Layout;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/plugin.d.ts
|
|
329
|
+
/**
|
|
330
|
+
* Manages the embedding, messaging, and lifecycle of the UpTalkTV chat plugin.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* const playerContainer = document.getElementById("player-container");
|
|
335
|
+
* const plugin = new UpTalkTV(playerContainer, {
|
|
336
|
+
* apiKey: 'your-api-key',
|
|
337
|
+
* chatId: '12345'
|
|
338
|
+
* });
|
|
339
|
+
*
|
|
340
|
+
* // Cleanup when unmounting:
|
|
341
|
+
* plugin.destroy();
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
export declare class UpTalkTV {
|
|
345
|
+
/** Base URL for loading the chat iframe interface. */
|
|
346
|
+
private readonly baseUrl;
|
|
347
|
+
/** Internal reference to the created iframe element. */
|
|
348
|
+
private iframeElement;
|
|
349
|
+
/**
|
|
350
|
+
* Initializes the UpTalkTV chat plugin, constructs the DOM element, and handles
|
|
351
|
+
* initial configuration dispatch.
|
|
352
|
+
*
|
|
353
|
+
* @param container - The target HTML element where the chat iframe will be appended.
|
|
354
|
+
* @param config - Options to configure authentication, target content, and visual layout.
|
|
355
|
+
*
|
|
356
|
+
* @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} Thrown if `apiKey` is missing.
|
|
357
|
+
* @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} Thrown if `chatId` is missing or `content.id` and `content.title` are not supplied.
|
|
358
|
+
*/
|
|
359
|
+
constructor(container: HTMLElement, config: Config);
|
|
360
|
+
/**
|
|
361
|
+
* Removes the chat iframe from the DOM and releases internal element references.
|
|
362
|
+
*/
|
|
363
|
+
destroy(): void;
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
export type { CategoryTaxonomy, Channel, Config, Content, Context, Data, Layout, MediaRating, Network, Producer, ProductionQuality, Segment };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Represents OpenRTB Content object (Section 3.2.16) describing the media in which the ad/chat is embedded.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://iabtechlab.com/wp-content/uploads/2022/04/OpenRTB-2-6_FINAL.pdf | OpenRTB 2.6 Specification}
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface Content {
|
|
9
|
+
/**
|
|
10
|
+
* ID uniquely identifying the content.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Content title.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* Video: "Search Committee", "A New Hope"
|
|
18
|
+
* @example
|
|
19
|
+
* Article: "Why an Antarctic Glacier Is Melting So Quickly"
|
|
20
|
+
*/
|
|
21
|
+
title: string;
|
|
22
|
+
/**
|
|
23
|
+
* Genre describing the content (e.g., `"rock"`, `"pop"`).
|
|
24
|
+
*/
|
|
25
|
+
genre?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Episode number.
|
|
28
|
+
*/
|
|
29
|
+
episode?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Content series.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* Video: "The Office", "Star Wars"
|
|
35
|
+
* @example
|
|
36
|
+
* Article/Blog: "Ecocentric"
|
|
37
|
+
*/
|
|
38
|
+
series?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Content season (e.g., `"Season 3"`).
|
|
41
|
+
*/
|
|
42
|
+
season?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Artist credited with the content.
|
|
45
|
+
*/
|
|
46
|
+
artist?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Album to which the content belongs (typically for audio).
|
|
49
|
+
*/
|
|
50
|
+
album?: string;
|
|
51
|
+
/**
|
|
52
|
+
* International Standard Recording Code conforming to ISO 3901.
|
|
53
|
+
*/
|
|
54
|
+
isrc?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Details about the content Producer (OpenRTB Section 3.2.17).
|
|
57
|
+
*/
|
|
58
|
+
producer?: Producer;
|
|
59
|
+
/**
|
|
60
|
+
* URL of the content, for buy-side contextualization or review.
|
|
61
|
+
*/
|
|
62
|
+
url?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The taxonomy in use. Refer to AdCOM 1.0 Category Taxonomies list.
|
|
65
|
+
*
|
|
66
|
+
* @defaultValue `1` (IAB Content Category Taxonomy 1.0)
|
|
67
|
+
*/
|
|
68
|
+
cattax?: CategoryTaxonomy;
|
|
69
|
+
/**
|
|
70
|
+
* Array of IAB content categories that describe the content.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The taxonomy used is defined by {@link Content.cattax}. If no `cattax` is supplied,
|
|
74
|
+
* IAB Content Category Taxonomy 1.0 is assumed.
|
|
75
|
+
*/
|
|
76
|
+
cat?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Production quality rating per AdCOM 1.0.
|
|
79
|
+
*/
|
|
80
|
+
prodq?: ProductionQuality;
|
|
81
|
+
/**
|
|
82
|
+
* Type of content context (e.g., game, video, text). Refer to AdCOM 1.0 Content Contexts.
|
|
83
|
+
*/
|
|
84
|
+
context?: Context;
|
|
85
|
+
/**
|
|
86
|
+
* Content rating (e.g., `"MPAA"`, `"TV-MA"`).
|
|
87
|
+
*/
|
|
88
|
+
contentrating?: string;
|
|
89
|
+
/**
|
|
90
|
+
* User rating of the content (e.g., number of stars, likes).
|
|
91
|
+
*/
|
|
92
|
+
userrating?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Media rating per IQG guidelines. Refer to AdCOM 1.0 Media Ratings.
|
|
95
|
+
*/
|
|
96
|
+
qagmediarating?: MediaRating;
|
|
97
|
+
/**
|
|
98
|
+
* Comma-separated list of keywords describing the content.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Mutually exclusive with {@link Content.kwarray}. Only one should be present.
|
|
102
|
+
*/
|
|
103
|
+
keywords?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Array of keywords describing the content.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Mutually exclusive with {@link Content.keywords}. Only one should be present.
|
|
109
|
+
*/
|
|
110
|
+
kwarray?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* Live stream indicator.
|
|
113
|
+
* - `0` = Not live
|
|
114
|
+
* - `1` = Content is live (e.g., stream, live blog)
|
|
115
|
+
*/
|
|
116
|
+
livestream?: 0 | 1;
|
|
117
|
+
/**
|
|
118
|
+
* Source relationship indicator.
|
|
119
|
+
* - `0` = Indirect
|
|
120
|
+
* - `1` = Direct
|
|
121
|
+
*/
|
|
122
|
+
sourcerelationship?: 0 | 1;
|
|
123
|
+
/**
|
|
124
|
+
* Length of content in seconds (appropriate for video or audio).
|
|
125
|
+
*/
|
|
126
|
+
len?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Content language using ISO-639-1-alpha-2 format.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* Mutually exclusive with {@link Content.langb}. Only one should be present.
|
|
132
|
+
*/
|
|
133
|
+
language?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Content language using IETF BCP 47 format.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Mutually exclusive with {@link Content.language}. Only one should be present.
|
|
139
|
+
*/
|
|
140
|
+
langb?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Indicator of whether the content is embeddable (e.g., embeddable video player).
|
|
143
|
+
* - `0` = No
|
|
144
|
+
* - `1` = Yes
|
|
145
|
+
*/
|
|
146
|
+
embeddable?: 0 | 1;
|
|
147
|
+
/**
|
|
148
|
+
* Additional content data objects (OpenRTB Section 3.2.21).
|
|
149
|
+
*/
|
|
150
|
+
data?: Data[];
|
|
151
|
+
/**
|
|
152
|
+
* Details about the network (OpenRTB Section 3.2.23) the content is on.
|
|
153
|
+
*/
|
|
154
|
+
network?: Network;
|
|
155
|
+
/**
|
|
156
|
+
* Details about the channel (OpenRTB Section 3.2.24) the content is on.
|
|
157
|
+
*/
|
|
158
|
+
channel?: Channel;
|
|
159
|
+
/**
|
|
160
|
+
* Placeholder for exchange-specific extensions to OpenRTB.
|
|
161
|
+
*/
|
|
162
|
+
ext?: Record<string, unknown>;
|
|
163
|
+
}
|
|
164
|
+
interface Producer {
|
|
165
|
+
/** Content producer ID */
|
|
166
|
+
id?: string;
|
|
167
|
+
/** Content producer name */
|
|
168
|
+
name?: string;
|
|
169
|
+
/** Category taxonomy in use */
|
|
170
|
+
cattax?: CategoryTaxonomy;
|
|
171
|
+
/** Producer content categories */
|
|
172
|
+
cat?: string[];
|
|
173
|
+
/** Producer domain */
|
|
174
|
+
domain?: string;
|
|
175
|
+
/** Extension field */
|
|
176
|
+
ext?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
declare const enum CategoryTaxonomy {
|
|
179
|
+
/** IAB Tech Lab Ad Product Taxonomy 1.0 */
|
|
180
|
+
AD_PRODUCT_TAXONOMY_1_0 = 3,
|
|
181
|
+
/** IAB Tech Lab Audience Taxonomy 1.1 */
|
|
182
|
+
AUDIENCE_TAXONOMY_1_1 = 4,
|
|
183
|
+
/** IAB Tech Lab Content Taxonomy 2.1 */
|
|
184
|
+
CONTENT_TAXONOMY_2_1 = 5,
|
|
185
|
+
/** IAB Tech Lab Content Taxonomy 2.2 */
|
|
186
|
+
CONTENT_TAXONOMY_2_2 = 6,
|
|
187
|
+
/** IAB Tech Lab Content Taxonomy 3.0 */
|
|
188
|
+
CONTENT_TAXONOMY_3_0 = 7,
|
|
189
|
+
/** IAB Tech Lab Ad Product Taxonomy 2.0 */
|
|
190
|
+
AD_PRODUCT_TAXONOMY_2_0 = 8,
|
|
191
|
+
/** IAB Tech Lab Content Taxonomy 3.1 */
|
|
192
|
+
CONTENT_TAXONOMY_3_1 = 9
|
|
193
|
+
}
|
|
194
|
+
declare const enum ProductionQuality {
|
|
195
|
+
/** Unknown */
|
|
196
|
+
UNKNOWN = 0,
|
|
197
|
+
/** Professionally Produced */
|
|
198
|
+
PROFESSIONAL = 1,
|
|
199
|
+
/** Prosumer */
|
|
200
|
+
PROSUMER = 2,
|
|
201
|
+
/** User Generated Content (UGC) */
|
|
202
|
+
USER_GENERATED = 3
|
|
203
|
+
}
|
|
204
|
+
declare const enum MediaRating {
|
|
205
|
+
ALL_AUDIENCES = 1,
|
|
206
|
+
/** Everyone Over Age 12 */
|
|
207
|
+
OVER_12 = 2,
|
|
208
|
+
/** Mature Audiences */
|
|
209
|
+
MATURE = 3
|
|
210
|
+
}
|
|
211
|
+
interface Network {
|
|
212
|
+
/** Network identifier */
|
|
213
|
+
id?: string;
|
|
214
|
+
/** Network name */
|
|
215
|
+
name?: string;
|
|
216
|
+
/** Network domain */
|
|
217
|
+
domain?: string;
|
|
218
|
+
/** Extension field */
|
|
219
|
+
ext?: Record<string, unknown>;
|
|
220
|
+
}
|
|
221
|
+
interface Channel {
|
|
222
|
+
/** Channel identifier */
|
|
223
|
+
id?: string;
|
|
224
|
+
/** Channel name */
|
|
225
|
+
name?: string;
|
|
226
|
+
/** Channel domain */
|
|
227
|
+
domain?: string;
|
|
228
|
+
/** Extension field */
|
|
229
|
+
ext?: Record<string, unknown>;
|
|
230
|
+
}
|
|
231
|
+
interface Segment {
|
|
232
|
+
/** Segment ID */
|
|
233
|
+
id?: string;
|
|
234
|
+
/** Segment name */
|
|
235
|
+
name?: string;
|
|
236
|
+
/** Segment value */
|
|
237
|
+
value?: string;
|
|
238
|
+
/** Extension field */
|
|
239
|
+
ext?: Record<string, unknown>;
|
|
240
|
+
}
|
|
241
|
+
interface Data {
|
|
242
|
+
/** Data provider ID */
|
|
243
|
+
id?: string;
|
|
244
|
+
/** Data provider name */
|
|
245
|
+
name?: string;
|
|
246
|
+
/** Array of data segments */
|
|
247
|
+
segment?: Segment[];
|
|
248
|
+
/** Array of Extended Content IDs */
|
|
249
|
+
cids?: string[];
|
|
250
|
+
/** Extension field */
|
|
251
|
+
ext?: Record<string, unknown>;
|
|
252
|
+
}
|
|
253
|
+
declare const enum Context {
|
|
254
|
+
/** Video (i.e., video file or stream such as Internet TV broadcasts) */
|
|
255
|
+
VIDEO = 1,
|
|
256
|
+
/** Game (i.e., an interactive software game) */
|
|
257
|
+
GAME = 2,
|
|
258
|
+
/** Music (i.e., audio file or stream such as Internet radio broadcasts) */
|
|
259
|
+
MUSIC = 3,
|
|
260
|
+
/** Application (i.e., an interactive software application) */
|
|
261
|
+
APPLICATION = 4,
|
|
262
|
+
/** Text (i.e., primarily textual document such as a web page, eBook, or news article) */
|
|
263
|
+
TEXT = 5,
|
|
264
|
+
/** Other (i.e., none of the other categories applies) */
|
|
265
|
+
OTHER = 6,
|
|
266
|
+
/** Unknown content context */
|
|
267
|
+
UNKNOWN = 7
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Layout configuration options for the UpTalkTV chat iframe.
|
|
271
|
+
*
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
interface Layout {
|
|
275
|
+
/**
|
|
276
|
+
* Whether the chat container should align to the left side of the screen.
|
|
277
|
+
*
|
|
278
|
+
* @defaultValue `false`
|
|
279
|
+
*/
|
|
280
|
+
left?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Whether the message thread order or UI layout should be reversed.
|
|
283
|
+
*
|
|
284
|
+
* @defaultValue `false`
|
|
285
|
+
*/
|
|
286
|
+
reversed?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* The CSS `z-index` applied to the iframe element.
|
|
289
|
+
*
|
|
290
|
+
* @defaultValue `1000`
|
|
291
|
+
*/
|
|
292
|
+
zIndex?: number;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Main configuration object required to initialize the UpTalkTV chat plugin.
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
*/
|
|
299
|
+
interface Config {
|
|
300
|
+
/**
|
|
301
|
+
* Authentication API key for the UpTalkTV service.
|
|
302
|
+
*/
|
|
303
|
+
apiKey: string;
|
|
304
|
+
/**
|
|
305
|
+
* Unique identifier of the target chat room to join.
|
|
306
|
+
*
|
|
307
|
+
* @remarks
|
|
308
|
+
* Required if {@link Config.content} is not specified.
|
|
309
|
+
*/
|
|
310
|
+
chatId?: string;
|
|
311
|
+
/**
|
|
312
|
+
* OpenRTB Content object describing the surrounding media context.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* Required if {@link Config.chatId} is not specified.
|
|
316
|
+
*/
|
|
317
|
+
content?: Content;
|
|
318
|
+
/**
|
|
319
|
+
* Unique device identifier.
|
|
320
|
+
*/
|
|
321
|
+
deviceId?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Visual positioning and rendering choices for the chat iframe.
|
|
324
|
+
*/
|
|
325
|
+
layout?: Layout;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/plugin.d.ts
|
|
329
|
+
/**
|
|
330
|
+
* Manages the embedding, messaging, and lifecycle of the UpTalkTV chat plugin.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* const playerContainer = document.getElementById("player-container");
|
|
335
|
+
* const plugin = new UpTalkTV(playerContainer, {
|
|
336
|
+
* apiKey: 'your-api-key',
|
|
337
|
+
* chatId: '12345'
|
|
338
|
+
* });
|
|
339
|
+
*
|
|
340
|
+
* // Cleanup when unmounting:
|
|
341
|
+
* plugin.destroy();
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
export declare class UpTalkTV {
|
|
345
|
+
/** Base URL for loading the chat iframe interface. */
|
|
346
|
+
private readonly baseUrl;
|
|
347
|
+
/** Internal reference to the created iframe element. */
|
|
348
|
+
private iframeElement;
|
|
349
|
+
/**
|
|
350
|
+
* Initializes the UpTalkTV chat plugin, constructs the DOM element, and handles
|
|
351
|
+
* initial configuration dispatch.
|
|
352
|
+
*
|
|
353
|
+
* @param container - The target HTML element where the chat iframe will be appended.
|
|
354
|
+
* @param config - Options to configure authentication, target content, and visual layout.
|
|
355
|
+
*
|
|
356
|
+
* @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} Thrown if `apiKey` is missing.
|
|
357
|
+
* @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} Thrown if `chatId` is missing or `content.id` and `content.title` are not supplied.
|
|
358
|
+
*/
|
|
359
|
+
constructor(container: HTMLElement, config: Config);
|
|
360
|
+
/**
|
|
361
|
+
* Removes the chat iframe from the DOM and releases internal element references.
|
|
362
|
+
*/
|
|
363
|
+
destroy(): void;
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
export type { CategoryTaxonomy, Channel, Config, Content, Context, Data, Layout, MediaRating, Network, Producer, ProductionQuality, Segment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var UpTalkTV=(function(e){return Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),e.UpTalkTV=class{constructor(e,t){if(this.baseUrl=`https://iframe.uptalktv.com/chat`,this.iframeElement=null,!t.apiKey)throw Error(`API key is required`);if(!t.chatId&&(!t.content||!t.content.id||!t.content.title))throw Error(`Either Chat Id or Content object with Id and Title is required`);this.iframeElement=document.createElement(`iframe`),this.iframeElement.src=this.baseUrl,this.iframeElement.className=`uptalktv-plugin`,this.iframeElement.onload=()=>{this.iframeElement?.contentWindow?.postMessage({type:`INIT_CONFIG`,payload:t},this.baseUrl)},this.iframeElement.setAttribute(`allowtransparency`,`true`),this.iframeElement.setAttribute(`tabindex`,`-1`),Object.assign(this.iframeElement.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,border:`none`,zIndex:(t.layout?.zIndex??1e3).toString(),backgroundColor:`transparent`,pointerEvents:`none`}),e.appendChild(this.iframeElement)}destroy(){this.iframeElement&&=(this.iframeElement.remove(),null)}},e})({});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{constructor(e,t){if(this.baseUrl=`https://iframe.uptalktv.com/chat`,this.iframeElement=null,!t.apiKey)throw Error(`API key is required`);if(!t.chatId&&(!t.content||!t.content.id||!t.content.title))throw Error(`Either Chat Id or Content object with Id and Title is required`);this.iframeElement=document.createElement(`iframe`),this.iframeElement.src=this.baseUrl,this.iframeElement.className=`uptalktv-plugin`,this.iframeElement.onload=()=>{this.iframeElement?.contentWindow?.postMessage({type:`INIT_CONFIG`,payload:t},this.baseUrl)},this.iframeElement.setAttribute(`allowtransparency`,`true`),this.iframeElement.setAttribute(`tabindex`,`-1`),Object.assign(this.iframeElement.style,{position:`absolute`,top:`0`,left:`0`,width:`100%`,height:`100%`,border:`none`,zIndex:(t.layout?.zIndex??1e3).toString(),backgroundColor:`transparent`,pointerEvents:`none`}),e.appendChild(this.iframeElement)}destroy(){this.iframeElement&&=(this.iframeElement.remove(),null)}};export{e as UpTalkTV};
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uptalktv-plugin",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "UpTalkTV Video Player Plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "tsdown --watch",
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"docs": "typedoc src/index.ts"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://bitbucket.org/uptalktv/uptalktv-plugin.git"
|
|
27
|
+
},
|
|
28
|
+
"author": "Deivydas Šabaras",
|
|
29
|
+
"license": "ISC",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"tsdown": "^0.23.0",
|
|
32
|
+
"typedoc": "^0.28.20",
|
|
33
|
+
"typescript": "^6.0.3"
|
|
34
|
+
}
|
|
35
|
+
}
|