@monterosa/sdk-interact-kit 2.0.0-rc.1 → 2.0.0-rc.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/core/connection_health/index.d.ts +7 -1
- package/dist/core/connection_health/public-types.d.ts +1 -1
- package/dist/core/element/api.d.ts +51 -30
- package/dist/core/element/public-types.d.ts +37 -26
- package/dist/core/element/types.d.ts +11 -11
- package/dist/core/event/api.d.ts +43 -35
- package/dist/core/event/public-types.d.ts +25 -21
- package/dist/core/project/api.d.ts +12 -12
- package/dist/core/project/public-types.d.ts +10 -8
- package/dist/index.d.ts +5 -6
- package/dist/{index.esm.js → index.js} +126 -128
- package/dist/index.js.map +1 -0
- package/package.json +21 -20
- package/dist/api.d.ts +0 -36
- package/dist/index.cjs.js +0 -2961
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
|
@@ -11,11 +11,17 @@ import { Unsubscribe } from '@monterosa/sdk-util';
|
|
|
11
11
|
import { ConnectionHealth, ConnectionHealthState } from './public-types';
|
|
12
12
|
/**
|
|
13
13
|
* Returns {@link ConnectionHealth | connection health} instance
|
|
14
|
+
*
|
|
15
|
+
* @param sdk - The SDK instance to monitor
|
|
16
|
+
* @returns The connection health instance.
|
|
14
17
|
*/
|
|
15
18
|
declare function getConnectionHealth(sdk?: MonterosaSdk): Promise<ConnectionHealth>;
|
|
16
19
|
/**
|
|
17
20
|
* Adds an observer for when
|
|
18
|
-
* {@link ConnectionHealth
|
|
21
|
+
* {@link ConnectionHealth | connection health state} changed
|
|
22
|
+
*
|
|
23
|
+
* @param connectionHealth - The instance to observe
|
|
24
|
+
* @param callback - Called with the new state
|
|
19
25
|
*/
|
|
20
26
|
declare function onConnectionHealthState(connectionHealth: ConnectionHealth, callback: (state: ConnectionHealthState) => void): Unsubscribe;
|
|
21
27
|
export { ConnectionHealthState, ConnectionHealth } from './public-types';
|
|
@@ -26,7 +26,7 @@ export declare enum ConnectionHealthState {
|
|
|
26
26
|
Ok = "ok",
|
|
27
27
|
/**
|
|
28
28
|
* The client is either trying to establish a connection but failing, or
|
|
29
|
-
* the client has been
|
|
29
|
+
* the client has been explicitly {@link @monterosa/sdk-connect-kit#disconnect() | disconnected}
|
|
30
30
|
*/
|
|
31
31
|
Error = "error"
|
|
32
32
|
}
|
|
@@ -15,7 +15,10 @@ import { Answer, AnswerValue } from './answer';
|
|
|
15
15
|
*/
|
|
16
16
|
declare const getElementMemoized: (...args: any[]) => Promise<InteractElement | null>;
|
|
17
17
|
/**
|
|
18
|
-
* Returns an
|
|
18
|
+
* Returns an Element of a specific Event by its id.
|
|
19
|
+
*
|
|
20
|
+
* @param event - The Event that owns the Element
|
|
21
|
+
* @param id - The Element identifier
|
|
19
22
|
*/
|
|
20
23
|
declare function getElement(event: InteractEvent, id: string): Promise<InteractElement | null>;
|
|
21
24
|
/**
|
|
@@ -23,11 +26,14 @@ declare function getElement(event: InteractEvent, id: string): Promise<InteractE
|
|
|
23
26
|
*/
|
|
24
27
|
declare const getElementsMemoized: (...args: any[]) => Promise<InteractElement[]>;
|
|
25
28
|
/**
|
|
26
|
-
* Returns the list of
|
|
29
|
+
* Returns the list of Elements published in a specific Event
|
|
30
|
+
*
|
|
31
|
+
* @param event - The Event to fetch Elements for
|
|
32
|
+
* @returns The published Elements, sorted oldest first.
|
|
27
33
|
*/
|
|
28
34
|
declare function getElements(event: InteractEvent): Promise<InteractElement[]>;
|
|
29
35
|
/**
|
|
30
|
-
* Submits an
|
|
36
|
+
* Submits an Element answer as a spread of options indices
|
|
31
37
|
*
|
|
32
38
|
* @example
|
|
33
39
|
* ```javascript
|
|
@@ -35,12 +41,12 @@ declare function getElements(event: InteractEvent): Promise<InteractElement[]>;
|
|
|
35
41
|
* answer(element, 0, 2);
|
|
36
42
|
* ```
|
|
37
43
|
*
|
|
38
|
-
* @param element - An
|
|
44
|
+
* @param element - An Element instance
|
|
39
45
|
* @param indices - Spread of options indices (starting with 0) to vote for
|
|
40
46
|
*/
|
|
41
47
|
declare function answer(element: InteractElement, ...indices: number[]): void;
|
|
42
48
|
/**
|
|
43
|
-
* Submits an
|
|
49
|
+
* Submits an Element answer as an array of options indices
|
|
44
50
|
*
|
|
45
51
|
* @example
|
|
46
52
|
* ```javascript
|
|
@@ -48,12 +54,12 @@ declare function answer(element: InteractElement, ...indices: number[]): void;
|
|
|
48
54
|
* answer(element, [0, 2]);
|
|
49
55
|
* ```
|
|
50
56
|
*
|
|
51
|
-
* @param element - An
|
|
57
|
+
* @param element - An Element instance
|
|
52
58
|
* @param arrayOfIndices - Array of options indices (starting with 0) to vote for
|
|
53
59
|
*/
|
|
54
60
|
declare function answer(element: InteractElement, arrayOfIndices: number[]): void;
|
|
55
61
|
/**
|
|
56
|
-
* Submits an
|
|
62
|
+
* Submits an Element answer as a spread of answer values
|
|
57
63
|
*
|
|
58
64
|
* @example
|
|
59
65
|
* ```javascript
|
|
@@ -64,12 +70,12 @@ declare function answer(element: InteractElement, arrayOfIndices: number[]): voi
|
|
|
64
70
|
* );
|
|
65
71
|
* ```
|
|
66
72
|
*
|
|
67
|
-
* @param element - An
|
|
73
|
+
* @param element - An Element instance
|
|
68
74
|
* @param answerValues - Spread of answer values to vote for
|
|
69
75
|
*/
|
|
70
76
|
declare function answer(element: InteractElement, ...answerValues: AnswerValue[]): void;
|
|
71
77
|
/**
|
|
72
|
-
* Submits an
|
|
78
|
+
* Submits an Element answer as an array of answer values
|
|
73
79
|
*
|
|
74
80
|
* @example
|
|
75
81
|
* ```javascript
|
|
@@ -80,12 +86,12 @@ declare function answer(element: InteractElement, ...answerValues: AnswerValue[]
|
|
|
80
86
|
* ]);
|
|
81
87
|
* ```
|
|
82
88
|
*
|
|
83
|
-
* @param element - An
|
|
89
|
+
* @param element - An Element instance
|
|
84
90
|
* @param arrayOfAnswerValues - Array of answer values to vote for
|
|
85
91
|
*/
|
|
86
92
|
declare function answer(element: InteractElement, arrayOfAnswerValues: AnswerValue[]): void;
|
|
87
93
|
/**
|
|
88
|
-
* Submits an
|
|
94
|
+
* Submits an Element answer as an Answer instance
|
|
89
95
|
*
|
|
90
96
|
* @example
|
|
91
97
|
* ```javascript
|
|
@@ -97,7 +103,7 @@ declare function answer(element: InteractElement, arrayOfAnswerValues: AnswerVal
|
|
|
97
103
|
* answer(element, value);
|
|
98
104
|
* ```
|
|
99
105
|
*
|
|
100
|
-
* @param element - An
|
|
106
|
+
* @param element - An Element instance
|
|
101
107
|
* @param answerObject - Array of answer values to vote for
|
|
102
108
|
*/
|
|
103
109
|
declare function answer(element: InteractElement, answerObject: Answer): void;
|
|
@@ -105,7 +111,7 @@ declare function answer(element: InteractElement, answerObject: Answer): void;
|
|
|
105
111
|
* Validates user's answer as a spread of options indices and
|
|
106
112
|
* throws {@link @monterosa/sdk-util#MonterosaError%20class | error} with one of the
|
|
107
113
|
* {@link AnswerError | error code} if the answer doesn't match
|
|
108
|
-
*
|
|
114
|
+
* Element's constraints
|
|
109
115
|
*
|
|
110
116
|
*
|
|
111
117
|
* @example
|
|
@@ -117,7 +123,7 @@ declare function answer(element: InteractElement, answerObject: Answer): void;
|
|
|
117
123
|
* }
|
|
118
124
|
* ```
|
|
119
125
|
*
|
|
120
|
-
* @param element - An
|
|
126
|
+
* @param element - An Element instance
|
|
121
127
|
* @param indices - Spread of options indices (starting with 0) to vote for
|
|
122
128
|
*/
|
|
123
129
|
declare function validateAnswer(element: InteractElement, ...indices: number[]): void;
|
|
@@ -125,7 +131,7 @@ declare function validateAnswer(element: InteractElement, ...indices: number[]):
|
|
|
125
131
|
* Validates user's answer as an array of options indices and
|
|
126
132
|
* throws {@link @monterosa/sdk-util#MonterosaError%20class | error} with one of the
|
|
127
133
|
* {@link AnswerError | error code} if the answer doesn't match
|
|
128
|
-
*
|
|
134
|
+
* Element's constraints
|
|
129
135
|
*
|
|
130
136
|
* @example
|
|
131
137
|
* ```javascript
|
|
@@ -136,7 +142,7 @@ declare function validateAnswer(element: InteractElement, ...indices: number[]):
|
|
|
136
142
|
* }
|
|
137
143
|
* ```
|
|
138
144
|
*
|
|
139
|
-
* @param element - An
|
|
145
|
+
* @param element - An Element instance
|
|
140
146
|
* @param arrayOfIndices - Array of options indices (starting with 0) to vote for
|
|
141
147
|
*/
|
|
142
148
|
declare function validateAnswer(element: InteractElement, arrayOfIndices: number[]): void;
|
|
@@ -144,7 +150,7 @@ declare function validateAnswer(element: InteractElement, arrayOfIndices: number
|
|
|
144
150
|
* Validates user's answer as a spread of answer values and
|
|
145
151
|
* throws {@link @monterosa/sdk-util#MonterosaError%20class | error} with one of the
|
|
146
152
|
* {@link AnswerError | error code} if the answer doesn't match
|
|
147
|
-
*
|
|
153
|
+
* Element's constraints
|
|
148
154
|
*
|
|
149
155
|
* @example
|
|
150
156
|
* ```javascript
|
|
@@ -158,7 +164,7 @@ declare function validateAnswer(element: InteractElement, arrayOfIndices: number
|
|
|
158
164
|
* }
|
|
159
165
|
* ```
|
|
160
166
|
*
|
|
161
|
-
* @param element - An
|
|
167
|
+
* @param element - An Element instance
|
|
162
168
|
* @param answerValues - Spread of answer values to vote for
|
|
163
169
|
*/
|
|
164
170
|
declare function validateAnswer(element: InteractElement, ...answerValues: AnswerValue[]): void;
|
|
@@ -166,7 +172,7 @@ declare function validateAnswer(element: InteractElement, ...answerValues: Answe
|
|
|
166
172
|
* Validates user's answer as an array of answer values and
|
|
167
173
|
* throws {@link @monterosa/sdk-util#MonterosaError%20class | error} with one of the
|
|
168
174
|
* {@link AnswerError | error code} if the answer doesn't match
|
|
169
|
-
*
|
|
175
|
+
* Element's constraints
|
|
170
176
|
*
|
|
171
177
|
* @example
|
|
172
178
|
* ```javascript
|
|
@@ -180,7 +186,7 @@ declare function validateAnswer(element: InteractElement, ...answerValues: Answe
|
|
|
180
186
|
* }
|
|
181
187
|
* ```
|
|
182
188
|
*
|
|
183
|
-
* @param element - An
|
|
189
|
+
* @param element - An Element instance
|
|
184
190
|
* @param arrayOfAnswerValues - Array of answer values to vote for
|
|
185
191
|
*/
|
|
186
192
|
declare function validateAnswer(element: InteractElement, arrayOfAnswerValues: AnswerValue[]): void;
|
|
@@ -188,7 +194,7 @@ declare function validateAnswer(element: InteractElement, arrayOfAnswerValues: A
|
|
|
188
194
|
* Validates user's answer as an Answer instance and
|
|
189
195
|
* throws {@link @monterosa/sdk-util#MonterosaError%20class | error} with one of the
|
|
190
196
|
* {@link AnswerError | error code} if the answer doesn't match
|
|
191
|
-
*
|
|
197
|
+
* Element's constraints
|
|
192
198
|
*
|
|
193
199
|
* @example
|
|
194
200
|
* ```javascript
|
|
@@ -203,31 +209,46 @@ declare function validateAnswer(element: InteractElement, arrayOfAnswerValues: A
|
|
|
203
209
|
* }
|
|
204
210
|
* ```
|
|
205
211
|
*
|
|
206
|
-
* @param element - An
|
|
212
|
+
* @param element - An Element instance
|
|
207
213
|
* @param answerObject - Array of answer values to vote for
|
|
208
214
|
*/
|
|
209
215
|
declare function validateAnswer(element: InteractElement, answerObject: Answer): void;
|
|
210
216
|
/**
|
|
211
|
-
* Adds an observer for when
|
|
212
|
-
* are updated
|
|
217
|
+
* Adds an observer for when
|
|
218
|
+
* {@link InteractElement | Element results} are updated
|
|
219
|
+
*
|
|
220
|
+
* @param element - The Element to observe
|
|
221
|
+
* @param callback - Called when results are updated
|
|
213
222
|
*/
|
|
214
223
|
declare function onElementResults(element: InteractElement, callback: () => void): Unsubscribe;
|
|
215
224
|
/**
|
|
216
|
-
* Adds an observer for when
|
|
217
|
-
* changed
|
|
225
|
+
* Adds an observer for when
|
|
226
|
+
* {@link InteractElement | Element state} changed
|
|
227
|
+
*
|
|
228
|
+
* @param element - The Element to observe
|
|
229
|
+
* @param callback - Called when the state changes
|
|
218
230
|
*/
|
|
219
231
|
declare function onElementStateChanged(element: InteractElement, callback: () => void): Unsubscribe;
|
|
220
232
|
/**
|
|
221
|
-
* Adds an observer for when
|
|
222
|
-
*
|
|
233
|
+
* Adds an observer for when
|
|
234
|
+
* {@link InteractElement | Element fields} are updated
|
|
235
|
+
*
|
|
236
|
+
* @param event - The Event containing the Elements
|
|
237
|
+
* @param callback - Called with the updated Element
|
|
223
238
|
*/
|
|
224
239
|
declare function onElementUpdated(event: InteractEvent, callback: (element: InteractElement) => void): Unsubscribe;
|
|
225
240
|
/**
|
|
226
|
-
* Adds an observer for when a new
|
|
241
|
+
* Adds an observer for when a new Element is published
|
|
242
|
+
*
|
|
243
|
+
* @param event - The Event to observe
|
|
244
|
+
* @param callback - Called with the published Element
|
|
227
245
|
*/
|
|
228
246
|
declare function onElementPublished(event: InteractEvent, callback: (element: InteractElement) => void): Unsubscribe;
|
|
229
247
|
/**
|
|
230
|
-
* Adds an observer for when an
|
|
248
|
+
* Adds an observer for when an Element is revoked
|
|
249
|
+
*
|
|
250
|
+
* @param event - The Event to observe
|
|
251
|
+
* @param callback - Called with the revoked Element
|
|
231
252
|
*/
|
|
232
253
|
declare function onElementRevoked(event: InteractEvent, callback: (element: InteractElement) => void): Unsubscribe;
|
|
233
254
|
export { getElement, getElementMemoized, getElements, getElementsMemoized, answer, validateAnswer, onElementResults, onElementStateChanged, onElementUpdated, onElementPublished, onElementRevoked, };
|
|
@@ -15,13 +15,21 @@ import { Answer } from './answer';
|
|
|
15
15
|
* vote() or validateAnswer() functions.
|
|
16
16
|
*/
|
|
17
17
|
export declare enum AnswerError {
|
|
18
|
+
/** Selected option index is out of range. */
|
|
18
19
|
OptionIndexOutOfRange = "out_of_range",
|
|
20
|
+
/** Fewer options selected than the minimum required. */
|
|
19
21
|
BelowMinVoteOptions = "below_min_vote_options",
|
|
22
|
+
/** More options selected than the maximum allowed. */
|
|
20
23
|
AboveMaxVoteOptions = "above_max_vote_options",
|
|
24
|
+
/** User has exceeded the maximum votes allowed. */
|
|
21
25
|
AboveMaxVotesPerUser = "above_max_per_user",
|
|
26
|
+
/** A single option received more votes than allowed. */
|
|
22
27
|
AboveMaxVotesPerOption = "above_max_per_option",
|
|
28
|
+
/** Attempted to vote on a non-interactive element. */
|
|
23
29
|
VotedOnNonInteractiveElement = "non_interactive_element",
|
|
30
|
+
/** Attempted to vote on a closed element. */
|
|
24
31
|
VotedOnClosedElement = "closed_element",
|
|
32
|
+
/** No vote value was provided. */
|
|
25
33
|
EmptyVote = "empty_vote"
|
|
26
34
|
}
|
|
27
35
|
export declare const AnswerErrorMessages: {
|
|
@@ -35,35 +43,38 @@ export declare const AnswerErrorMessages: {
|
|
|
35
43
|
empty_vote: (indices: string) => string;
|
|
36
44
|
};
|
|
37
45
|
/**
|
|
38
|
-
* The ElementState represents the potential states an
|
|
46
|
+
* The ElementState represents the potential states an Element is in.
|
|
39
47
|
*/
|
|
40
48
|
export declare enum ElementState {
|
|
41
49
|
/**
|
|
42
50
|
* Element is opened and active. The user can vote if
|
|
43
|
-
*
|
|
51
|
+
* the Element is `interactive`
|
|
44
52
|
*/
|
|
45
53
|
Opened = "opened",
|
|
46
54
|
/**
|
|
47
55
|
* Element is closed and the user can no longer vote for
|
|
48
|
-
* `interactive`
|
|
56
|
+
* `interactive` Elements
|
|
49
57
|
*/
|
|
50
58
|
Closed = "closed"
|
|
51
59
|
}
|
|
52
60
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
61
|
+
* Represents an interactive Element such as a poll,
|
|
62
|
+
* prediction, or trivia question. Obtain via
|
|
63
|
+
* {@link getElements} or {@link getElement}.
|
|
56
64
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* publish time, question, answers,
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Elements are interactive components with configuration
|
|
67
|
+
* fields such as duration, publish time, question, answers,
|
|
68
|
+
* etc. Developers can add custom fields of various
|
|
69
|
+
* types via the
|
|
70
|
+
* {@link https://products.monterosa.co/mic/developer-guides/app-spec/elements-spec | app's Element spec}.
|
|
63
71
|
*
|
|
64
|
-
* Elements
|
|
65
|
-
*
|
|
66
|
-
*
|
|
72
|
+
* Elements are triggered to appear at a certain time and
|
|
73
|
+
* process both the appearance of the content, the way it
|
|
74
|
+
* behaves, and the data sent back from the audience.
|
|
75
|
+
*
|
|
76
|
+
* See {@link https://products.monterosa.co/mic/core-concepts/elements | Elements} in
|
|
77
|
+
* the platform documentation for more details.
|
|
67
78
|
*/
|
|
68
79
|
export interface InteractElement extends Emitter {
|
|
69
80
|
/**
|
|
@@ -75,32 +86,32 @@ export interface InteractElement extends Emitter {
|
|
|
75
86
|
*/
|
|
76
87
|
state: ElementState;
|
|
77
88
|
/**
|
|
78
|
-
* Basic type of the
|
|
89
|
+
* Basic type of the Element
|
|
79
90
|
*/
|
|
80
91
|
type: ElementType;
|
|
81
92
|
/**
|
|
82
93
|
* Returns `content type` of a custom Element if any is set in
|
|
83
|
-
* the
|
|
94
|
+
* the Element spec. Otherwise returns the basic `type`.
|
|
84
95
|
*/
|
|
85
96
|
contentType: ElementType | string;
|
|
86
97
|
/**
|
|
87
|
-
* Returns the
|
|
98
|
+
* Returns the Element publish time as UNIX time in seconds.
|
|
88
99
|
*/
|
|
89
100
|
publishedAt: number;
|
|
90
101
|
/**
|
|
91
|
-
* Returns the
|
|
102
|
+
* Returns the Element publish time as ISO string.
|
|
92
103
|
*/
|
|
93
104
|
publishedAtIso: string;
|
|
94
105
|
/**
|
|
95
|
-
* Returns the
|
|
106
|
+
* Returns the Element update as UNIX time in seconds.
|
|
96
107
|
*/
|
|
97
108
|
updatedAt: number;
|
|
98
109
|
/**
|
|
99
|
-
* Returns the
|
|
110
|
+
* Returns the Element update time as ISO string.
|
|
100
111
|
*/
|
|
101
112
|
updatedAtIso: string;
|
|
102
113
|
/**
|
|
103
|
-
* Returns the total duration in seconds of the
|
|
114
|
+
* Returns the total duration in seconds of the Element.
|
|
104
115
|
*/
|
|
105
116
|
duration: number;
|
|
106
117
|
/**
|
|
@@ -121,7 +132,7 @@ export interface InteractElement extends Emitter {
|
|
|
121
132
|
*/
|
|
122
133
|
fields: Record<string, unknown>;
|
|
123
134
|
/**
|
|
124
|
-
* Returns `true` if the user can vote for the
|
|
135
|
+
* Returns `true` if the user can vote for the Element
|
|
125
136
|
*/
|
|
126
137
|
interactive: boolean;
|
|
127
138
|
/**
|
|
@@ -169,7 +180,7 @@ export interface InteractElement extends Emitter {
|
|
|
169
180
|
*/
|
|
170
181
|
maxVotesPerUser: number | null;
|
|
171
182
|
/**
|
|
172
|
-
* Returns
|
|
183
|
+
* Returns Element results if they exist. Otherwise, returns `null`.
|
|
173
184
|
*
|
|
174
185
|
* @example
|
|
175
186
|
* ```javascript
|
|
@@ -202,13 +213,13 @@ export interface InteractElement extends Emitter {
|
|
|
202
213
|
/** @internal */
|
|
203
214
|
showResultsMode: ShowResultsMode | null;
|
|
204
215
|
/**
|
|
205
|
-
* Returns `true` if results present and the state of the
|
|
216
|
+
* Returns `true` if results present and the state of the Element satisfies
|
|
206
217
|
* reveal mode. Otherwise, returns `false`.
|
|
207
218
|
*/
|
|
208
219
|
canShowResults: boolean;
|
|
209
220
|
/**
|
|
210
221
|
* Returns `true` if the user voted and `false` if not. The user answer
|
|
211
|
-
* could be retrieved by calling {@link InteractElement
|
|
222
|
+
* could be retrieved by calling {@link InteractElement | userAnswer} getter.
|
|
212
223
|
*/
|
|
213
224
|
hasBeenAnswered: boolean;
|
|
214
225
|
/**
|
|
@@ -8,39 +8,39 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Localised } from '../../types';
|
|
10
10
|
/**
|
|
11
|
-
* Describes
|
|
11
|
+
* Describes Element types
|
|
12
12
|
*/
|
|
13
13
|
export declare enum ElementType {
|
|
14
14
|
/**
|
|
15
|
-
* Data
|
|
15
|
+
* Data Element
|
|
16
16
|
*/
|
|
17
17
|
Data = "data",
|
|
18
18
|
/**
|
|
19
|
-
* Poll
|
|
19
|
+
* Poll Element
|
|
20
20
|
*/
|
|
21
21
|
Poll = "poll",
|
|
22
22
|
/**
|
|
23
|
-
* Regular poll
|
|
23
|
+
* Regular poll Element
|
|
24
24
|
*/
|
|
25
25
|
RegularPoll = "rpoll",
|
|
26
26
|
/**
|
|
27
|
-
* Diametric poll
|
|
27
|
+
* Diametric poll Element
|
|
28
28
|
*/
|
|
29
29
|
DiametricPoll = "dpoll",
|
|
30
30
|
/**
|
|
31
|
-
* Emoting poll
|
|
31
|
+
* Emoting poll Element
|
|
32
32
|
*/
|
|
33
33
|
EmotingPoll = "emo",
|
|
34
34
|
/**
|
|
35
|
-
* Powerbar
|
|
35
|
+
* Powerbar Element
|
|
36
36
|
*/
|
|
37
37
|
Powerbar = "powerbar",
|
|
38
38
|
/**
|
|
39
|
-
* Prediction
|
|
39
|
+
* Prediction Element
|
|
40
40
|
*/
|
|
41
41
|
Prediction = "prediction",
|
|
42
42
|
/**
|
|
43
|
-
* Trivia
|
|
43
|
+
* Trivia Element
|
|
44
44
|
*/
|
|
45
45
|
Trivia = "trivia"
|
|
46
46
|
}
|
|
@@ -53,11 +53,11 @@ export declare enum ShowResultsMode {
|
|
|
53
53
|
Always = "always"
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* A dataset that describes result for a single option
|
|
56
|
+
* A dataset that describes the result for a single option
|
|
57
57
|
*/
|
|
58
58
|
export interface ElementResult {
|
|
59
59
|
/**
|
|
60
|
-
* Total number of votes placed against the
|
|
60
|
+
* Total number of votes placed against the Element's option
|
|
61
61
|
*/
|
|
62
62
|
votes: number;
|
|
63
63
|
/**
|
package/dist/core/event/api.d.ts
CHANGED
|
@@ -6,12 +6,13 @@ import { InteractProject } from '../project/public-types';
|
|
|
6
6
|
*/
|
|
7
7
|
declare const getEventsMemoized: (...args: any[]) => Promise<InteractEvent[]>;
|
|
8
8
|
/**
|
|
9
|
-
* Returns all
|
|
10
|
-
* past/upcoming
|
|
9
|
+
* Returns all Events in a Project, including all active Events and
|
|
10
|
+
* past/upcoming Events, according to Listings settings in Project Setup
|
|
11
11
|
* in Studio.
|
|
12
12
|
*
|
|
13
|
-
* @param project - A
|
|
14
|
-
* the one from the default
|
|
13
|
+
* @param project - A Project instance. If not provided,
|
|
14
|
+
* the one from the default SDK will be fetched.
|
|
15
|
+
* @returns A promise that resolves to an array of Events.
|
|
15
16
|
*/
|
|
16
17
|
declare function getEvents(project?: InteractProject): Promise<InteractEvent[]>;
|
|
17
18
|
/**
|
|
@@ -19,66 +20,73 @@ declare function getEvents(project?: InteractProject): Promise<InteractEvent[]>;
|
|
|
19
20
|
*/
|
|
20
21
|
declare const getEventMemoized: (...args: any[]) => Promise<InteractEvent | null>;
|
|
21
22
|
/**
|
|
22
|
-
* Returns an
|
|
23
|
+
* Returns an Event by its id
|
|
23
24
|
*
|
|
24
|
-
* @param id - Id of the
|
|
25
|
-
* @param project - A
|
|
26
|
-
* the one from the default
|
|
25
|
+
* @param id - Id of the Event
|
|
26
|
+
* @param project - A Project instance. If not provided,
|
|
27
|
+
* the one from the default SDK will be fetched.
|
|
27
28
|
*
|
|
28
|
-
* @returns
|
|
29
|
-
*
|
|
29
|
+
* @returns The Event associated with the provided id,
|
|
30
|
+
* or null if no such Event exists in the Project.
|
|
30
31
|
*/
|
|
31
32
|
declare function getEvent(id: string, project?: InteractProject): Promise<InteractEvent | null>;
|
|
32
33
|
/**
|
|
33
|
-
* Adds an observer for when
|
|
34
|
+
* Adds an observer for when
|
|
35
|
+
* {@link InteractEvent | Event state} changed
|
|
36
|
+
*
|
|
37
|
+
* @param event - The Event to observe
|
|
38
|
+
* @param callback - Called with the new state
|
|
34
39
|
*/
|
|
35
40
|
declare function onEventState(event: InteractEvent, callback: (state: EventState) => void): Unsubscribe;
|
|
36
41
|
/**
|
|
37
|
-
* Adds an observer for when
|
|
42
|
+
* Adds an observer for when Event's data changed
|
|
43
|
+
*
|
|
44
|
+
* @param event - The Event to observe
|
|
45
|
+
* @param callback - Called when the Event data changes
|
|
38
46
|
*/
|
|
39
47
|
declare function onEventUpdated(event: InteractEvent, callback: () => void): Unsubscribe;
|
|
40
48
|
/**
|
|
41
|
-
* Adds an observer that is called when an
|
|
49
|
+
* Adds an observer that is called when an Event is added to listings.
|
|
42
50
|
*
|
|
43
51
|
* @remarks
|
|
44
|
-
* The following actions will result in adding an
|
|
52
|
+
* The following actions will result in adding an Event to listings:
|
|
45
53
|
*
|
|
46
|
-
* - The start of the
|
|
54
|
+
* - The start of the Event in Studio
|
|
47
55
|
*
|
|
48
|
-
* - The scheduling of a future
|
|
49
|
-
* to include future
|
|
56
|
+
* - The scheduling of a future Event in Studio, when listings are configured
|
|
57
|
+
* to include future Events in Project Settings.
|
|
50
58
|
*
|
|
51
|
-
* - When a future
|
|
52
|
-
* depending on the
|
|
53
|
-
* upcoming
|
|
54
|
-
*/
|
|
55
|
-
declare function onEventAdded(project: InteractProject, callback: (event: InteractEvent) => void): Unsubscribe;
|
|
56
|
-
/**
|
|
57
|
-
* {@link onEventAdded} alias.
|
|
59
|
+
* - When a future Event starts, a new future Event may be added to the list,
|
|
60
|
+
* depending on the Project configuration, to ensure a minimum number of
|
|
61
|
+
* upcoming Events are always available.
|
|
58
62
|
*
|
|
59
|
-
* @
|
|
63
|
+
* @param project - The Project to observe
|
|
64
|
+
* @param callback - Called with the added Event
|
|
60
65
|
*/
|
|
61
|
-
declare function
|
|
66
|
+
declare function onEventAdded(project: InteractProject, callback: (event: InteractEvent) => void): Unsubscribe;
|
|
62
67
|
/**
|
|
63
|
-
* Adds an observer that is called when an
|
|
68
|
+
* Adds an observer that is called when an Event is removed from listings.
|
|
64
69
|
*
|
|
65
70
|
* @remarks
|
|
66
|
-
* The following actions will result in removing an
|
|
71
|
+
* The following actions will result in removing an Event from listings:
|
|
67
72
|
*
|
|
68
|
-
* - The deletion of the
|
|
73
|
+
* - The deletion of the Event from Studio
|
|
69
74
|
*
|
|
70
|
-
* - The change of listings
|
|
71
|
-
* or past
|
|
75
|
+
* - The change of listings configuration in Project Settings to exclude future
|
|
76
|
+
* or past Events.
|
|
72
77
|
*
|
|
73
|
-
* - The
|
|
78
|
+
* - The Event is removed after a period of time since its completion. This period
|
|
74
79
|
* is calculated as 45 seconds plus the Maximum allowed delay (configured in
|
|
75
80
|
* Project Settings in Studio).
|
|
81
|
+
*
|
|
82
|
+
* @param project - The Project to observe
|
|
83
|
+
* @param callback - Called with the removed Event
|
|
76
84
|
*/
|
|
77
85
|
declare function onEventRemoved(project: InteractProject, callback: (event: InteractEvent) => void): Unsubscribe;
|
|
78
86
|
/**
|
|
79
|
-
* Returns the list of upcoming
|
|
87
|
+
* Returns the list of upcoming Events
|
|
80
88
|
*/
|
|
81
89
|
/**
|
|
82
|
-
* Returns the list of active
|
|
90
|
+
* Returns the list of active Events
|
|
83
91
|
*/
|
|
84
|
-
export { getEvents, getEventsMemoized, getEvent, getEventMemoized, onEventState, onEventUpdated, onEventAdded,
|
|
92
|
+
export { getEvents, getEventsMemoized, getEvent, getEventMemoized, onEventState, onEventUpdated, onEventAdded, onEventRemoved, };
|