fix(invite-dialog) adjust dial in limit display condition and styling (#12654)
This commit is contained in:
parent
298c4bd1e3
commit
0e47f72b5f
|
@ -1,6 +1,13 @@
|
||||||
import { parseURLParams } from './parseURLParams';
|
import { parseURLParams } from './parseURLParams';
|
||||||
import { normalizeNFKC } from './strings';
|
import { normalizeNFKC } from './strings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Http status codes.
|
||||||
|
*/
|
||||||
|
export enum StatusCode {
|
||||||
|
PaymentRequired = 402
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The app linking scheme.
|
* The app linking scheme.
|
||||||
* TODO: This should be read from the manifest files later.
|
* TODO: This should be read from the manifest files later.
|
||||||
|
|
|
@ -10,8 +10,8 @@ import { translate } from '../../../../base/i18n/functions';
|
||||||
import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';
|
import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';
|
||||||
import { connect } from '../../../../base/redux/functions';
|
import { connect } from '../../../../base/redux/functions';
|
||||||
import Dialog from '../../../../base/ui/components/web/Dialog';
|
import Dialog from '../../../../base/ui/components/web/Dialog';
|
||||||
|
import { StatusCode } from '../../../../base/util/uri';
|
||||||
import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding/functions.any';
|
import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding/functions.any';
|
||||||
import { isVpaasMeeting } from '../../../../jaas/functions';
|
|
||||||
import { getActiveSession } from '../../../../recording/functions';
|
import { getActiveSession } from '../../../../recording/functions';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { updateDialInNumbers } from '../../../actions';
|
import { updateDialInNumbers } from '../../../actions';
|
||||||
|
@ -80,9 +80,9 @@ interface IProps extends WithTranslation {
|
||||||
_inviteUrl: string;
|
_inviteUrl: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the current meeting belongs to a JaaS user.
|
* Whether the dial in limit has been exceeded.
|
||||||
*/
|
*/
|
||||||
_isVpaasMeeting: boolean;
|
_isDialInOverLimit?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current known URL for a live stream in progress.
|
* The current known URL for a live stream in progress.
|
||||||
|
@ -120,7 +120,7 @@ function AddPeopleDialog({
|
||||||
_inviteAppName,
|
_inviteAppName,
|
||||||
_inviteContactsVisible,
|
_inviteContactsVisible,
|
||||||
_inviteUrl,
|
_inviteUrl,
|
||||||
_isVpaasMeeting,
|
_isDialInOverLimit,
|
||||||
_liveStreamViewURL,
|
_liveStreamViewURL,
|
||||||
_phoneNumber,
|
_phoneNumber,
|
||||||
t,
|
t,
|
||||||
|
@ -182,7 +182,7 @@ function AddPeopleDialog({
|
||||||
&& <DialInSection phoneNumber = { _phoneNumber } />
|
&& <DialInSection phoneNumber = { _phoneNumber } />
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!_phoneNumber && _dialInVisible && _isVpaasMeeting && <DialInLimit />
|
!_phoneNumber && _dialInVisible && _isDialInOverLimit && <DialInLimit />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
@ -207,6 +207,7 @@ function mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
|
||||||
const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled);
|
const hideInviteContacts = iAmRecorder || (!addPeopleEnabled && !dialOutEnabled);
|
||||||
const dialIn = state['features/invite']; // @ts-ignore
|
const dialIn = state['features/invite']; // @ts-ignore
|
||||||
const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined;
|
const phoneNumber = dialIn?.numbers ? _getDefaultPhoneNumber(dialIn.numbers) : undefined;
|
||||||
|
const isDialInOverLimit = dialIn?.error?.status === StatusCode.PaymentRequired;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_dialIn: dialIn,
|
_dialIn: dialIn,
|
||||||
|
@ -222,7 +223,7 @@ function mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
|
||||||
_inviteAppName: inviteAppName,
|
_inviteAppName: inviteAppName,
|
||||||
_inviteContactsVisible: interfaceConfig.ENABLE_DIAL_OUT && !hideInviteContacts,
|
_inviteContactsVisible: interfaceConfig.ENABLE_DIAL_OUT && !hideInviteContacts,
|
||||||
_inviteUrl: getInviteURL(state),
|
_inviteUrl: getInviteURL(state),
|
||||||
_isVpaasMeeting: isVpaasMeeting(state),
|
_isDialInOverLimit: isDialInOverLimit,
|
||||||
_liveStreamViewURL: currentLiveStreamingSession?.liveStreamViewURL,
|
_liveStreamViewURL: currentLiveStreamingSession?.liveStreamViewURL,
|
||||||
_phoneNumber: phoneNumber
|
_phoneNumber: phoneNumber
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,11 +14,11 @@ const useStyles = makeStyles()(theme => {
|
||||||
padding: '8px 16px'
|
padding: '8px 16px'
|
||||||
},
|
},
|
||||||
limitInfo: {
|
limitInfo: {
|
||||||
color: theme.palette.field01,
|
color: theme.palette.text.primary,
|
||||||
...withPixelLineHeight(theme.typography.bodyShortRegular)
|
...withPixelLineHeight(theme.typography.bodyShortRegular)
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
color: theme.palette.field01,
|
color: `${theme.palette.text.primary} !important`,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
textDecoration: 'underline'
|
textDecoration: 'underline'
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,11 @@ import { JitsiRecordingConstants } from '../base/lib-jitsi-meet';
|
||||||
import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants/functions';
|
import { getLocalParticipant, isLocalParticipantModerator } from '../base/participants/functions';
|
||||||
import { toState } from '../base/redux/functions';
|
import { toState } from '../base/redux/functions';
|
||||||
import { parseURLParams } from '../base/util/parseURLParams';
|
import { parseURLParams } from '../base/util/parseURLParams';
|
||||||
import { appendURLParam, parseURIString } from '../base/util/uri';
|
import {
|
||||||
|
StatusCode,
|
||||||
|
appendURLParam,
|
||||||
|
parseURIString
|
||||||
|
} from '../base/util/uri';
|
||||||
import { isVpaasMeeting } from '../jaas/functions';
|
import { isVpaasMeeting } from '../jaas/functions';
|
||||||
import { getActiveSession } from '../recording/functions';
|
import { getActiveSession } from '../recording/functions';
|
||||||
|
|
||||||
|
@ -17,7 +21,8 @@ import { getDialInConferenceID, getDialInNumbers } from './_utils';
|
||||||
import {
|
import {
|
||||||
DIAL_IN_INFO_PAGE_PATH_NAME,
|
DIAL_IN_INFO_PAGE_PATH_NAME,
|
||||||
INVITE_TYPES,
|
INVITE_TYPES,
|
||||||
SIP_ADDRESS_REGEX
|
SIP_ADDRESS_REGEX,
|
||||||
|
UPGRADE_OPTIONS_TEXT
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
|
@ -514,6 +519,7 @@ export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?
|
||||||
if (includeDialInfo) {
|
if (includeDialInfo) {
|
||||||
const { room } = parseURIString(inviteUrl);
|
const { room } = parseURIString(inviteUrl);
|
||||||
let numbersPromise;
|
let numbersPromise;
|
||||||
|
let hasPaymentError = false;
|
||||||
|
|
||||||
if (state['features/invite'].numbers
|
if (state['features/invite'].numbers
|
||||||
&& state['features/invite'].conferenceID) {
|
&& state['features/invite'].conferenceID) {
|
||||||
|
@ -560,9 +566,19 @@ export function getShareInfoText(state: IReduxState, inviteUrl: string, useHtml?
|
||||||
i18next.t('info.dialInConferenceID')} ${
|
i18next.t('info.dialInConferenceID')} ${
|
||||||
conferenceID}#\n\n`;
|
conferenceID}#\n\n`;
|
||||||
})
|
})
|
||||||
.catch(error =>
|
.catch(error => {
|
||||||
logger.error('Error fetching numbers or conferenceID', error))
|
logger.error('Error fetching numbers or conferenceID', error);
|
||||||
|
hasPaymentError = error?.status === StatusCode.PaymentRequired;
|
||||||
|
})
|
||||||
.then(defaultDialInNumber => {
|
.then(defaultDialInNumber => {
|
||||||
|
if (hasPaymentError) {
|
||||||
|
infoText += `${
|
||||||
|
i18next.t('info.dialInNumber')} ${i18next.t('info.reachedLimit')} ${
|
||||||
|
i18next.t('info.upgradeOptions')} ${UPGRADE_OPTIONS_TEXT}`;
|
||||||
|
|
||||||
|
return infoText;
|
||||||
|
}
|
||||||
|
|
||||||
let dialInfoPageUrl = getDialInfoPageURL(state, room);
|
let dialInfoPageUrl = getDialInfoPageURL(state, room);
|
||||||
|
|
||||||
if (useHtml) {
|
if (useHtml) {
|
||||||
|
|
|
@ -26,7 +26,9 @@ const DEFAULT_STATE = {
|
||||||
export interface IInviteState {
|
export interface IInviteState {
|
||||||
calleeInfoVisible?: boolean;
|
calleeInfoVisible?: boolean;
|
||||||
conferenceID?: string | number;
|
conferenceID?: string | number;
|
||||||
error?: Error;
|
error?: {
|
||||||
|
status: number;
|
||||||
|
};
|
||||||
initialCalleeInfo?: Object;
|
initialCalleeInfo?: Object;
|
||||||
numbers?: string[];
|
numbers?: string[];
|
||||||
numbersEnabled: boolean;
|
numbersEnabled: boolean;
|
||||||
|
@ -73,6 +75,7 @@ ReducerRegistry.register<IInviteState>('features/invite', (state = DEFAULT_STATE
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
conferenceID: action.conferenceID,
|
conferenceID: action.conferenceID,
|
||||||
|
error: undefined,
|
||||||
numbers: action.dialInNumbers,
|
numbers: action.dialInNumbers,
|
||||||
sipUri: action.sipUri,
|
sipUri: action.sipUri,
|
||||||
numbersEnabled: true,
|
numbersEnabled: true,
|
||||||
|
@ -88,6 +91,7 @@ ReducerRegistry.register<IInviteState>('features/invite', (state = DEFAULT_STATE
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
conferenceID: action.conferenceID,
|
conferenceID: action.conferenceID,
|
||||||
|
error: undefined,
|
||||||
numbers: action.dialInNumbers,
|
numbers: action.dialInNumbers,
|
||||||
numbersEnabled,
|
numbersEnabled,
|
||||||
numbersFetched: true
|
numbersFetched: true
|
||||||
|
|
Loading…
Reference in New Issue