From 4f948dcfc1a1a1a6213459aa1b014af955385468 Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Tue, 27 Mar 2018 10:55:56 +0800 Subject: [PATCH 01/14] merge GA regression commits back to master (#860) * add options guide to whats new (#826) * fix bug in c2d detect hyperlink incorrectly && dial pad title incorrect && meeting discription is not right && white screen when update contact source filter (#831) * Fix c2d detect hyperlink incorrectly && app name error && dial pad title incorrect && meeting content not right && white screen when update contact source filter && lose source icon when contact name is null * fix meeting discription is not right * check value this.listelem not null before use * await hangup func in answerAndEnd and update googleclientid in bt brand (#838) * fix bug in login panel that currentlocale is sync after initialize proxy (#836) * fix bug in login panel that currentlocale is sync after initialize proxy * update currentLocale * remove unuserd code * chore: add sample rate to sentry in prod env (#841) * add sample rate to sentry in prod env * fix syntax error * update sentry configuration * [RCINIT-6839]Remove failed fax message in call history list (#827) * fix bug Presence icon is not displayed correctly when changing status (#837) * fix bug Presence icon is not displayed correctly when changing status in SW * update presencestatus in headerview * Revert "update presencestatus in headerview" This reverts commit fe37a21baa44222657f5270186eecc66b1dbd0e4. * Revert "fix bug Presence icon is not displayed correctly when changing status in SW" This reverts commit 285cbef463b3c1d6316c323d27961f8baec87e7d. * when dndstatus is do not disturb status should be do not disturb * update presence status * bugfix answer call then direct to blank page & prod build hash (#843) * should not open conversation page when click actionmenulist (#842) * feat: add extra webrtc warning (#835) * add extra webrtc warning * add rebranding to webphone alert * add calling mode condition to disable check in non-webphone mode * update webphone to support reconnect from webphone badge * update i18n * add tests for webphone badge * update locale for audio settings alert * remove errcode -1 to make error msg more generic * support audio auto prompted * in meeting description replace /r/n with
(#847) * Bugfix: do not launch sign in flow when unauthorized & lock authorize process (#828) * Bugfix: do not launch sign in flow when unauthorized & lock authorize process * fix google signin flow * chore: implement localStorage migration process (#846) * empty localStorage when upgrading from lower version * enable migration in all env * extract migrationLocalStorage & add tests * update unit tests * minor: update navigation UI (#850) * update navigation UI * update styles * update user guide to support locales (#844) * update user guide to support locales * remove unnecessary comments * update user guide module * Fix user guide & update webphone error handling & hide area code check for non-rc app (#853) * fix user guide add error handling for 403 in webphone & update call button color * hide area code check for non-rc app & add webphone error msg * fix dependencies name * change the order of code * workaround: fixed width and height of options page * should hide what's new when c2d or c2sms (#854) * hide feedback in other brands (#852) * fix bug show blank page when answer fail (#851) * Import user guides for RC (#859) * import what's new guides images * replace image 2 --- dev-server/containers/AppView/index.js | 3 - src/components/ContactDisplay/index.js | 507 +++++++++++++------------ 2 files changed, 254 insertions(+), 256 deletions(-) diff --git a/dev-server/containers/AppView/index.js b/dev-server/containers/AppView/index.js index f50aab3a8d..343ad1e73f 100644 --- a/dev-server/containers/AppView/index.js +++ b/dev-server/containers/AppView/index.js @@ -53,7 +53,6 @@ AppView.propTypes = { offline: PropTypes.bool.isRequired, showOfflineAlert: PropTypes.func.isRequired, webphoneUnavailable: PropTypes.bool.isRequired, - onWebphoneBadgeClicked: PropTypes.func.isRequired, }; AppView.defaultProps = { @@ -122,8 +121,6 @@ export default withPhone(connect((state, { audioSettings.getUserMedia(); } if (webphone && webphone.ready) { - // Trigger reconnect - // webphone.connect(); webphone.showAlert(); } }, diff --git a/src/components/ContactDisplay/index.js b/src/components/ContactDisplay/index.js index 1b581a2eb5..9c6dcadafb 100644 --- a/src/components/ContactDisplay/index.js +++ b/src/components/ContactDisplay/index.js @@ -1,253 +1,254 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import formatNumber from 'ringcentral-integration/lib/formatNumber'; -import formatMessage from 'format-message'; -import DropdownSelect from '../DropdownSelect'; -import i18n from './i18n'; -import styles from './styles.scss'; -import phoneSourceNames from '../../lib/phoneSourceNames'; -import phoneSources from '../../enums/phoneSources'; - -const displayFormatter = ({ - entityName, - entityType, - phoneNumber, - currentLocale, - brand, -}) => { - let typeName; - if (entityType) { - typeName = formatMessage( - phoneSourceNames.getString(entityType, currentLocale), - { brand } - ); - } - if (phoneNumber && entityName && entityType) { - return `${entityName} | ${typeName} ${phoneNumber}`; - } else if (entityName && entityType) { - return `${entityName} | ${typeName}`; - } else if (entityName) { - return entityName; - } else if (phoneNumber) { - return `${phoneNumber}`; - } - return ''; -}; - -function ContactDisplayItem({ - entityName, - entityType, - phoneNumber, - sourceIcons -}) { - let SourceIcon = null; - if (entityType) { - if (entityType === phoneSources.rcContact) { - SourceIcon = sourceIcons.brandIcon; - } else { - SourceIcon = sourceIcons[entityType]; - } - } - if (phoneNumber && entityName !== undefined && SourceIcon) { - return ( - - - {entityName} - - ); - } else if (entityName !== undefined && SourceIcon) { - return ( - - - {entityName} - - ); - } else if (entityName !== undefined) { - return {entityName}; - } else if (phoneNumber) { - return {phoneNumber}; - } - return null; -} - -ContactDisplayItem.propTypes = { - entityName: PropTypes.string.isRequired, - entityType: PropTypes.string.isRequired, - phoneNumber: PropTypes.string.isRequired, - sourceIcons: PropTypes.object.isRequired, -}; - -export default function ContactDisplay({ - reference, - className, - contactMatches, - selected, - onSelectContact, - disabled, - isLogging, - fallBackName, - enableContactFallback, - areaCode, - countryCode, - phoneNumber, - currentLocale, - groupNumbers, - showType, - selectClassName, - showPlaceholder, - brand, - stopPropagation, - sourceIcons = {}, - showGroupNumberName, -}) { - let contentEl; - if (groupNumbers && showGroupNumberName) { - const groupNames = groupNumbers.map((groupNumber) => { - const groupContact = contactMatches.find(match => match.extensionNumber === groupNumber); - return (groupContact && groupContact.name) || groupNumber; - }); - const display = groupNames.join(', '); - contentEl = ( -
- {display} -
- ); - } else if (groupNumbers) { - const display = groupNumbers.join(', '); - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length === 0) { - const display = (enableContactFallback && fallBackName) || - (phoneNumber && formatNumber({ - phoneNumber, - countryCode, - areaCode, - })) || - i18n.getString('unknownNumber', currentLocale); - const title = (enableContactFallback && fallBackName) || - phoneNumber || ''; - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length === 1) { - const display = contactMatches[0].name; - const title = displayFormatter({ - entityName: display, - entityType: contactMatches[0].entityType, - phoneNumber, - brand, - currentLocale - }); - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length > 1) { - const options = [ - ...contactMatches, - ]; - let placeholder; - let _selected = selected; - if (showPlaceholder) { - placeholder = i18n.getString('select', currentLocale); - } else { - _selected = _selected < 0 ? 0 : _selected; - } - contentEl = ( - ( - ContactDisplayItem({ - entityName: entity.name, - entityType: entity.entityType, - brand, - currentLocale, - sourceIcons - }) - )} - renderValue={value => ( - displayFormatter({ - entityName: options[value].name, - entityType: showType && options[value].entityType, - brand, - currentLocale, - }) - )} - renderTitle={entity => ( - entity ? displayFormatter({ - entityName: entity.name, - entityType: entity.entityType, - phoneNumber, - brand, - currentLocale, - }) : phoneNumber) - } - dropdownAlign="left" - titleEnabled - noPadding - stopPropagation={stopPropagation} - /> - ); - } - return ( -
- {contentEl} -
- ); -} -ContactDisplay.propTypes = { - reference: PropTypes.func, - className: PropTypes.string, - contactMatches: PropTypes.arrayOf(PropTypes.any).isRequired, - selected: PropTypes.number.isRequired, - onSelectContact: PropTypes.func, - disabled: PropTypes.bool.isRequired, - isLogging: PropTypes.bool.isRequired, - fallBackName: PropTypes.string, - enableContactFallback: PropTypes.bool, - areaCode: PropTypes.string.isRequired, - countryCode: PropTypes.string.isRequired, - phoneNumber: PropTypes.string, - currentLocale: PropTypes.string.isRequired, - groupNumbers: PropTypes.arrayOf(PropTypes.string), - showType: PropTypes.bool, - selectClassName: PropTypes.string, - showPlaceholder: PropTypes.bool, - brand: PropTypes.string, - stopPropagation: PropTypes.bool, - sourceIcons: PropTypes.object, - showGroupNumberName: PropTypes.bool, -}; -ContactDisplay.defaultProps = { - reference: undefined, - className: undefined, - onSelectContact: undefined, - fallBackName: '', - phoneNumber: undefined, - groupNumbers: undefined, - enableContactFallback: undefined, - showType: true, - selectClassName: undefined, - showPlaceholder: true, - brand: undefined, - stopPropagation: true, - sourceIcons: undefined, - showGroupNumberName: false, -}; +import React from 'react'; +import PropTypes from 'prop-types'; +import classnames from 'classnames'; +import formatNumber from 'ringcentral-integration/lib/formatNumber'; +import formatMessage from 'format-message'; +import DropdownSelect from '../DropdownSelect'; +import i18n from './i18n'; +import styles from './styles.scss'; +import phoneSourceNames from '../../lib/phoneSourceNames'; +import phoneSources from '../../enums/phoneSources'; + +const displayFormatter = ({ + entityName, + entityType, + phoneNumber, + currentLocale, + brand, +}) => { + let typeName; + if (entityType) { + typeName = formatMessage( + phoneSourceNames.getString(entityType, currentLocale), + { brand } + ); + } + if (phoneNumber && entityName && entityType) { + return `${entityName} | ${typeName} ${phoneNumber}`; + } else if (entityName && entityType) { + return `${entityName} | ${typeName}`; + } else if (entityName) { + return entityName; + } else if (phoneNumber) { + return `${phoneNumber}`; + } + return ''; +}; + +function ContactDisplayItem({ + entityName, + entityType, + phoneNumber, + sourceIcons +}) { + let SourceIcon = null; + if (entityType) { + if (entityType === phoneSources.rcContact) { + SourceIcon = sourceIcons.brandIcon; + } else { + SourceIcon = sourceIcons[entityType]; + } + } + if (phoneNumber && entityName !== undefined && SourceIcon) { + return ( + + + {entityName} + + ); + } else if (entityName !== undefined && SourceIcon) { + return ( + + + {entityName} + + ); + } else if (entityName !== undefined) { + return {entityName}; + } else if (phoneNumber) { + return {phoneNumber}; + } + return null; +} + +ContactDisplayItem.propTypes = { + entityName: PropTypes.string.isRequired, + entityType: PropTypes.string.isRequired, + phoneNumber: PropTypes.string.isRequired, + sourceIcons: PropTypes.object.isRequired, +}; + +export default function ContactDisplay({ + reference, + className, + contactMatches, + selected, + onSelectContact, + disabled, + isLogging, + fallBackName, + enableContactFallback, + areaCode, + countryCode, + phoneNumber, + currentLocale, + groupNumbers, + showType, + selectClassName, + showPlaceholder, + brand, + stopPropagation, + sourceIcons = {}, + showGroupNumberName, +}) { + let contentEl; + if (groupNumbers && showGroupNumberName) { + const groupNames = groupNumbers.map((groupNumber) => { + const groupContact = contactMatches.find(match => match.extensionNumber === groupNumber); + return (groupContact && groupContact.name) || groupNumber; + }); + const display = groupNames.join(', '); + contentEl = ( +
+ {display} +
+ ); + } else if (groupNumbers) { + const display = groupNumbers.join(', '); + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length === 0) { + const display = (enableContactFallback && fallBackName) || + (phoneNumber && formatNumber({ + phoneNumber, + countryCode, + areaCode, + })) || + i18n.getString('unknownNumber', currentLocale); + const title = (enableContactFallback && fallBackName) || + phoneNumber || ''; + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length === 1) { + const display = contactMatches[0].name; + const title = displayFormatter({ + entityName: display, + entityType: contactMatches[0].entityType, + phoneNumber, + brand, + currentLocale + }); + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length > 1) { + const options = [ + ...contactMatches, + ]; + let placeholder; + let _selected = selected; + if (showPlaceholder) { + placeholder = i18n.getString('select', currentLocale); + } else { + _selected = _selected < 0 ? 0 : _selected; + } + contentEl = ( + ( + ContactDisplayItem({ + entityName: entity.name, + entityType: entity.entityType, + brand, + currentLocale, + sourceIcons + }) + )} + renderValue={value => ( + displayFormatter({ + entityName: options[value].name, + entityType: showType && options[value].entityType, + brand, + currentLocale, + }) + )} + renderTitle={entity => ( + entity ? displayFormatter({ + entityName: entity.name, + entityType: entity.entityType, + phoneNumber, + brand, + currentLocale, + }) : phoneNumber) + } + dropdownAlign="left" + titleEnabled + noPadding + stopPropagation={stopPropagation} + /> + ); + } + + return ( +
+ {contentEl} +
+ ); +} +ContactDisplay.propTypes = { + reference: PropTypes.func, + className: PropTypes.string, + contactMatches: PropTypes.arrayOf(PropTypes.any).isRequired, + selected: PropTypes.number.isRequired, + onSelectContact: PropTypes.func, + disabled: PropTypes.bool.isRequired, + isLogging: PropTypes.bool.isRequired, + fallBackName: PropTypes.string, + enableContactFallback: PropTypes.bool, + areaCode: PropTypes.string.isRequired, + countryCode: PropTypes.string.isRequired, + phoneNumber: PropTypes.string, + currentLocale: PropTypes.string.isRequired, + groupNumbers: PropTypes.arrayOf(PropTypes.string), + showType: PropTypes.bool, + selectClassName: PropTypes.string, + showPlaceholder: PropTypes.bool, + brand: PropTypes.string, + stopPropagation: PropTypes.bool, + sourceIcons: PropTypes.object, + showGroupNumberName: PropTypes.bool, +}; +ContactDisplay.defaultProps = { + reference: undefined, + className: undefined, + onSelectContact: undefined, + fallBackName: '', + phoneNumber: undefined, + groupNumbers: undefined, + enableContactFallback: undefined, + showType: true, + selectClassName: undefined, + showPlaceholder: true, + brand: undefined, + stopPropagation: true, + sourceIcons: undefined, + showGroupNumberName: false, +}; From 2e5de9b9411a88c560daf2fb362eb9551b7f5778 Mon Sep 17 00:00:00 2001 From: Bella Lian Date: Fri, 30 Mar 2018 13:33:43 +0800 Subject: [PATCH 02/14] fixbug-colon --- src/components/ActiveCallItem/i18n/fr-CA.js | 4 ++-- src/components/ActiveCallItem/i18n/fr-FR.js | 4 ++-- src/components/ComposeTextPanel/i18n/fr-CA.js | 4 ++-- src/components/ComposeTextPanel/i18n/fr-FR.js | 4 ++-- src/components/FromField/i18n/fr-CA.js | 2 +- src/components/FromField/i18n/fr-FR.js | 2 +- src/components/RecipientsInput/i18n/fr-CA.js | 2 +- src/components/RecipientsInput/i18n/fr-FR.js | 2 +- src/components/ToField/i18n/fr-CA.js | 2 +- src/components/ToField/i18n/fr-FR.js | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/ActiveCallItem/i18n/fr-CA.js b/src/components/ActiveCallItem/i18n/fr-CA.js index b67a4353e1..e6d00f2cea 100644 --- a/src/components/ActiveCallItem/i18n/fr-CA.js +++ b/src/components/ActiveCallItem/i18n/fr-CA.js @@ -18,8 +18,8 @@ export default { missedCall: 'Manqué', inboundCall: 'Entrant', outboundCall: 'Sortant', - from: 'De', - to: 'À', + from: 'De ', + to: 'À ', hangup: 'Raccrocher', accept: 'Accepter', toVoicemail: 'Envoyer vers la messagerie vocale', diff --git a/src/components/ActiveCallItem/i18n/fr-FR.js b/src/components/ActiveCallItem/i18n/fr-FR.js index 8e16e37cc8..8526d9497f 100644 --- a/src/components/ActiveCallItem/i18n/fr-FR.js +++ b/src/components/ActiveCallItem/i18n/fr-FR.js @@ -18,8 +18,8 @@ export default { missedCall: 'Manqué', inboundCall: 'Entrant', outboundCall: 'Sortant', - from: 'De', - to: 'À', + from: 'De ', + to: 'À ', hangup: 'Raccrocher', accept: 'Accepter', toVoicemail: 'Envoyer vers la messagerie vocale', diff --git a/src/components/ComposeTextPanel/i18n/fr-CA.js b/src/components/ComposeTextPanel/i18n/fr-CA.js index 0c31a02ea3..21998f5cf4 100644 --- a/src/components/ComposeTextPanel/i18n/fr-CA.js +++ b/src/components/ComposeTextPanel/i18n/fr-CA.js @@ -1,6 +1,6 @@ export default { - from: 'De', - to: 'À', + from: 'De ', + to: 'À ', enterNameOrNumber: 'Saisir le numéro ou le nom', typeMessage: 'Entrer le message...', send: 'Envoyer', diff --git a/src/components/ComposeTextPanel/i18n/fr-FR.js b/src/components/ComposeTextPanel/i18n/fr-FR.js index 9e37c36355..4aba4165b9 100644 --- a/src/components/ComposeTextPanel/i18n/fr-FR.js +++ b/src/components/ComposeTextPanel/i18n/fr-FR.js @@ -1,6 +1,6 @@ export default { - from: 'De', - to: 'À', + from: 'De ', + to: 'À ', enterNameOrNumber: 'Saisir le numéro ou le nom', typeMessage: 'Saisie du message...', send: 'Envoyer', diff --git a/src/components/FromField/i18n/fr-CA.js b/src/components/FromField/i18n/fr-CA.js index cb84186967..7b618d7c91 100644 --- a/src/components/FromField/i18n/fr-CA.js +++ b/src/components/FromField/i18n/fr-CA.js @@ -4,7 +4,7 @@ export default { CompanyNumber: 'Entreprise', CompanyFaxNumber: 'Fax', Blocked: 'Bloqué', - from: 'De', + from: 'De ', AdditionalCompanyNumber: 'Entreprise', ForwardedCompanyNumber: 'Transféré', }; diff --git a/src/components/FromField/i18n/fr-FR.js b/src/components/FromField/i18n/fr-FR.js index cb84186967..7b618d7c91 100644 --- a/src/components/FromField/i18n/fr-FR.js +++ b/src/components/FromField/i18n/fr-FR.js @@ -4,7 +4,7 @@ export default { CompanyNumber: 'Entreprise', CompanyFaxNumber: 'Fax', Blocked: 'Bloqué', - from: 'De', + from: 'De ', AdditionalCompanyNumber: 'Entreprise', ForwardedCompanyNumber: 'Transféré', }; diff --git a/src/components/RecipientsInput/i18n/fr-CA.js b/src/components/RecipientsInput/i18n/fr-CA.js index f8ea27062d..1dcae1cd31 100644 --- a/src/components/RecipientsInput/i18n/fr-CA.js +++ b/src/components/RecipientsInput/i18n/fr-CA.js @@ -1,5 +1,5 @@ export default { - to: 'À', + to: 'À ', enterNameOrNumber: 'Entrer le nom ou le numéro', }; diff --git a/src/components/RecipientsInput/i18n/fr-FR.js b/src/components/RecipientsInput/i18n/fr-FR.js index e139061f2f..dd5d72f5e4 100644 --- a/src/components/RecipientsInput/i18n/fr-FR.js +++ b/src/components/RecipientsInput/i18n/fr-FR.js @@ -1,5 +1,5 @@ export default { - to: 'À', + to: 'À ', enterNameOrNumber: 'Saisir un nom ou numéro', }; diff --git a/src/components/ToField/i18n/fr-CA.js b/src/components/ToField/i18n/fr-CA.js index 06a7bc19ad..4f710ca7fc 100644 --- a/src/components/ToField/i18n/fr-CA.js +++ b/src/components/ToField/i18n/fr-CA.js @@ -1,5 +1,5 @@ export default { - to: 'À', + to: 'À ', enterNameOrNumber: 'Saisir le numéro ou le nom', }; diff --git a/src/components/ToField/i18n/fr-FR.js b/src/components/ToField/i18n/fr-FR.js index 06a7bc19ad..4f710ca7fc 100644 --- a/src/components/ToField/i18n/fr-FR.js +++ b/src/components/ToField/i18n/fr-FR.js @@ -1,5 +1,5 @@ export default { - to: 'À', + to: 'À ', enterNameOrNumber: 'Saisir le numéro ou le nom', }; From 182d2421017edbea61b515a3cb6d855c4c5e2ee6 Mon Sep 17 00:00:00 2001 From: Jack Tzu-Chieh Huang Date: Fri, 30 Mar 2018 18:36:52 +0800 Subject: [PATCH 03/14] [RCINT-7103] Remove auto focus on dialer and compose text pages (#867) --- src/components/ComposeTextPanel/index.js | 4 +++- src/components/DialerPanel/index.js | 5 ++++- src/components/ForwardForm/index.js | 5 ++++- src/components/TransferPanel/index.js | 4 +++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/ComposeTextPanel/index.js b/src/components/ComposeTextPanel/index.js index 327ada79f5..6e1e9a4cab 100644 --- a/src/components/ComposeTextPanel/index.js +++ b/src/components/ComposeTextPanel/index.js @@ -88,7 +88,7 @@ class ComposeTextPanel extends Component { contactInfoRenderer={this.props.recipientsContactInfoRenderer} contactPhoneRenderer={this.props.recipientsContactPhoneRenderer} titleEnabled - autoFocus + autoFocus={this.props.autoFocus} multiple />
@@ -163,6 +163,7 @@ ComposeTextPanel.propTypes = { phoneTypeRenderer: PropTypes.func, recipientsContactInfoRenderer: PropTypes.func, recipientsContactPhoneRenderer: PropTypes.func, + autoFocus: PropTypes.bool, }; ComposeTextPanel.defaultProps = { @@ -176,6 +177,7 @@ ComposeTextPanel.defaultProps = { phoneTypeRenderer: undefined, recipientsContactInfoRenderer: undefined, recipientsContactPhoneRenderer: undefined, + autoFocus: false, }; export default ComposeTextPanel; diff --git a/src/components/DialerPanel/index.js b/src/components/DialerPanel/index.js index 44e93f0914..d65a73c85c 100644 --- a/src/components/DialerPanel/index.js +++ b/src/components/DialerPanel/index.js @@ -34,6 +34,7 @@ function DialerPanel({ phoneTypeRenderer, recipientsContactInfoRenderer, recipientsContactPhoneRenderer, + autoFocus, }) { const onCallFunc = () => { if (!callButtonDisabled) { @@ -58,7 +59,7 @@ function DialerPanel({ contactInfoRenderer={recipientsContactInfoRenderer} contactPhoneRenderer={recipientsContactPhoneRenderer} titleEnabled - autoFocus + autoFocus={autoFocus} />
@@ -227,10 +228,12 @@ ForwardForm.propTypes = { searchContactList: PropTypes.array.isRequired, searchContact: PropTypes.func.isRequired, phoneTypeRenderer: PropTypes.func, + autoFocus: PropTypes.bool, }; ForwardForm.defaultProps = { className: null, onChange: undefined, phoneTypeRenderer: undefined, + autoFocus: true, }; diff --git a/src/components/TransferPanel/index.js b/src/components/TransferPanel/index.js index 41793c25fa..bd9591a93e 100644 --- a/src/components/TransferPanel/index.js +++ b/src/components/TransferPanel/index.js @@ -20,11 +20,13 @@ export default class TransferPanel extends PureComponent { formatPhone: PropTypes.func.isRequired, phoneTypeRenderer: PropTypes.func, isOnTransfer: PropTypes.bool, + autoFocus: PropTypes.bool, }; static defaultProps = { phoneTypeRenderer: undefined, isOnTransfer: false, + autoFocus: true, }; constructor(props) { @@ -106,7 +108,7 @@ export default class TransferPanel extends PureComponent { currentLocale={this.props.currentLocale} phoneTypeRenderer={this.props.phoneTypeRenderer} titleEnabled - autoFocus + autoFocus={this.props.autoFocus} />
Date: Mon, 2 Apr 2018 14:07:03 +0800 Subject: [PATCH 04/14] fix bug presence status display incorrectly in contact detail (#870) --- src/components/ContactDetails/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ContactDetails/index.js b/src/components/ContactDetails/index.js index 7098c90b2e..6efde31d85 100644 --- a/src/components/ContactDetails/index.js +++ b/src/components/ContactDetails/index.js @@ -11,11 +11,11 @@ import i18n from './i18n'; import styles from './styles.scss'; export function getPresenceStatusName(presence, currentLocale) { - const { userStatus, dndStatus } = presence; + const { presenceStatus, dndStatus } = presence; if (dndStatus === DndStatus.doNotAcceptAnyCalls) { return i18n.getString(dndStatus, currentLocale); } - return i18n.getString(userStatus, currentLocale); + return i18n.getString(presenceStatus, currentLocale); } function AvatarNode({ name, avatarUrl }) { From 06aba1564a7e9fe046930166ed486f692c648277 Mon Sep 17 00:00:00 2001 From: Eric Huang Date: Mon, 2 Apr 2018 16:44:45 +0800 Subject: [PATCH 05/14] Sync changes from commons and widgets (#863) * git subrepo pull packages/ringcentral-integration subrepo: subdir: "packages/ringcentral-integration" merged: "e8cd64892" upstream: origin: "https://github.com/ringcentral/ringcentral-js-integration-commons.git" branch: "master" commit: "bebfba673" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * git subrepo pull packages/ringcentral-widgets subrepo: subdir: "packages/ringcentral-widgets" merged: "e024e3189" upstream: origin: "https://github.com/ringcentral/ringcentral-js-widgets.git" branch: "master" commit: "33f1332ba" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * fix tests & lint * git subrepo commit packages/ringcentral-integration subrepo: subdir: "packages/ringcentral-integration" merged: "458bff886" upstream: origin: "https://github.com/ringcentral/ringcentral-js-integration-commons.git" branch: "master" commit: "8446edcf0" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * fix test * upgrade ringcentral-integration * update appview in dev-server * git subrepo pull packages/ringcentral-integration subrepo: subdir: "packages/ringcentral-integration" merged: "c3cdacff2" upstream: origin: "https://github.com/ringcentral/ringcentral-js-integration-commons.git" branch: "master" commit: "c3cdacff2" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * git subrepo pull packages/ringcentral-widgets subrepo: subdir: "packages/ringcentral-widgets" merged: "2956435f6" upstream: origin: "https://github.com/ringcentral/ringcentral-js-widgets.git" branch: "master" commit: "2956435f6" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * git subrepo pull packages/ringcentral-widgets subrepo: subdir: "packages/ringcentral-widgets" merged: "eb789eb39" upstream: origin: "https://github.com/ringcentral/ringcentral-js-widgets.git" branch: "master" commit: "eb789eb39" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * git subrepo pull packages/ringcentral-integration subrepo: subdir: "packages/ringcentral-integration" merged: "3a8efb211" upstream: origin: "https://github.com/ringcentral/ringcentral-js-integration-commons.git" branch: "master" commit: "3a8efb211" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * git subrepo pull packages/ringcentral-integration subrepo: subdir: "packages/ringcentral-integration" merged: "a963aec51" upstream: origin: "https://github.com/ringcentral/ringcentral-js-integration-commons.git" branch: "master" commit: "a963aec51" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * add dependencies to Phone * git subrepo pull packages/ringcentral-widgets subrepo: subdir: "packages/ringcentral-widgets" merged: "b190f5cf7" upstream: origin: "https://github.com/ringcentral/ringcentral-js-widgets.git" branch: "master" commit: "6da03ef42" git-subrepo: version: "0.3.1" origin: "???" commit: "???" * bugfix: apply reducer from successor in Presence module * add storage for presence module --- dev-server/containers/AppView/index.js | 3 + src/components/ContactDisplay/index.js | 507 ++++++++++++------------- 2 files changed, 256 insertions(+), 254 deletions(-) diff --git a/dev-server/containers/AppView/index.js b/dev-server/containers/AppView/index.js index 343ad1e73f..f50aab3a8d 100644 --- a/dev-server/containers/AppView/index.js +++ b/dev-server/containers/AppView/index.js @@ -53,6 +53,7 @@ AppView.propTypes = { offline: PropTypes.bool.isRequired, showOfflineAlert: PropTypes.func.isRequired, webphoneUnavailable: PropTypes.bool.isRequired, + onWebphoneBadgeClicked: PropTypes.func.isRequired, }; AppView.defaultProps = { @@ -121,6 +122,8 @@ export default withPhone(connect((state, { audioSettings.getUserMedia(); } if (webphone && webphone.ready) { + // Trigger reconnect + // webphone.connect(); webphone.showAlert(); } }, diff --git a/src/components/ContactDisplay/index.js b/src/components/ContactDisplay/index.js index 9c6dcadafb..1b581a2eb5 100644 --- a/src/components/ContactDisplay/index.js +++ b/src/components/ContactDisplay/index.js @@ -1,254 +1,253 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import formatNumber from 'ringcentral-integration/lib/formatNumber'; -import formatMessage from 'format-message'; -import DropdownSelect from '../DropdownSelect'; -import i18n from './i18n'; -import styles from './styles.scss'; -import phoneSourceNames from '../../lib/phoneSourceNames'; -import phoneSources from '../../enums/phoneSources'; - -const displayFormatter = ({ - entityName, - entityType, - phoneNumber, - currentLocale, - brand, -}) => { - let typeName; - if (entityType) { - typeName = formatMessage( - phoneSourceNames.getString(entityType, currentLocale), - { brand } - ); - } - if (phoneNumber && entityName && entityType) { - return `${entityName} | ${typeName} ${phoneNumber}`; - } else if (entityName && entityType) { - return `${entityName} | ${typeName}`; - } else if (entityName) { - return entityName; - } else if (phoneNumber) { - return `${phoneNumber}`; - } - return ''; -}; - -function ContactDisplayItem({ - entityName, - entityType, - phoneNumber, - sourceIcons -}) { - let SourceIcon = null; - if (entityType) { - if (entityType === phoneSources.rcContact) { - SourceIcon = sourceIcons.brandIcon; - } else { - SourceIcon = sourceIcons[entityType]; - } - } - if (phoneNumber && entityName !== undefined && SourceIcon) { - return ( - - - {entityName} - - ); - } else if (entityName !== undefined && SourceIcon) { - return ( - - - {entityName} - - ); - } else if (entityName !== undefined) { - return {entityName}; - } else if (phoneNumber) { - return {phoneNumber}; - } - return null; -} - -ContactDisplayItem.propTypes = { - entityName: PropTypes.string.isRequired, - entityType: PropTypes.string.isRequired, - phoneNumber: PropTypes.string.isRequired, - sourceIcons: PropTypes.object.isRequired, -}; - -export default function ContactDisplay({ - reference, - className, - contactMatches, - selected, - onSelectContact, - disabled, - isLogging, - fallBackName, - enableContactFallback, - areaCode, - countryCode, - phoneNumber, - currentLocale, - groupNumbers, - showType, - selectClassName, - showPlaceholder, - brand, - stopPropagation, - sourceIcons = {}, - showGroupNumberName, -}) { - let contentEl; - if (groupNumbers && showGroupNumberName) { - const groupNames = groupNumbers.map((groupNumber) => { - const groupContact = contactMatches.find(match => match.extensionNumber === groupNumber); - return (groupContact && groupContact.name) || groupNumber; - }); - const display = groupNames.join(', '); - contentEl = ( -
- {display} -
- ); - } else if (groupNumbers) { - const display = groupNumbers.join(', '); - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length === 0) { - const display = (enableContactFallback && fallBackName) || - (phoneNumber && formatNumber({ - phoneNumber, - countryCode, - areaCode, - })) || - i18n.getString('unknownNumber', currentLocale); - const title = (enableContactFallback && fallBackName) || - phoneNumber || ''; - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length === 1) { - const display = contactMatches[0].name; - const title = displayFormatter({ - entityName: display, - entityType: contactMatches[0].entityType, - phoneNumber, - brand, - currentLocale - }); - contentEl = ( -
- {display} -
- ); - } else if (contactMatches.length > 1) { - const options = [ - ...contactMatches, - ]; - let placeholder; - let _selected = selected; - if (showPlaceholder) { - placeholder = i18n.getString('select', currentLocale); - } else { - _selected = _selected < 0 ? 0 : _selected; - } - contentEl = ( - ( - ContactDisplayItem({ - entityName: entity.name, - entityType: entity.entityType, - brand, - currentLocale, - sourceIcons - }) - )} - renderValue={value => ( - displayFormatter({ - entityName: options[value].name, - entityType: showType && options[value].entityType, - brand, - currentLocale, - }) - )} - renderTitle={entity => ( - entity ? displayFormatter({ - entityName: entity.name, - entityType: entity.entityType, - phoneNumber, - brand, - currentLocale, - }) : phoneNumber) - } - dropdownAlign="left" - titleEnabled - noPadding - stopPropagation={stopPropagation} - /> - ); - } - - return ( -
- {contentEl} -
- ); -} -ContactDisplay.propTypes = { - reference: PropTypes.func, - className: PropTypes.string, - contactMatches: PropTypes.arrayOf(PropTypes.any).isRequired, - selected: PropTypes.number.isRequired, - onSelectContact: PropTypes.func, - disabled: PropTypes.bool.isRequired, - isLogging: PropTypes.bool.isRequired, - fallBackName: PropTypes.string, - enableContactFallback: PropTypes.bool, - areaCode: PropTypes.string.isRequired, - countryCode: PropTypes.string.isRequired, - phoneNumber: PropTypes.string, - currentLocale: PropTypes.string.isRequired, - groupNumbers: PropTypes.arrayOf(PropTypes.string), - showType: PropTypes.bool, - selectClassName: PropTypes.string, - showPlaceholder: PropTypes.bool, - brand: PropTypes.string, - stopPropagation: PropTypes.bool, - sourceIcons: PropTypes.object, - showGroupNumberName: PropTypes.bool, -}; -ContactDisplay.defaultProps = { - reference: undefined, - className: undefined, - onSelectContact: undefined, - fallBackName: '', - phoneNumber: undefined, - groupNumbers: undefined, - enableContactFallback: undefined, - showType: true, - selectClassName: undefined, - showPlaceholder: true, - brand: undefined, - stopPropagation: true, - sourceIcons: undefined, - showGroupNumberName: false, -}; +import React from 'react'; +import PropTypes from 'prop-types'; +import classnames from 'classnames'; +import formatNumber from 'ringcentral-integration/lib/formatNumber'; +import formatMessage from 'format-message'; +import DropdownSelect from '../DropdownSelect'; +import i18n from './i18n'; +import styles from './styles.scss'; +import phoneSourceNames from '../../lib/phoneSourceNames'; +import phoneSources from '../../enums/phoneSources'; + +const displayFormatter = ({ + entityName, + entityType, + phoneNumber, + currentLocale, + brand, +}) => { + let typeName; + if (entityType) { + typeName = formatMessage( + phoneSourceNames.getString(entityType, currentLocale), + { brand } + ); + } + if (phoneNumber && entityName && entityType) { + return `${entityName} | ${typeName} ${phoneNumber}`; + } else if (entityName && entityType) { + return `${entityName} | ${typeName}`; + } else if (entityName) { + return entityName; + } else if (phoneNumber) { + return `${phoneNumber}`; + } + return ''; +}; + +function ContactDisplayItem({ + entityName, + entityType, + phoneNumber, + sourceIcons +}) { + let SourceIcon = null; + if (entityType) { + if (entityType === phoneSources.rcContact) { + SourceIcon = sourceIcons.brandIcon; + } else { + SourceIcon = sourceIcons[entityType]; + } + } + if (phoneNumber && entityName !== undefined && SourceIcon) { + return ( + + + {entityName} + + ); + } else if (entityName !== undefined && SourceIcon) { + return ( + + + {entityName} + + ); + } else if (entityName !== undefined) { + return {entityName}; + } else if (phoneNumber) { + return {phoneNumber}; + } + return null; +} + +ContactDisplayItem.propTypes = { + entityName: PropTypes.string.isRequired, + entityType: PropTypes.string.isRequired, + phoneNumber: PropTypes.string.isRequired, + sourceIcons: PropTypes.object.isRequired, +}; + +export default function ContactDisplay({ + reference, + className, + contactMatches, + selected, + onSelectContact, + disabled, + isLogging, + fallBackName, + enableContactFallback, + areaCode, + countryCode, + phoneNumber, + currentLocale, + groupNumbers, + showType, + selectClassName, + showPlaceholder, + brand, + stopPropagation, + sourceIcons = {}, + showGroupNumberName, +}) { + let contentEl; + if (groupNumbers && showGroupNumberName) { + const groupNames = groupNumbers.map((groupNumber) => { + const groupContact = contactMatches.find(match => match.extensionNumber === groupNumber); + return (groupContact && groupContact.name) || groupNumber; + }); + const display = groupNames.join(', '); + contentEl = ( +
+ {display} +
+ ); + } else if (groupNumbers) { + const display = groupNumbers.join(', '); + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length === 0) { + const display = (enableContactFallback && fallBackName) || + (phoneNumber && formatNumber({ + phoneNumber, + countryCode, + areaCode, + })) || + i18n.getString('unknownNumber', currentLocale); + const title = (enableContactFallback && fallBackName) || + phoneNumber || ''; + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length === 1) { + const display = contactMatches[0].name; + const title = displayFormatter({ + entityName: display, + entityType: contactMatches[0].entityType, + phoneNumber, + brand, + currentLocale + }); + contentEl = ( +
+ {display} +
+ ); + } else if (contactMatches.length > 1) { + const options = [ + ...contactMatches, + ]; + let placeholder; + let _selected = selected; + if (showPlaceholder) { + placeholder = i18n.getString('select', currentLocale); + } else { + _selected = _selected < 0 ? 0 : _selected; + } + contentEl = ( + ( + ContactDisplayItem({ + entityName: entity.name, + entityType: entity.entityType, + brand, + currentLocale, + sourceIcons + }) + )} + renderValue={value => ( + displayFormatter({ + entityName: options[value].name, + entityType: showType && options[value].entityType, + brand, + currentLocale, + }) + )} + renderTitle={entity => ( + entity ? displayFormatter({ + entityName: entity.name, + entityType: entity.entityType, + phoneNumber, + brand, + currentLocale, + }) : phoneNumber) + } + dropdownAlign="left" + titleEnabled + noPadding + stopPropagation={stopPropagation} + /> + ); + } + return ( +
+ {contentEl} +
+ ); +} +ContactDisplay.propTypes = { + reference: PropTypes.func, + className: PropTypes.string, + contactMatches: PropTypes.arrayOf(PropTypes.any).isRequired, + selected: PropTypes.number.isRequired, + onSelectContact: PropTypes.func, + disabled: PropTypes.bool.isRequired, + isLogging: PropTypes.bool.isRequired, + fallBackName: PropTypes.string, + enableContactFallback: PropTypes.bool, + areaCode: PropTypes.string.isRequired, + countryCode: PropTypes.string.isRequired, + phoneNumber: PropTypes.string, + currentLocale: PropTypes.string.isRequired, + groupNumbers: PropTypes.arrayOf(PropTypes.string), + showType: PropTypes.bool, + selectClassName: PropTypes.string, + showPlaceholder: PropTypes.bool, + brand: PropTypes.string, + stopPropagation: PropTypes.bool, + sourceIcons: PropTypes.object, + showGroupNumberName: PropTypes.bool, +}; +ContactDisplay.defaultProps = { + reference: undefined, + className: undefined, + onSelectContact: undefined, + fallBackName: '', + phoneNumber: undefined, + groupNumbers: undefined, + enableContactFallback: undefined, + showType: true, + selectClassName: undefined, + showPlaceholder: true, + brand: undefined, + stopPropagation: true, + sourceIcons: undefined, + showGroupNumberName: false, +}; From 4435a831b112306d54417c8429fe9dcc00c5d92a Mon Sep 17 00:00:00 2001 From: Jack Tzu-Chieh Huang Date: Tue, 3 Apr 2018 12:35:27 +0800 Subject: [PATCH 06/14] enable falling back to rc caller/callee name display if no contact match was found (#866) --- src/containers/ActiveCallsPage/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/containers/ActiveCallsPage/index.js b/src/containers/ActiveCallsPage/index.js index 69a32c8453..76f7a22e04 100644 --- a/src/containers/ActiveCallsPage/index.js +++ b/src/containers/ActiveCallsPage/index.js @@ -14,6 +14,7 @@ function mapToProps(_, { rolesAndPermissions, }, showContactDisplayPlaceholder = false, + enableContactFallback = false, }) { return { currentLocale: locale.currentLocale, @@ -35,6 +36,7 @@ function mapToProps(_, { brand: brand.fullName, showContactDisplayPlaceholder, autoLog: !!(callLogger && callLogger.autoLog), + enableContactFallback, }; } From b46ec475a60abd1d5e3dcd80ed5453171cec2699 Mon Sep 17 00:00:00 2001 From: Jack Tzu-Chieh Huang Date: Tue, 3 Apr 2018 12:35:47 +0800 Subject: [PATCH 07/14] fix bug where when editing message text in compose text page, the cursor will always be force to the end of text (#869) --- src/components/ComposeTextPanel/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/ComposeTextPanel/index.js b/src/components/ComposeTextPanel/index.js index 6e1e9a4cab..3a82a4ebd6 100644 --- a/src/components/ComposeTextPanel/index.js +++ b/src/components/ComposeTextPanel/index.js @@ -12,6 +12,9 @@ import FromField from '../FromField'; class ComposeTextPanel extends Component { constructor(props) { super(props); + this.state = { + messageText: props.messageText, + }; this.onSenderChange = (value) => { this.props.updateSenderNumber(value); @@ -35,6 +38,9 @@ class ComposeTextPanel extends Component { this.onTextChange = (e) => { const value = e.currentTarget.value; + this.setState({ + messageText: value, + }); this.props.updateMessageText(value); }; @@ -51,6 +57,13 @@ class ComposeTextPanel extends Component { console.debug('send message ...'); }; } + componentWillReceiveProps(nextProps) { + if (nextProps.messageText !== this.state.messageText) { + this.setState({ + messageText: nextProps.messageText, + }); + } + } hasSenderNumbers() { return this.props.senderNumbers.length > 0; @@ -106,7 +119,7 @@ class ComposeTextPanel extends Component {