|
@@ -1,20 +1,17 @@
|
1
|
|
-// @flow
|
2
|
|
-
|
3
|
|
-import { getActiveSession } from '../../features/recording/functions';
|
4
|
|
-import { getRoomName } from '../base/conference';
|
5
|
|
-import { getInviteURL } from '../base/connection';
|
|
1
|
+import { IReduxState } from '../app/types';
|
|
2
|
+import { IStateful } from '../base/app/types';
|
|
3
|
+import { getRoomName } from '../base/conference/functions';
|
|
4
|
+import { getInviteURL } from '../base/connection/functions';
|
6
|
5
|
import { isIosMobileBrowser } from '../base/environment/utils';
|
7
|
|
-import { i18next } from '../base/i18n';
|
|
6
|
+import i18next from '../base/i18n/i18next';
|
8
|
7
|
import { isJwtFeatureEnabled } from '../base/jwt/functions';
|
9
|
8
|
import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
|
10
|
|
-import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants';
|
11
|
|
-import { toState } from '../base/redux';
|
12
|
|
-import {
|
13
|
|
- appendURLParam,
|
14
|
|
- parseURIString,
|
15
|
|
- parseURLParams
|
16
|
|
-} from '../base/util';
|
|
9
|
+import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants/functions';
|
|
10
|
+import { toState } from '../base/redux/functions';
|
|
11
|
+import { parseURLParams } from '../base/util/parseURLParams';
|
|
12
|
+import { appendURLParam, parseURIString } from '../base/util/uri';
|
17
|
13
|
import { isVpaasMeeting } from '../jaas/functions';
|
|
14
|
+import { getActiveSession } from '../recording/functions';
|
18
|
15
|
|
19
|
16
|
import { getDialInConferenceID, getDialInNumbers } from './_utils';
|
20
|
17
|
import {
|
|
@@ -24,8 +21,7 @@ import {
|
24
|
21
|
} from './constants';
|
25
|
22
|
import logger from './logger';
|
26
|
23
|
|
27
|
|
-declare var $: Function;
|
28
|
|
-declare var interfaceConfig: Object;
|
|
24
|
+declare let $: any;
|
29
|
25
|
|
30
|
26
|
export const sharingFeatures = {
|
31
|
27
|
email: 'email',
|
|
@@ -44,7 +40,7 @@ export const sharingFeatures = {
|
44
|
40
|
export function checkDialNumber(
|
45
|
41
|
dialNumber: string,
|
46
|
42
|
dialOutAuthUrl: string
|
47
|
|
-): Promise<Object> {
|
|
43
|
+): Promise<{ allow?: boolean; country?: string; phone?: string; }> {
|
48
|
44
|
const fullUrl = `${dialOutAuthUrl}?phone=${dialNumber}`;
|
49
|
45
|
|
50
|
46
|
return new Promise((resolve, reject) => {
|
|
@@ -61,7 +57,7 @@ export function checkDialNumber(
|
61
|
57
|
* numbers.
|
62
|
58
|
* @returns {string} A string with only numbers.
|
63
|
59
|
*/
|
64
|
|
-export function getDigitsOnly(text: string = ''): string {
|
|
60
|
+export function getDigitsOnly(text = ''): string {
|
65
|
61
|
return text.replace(/\D/g, '');
|
66
|
62
|
}
|
67
|
63
|
|
|
@@ -71,40 +67,40 @@ export function getDigitsOnly(text: string = ''): string {
|
71
|
67
|
export type GetInviteResultsOptions = {
|
72
|
68
|
|
73
|
69
|
/**
|
74
|
|
- * The endpoint to use for checking phone number validity.
|
|
70
|
+ * Whether or not to search for people.
|
75
|
71
|
*/
|
76
|
|
- dialOutAuthUrl: string,
|
|
72
|
+ addPeopleEnabled: boolean;
|
77
|
73
|
|
78
|
74
|
/**
|
79
|
|
- * Whether or not to search for people.
|
|
75
|
+ * The endpoint to use for checking phone number validity.
|
80
|
76
|
*/
|
81
|
|
- addPeopleEnabled: boolean,
|
|
77
|
+ dialOutAuthUrl: string;
|
82
|
78
|
|
83
|
79
|
/**
|
84
|
80
|
* Whether or not to check phone numbers.
|
85
|
81
|
*/
|
86
|
|
- dialOutEnabled: boolean,
|
|
82
|
+ dialOutEnabled: boolean;
|
|
83
|
+
|
|
84
|
+ /**
|
|
85
|
+ * The jwt token to pass to the search service.
|
|
86
|
+ */
|
|
87
|
+ jwt: string;
|
87
|
88
|
|
88
|
89
|
/**
|
89
|
90
|
* Array with the query types that will be executed -
|
90
|
91
|
* "conferenceRooms" | "user" | "room".
|
91
|
92
|
*/
|
92
|
|
- peopleSearchQueryTypes: Array<string>,
|
|
93
|
+ peopleSearchQueryTypes: Array<string>;
|
93
|
94
|
|
94
|
95
|
/**
|
95
|
96
|
* The url to query for people.
|
96
|
97
|
*/
|
97
|
|
- peopleSearchUrl: string,
|
|
98
|
+ peopleSearchUrl: string;
|
98
|
99
|
|
99
|
100
|
/**
|
100
|
101
|
* Whether or not to check sip invites.
|
101
|
102
|
*/
|
102
|
|
- sipInviteEnabled: boolean,
|
103
|
|
-
|
104
|
|
- /**
|
105
|
|
- * The jwt token to pass to the search service.
|
106
|
|
- */
|
107
|
|
- jwt: string
|
|
103
|
+ sipInviteEnabled: boolean;
|
108
|
104
|
};
|
109
|
105
|
|
110
|
106
|
/**
|
|
@@ -118,8 +114,7 @@ export type GetInviteResultsOptions = {
|
118
|
114
|
export function getInviteResultsForQuery(
|
119
|
115
|
query: string,
|
120
|
116
|
options: GetInviteResultsOptions
|
121
|
|
-): Promise<*> {
|
122
|
|
-
|
|
117
|
+): Promise<any> {
|
123
|
118
|
const text = query.trim();
|
124
|
119
|
|
125
|
120
|
const {
|
|
@@ -183,12 +178,12 @@ export function getInviteResultsForQuery(
|
183
|
178
|
phone: text
|
184
|
179
|
});
|
185
|
180
|
} else {
|
186
|
|
- phoneNumberPromise = Promise.resolve({});
|
|
181
|
+ phoneNumberPromise = Promise.resolve<{ allow?: boolean; country?: string; phone?: string; }>({});
|
187
|
182
|
}
|
188
|
183
|
|
189
|
184
|
return Promise.all([ peopleSearchPromise, phoneNumberPromise ])
|
190
|
185
|
.then(([ peopleResults, phoneResults ]) => {
|
191
|
|
- const results = [
|
|
186
|
+ const results: any[] = [
|
192
|
187
|
...peopleResults
|
193
|
188
|
];
|
194
|
189
|
|
|
@@ -233,7 +228,7 @@ export function getInviteTextiOS({
|
233
|
228
|
state,
|
234
|
229
|
phoneNumber,
|
235
|
230
|
t
|
236
|
|
-}: Object) {
|
|
231
|
+}: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
|
237
|
232
|
if (!isIosMobileBrowser()) {
|
238
|
233
|
return '';
|
239
|
234
|
}
|
|
@@ -246,23 +241,23 @@ export function getInviteTextiOS({
|
246
|
241
|
const inviteURL = _decodeRoomURI(inviteUrl);
|
247
|
242
|
|
248
|
243
|
let invite = localParticipantName
|
249
|
|
- ? t('info.inviteTextiOSPersonal', { name: localParticipantName })
|
250
|
|
- : t('info.inviteURLFirstPartGeneral');
|
|
244
|
+ ? t?.('info.inviteTextiOSPersonal', { name: localParticipantName })
|
|
245
|
+ : t?.('info.inviteURLFirstPartGeneral');
|
251
|
246
|
|
252
|
247
|
invite += ' ';
|
253
|
248
|
|
254
|
|
- invite += t('info.inviteTextiOSInviteUrl', { inviteUrl });
|
|
249
|
+ invite += t?.('info.inviteTextiOSInviteUrl', { inviteUrl });
|
255
|
250
|
invite += ' ';
|
256
|
251
|
|
257
|
252
|
if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
|
258
|
|
- invite += t('info.inviteTextiOSPhone', {
|
|
253
|
+ invite += t?.('info.inviteTextiOSPhone', {
|
259
|
254
|
number: phoneNumber,
|
260
|
255
|
conferenceID: dialIn.conferenceID,
|
261
|
256
|
didUrl: getDialInfoPageURL(state)
|
262
|
257
|
});
|
263
|
258
|
}
|
264
|
259
|
invite += ' ';
|
265
|
|
- invite += t('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` });
|
|
260
|
+ invite += t?.('info.inviteTextiOSJoinSilent', { silentUrl: `${inviteURL}#config.startSilent=true` });
|
266
|
261
|
|
267
|
262
|
return invite;
|
268
|
263
|
}
|
|
@@ -276,27 +271,25 @@ export function getInviteText({
|
276
|
271
|
state,
|
277
|
272
|
phoneNumber,
|
278
|
273
|
t
|
279
|
|
-}: Object) {
|
|
274
|
+}: { phoneNumber?: string | null; state: IReduxState; t?: Function; }) {
|
280
|
275
|
const dialIn = state['features/invite'];
|
281
|
276
|
const inviteUrl = getInviteURL(state);
|
282
|
277
|
const currentLiveStreamingSession = getActiveSession(state, JitsiRecordingConstants.mode.STREAM);
|
283
|
|
- const liveStreamViewURL
|
284
|
|
- = currentLiveStreamingSession
|
285
|
|
- && currentLiveStreamingSession.liveStreamViewURL;
|
|
278
|
+ const liveStreamViewURL = currentLiveStreamingSession?.liveStreamViewURL;
|
286
|
279
|
const localParticipant = getLocalParticipant(state);
|
287
|
280
|
const localParticipantName = localParticipant?.name;
|
288
|
281
|
|
289
|
282
|
const inviteURL = _decodeRoomURI(inviteUrl);
|
290
|
283
|
let invite = localParticipantName
|
291
|
|
- ? t('info.inviteURLFirstPartPersonal', { name: localParticipantName })
|
292
|
|
- : t('info.inviteURLFirstPartGeneral');
|
|
284
|
+ ? t?.('info.inviteURLFirstPartPersonal', { name: localParticipantName })
|
|
285
|
+ : t?.('info.inviteURLFirstPartGeneral');
|
293
|
286
|
|
294
|
|
- invite += t('info.inviteURLSecondPart', {
|
|
287
|
+ invite += t?.('info.inviteURLSecondPart', {
|
295
|
288
|
url: inviteURL
|
296
|
289
|
});
|
297
|
290
|
|
298
|
291
|
if (liveStreamViewURL) {
|
299
|
|
- const liveStream = t('info.inviteLiveStream', {
|
|
292
|
+ const liveStream = t?.('info.inviteLiveStream', {
|
300
|
293
|
url: liveStreamViewURL
|
301
|
294
|
});
|
302
|
295
|
|
|
@@ -304,11 +297,11 @@ export function getInviteText({
|
304
|
297
|
}
|
305
|
298
|
|
306
|
299
|
if (shouldDisplayDialIn(dialIn) && isSharingEnabled(sharingFeatures.dialIn)) {
|
307
|
|
- const dial = t('info.invitePhone', {
|
|
300
|
+ const dial = t?.('info.invitePhone', {
|
308
|
301
|
number: phoneNumber,
|
309
|
302
|
conferenceID: dialIn.conferenceID
|
310
|
303
|
});
|
311
|
|
- const moreNumbers = t('info.invitePhoneAlternatives', {
|
|
304
|
+ const moreNumbers = t?.('info.invitePhoneAlternatives', {
|
312
|
305
|
url: getDialInfoPageURL(state),
|
313
|
306
|
silentUrl: `${inviteURL}#config.startSilent=true`
|
314
|
307
|
});
|
|
@@ -328,8 +321,8 @@ export function getInviteText({
|
328
|
321
|
* @returns {Object} An object with keys as user types and values as the number
|
329
|
322
|
* of invites for that type.
|
330
|
323
|
*/
|
331
|
|
-export function getInviteTypeCounts(inviteItems: Array<Object> = []) {
|
332
|
|
- const inviteTypeCounts = {};
|
|
324
|
+export function getInviteTypeCounts(inviteItems: Array<{ type: string; }> = []) {
|
|
325
|
+ const inviteTypeCounts: any = {};
|
333
|
326
|
|
334
|
327
|
inviteItems.forEach(({ type }) => {
|
335
|
328
|
if (!inviteTypeCounts[type]) {
|
|
@@ -352,51 +345,51 @@ export function getInviteTypeCounts(inviteItems: Array<Object> = []) {
|
352
|
345
|
* items to invite.
|
353
|
346
|
* @returns {Promise} - The promise created by the request.
|
354
|
347
|
*/
|
355
|
|
-export function invitePeopleAndChatRooms( // eslint-disable-line max-params
|
|
348
|
+export function invitePeopleAndChatRooms(
|
356
|
349
|
inviteServiceUrl: string,
|
357
|
350
|
inviteUrl: string,
|
358
|
351
|
jwt: string,
|
359
|
352
|
inviteItems: Array<Object>
|
360
|
|
-): Promise<void> {
|
|
353
|
+): Promise<any> {
|
361
|
354
|
|
362
|
355
|
if (!inviteItems || inviteItems.length === 0) {
|
363
|
356
|
return Promise.resolve();
|
364
|
357
|
}
|
365
|
358
|
|
366
|
359
|
return fetch(
|
367
|
|
- `${inviteServiceUrl}?token=${jwt}`,
|
368
|
|
- {
|
369
|
|
- body: JSON.stringify({
|
370
|
|
- 'invited': inviteItems,
|
371
|
|
- 'url': inviteUrl
|
372
|
|
- }),
|
373
|
|
- method: 'POST',
|
374
|
|
- headers: {
|
375
|
|
- 'Content-Type': 'application/json'
|
376
|
|
- }
|
377
|
|
- }
|
|
360
|
+ `${inviteServiceUrl}?token=${jwt}`,
|
|
361
|
+ {
|
|
362
|
+ body: JSON.stringify({
|
|
363
|
+ 'invited': inviteItems,
|
|
364
|
+ 'url': inviteUrl
|
|
365
|
+ }),
|
|
366
|
+ method: 'POST',
|
|
367
|
+ headers: {
|
|
368
|
+ 'Content-Type': 'application/json'
|
|
369
|
+ }
|
|
370
|
+ }
|
378
|
371
|
);
|
379
|
372
|
}
|
380
|
373
|
|
381
|
374
|
/**
|
382
|
375
|
* Determines if adding people is currently enabled.
|
383
|
376
|
*
|
384
|
|
- * @param {boolean} state - Current state.
|
|
377
|
+ * @param {IReduxState} state - Current state.
|
385
|
378
|
* @returns {boolean} Indication of whether adding people is currently enabled.
|
386
|
379
|
*/
|
387
|
|
-export function isAddPeopleEnabled(state: Object): boolean {
|
|
380
|
+export function isAddPeopleEnabled(state: IReduxState): boolean {
|
388
|
381
|
const { peopleSearchUrl } = state['features/base/config'];
|
389
|
382
|
|
390
|
|
- return state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state);
|
|
383
|
+ return Boolean(state['features/base/jwt'].jwt && Boolean(peopleSearchUrl) && !isVpaasMeeting(state));
|
391
|
384
|
}
|
392
|
385
|
|
393
|
386
|
/**
|
394
|
387
|
* Determines if dial out is currently enabled or not.
|
395
|
388
|
*
|
396
|
|
- * @param {boolean} state - Current state.
|
|
389
|
+ * @param {IReduxState} state - Current state.
|
397
|
390
|
* @returns {boolean} Indication of whether dial out is currently enabled.
|
398
|
391
|
*/
|
399
|
|
-export function isDialOutEnabled(state: Object): boolean {
|
|
392
|
+export function isDialOutEnabled(state: IReduxState): boolean {
|
400
|
393
|
const { conference } = state['features/base/conference'];
|
401
|
394
|
|
402
|
395
|
return isLocalParticipantModerator(state)
|
|
@@ -406,10 +399,10 @@ export function isDialOutEnabled(state: Object): boolean {
|
406
|
399
|
/**
|
407
|
400
|
* Determines if inviting sip endpoints is enabled or not.
|
408
|
401
|
*
|
409
|
|
- * @param {Object} state - Current state.
|
|
402
|
+ * @param {IReduxState} state - Current state.
|
410
|
403
|
* @returns {boolean} Indication of whether dial out is currently enabled.
|
411
|
404
|
*/
|
412
|
|
-export function isSipInviteEnabled(state: Object): boolean {
|
|
405
|
+export function isSipInviteEnabled(state: IReduxState): boolean {
|
413
|
406
|
const { sipInviteUrl } = state['features/base/config'];
|
414
|
407
|
|
415
|
408
|
return isJwtFeatureEnabled(state, 'sip-outbound-call') && Boolean(sipInviteUrl);
|
|
@@ -473,7 +466,7 @@ export function searchDirectory( // eslint-disable-line max-params
|
473
|
466
|
jwt: string,
|
474
|
467
|
text: string,
|
475
|
468
|
queryTypes: Array<string> = [ 'conferenceRooms', 'user', 'room' ]
|
476
|
|
-): Promise<Array<Object>> {
|
|
469
|
+): Promise<Array<{ type: string; }>> {
|
477
|
470
|
|
478
|
471
|
const query = encodeURIComponent(text);
|
479
|
472
|
const queryTypesString = encodeURIComponent(JSON.stringify(queryTypes));
|
|
@@ -502,14 +495,13 @@ export function searchDirectory( // eslint-disable-line max-params
|
502
|
495
|
* Returns descriptive text that can be used to invite participants to a meeting
|
503
|
496
|
* (share via mobile or use it for calendar event description).
|
504
|
497
|
*
|
505
|
|
- * @param {Object} state - The current state.
|
|
498
|
+ * @param {IReduxState} state - The current state.
|
506
|
499
|
* @param {string} inviteUrl - The conference/location URL.
|
507
|
500
|
* @param {boolean} useHtml - Whether to return html text.
|
508
|
501
|
* @returns {Promise<string>} A {@code Promise} resolving with a
|
509
|
502
|
* descriptive text that can be used to invite participants to a meeting.
|
510
|
503
|
*/
|
511
|
|
-export function getShareInfoText(
|
512
|
|
- state: Object, inviteUrl: string, useHtml: ?boolean): Promise<string> {
|
|
504
|
+export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?: boolean): Promise<string> {
|
513
|
505
|
let roomUrl = _decodeRoomURI(inviteUrl);
|
514
|
506
|
const includeDialInfo = state['features/base/config'] !== undefined;
|
515
|
507
|
|
|
@@ -534,7 +526,7 @@ export function getShareInfoText(
|
534
|
526
|
const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
|
535
|
527
|
= state['features/base/config'];
|
536
|
528
|
const { locationURL = {} } = state['features/base/connection'];
|
537
|
|
- const mucURL = hosts && hosts.muc;
|
|
529
|
+ const mucURL = hosts?.muc;
|
538
|
530
|
|
539
|
531
|
if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
|
540
|
532
|
// URLs for fetching dial in numbers not defined
|
|
@@ -542,7 +534,7 @@ export function getShareInfoText(
|
542
|
534
|
}
|
543
|
535
|
|
544
|
536
|
numbersPromise = Promise.all([
|
545
|
|
- getDialInNumbers(dialInNumbersUrl, room, mucURL),
|
|
537
|
+ getDialInNumbers(dialInNumbersUrl, room, mucURL), // @ts-ignore
|
546
|
538
|
getDialInConferenceID(dialInConfCodeUrl, room, mucURL, locationURL)
|
547
|
539
|
]).then(([ numbers, {
|
548
|
540
|
conference, id, message } ]) => {
|
|
@@ -592,16 +584,16 @@ export function getShareInfoText(
|
592
|
584
|
/**
|
593
|
585
|
* Generates the URL for the static dial in info page.
|
594
|
586
|
*
|
595
|
|
- * @param {Object} state - The state from the Redux store.
|
|
587
|
+ * @param {IReduxState} state - The state from the Redux store.
|
596
|
588
|
* @param {string?} roomName - The conference name. Optional name, if missing will be extracted from state.
|
597
|
589
|
* @returns {string}
|
598
|
590
|
*/
|
599
|
|
-export function getDialInfoPageURL(state: Object, roomName: ?string) {
|
|
591
|
+export function getDialInfoPageURL(state: IReduxState, roomName?: string) {
|
600
|
592
|
const { didPageUrl } = state['features/dynamic-branding'];
|
601
|
593
|
const conferenceName = roomName ?? getRoomName(state);
|
602
|
594
|
const { locationURL } = state['features/base/connection'];
|
603
|
|
- const { href } = locationURL;
|
604
|
|
- const room = _decodeRoomURI(conferenceName);
|
|
595
|
+ const { href = '' } = locationURL ?? {};
|
|
596
|
+ const room = _decodeRoomURI(conferenceName ?? '');
|
605
|
597
|
|
606
|
598
|
const url = didPageUrl || `${href.substring(0, href.lastIndexOf('/'))}/${DIAL_IN_INFO_PAGE_PATH_NAME}`;
|
607
|
599
|
|
|
@@ -615,7 +607,7 @@ export function getDialInfoPageURL(state: Object, roomName: ?string) {
|
615
|
607
|
* @returns {string}
|
616
|
608
|
*/
|
617
|
609
|
export function getDialInfoPageURLForURIString(
|
618
|
|
- uri: ?string) {
|
|
610
|
+ uri?: string) {
|
619
|
611
|
if (!uri) {
|
620
|
612
|
return undefined;
|
621
|
613
|
}
|
|
@@ -637,7 +629,7 @@ export function getDialInfoPageURLForURIString(
|
637
|
629
|
* @param {Object} dialIn - Dial in information.
|
638
|
630
|
* @returns {boolean}
|
639
|
631
|
*/
|
640
|
|
-export function shouldDisplayDialIn(dialIn: Object) {
|
|
632
|
+export function shouldDisplayDialIn(dialIn: any) {
|
641
|
633
|
const { conferenceID, numbers, numbersEnabled } = dialIn;
|
642
|
634
|
const phoneNumber = _getDefaultPhoneNumber(numbers);
|
643
|
635
|
|
|
@@ -656,7 +648,7 @@ export function shouldDisplayDialIn(dialIn: Object) {
|
656
|
648
|
* @private
|
657
|
649
|
* @returns {boolean}
|
658
|
650
|
*/
|
659
|
|
-export function hasMultipleNumbers(dialInNumbers: ?Object) {
|
|
651
|
+export function hasMultipleNumbers(dialInNumbers?: { numbers: Object; } | string[]) {
|
660
|
652
|
if (!dialInNumbers) {
|
661
|
653
|
return false;
|
662
|
654
|
}
|
|
@@ -682,7 +674,7 @@ export function hasMultipleNumbers(dialInNumbers: ?Object) {
|
682
|
674
|
* @returns {string|null}
|
683
|
675
|
*/
|
684
|
676
|
export function _getDefaultPhoneNumber(
|
685
|
|
- dialInNumbers: ?Object): ?string {
|
|
677
|
+ dialInNumbers?: { numbers: any; } | Array<{ default: string; formattedNumber: string; }>): string | null {
|
686
|
678
|
|
687
|
679
|
if (!dialInNumbers) {
|
688
|
680
|
return null;
|
|
@@ -743,22 +735,23 @@ export function _decodeRoomURI(url: string) {
|
743
|
735
|
/**
|
744
|
736
|
* Returns the stored conference id.
|
745
|
737
|
*
|
746
|
|
- * @param {Object | Function} stateful - The Object or Function that can be
|
|
738
|
+ * @param {IStateful} stateful - The Object or Function that can be
|
747
|
739
|
* resolved to a Redux state object with the toState function.
|
748
|
740
|
* @returns {string}
|
749
|
741
|
*/
|
750
|
|
-export function getConferenceId(stateful: Object | Function) {
|
|
742
|
+export function getConferenceId(stateful: IStateful) {
|
751
|
743
|
return toState(stateful)['features/invite'].conferenceID;
|
752
|
744
|
}
|
753
|
745
|
|
754
|
746
|
/**
|
755
|
747
|
* Returns the default dial in number from the store.
|
756
|
748
|
*
|
757
|
|
- * @param {Object | Function} stateful - The Object or Function that can be
|
|
749
|
+ * @param {IStateful} stateful - The Object or Function that can be
|
758
|
750
|
* resolved to a Redux state object with the toState function.
|
759
|
751
|
* @returns {string | null}
|
760
|
752
|
*/
|
761
|
|
-export function getDefaultDialInNumber(stateful: Object | Function) {
|
|
753
|
+export function getDefaultDialInNumber(stateful: IStateful) {
|
|
754
|
+ // @ts-ignore
|
762
|
755
|
return _getDefaultPhoneNumber(toState(stateful)['features/invite'].numbers);
|
763
|
756
|
}
|
764
|
757
|
|
|
@@ -831,14 +824,14 @@ export function isSharingEnabled(sharingFeature: string) {
|
831
|
824
|
* @returns {Promise} - The promise created by the request.
|
832
|
825
|
*/
|
833
|
826
|
export function inviteSipEndpoints( // eslint-disable-line max-params
|
834
|
|
- inviteItems: Array<Object>,
|
|
827
|
+ inviteItems: Array<{ address: string; }>,
|
835
|
828
|
locationURL: URL,
|
836
|
829
|
sipInviteUrl: string,
|
837
|
830
|
jwt: string,
|
838
|
831
|
roomName: string,
|
839
|
832
|
roomPassword: String,
|
840
|
833
|
displayName: string
|
841
|
|
-): Promise<void> {
|
|
834
|
+): Promise<any> {
|
842
|
835
|
if (inviteItems.length === 0) {
|
843
|
836
|
return Promise.resolve();
|
844
|
837
|
}
|
|
@@ -851,26 +844,26 @@ export function inviteSipEndpoints( // eslint-disable-line max-params
|
851
|
844
|
});
|
852
|
845
|
|
853
|
846
|
return fetch(
|
854
|
|
- sipInviteUrl,
|
855
|
|
- {
|
856
|
|
- body: JSON.stringify({
|
857
|
|
- callParams: {
|
858
|
|
- callUrlInfo: {
|
859
|
|
- baseUrl,
|
860
|
|
- callName: roomName
|
861
|
|
- },
|
862
|
|
- passcode: roomPassword
|
863
|
|
- },
|
864
|
|
- sipClientParams: {
|
865
|
|
- displayName,
|
866
|
|
- sipAddress: inviteItems.map(item => item.address)
|
867
|
|
- }
|
868
|
|
- }),
|
869
|
|
- method: 'POST',
|
870
|
|
- headers: {
|
871
|
|
- 'Authorization': `Bearer ${jwt}`,
|
872
|
|
- 'Content-Type': 'application/json'
|
873
|
|
- }
|
874
|
|
- }
|
|
847
|
+ sipInviteUrl,
|
|
848
|
+ {
|
|
849
|
+ body: JSON.stringify({
|
|
850
|
+ callParams: {
|
|
851
|
+ callUrlInfo: {
|
|
852
|
+ baseUrl,
|
|
853
|
+ callName: roomName
|
|
854
|
+ },
|
|
855
|
+ passcode: roomPassword
|
|
856
|
+ },
|
|
857
|
+ sipClientParams: {
|
|
858
|
+ displayName,
|
|
859
|
+ sipAddress: inviteItems.map(item => item.address)
|
|
860
|
+ }
|
|
861
|
+ }),
|
|
862
|
+ method: 'POST',
|
|
863
|
+ headers: {
|
|
864
|
+ 'Authorization': `Bearer ${jwt}`,
|
|
865
|
+ 'Content-Type': 'application/json'
|
|
866
|
+ }
|
|
867
|
+ }
|
875
|
868
|
);
|
876
|
869
|
}
|