Merge branch 'next' into phone
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"290.prod.js","mappings":"uMASA,MAAMA,UAA6BC,IAAAA,cACjCC,YAAYC,GACVC,MAAMD,GAENE,KAAKC,UAAY,GACjB,MAAM,qBAACC,GAAwBJ,EAAMK,KACrCC,EAAAA,SAAuBC,IACrBL,KAAKC,UAAUK,KAAK,CAClBC,KAAMF,EAAGE,KACTC,KAAMH,EAAGG,KACTC,MAAMC,EAAAA,EAAAA,IAAUL,EAAGG,MACnBG,KAAMT,EAAqBG,EAAGG,KAAM,CAACI,KAAM,YAC3C,IAGJZ,KAAKC,UAAUY,MAAK,CAACC,EAAGC,IAAMD,EAAEH,KAAKK,cAAcD,EAAEJ,QAErDX,KAAKiB,YAAcjB,KAAKiB,YAAYC,KAAKlB,KAC3C,CAEAiB,YAAYE,GACVA,EAAEC,iBACFpB,KAAKF,MAAMuB,SAASF,EAAEG,OAAOC,QAAQf,KAAMW,EAAEG,OAAOC,QAAQhB,KAC9D,CAEAiB,SACE,MAAMvB,EAAY,GACZwB,EAAWzB,KAAKF,MAAM2B,UAAY,KAQxC,OAPAzB,KAAKC,UAAUyB,SAAQC,IACrB,MAAMC,EAASD,EAAEnB,MAAQiB,EAAW,YAAc,GAClDxB,EAAUK,KAAK,wBAAIuB,UAAWD,EAAOE,IAAKC,IAAK,YAAWJ,EAAEnB,KAAM,YAAWmB,EAAEpB,KAAMyB,QAAShC,KAAKiB,aACjG,0BAAOY,UAAU,gBAAgBF,EAAElB,MAAY,IAAOkB,EAAEhB,KAAK,IAAM,0BAAMkB,UAAU,aAAY,IAAEF,EAAEpB,OAC/F,IAIN,yBAAKsB,UAAU,oBACb,wBAAIA,UAAU,0BACX5B,GAIT,EAGF,SAAegC,EAAAA,EAAAA,YAAWtC,E","sources":["webpack://tinode-webapp/./src/widgets/phone-country-selector.jsx"],"sourcesContent":["// Selector for country dialing code.\n\nimport React from 'react';\nimport { injectIntl } from 'react-intl';\n\nimport * as dcodes from '../dcodes.json';\n\nimport { flagEmoji } from '../lib/strformat';\n\nclass PhoneCountrySelector extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.countries = [];\n const {formattedDisplayName} = props.intl;\n dcodes.default.forEach(dc => {\n this.countries.push({\n dial: dc.dial,\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formattedDisplayName(dc.code, {type: 'region'})\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n\n this.handleClick = this.handleClick.bind(this);\n }\n\n handleClick(e) {\n e.preventDefault();\n this.props.onSubmit(e.target.dataset.code, e.target.dataset.dial);\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach(c => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx} data-code={c.code} data-dial={c.dial} onClick={this.handleClick}>\n <span className=\"country-flag\">{c.flag}</span> {c.name} <span className=\"dial-code\">+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\">\n <ul className=\"phone-country-selector\">\n {countries}\n </ul>\n </div>\n );\n }\n}\n\nexport default injectIntl(PhoneCountrySelector);\n"],"names":["PhoneCountrySelector","React","constructor","props","super","this","countries","formattedDisplayName","intl","dcodes","dc","push","dial","code","flag","flagEmoji","name","type","sort","a","b","localeCompare","handleClick","bind","e","preventDefault","onSubmit","target","dataset","render","selected","forEach","c","style","className","key","idx","onClick","injectIntl"],"sourceRoot":""}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"78.prod.js","mappings":"uNAUA,MAAMA,UAAkBC,IAAAA,cACtBC,YAAYC,GACVC,MAAMD,GAENE,KAAKC,QAAU,CAAC,EAChBC,EAAAA,SAAuBC,IAAQH,KAAKC,QAAQE,EAAGC,MAAQD,EAAGE,IAAI,IAE9DL,KAAKM,MAAQ,CACXC,YAAaT,EAAMS,aA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AKY,eAC3D8B,UAAQ,EAACC,UAAW3C,KAAKF,MAAM6C,YAGzC,EAGF,SAAeC,EAAAA,EAAAA,YAAWjD,E","sources":["webpack://tinode-webapp/./src/widgets/phone-edit.jsx"],"sourcesContent":["// Editor for a phone number.\n\nimport React from 'react';\nimport { injectIntl } from 'react-intl';\nimport { getExampleNumber, parsePhoneNumber } from 'libphonenumber-js/mobile';\nimport examples from 'libphonenumber-js/mobile/examples'\n\nimport * as dcodes from '../dcodes.json';\nimport { flagEmoji } from '../lib/strformat';\n\nclass PhoneEdit extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.codeMap = {};\n dcodes.default.forEach(dc => { this.codeMap[dc.code] = dc.dial; });\n\n this.state = {\n countryCode: props.countryCode || 'US',\n dialCode: this.codeMap[props.countryCode || 'US'],\n localNumber: ''\n };\n\n this.handleChange = this.handleChange.bind(this);\n this.handleFinished = this.handleFinished.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.showCountrySelector = this.showCountrySelector.bind(this);\n this.placholderNumber = this.placholderNumber.bind(this);\n }\n\n handleChange(e) {\n this.setState({localNumber: this.filterNumber(e.target.value)});\n }\n\n handleFinished(e) {\n // this.setCustomValidity(\"Mobile phone number required\");\n e.preventDefault();\n const number = `${this.state.dialCode}${this.state.localNumber.trim()}`.replace(/[^\\d]/g, '')\n this.props.onSubmit(`+${number}`);\n }\n\n\n handleKeyDown(e) {\n if (e.key === 'Enter') {\n this.handleFinished(e);\n }\n }\n\n showCountrySelector() {\n this.props.onShowCountrySelector(this.state.countryCode, this.state.dialCode);\n }\n\n // Filter out characters not permitted in a phone number.\n filterNumber(number) {\n if (!number) {\n return number;\n }\n // Leave numbers, space, (, ), -, and .\n // The + is not allowed: it's handled by the country code portion.\n return number.replace(/[^-\\s().\\d]/g, '');\n }\n\n placholderNumber() {\n const phoneNumber = getExampleNumber(this.state.countryCode, examples)\n // TODO: strip calling code from number.\n this.setState({placeholder: phoneNumber.formatNational()});\n }\n\n render() {\n return (\n <>\n <span className=\"dial-code\" onClick={this.showCountrySelector}>\n <span className=\"country-flag\">{flagEmoji(this.state.countryCode)} </span>\n +{this.state.dialCode} </span>\n <input type=\"tel\" placeholder={this.state.placeholder}\n value={this.state.localNumber} onChange={this.handleChange}\n maxLength={17} onKeyDown={this.handleKeyDown} onBlur={this.handleFinished}\n required autoFocus={this.props.autoFocus} />\n </>\n );\n }\n}\n\nexport default injectIntl(PhoneEdit);\n"],"names":["PhoneEdit","React","constructor","props","super","this","codeMap","dcodes","dc","code","dial","state","countryCode","dialCode","localNumber","handleChange","bind","handleFinished","handleKeyDown","showCountrySelector","placholderNumber","e","setState","filterNumber","target","value","preventDefault","number","trim","replace","onSubmit","key","onShowCountrySelector","phoneNumber","getExampleNumber","examples","placeholder","formatNational","render","className","onClick","flagEmoji","type","onChange","maxLength","onKeyDown","onBlur","required","autoFocus","injectIntl"],"sourceRoot":""}
|
||||
+34
-18
@@ -3580,7 +3580,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "PACKAGE_VERSION": () => (/* binding */ PACKAGE_VERSION)
|
||||
/* harmony export */ });
|
||||
const PACKAGE_VERSION = "0.21.0-rc1";
|
||||
const PACKAGE_VERSION = "0.21.0-rc2";
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -9898,7 +9898,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
|
||||
class Alert extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComponent) {
|
||||
render() {
|
||||
react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "alert-container"
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "alert"
|
||||
@@ -10858,6 +10858,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
super(props);
|
||||
this.state = {
|
||||
localStream: undefined,
|
||||
remoteStream: undefined,
|
||||
pc: undefined,
|
||||
dataChannel: undefined,
|
||||
previousOnInfo: undefined,
|
||||
@@ -10895,6 +10896,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
this.reportError = this.reportError.bind(this);
|
||||
this.handleGetUserMediaError = this.handleGetUserMediaError.bind(this);
|
||||
this.stopTracks = this.stopTracks.bind(this);
|
||||
this.disconnectMedia = this.disconnectMedia.bind(this);
|
||||
this.handleCloseClick = this.handleCloseClick.bind(this);
|
||||
this.handleToggleCameraClick = this.handleToggleCameraClick.bind(this);
|
||||
this.handleToggleMicClick = this.handleToggleMicClick.bind(this);
|
||||
@@ -10928,7 +10930,8 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
const stream = this.state.localStream;
|
||||
stream.getTracks().forEach(track => {
|
||||
pc.addTrack(track, stream);
|
||||
if (track.kind == 'video' && !this.localStreamConstraints.video) {
|
||||
if (track.kind == 'video' && this.state.audioOnly) {
|
||||
track.enabled = false;
|
||||
track.stop();
|
||||
stream.removeTrack(track);
|
||||
}
|
||||
@@ -11002,8 +11005,10 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
CALL_ENDED_SOUND.currentTime = 0;
|
||||
RING_SOUND.pause();
|
||||
RING_SOUND.currentTime = 0;
|
||||
this.stopTracks(this.localRef.current);
|
||||
this.stopTracks(this.remoteRef.current);
|
||||
this.stopTracks(this.state.localStream);
|
||||
this.stopTracks(this.state.remoteStream);
|
||||
this.disconnectMedia(this.localRef.current);
|
||||
this.disconnectMedia(this.remoteRef.current);
|
||||
if (this.state.pc) {
|
||||
this.state.pc.ontrack = null;
|
||||
this.state.pc.onremovetrack = null;
|
||||
@@ -11025,11 +11030,14 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
waitingForPeer: false
|
||||
});
|
||||
}
|
||||
stopTracks(el) {
|
||||
disconnectMedia(el) {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
let stream = el.srcObject;
|
||||
el.srcObject = null;
|
||||
el.src = '';
|
||||
}
|
||||
stopTracks(stream) {
|
||||
if (!stream) {
|
||||
return;
|
||||
}
|
||||
@@ -11040,8 +11048,6 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
track.enabled = false;
|
||||
});
|
||||
}
|
||||
el.srcObject = null;
|
||||
el.src = '';
|
||||
}
|
||||
handleDataChannelError(error) {
|
||||
console.error('data channel error', error);
|
||||
@@ -11051,11 +11057,15 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
case VIDEO_MUTED_EVENT:
|
||||
this.setState({
|
||||
remoteVideoLive: false
|
||||
}, _ => {
|
||||
this.remoteRef.current.srcObject = this.state.remoteStream;
|
||||
});
|
||||
break;
|
||||
case VIDEO_UNMUTED_EVENT:
|
||||
this.setState({
|
||||
remoteVideoLive: true
|
||||
}, _ => {
|
||||
this.remoteRef.current.srcObject = this.state.remoteStream;
|
||||
});
|
||||
break;
|
||||
default:
|
||||
@@ -11163,7 +11173,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
this.remoteIceCandidatesCache = [];
|
||||
}
|
||||
handleICEConnectionStateChangeEvent(event) {
|
||||
switch (this.state.pc.iceConnectionState) {
|
||||
switch (event.target.iceConnectionState) {
|
||||
case 'closed':
|
||||
case 'failed':
|
||||
this.handleCloseClick();
|
||||
@@ -11178,7 +11188,9 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
handleICEGatheringStateChangeEvent(event) {}
|
||||
handleTrackEvent(event) {
|
||||
this.remoteRef.current.srcObject = event.streams[0];
|
||||
this.forceUpdate();
|
||||
this.setState({
|
||||
remoteStream: event.streams[0]
|
||||
});
|
||||
}
|
||||
handleGetUserMediaError(e) {
|
||||
console.error("Error opening camera and/or microphone", e);
|
||||
@@ -11216,6 +11228,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
pc.addTrack(track, localStream);
|
||||
});
|
||||
if (dummyVideo) {
|
||||
dummyVideo.enabled = false;
|
||||
dummyVideo.stop();
|
||||
stream.removeTrack(dummyVideo);
|
||||
}
|
||||
@@ -11318,12 +11331,12 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
const videoIcon = videoTracks && videoTracks[0] && videoTracks[0].enabled && videoTracks[0].readyState == 'live' ? 'videocam' : 'videocam_off';
|
||||
const peerTitle = (0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_5__.clipStr)(this.props.title, _config_js__WEBPACK_IMPORTED_MODULE_3__.MAX_PEER_TITLE_LENGTH);
|
||||
const pulseAnimation = this.state.waitingForPeer ? ' pulse' : '';
|
||||
let removeActive = false;
|
||||
let remoteActive = false;
|
||||
if (this.remoteRef.current && this.remoteRef.current.srcObject && this.state.remoteVideoLive) {
|
||||
const rstream = this.remoteRef.current.srcObject;
|
||||
if (rstream.getVideoTracks().length > 0) {
|
||||
const t = rstream.getVideoTracks()[0];
|
||||
removeActive = t.enabled && t.readyState == 'live';
|
||||
remoteActive = t.enabled && t.readyState == 'live';
|
||||
}
|
||||
}
|
||||
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
@@ -11348,14 +11361,17 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
}]
|
||||
}))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "call-party peer",
|
||||
disabled: !removeActive
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("video", {
|
||||
disabled: !remoteActive
|
||||
}, remoteActive ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("video", {
|
||||
ref: this.remoteRef,
|
||||
autoPlay: true,
|
||||
playsInline: true
|
||||
}), removeActive ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "caller-name inactive"
|
||||
}, peerTitle) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
}, peerTitle)) : react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("audio", {
|
||||
ref: this.remoteRef,
|
||||
autoPlay: true
|
||||
}), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: `caller-card${pulseAnimation}`
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "avatar-box"
|
||||
@@ -11366,7 +11382,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
||||
title: this.props.title
|
||||
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "caller-name"
|
||||
}, peerTitle)))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
}, peerTitle))))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
||||
className: "controls"
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
||||
className: "danger",
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"src_widgets_phone-country-selector_jsx.dev.js","mappings":";;;;;;;;;;;;;;;;;;;AAE0B;AACc;AAEC;AAEI;AAE7C,MAAMI,oBAAoB,SAASJ,4DAAmB,CAA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AAI,SAAS,EAAEoB,KAAM;QAAC,GAAG,EAAEC,GAAI;QAAC,aAAWF,CAAC,CAACjB,IAAK;QAAC,aAAWiB,CAAC,CAAClB,IAAK;QAAC,OAAO,EAAE,IAAI,CAACS;MAAY,GAC7G;QAAO,SAAS,EAAC;MAAc,GAAES,CAAC,CAAChB,IAAI,CAAQ,QAAM,EAACgB,CAAC,CAACf,IAAI,EAAC,MAAM;QAAM,SAAS,EAAC;MAAW,GAAC,GAAC,EAACe,CAAC,CAAClB,IAAI,CAAQ,CAC5G,CAAC;IACR,CAAC,CAAC;IAEF,OACE;MAAK,SAAS,EAAC;IAAkB,GAC/B;MAAI,SAAS,EAAC;IAAwB,GACnCP,SAAS,CACP,CACD;EAEV;AACF;AAEA,iEAAeP,sDAAU,CAACG,oBAAoB,CAAC","sources":["webpack://tinode-webapp/./src/widgets/phone-country-selector.jsx"],"sourcesContent":["// Selector for country dialing code.\n\nimport React from 'react';\nimport { injectIntl } from 'react-intl';\n\nimport * as dcodes from '../dcodes.json';\n\nimport { flagEmoji } from '../lib/strformat';\n\nclass PhoneCountrySelector extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.countries = [];\n const {formattedDisplayName} = props.intl;\n dcodes.default.forEach(dc => {\n this.countries.push({\n dial: dc.dial,\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formattedDisplayName(dc.code, {type: 'region'})\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n\n this.handleClick = this.handleClick.bind(this);\n }\n\n handleClick(e) {\n e.preventDefault();\n this.props.onSubmit(e.target.dataset.code, e.target.dataset.dial);\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach(c => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx} data-code={c.code} data-dial={c.dial} onClick={this.handleClick}>\n <span className=\"country-flag\">{c.flag}</span> {c.name} <span className=\"dial-code\">+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\">\n <ul className=\"phone-country-selector\">\n {countries}\n </ul>\n </div>\n );\n }\n}\n\nexport default injectIntl(PhoneCountrySelector);\n"],"names":["React","injectIntl","dcodes","flagEmoji","PhoneCountrySelector","PureComponent","constructor","props","countries","formattedDisplayName","intl","default","forEach","dc","push","dial","code","flag","name","type","sort","a","b","localeCompare","handleClick","bind","e","preventDefault","onSubmit","target","dataset","render","selected","c","style","idx"],"sourceRoot":""}
|
||||
+2175
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user