2022-10-07 09:16:41 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2021-02-24 09:37:14 +00:00
|
|
|
import React, { useEffect } from 'react';
|
2022-10-07 09:16:41 +00:00
|
|
|
import { WithTranslation } from 'react-i18next';
|
2017-06-14 18:41:22 +00:00
|
|
|
|
2022-10-07 09:16:41 +00:00
|
|
|
import { createInviteDialogEvent } from '../../../../analytics/AnalyticsEvents';
|
|
|
|
import { sendAnalytics } from '../../../../analytics/functions';
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../../../app/types';
|
2022-10-07 09:16:41 +00:00
|
|
|
import { getInviteURL } from '../../../../base/connection/functions';
|
|
|
|
import { translate } from '../../../../base/i18n/functions';
|
2020-04-01 07:47:51 +00:00
|
|
|
import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';
|
2022-10-07 09:16:41 +00:00
|
|
|
import { connect } from '../../../../base/redux/functions';
|
|
|
|
import Dialog from '../../../../base/ui/components/web/Dialog';
|
2022-05-23 15:02:14 +00:00
|
|
|
import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding/functions.any';
|
2021-07-20 08:58:42 +00:00
|
|
|
import { isVpaasMeeting } from '../../../../jaas/functions';
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2020-04-01 07:47:51 +00:00
|
|
|
import { getActiveSession } from '../../../../recording';
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2020-04-01 07:47:51 +00:00
|
|
|
import { updateDialInNumbers } from '../../../actions';
|
2021-02-27 01:50:26 +00:00
|
|
|
import {
|
|
|
|
_getDefaultPhoneNumber,
|
|
|
|
getInviteText,
|
2021-07-15 13:12:06 +00:00
|
|
|
getInviteTextiOS,
|
2021-02-27 01:50:26 +00:00
|
|
|
isAddPeopleEnabled,
|
|
|
|
isDialOutEnabled,
|
2022-09-27 07:10:28 +00:00
|
|
|
isSharingEnabled,
|
|
|
|
sharingFeatures
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2021-02-27 01:50:26 +00:00
|
|
|
} from '../../../functions';
|
2020-04-01 07:47:51 +00:00
|
|
|
|
|
|
|
import CopyMeetingLinkSection from './CopyMeetingLinkSection';
|
2022-09-29 14:35:47 +00:00
|
|
|
import DialInLimit from './DialInLimit';
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2020-04-01 07:47:51 +00:00
|
|
|
import DialInSection from './DialInSection';
|
|
|
|
import InviteByEmailSection from './InviteByEmailSection';
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2020-04-01 07:47:51 +00:00
|
|
|
import InviteContactsSection from './InviteContactsSection';
|
2022-10-07 09:16:41 +00:00
|
|
|
// @ts-ignore
|
2020-04-01 07:47:51 +00:00
|
|
|
import LiveStreamSection from './LiveStreamSection';
|
2018-03-12 19:23:40 +00:00
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
interface IProps extends WithTranslation {
|
2018-10-30 05:02:23 +00:00
|
|
|
|
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* The object representing the dialIn feature.
|
2018-10-30 05:02:23 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_dialIn: any;
|
2020-09-23 09:09:07 +00:00
|
|
|
|
2021-02-27 01:50:26 +00:00
|
|
|
/**
|
|
|
|
* Whether or not dial in number should be visible.
|
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_dialInVisible: boolean;
|
2021-02-27 01:50:26 +00:00
|
|
|
|
|
|
|
/**
|
2022-10-07 09:16:41 +00:00
|
|
|
* Whether or not email sharing features should be visible.
|
2021-02-27 01:50:26 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_emailSharingVisible: boolean;
|
2021-02-27 01:50:26 +00:00
|
|
|
|
2021-02-24 09:37:14 +00:00
|
|
|
/**
|
|
|
|
* The meeting invitation text.
|
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_invitationText: string;
|
2021-02-24 09:37:14 +00:00
|
|
|
|
2021-07-15 13:12:06 +00:00
|
|
|
/**
|
|
|
|
* The custom no new-lines meeting invitation text for iOS default email.
|
2021-11-04 21:10:43 +00:00
|
|
|
* Needed because of this mailto: iOS issue: https://developer.apple.com/forums/thread/681023.
|
2021-07-15 13:12:06 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_invitationTextiOS: string;
|
2021-07-15 13:12:06 +00:00
|
|
|
|
2021-05-13 09:33:05 +00:00
|
|
|
/**
|
|
|
|
* An alternate app name to be displayed in the email subject.
|
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_inviteAppName?: string;
|
2021-05-13 09:33:05 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
2020-06-25 13:58:25 +00:00
|
|
|
* Whether or not invite contacts should be visible.
|
2018-10-30 05:02:23 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_inviteContactsVisible: boolean;
|
2017-11-21 22:45:14 +00:00
|
|
|
|
2018-10-30 05:02:23 +00:00
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* The current url of the conference to be copied onto the clipboard.
|
2018-10-30 05:02:23 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_inviteUrl: string;
|
2017-10-06 20:15:51 +00:00
|
|
|
|
2022-09-29 14:35:47 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the current meeting belongs to a JaaS user.
|
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_isVpaasMeeting: boolean;
|
2022-09-29 14:35:47 +00:00
|
|
|
|
2017-06-14 18:41:22 +00:00
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* The current known URL for a live stream in progress.
|
2017-06-14 18:41:22 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_liveStreamViewURL: string;
|
2017-06-14 18:41:22 +00:00
|
|
|
|
2018-03-23 00:53:16 +00:00
|
|
|
/**
|
2021-02-24 09:37:14 +00:00
|
|
|
* The default phone number.
|
2017-06-14 18:41:22 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_phoneNumber?: string;
|
2017-06-14 18:41:22 +00:00
|
|
|
|
2018-03-23 00:53:16 +00:00
|
|
|
/**
|
2022-10-07 09:16:41 +00:00
|
|
|
* Whether or not url sharing button should be visible.
|
2018-03-23 00:53:16 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
_urlSharingVisible: boolean;
|
2018-03-23 00:53:16 +00:00
|
|
|
|
2017-06-14 18:41:22 +00:00
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* Method to update the dial in numbers.
|
2017-06-14 18:41:22 +00:00
|
|
|
*/
|
2022-10-07 09:16:41 +00:00
|
|
|
updateNumbers: Function;
|
|
|
|
}
|
2018-03-12 19:23:40 +00:00
|
|
|
|
2020-04-01 07:47:51 +00:00
|
|
|
/**
|
|
|
|
* Invite More component.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
|
|
|
function AddPeopleDialog({
|
|
|
|
_dialIn,
|
2021-02-27 01:50:26 +00:00
|
|
|
_dialInVisible,
|
|
|
|
_urlSharingVisible,
|
|
|
|
_emailSharingVisible,
|
2021-02-24 09:37:14 +00:00
|
|
|
_invitationText,
|
2021-07-15 13:12:06 +00:00
|
|
|
_invitationTextiOS,
|
2021-05-13 09:33:05 +00:00
|
|
|
_inviteAppName,
|
2020-06-25 13:58:25 +00:00
|
|
|
_inviteContactsVisible,
|
2020-04-01 07:47:51 +00:00
|
|
|
_inviteUrl,
|
2022-09-29 14:35:47 +00:00
|
|
|
_isVpaasMeeting,
|
2020-04-01 07:47:51 +00:00
|
|
|
_liveStreamViewURL,
|
2021-02-24 09:37:14 +00:00
|
|
|
_phoneNumber,
|
2020-04-01 07:47:51 +00:00
|
|
|
t,
|
2022-10-31 07:56:26 +00:00
|
|
|
updateNumbers
|
|
|
|
}: IProps) {
|
2020-04-01 07:47:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the dial-in numbers.
|
|
|
|
*/
|
|
|
|
useEffect(() => {
|
|
|
|
if (!_dialIn.numbers) {
|
|
|
|
updateNumbers();
|
2018-03-12 19:23:40 +00:00
|
|
|
}
|
2020-04-01 07:47:51 +00:00
|
|
|
}, []);
|
2017-10-06 20:15:51 +00:00
|
|
|
|
2017-06-14 18:41:22 +00:00
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* Sends analytics events when the dialog opens/closes.
|
2017-06-14 18:41:22 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2020-04-01 07:47:51 +00:00
|
|
|
useEffect(() => {
|
|
|
|
sendAnalytics(createInviteDialogEvent(
|
2021-11-09 10:20:40 +00:00
|
|
|
'opened', 'dialog'));
|
2017-06-14 18:41:22 +00:00
|
|
|
|
2020-04-01 07:47:51 +00:00
|
|
|
return () => {
|
|
|
|
sendAnalytics(createInviteDialogEvent(
|
2021-11-09 10:20:40 +00:00
|
|
|
'closed', 'dialog'));
|
2020-04-01 07:47:51 +00:00
|
|
|
};
|
|
|
|
}, []);
|
2017-10-06 20:15:51 +00:00
|
|
|
|
2020-04-01 07:47:51 +00:00
|
|
|
const inviteSubject = t('addPeople.inviteMoreMailSubject', {
|
2021-05-13 09:33:05 +00:00
|
|
|
appName: _inviteAppName ?? interfaceConfig.APP_NAME
|
2020-04-01 07:47:51 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Dialog
|
2022-10-07 09:16:41 +00:00
|
|
|
cancel = {{ hidden: true }}
|
|
|
|
ok = {{ hidden: true }}
|
|
|
|
titleKey = 'addPeople.inviteMorePrompt'>
|
2020-04-01 07:47:51 +00:00
|
|
|
<div className = 'invite-more-dialog'>
|
2020-06-25 13:58:25 +00:00
|
|
|
{ _inviteContactsVisible && <InviteContactsSection /> }
|
2021-02-27 01:50:26 +00:00
|
|
|
{_urlSharingVisible ? <CopyMeetingLinkSection url = { _inviteUrl } /> : null}
|
|
|
|
{
|
|
|
|
_emailSharingVisible
|
|
|
|
? <InviteByEmailSection
|
|
|
|
inviteSubject = { inviteSubject }
|
2021-07-15 13:12:06 +00:00
|
|
|
inviteText = { _invitationText }
|
|
|
|
inviteTextiOS = { _invitationTextiOS } />
|
2021-02-27 01:50:26 +00:00
|
|
|
: null
|
|
|
|
}
|
2020-07-23 08:16:40 +00:00
|
|
|
<div className = 'invite-more-dialog separator' />
|
2020-04-01 07:47:51 +00:00
|
|
|
{
|
|
|
|
_liveStreamViewURL
|
|
|
|
&& <LiveStreamSection liveStreamViewURL = { _liveStreamViewURL } />
|
|
|
|
}
|
|
|
|
{
|
2021-02-27 01:50:26 +00:00
|
|
|
_phoneNumber
|
|
|
|
&& _dialInVisible
|
2021-02-24 09:37:14 +00:00
|
|
|
&& <DialInSection phoneNumber = { _phoneNumber } />
|
2020-04-01 07:47:51 +00:00
|
|
|
}
|
2022-09-29 14:35:47 +00:00
|
|
|
{
|
2022-11-16 10:14:58 +00:00
|
|
|
!_phoneNumber && _dialInVisible && _isVpaasMeeting && <DialInLimit />
|
2022-09-29 14:35:47 +00:00
|
|
|
}
|
2017-07-12 15:35:00 +00:00
|
|
|
</div>
|
2020-04-01 07:47:51 +00:00
|
|
|
</Dialog>
|
|
|
|
);
|
2017-06-14 18:41:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-04-01 07:47:51 +00:00
|
|
|
* Maps (parts of) the Redux state to the associated props for the
|
|
|
|
* {@code AddPeopleDialog} component.
|
2017-06-14 18:41:22 +00:00
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
2021-02-24 09:37:14 +00:00
|
|
|
* @param {Object} ownProps - The properties explicitly passed to the component.
|
2017-06-14 18:41:22 +00:00
|
|
|
* @private
|
2022-10-20 09:11:27 +00:00
|
|
|
* @returns {IProps}
|
2017-06-14 18:41:22 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
function mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
|
2020-04-01 07:47:51 +00:00
|
|
|
const currentLiveStreamingSession
|
|
|
|
= getActiveSession(state, JitsiRecordingConstants.mode.STREAM);
|
2021-05-13 09:33:05 +00:00
|
|
|
const { iAmRecorder, inviteAppName } = state['features/base/config'];
|
2020-04-01 07:47:51 +00:00
|
|
|
const addPeopleEnabled = isAddPeopleEnabled(state);
|
|
|
|
const dialOutEnabled = isDialOutEnabled(state);
|
2020-06-25 13:58:25 +00:00
|
|
|
const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled);
|
2021-02-24 09:37:14 +00:00
|
|
|
const dialIn = state['features/invite'];
|
2022-10-07 09:16:41 +00:00
|
|
|
const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined;
|
2017-06-14 18:41:22 +00:00
|
|
|
|
|
|
|
return {
|
2021-02-24 09:37:14 +00:00
|
|
|
_dialIn: dialIn,
|
2021-02-27 01:50:26 +00:00
|
|
|
_dialInVisible: isSharingEnabled(sharingFeatures.dialIn),
|
2021-05-24 07:17:40 +00:00
|
|
|
_urlSharingVisible: isDynamicBrandingDataLoaded(state) && isSharingEnabled(sharingFeatures.url),
|
2021-02-27 01:50:26 +00:00
|
|
|
_emailSharingVisible: isSharingEnabled(sharingFeatures.email),
|
2021-02-24 09:37:14 +00:00
|
|
|
_invitationText: getInviteText({ state,
|
|
|
|
phoneNumber,
|
|
|
|
t: ownProps.t }),
|
2021-07-15 13:12:06 +00:00
|
|
|
_invitationTextiOS: getInviteTextiOS({ state,
|
|
|
|
phoneNumber,
|
|
|
|
t: ownProps.t }),
|
2021-05-13 09:33:05 +00:00
|
|
|
_inviteAppName: inviteAppName,
|
2020-06-25 13:58:25 +00:00
|
|
|
_inviteContactsVisible: interfaceConfig.ENABLE_DIAL_OUT && !hideInviteContacts,
|
2020-04-01 07:47:51 +00:00
|
|
|
_inviteUrl: getInviteURL(state),
|
2022-09-29 14:35:47 +00:00
|
|
|
_isVpaasMeeting: isVpaasMeeting(state),
|
2022-10-07 09:16:41 +00:00
|
|
|
_liveStreamViewURL: currentLiveStreamingSession?.liveStreamViewURL,
|
2021-02-24 09:37:14 +00:00
|
|
|
_phoneNumber: phoneNumber
|
2017-06-14 18:41:22 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-04-01 07:47:51 +00:00
|
|
|
/**
|
|
|
|
* Maps dispatching of some action to React component props.
|
|
|
|
*
|
|
|
|
* @param {Function} dispatch - Redux action dispatcher.
|
2022-10-20 09:11:27 +00:00
|
|
|
* @returns {IProps}
|
2020-04-01 07:47:51 +00:00
|
|
|
*/
|
|
|
|
const mapDispatchToProps = {
|
|
|
|
updateNumbers: () => updateDialInNumbers()
|
|
|
|
};
|
|
|
|
|
|
|
|
export default translate(
|
|
|
|
connect(mapStateToProps, mapDispatchToProps)(AddPeopleDialog)
|
|
|
|
);
|