merge devel

This commit is contained in:
or-else
2025-08-10 12:15:14 +03:00
56 changed files with 4510 additions and 2254 deletions
+1
View File
@@ -46,6 +46,7 @@ The app is currently available in the following languages:
* Chinese traditional
* French
* German
* Italian
* Korean
* Romanian
* Russian
+10
View File
@@ -1920,6 +1920,7 @@ img.channel {
background-color: var(--clr-overlay-white-strong);
}
#image-preview-caption-panel {
display: flex;
justify-content: space-between;
@@ -1968,6 +1969,15 @@ img.channel {
font-size: 6rem;
}
#image-preview-container .doc-card {
display: flex;
flex-direction: column;
overflow-x: hidden;
background-color: #ccc;
padding: 1rem;
border-radius: 0.5rem;
}
/* Video-call related styles */
#video-container {
+1 -1
View File
File diff suppressed because one or more lines are too long
+2029 -1972
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -1,7 +1,7 @@
{
"name": "tinode-webapp",
"description": "Tinode messenger for the web",
"version": "0.24.0",
"version": "0.25.0",
"repository": {
"type": "git",
"url": "git+https://github.com/tinode/webapp.git"
@@ -51,6 +51,7 @@
"en",
"es",
"fr",
"it",
"ko",
"ro",
"ru",
@@ -74,7 +75,7 @@
"react": "^18.3.0",
"react-dom": "^18.3.0",
"react-intl": "^7.0.0",
"tinode-sdk": "^0.24.0",
"tinode-sdk": "^0.24.4",
"webm-duration-fix": "^1.0.4"
},
"devDependencies": {
@@ -82,13 +83,13 @@
"@babel/preset-env": "^7.22.10",
"@babel/preset-react": "^7.22.5",
"@formatjs/cli": "^6.1.3",
"babel-loader": "^9.1.3",
"babel-loader": "^10.0.0",
"babel-plugin-formatjs": "^10.5.3",
"browserslist": "^4.21.10",
"copy-webpack-plugin": "^12.0.0",
"copy-webpack-plugin": "^13.0.0",
"cssnano": "^7.0.6",
"glob": "^11.0.0",
"jest": "^29.7.0",
"jest": "^30.0.0",
"postcss": "^8.4.27",
"postcss-cli": "^11.0.0",
"webpack": "^5.88.2",
+4
View File
@@ -26,6 +26,10 @@ const i18n = {
'new_message': "Nuevo mensaje",
'new_chat': "Nueva conversación",
},
'it': {
'new_message': "Nuovo Messaggio",
'new_chat': "Nuova Chat",
},
'ko': {
'new_message': "새로운 메시지",
'new_chat': "새로운 채팅",
+2
View File
@@ -155,3 +155,5 @@ export const DEFAULT_COLOR_SCHEME = 'light dark';
// Default text size in points.
export const DEFAULT_TEXT_SIZE = 10;
// MIME type for the legacy Drafty form-response data.
export const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json'; // Remove in 2026.
File diff suppressed because one or more lines are too long
+1791
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -10,8 +10,8 @@ import InlineVideo from '../widgets/inline-video.jsx';
import LazyImage from '../widgets/lazy-image.jsx'
import UploadingImage from '../widgets/uploading-image.jsx'
import { BROKEN_IMAGE_SIZE, CLICKABLE_URL_SCHEMES, IMAGE_THUMBNAIL_DIM, NO_DIMENSIONS_VIDEO, REM_SIZE,
VIDEO_THUMBNAIL_WIDTH } from '../config.js';
import { BROKEN_IMAGE_SIZE, CLICKABLE_URL_SCHEMES, IMAGE_THUMBNAIL_DIM, NO_DIMENSIONS_VIDEO,
REM_SIZE, VIDEO_THUMBNAIL_WIDTH } from '../config.js';
import { base64ToBlob, blobToBase64, fitImageSize, imageScaled } from './blob-helpers.js';
import { idToColorClass, secondsToTime, shortenFileName } from './strformat.js';
import { cancelablePromise, sanitizeUrl, sanitizeUrlForMime } from './utils.js';
@@ -304,7 +304,7 @@ export function previewFormatter(style, data, values, key) {
break;
case 'EX':
if (data) {
if (data.mime == 'application/json') {
if (Drafty.isFormResponseType(data.mime)) {
// Ignore JSON attachments: they are form response payloads.
return null;
}
@@ -426,7 +426,7 @@ function quoteFormatter(style, data, values, key) {
case 'EX':
let fname;
if (data) {
if (data.mime == 'application/json') {
if (Drafty.isFormResponseType(data.mime)) {
// Ignore JSON attachments: they are form response payloads.
return null;
}
+154
View File
@@ -0,0 +1,154 @@
import {
shortDateFormat,
relativeDateFormat,
secondsToTime,
bytesToHumanSize,
shortenFileName,
idToColorClass,
flagEmoji
} from './strformat.js';
describe('shortDateFormat', () => {
jest
.useFakeTimers()
.setSystemTime(new Date('2025-07-25T12:30:00Z'));
test('should format for same day', () => {
const then = new Date('2025-07-25T10:15:00');
// Note: output depends on the test runner's locale and timezone.
// Assuming a locale where the format is HH:mm.
expect(shortDateFormat(then, 'en-US')).toMatch(/10:15/);
});
test('should format for same year, different day', () => {
const then = new Date('2025-06-20T10:15:00');
expect(shortDateFormat(then, 'en-US')).toMatch(/Jun 20, 10:15/);
});
test('should format for different year', () => {
const then = new Date('2024-07-25T10:15:00');
expect(shortDateFormat(then, 'en-US')).toBe('Jul 25, 2024');
});
});
describe('relativeDateFormat', () => {
// Mock current date to a fixed point for consistent testing.
jest
.useFakeTimers()
.setSystemTime(new Date('2025-07-25T12:30:00Z'));
test('should format for today', () => {
const then = new Date('2025-07-25T10:00:00Z');
expect(relativeDateFormat(then, 'en-US')).toBe('today');
});
test('should format for yesterday', () => {
const then = new Date('2025-07-24T10:00:00Z');
expect(relativeDateFormat(then, 'en-US')).toBe('yesterday');
});
test('should format for a past date', () => {
const then = new Date('2025-07-20T10:00:00Z');
expect(relativeDateFormat(then, 'en-US')).toBe('7/20/2025');
});
test('should format for tomorrow', () => {
const then = new Date('2025-07-26T10:00:00Z');
expect(relativeDateFormat(then, 'en-US')).toBe('tomorrow');
});
});
describe('secondsToTime', () => {
test('should format seconds only', () => {
expect(secondsToTime(45)).toBe('0:45');
});
test('should format minutes and seconds', () => {
expect(secondsToTime(156)).toBe('2:36');
});
test('should format hours, minutes, and seconds', () => {
expect(secondsToTime(3756)).toBe('1:02:36');
});
test('should format with fixed minutes', () => {
expect(secondsToTime(3726, true)).toBe('1:02:06');
expect(secondsToTime(126, true)).toBe('02:06');
});
test('should handle non-number input', () => {
expect(secondsToTime('abc')).toBe('');
});
});
describe('bytesToHumanSize', () => {
test('should format 0 bytes', () => {
expect(bytesToHumanSize(0)).toBe('0 Bytes');
});
test('should format bytes', () => {
expect(bytesToHumanSize(500)).toBe('500 Bytes');
});
test('should format kilobytes', () => {
expect(bytesToHumanSize(1500)).toBe('1.46 KB');
});
test('should format megabytes', () => {
expect(bytesToHumanSize(1500000)).toBe('1.43 MB');
});
test('should format gigabytes', () => {
expect(bytesToHumanSize(1500000000)).toBe('1.40 GB');
});
});
describe('shortenFileName', () => {
test('should not shorten if not needed', () => {
expect(shortenFileName('shortname.txt', 20)).toBe('shortname.txt');
});
test('should shorten a long file name', () => {
const longName = 'this_is_a_very_long_file_name_that_needs_shortening.txt';
expect(shortenFileName(longName, 20)).toBe('this_is_a…ening.txt');
expect(shortenFileName(longName, 20).length).toBeLessThanOrEqual(20);
});
test('should handle non-string input', () => {
expect(shortenFileName(null, 20)).toBeNull();
expect(shortenFileName(undefined, 20)).toBeUndefined();
});
});
describe('idToColorClass', () => {
test('should generate light background color class', () => {
expect(idToColorClass('usr123', true, false)).toMatch(/lt-bg-\d+/);
});
test('should generate dark background color class', () => {
expect(idToColorClass('usr123', false, false)).toMatch(/dk-bg-\d+/);
});
test('should generate light foreground color class', () => {
expect(idToColorClass('usr123', true, true)).toMatch(/lt-fg-\d+/);
});
test('should generate dark foreground color class', () => {
expect(idToColorClass('usr123', false, true)).toMatch(/dk-fg-\d+/);
});
test('should be deterministic', () => {
expect(idToColorClass('usr123', true, false)).toBe('lt-bg-2');
expect(idToColorClass('grpABC', false, true)).toBe('dk-fg-3');
});
});
describe('flagEmoji', () => {
test('should convert country code to flag', () => {
expect(flagEmoji('US')).toBe('🇺🇸');
});
test('should handle lowercase country code', () => {
expect(flagEmoji('jp')).toBe('🇯🇵');
});
});
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit.
export const PACKAGE_VERSION = "0.24.0";
export const PACKAGE_VERSION = "0.25.0";
+9 -4
View File
@@ -22,8 +22,8 @@ import SendMessage from '../widgets/send-message.jsx';
import VideoPreview from '../widgets/video-preview.jsx';
import { DEFAULT_P2P_ACCESS_MODE, EDIT_PREVIEW_LENGTH, IMAGE_PREVIEW_DIM, IMMEDIATE_P2P_SUBSCRIPTION,
KEYPRESS_DELAY, MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM, MAX_INBAND_ATTACHMENT_SIZE,
READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js';
DRAFTY_FR_MIME_TYPE_LEGACY, KEYPRESS_DELAY, MESSAGES_PAGE, MAX_EXTERN_ATTACHMENT_SIZE, MAX_IMAGE_DIM,
MAX_INBAND_ATTACHMENT_SIZE, READ_DELAY, QUOTED_REPLY_LENGTH, VIDEO_PREVIEW_DIM } from '../config.js';
import { CALL_STATE_OUTGOING_INITATED, CALL_STATE_IN_PROGRESS } from '../constants.js';
import { blobToBase64, fileToBase64, imageScaled, makeImageUrl } from '../lib/blob-helpers.js';
import HashNavigation from '../lib/navigation.js';
@@ -1022,6 +1022,11 @@ class MessagesView extends React.Component {
const maxInbandAttachmentSize = (this.props.tinode.getServerParam('maxMessageSize',
MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024) | 0;
// If the attachment is a JSON file, then use 'application/octet-stream' instead of 'application/json'.
// This is a temporary workaround for the collision with the 'application/json' MIME type of form responses.
// Remove this code in 2026 or so.
const jsonMimeConverter = (fileType) => fileType === DRAFTY_FR_MIME_TYPE_LEGACY ? 'application/octet-stream' : fileType;
if (file.size > maxInbandAttachmentSize) {
// Too large to send inband - uploading out of band and sending as a link.
const uploader = this.props.tinode.getLargeFileHelper();
@@ -1031,7 +1036,7 @@ class MessagesView extends React.Component {
}
const uploadCompletionPromise = uploader.upload(file);
const msg = Drafty.attachFile(null, {
mime: file.type,
mime: jsonMimeConverter(file.type),
filename: file.name,
size: file.size,
urlPromise: uploadCompletionPromise
@@ -1042,7 +1047,7 @@ class MessagesView extends React.Component {
// Small enough to send inband.
fileToBase64(file)
.then(b64 => this.sendMessage(Drafty.attachFile(null, {
mime: b64.mime,
mime: jsonMimeConverter(b64.mime),
data: b64.bits,
filename: b64.name,
size: file.size
+2 -2
View File
@@ -162,8 +162,8 @@ class BaseChatMessage extends React.PureComponent {
const attachments = [];
if (this.props.mimeType == Drafty.getContentType() && Drafty.isValid(content)) {
Drafty.attachments(content, (att, i) => {
if (att.mime == 'application/json') {
// Don't show json objects as attachments.
if (Drafty.isFormResponseType(att.mime)) {
// Don't show json drafty form response objects as attachments.
// They are not meant for users.
return;
}
+1 -1
View File
@@ -51,7 +51,7 @@ export default class DocPreview extends React.PureComponent {
<a href="#" onClick={(e) => {e.preventDefault(); this.props.onClose();}}><i className="material-icons gray">close</i></a>
</div>
<div id="image-preview-container">
<div className="flex-column narrow">
<div className="doc-card">
<i className="material-icons gray">{iconFromMime(this.props.content.type)}</i>
<div><b><FormattedMessage id="label_file_name" defaultMessage="File name:"
description="Label for a file name" /></b> {shortenFileName(this.props.content.name, 24) || '-'}</div>
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"316.prod.js","mappings":"qkNASA,MAAMA,UAA6BC,IAAAA,cACjCC,WAAAA,CAAYC,GACVC,MAAMD,GAENE,KAAKC,UAAY,GACjB,MAAM,kBAAEC,GAAsBJ,EAAMK,KACpCC,EAAeC,SAAQC,IACPA,EAAGC,KAAKC,MAAM,KACtBH,SAAQI,IACZT,KAAKC,UAAUS,KAAK,CAClBH,KAAME,EAAKE,OACXC,KAAMN,EAAGM,KACTC,MAAMC,EAAAA,EAAAA,IAAUR,EAAGM,MACnBG,KAAMb,EAAkBI,EAAGM,KAAM,CAACI,KAAM,YACxC,GACF,IAGJhB,KAAKC,UAAUgB,MAAK,CAACC,EAAGC,IAAMD,EAAEH,KAAKK,cAAcD,EAAEJ,OACvD,CAEAM,iBAAAA,GACMrB,KAAKsB,aACPtB,KAAKsB,YAAYC,eAAe,CAACC,MAAO,SAAUC,OAAQ,WAE9D,CAEAC,MAAAA,GACE,MAAMzB,EAAY,GACZ0B,EAAW3B,KAAKF,MAAM6B,UAAY,KAYxC,OAXA3B,KAAKC,UAAUI,SAAQ,CAACuB,EAAGC,KACzB,MAAMC,EAASF,EAAEhB,MAAQe,EAAW,YAAc,GAClD1B,EAAUS,KAAKd,IAAAA,cAAA,MAAImC,UAAWD,EAAOE,IAAKH,EACxCI,IAAKA,IAAYL,EAAEhB,MAAQe,IAAW3B,KAAKsB,YAAcW,EAAG,EAC5DC,QAASC,GAAKnC,KAAKF,MAAMsC,SAASR,EAAEhB,KAAMgB,EAAErB,OAC5CX,IAAAA,cAAA,QAAMmC,UAAU,gBAAgBH,EAAEf,MAClCjB,IAAAA,cAAA,QAAMmC,UAAU,WAAU,IAAOH,EAAEb,MACnCnB,IAAAA,cAAA,QAAMmC,UAAU,aAAY,KAAQH,EAAErB,OAClC,IAINX,IAAAA,cAAA,OAAKmC,UAAU,mBAAmBD,MAAO,CAACO,OAAQ,UAChDzC,IAAAA,cAAA,MAAImC,UAAU,0BACX9B,GAIT,EAGF,WAAeqC,EAAAA,EAAAA,YAAW3C,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 { formatDisplayName } = props.intl;\n dcodes.default.forEach(dc => {\n const parts = dc.dial.split(',');\n parts.forEach(part => {\n this.countries.push({\n dial: part.trim(),\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formatDisplayName(dc.code, {type: 'region'})\n });\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n componentDidMount() {\n if (this.selectedRef) {\n this.selectedRef.scrollIntoView({block: 'center', inline: 'nearest'});\n }\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach((c, idx) => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx}\n ref={ref => {if (c.code == selected) {this.selectedRef = ref}}}\n onClick={_ => this.props.onSubmit(c.code, c.dial)}>\n <span className=\"country-flag\">{c.flag}</span>\n <span className=\"country\">&nbsp;{c.name}</span>\n <span className=\"dial-code\">&nbsp;+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\" style={{height: '30rem'}}>\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","formatDisplayName","intl","dcodes","forEach","dc","dial","split","part","push","trim","code","flag","flagEmoji","name","type","sort","a","b","localeCompare","componentDidMount","selectedRef","scrollIntoView","block","inline","render","selected","c","idx","style","className","key","ref","onClick","_","onSubmit","height","injectIntl"],"sourceRoot":""}
{"version":3,"file":"316.prod.js","mappings":"qkNASA,MAAMA,UAA6BC,IAAAA,cACjCC,WAAAA,CAAYC,GACVC,MAAMD,GAENE,KAAKC,UAAY,GACjB,MAAM,kBAAEC,GAAsBJ,EAAMK,KACpCC,EAAeC,QAAQC,IACPA,EAAGC,KAAKC,MAAM,KACtBH,QAAQI,IACZT,KAAKC,UAAUS,KAAK,CAClBH,KAAME,EAAKE,OACXC,KAAMN,EAAGM,KACTC,MAAMC,EAAAA,EAAAA,IAAUR,EAAGM,MACnBG,KAAMb,EAAkBI,EAAGM,KAAM,CAACI,KAAM,iBAK9ChB,KAAKC,UAAUgB,KAAK,CAACC,EAAGC,IAAMD,EAAEH,KAAKK,cAAcD,EAAEJ,MACvD,CAEAM,iBAAAA,GACMrB,KAAKsB,aACPtB,KAAKsB,YAAYC,eAAe,CAACC,MAAO,SAAUC,OAAQ,WAE9D,CAEAC,MAAAA,GACE,MAAMzB,EAAY,GACZ0B,EAAW3B,KAAKF,MAAM6B,UAAY,KAYxC,OAXA3B,KAAKC,UAAUI,QAAQ,CAACuB,EAAGC,KACzB,MAAMC,EAASF,EAAEhB,MAAQe,EAAW,YAAc,GAClD1B,EAAUS,KAAKd,IAAAA,cAAA,MAAImC,UAAWD,EAAOE,IAAKH,EACxCI,IAAKA,IAAYL,EAAEhB,MAAQe,IAAW3B,KAAKsB,YAAcW,IACzDC,QAASC,GAAKnC,KAAKF,MAAMsC,SAASR,EAAEhB,KAAMgB,EAAErB,OAC5CX,IAAAA,cAAA,QAAMmC,UAAU,gBAAgBH,EAAEf,MAClCjB,IAAAA,cAAA,QAAMmC,UAAU,WAAU,IAAOH,EAAEb,MACnCnB,IAAAA,cAAA,QAAMmC,UAAU,aAAY,KAAQH,EAAErB,UAKxCX,IAAAA,cAAA,OAAKmC,UAAU,mBAAmBD,MAAO,CAACO,OAAQ,UAChDzC,IAAAA,cAAA,MAAImC,UAAU,0BACX9B,GAIT,EAGF,WAAeqC,EAAAA,EAAAA,YAAW3C,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 { formatDisplayName } = props.intl;\n dcodes.default.forEach(dc => {\n const parts = dc.dial.split(',');\n parts.forEach(part => {\n this.countries.push({\n dial: part.trim(),\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formatDisplayName(dc.code, {type: 'region'})\n });\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n componentDidMount() {\n if (this.selectedRef) {\n this.selectedRef.scrollIntoView({block: 'center', inline: 'nearest'});\n }\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach((c, idx) => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx}\n ref={ref => {if (c.code == selected) {this.selectedRef = ref}}}\n onClick={_ => this.props.onSubmit(c.code, c.dial)}>\n <span className=\"country-flag\">{c.flag}</span>\n <span className=\"country\">&nbsp;{c.name}</span>\n <span className=\"dial-code\">&nbsp;+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\" style={{height: '30rem'}}>\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","formatDisplayName","intl","dcodes","forEach","dc","dial","split","part","push","trim","code","flag","flagEmoji","name","type","sort","a","b","localeCompare","componentDidMount","selectedRef","scrollIntoView","block","inline","render","selected","c","idx","style","className","key","ref","onClick","_","onSubmit","height","injectIntl"],"sourceRoot":""}
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+227 -18
View File
@@ -97,7 +97,7 @@ function isVersionServiceProvider(provider) {
}
const name$q = "@firebase/app";
const version$1 = "0.11.5";
const version$1 = "0.13.2";
/**
* @license
@@ -163,12 +163,12 @@ const name$4 = "@firebase/storage-compat";
const name$3 = "@firebase/firestore";
const name$2 = "@firebase/vertexai";
const name$2 = "@firebase/ai";
const name$1 = "@firebase/firestore-compat";
const name = "firebase";
const version = "11.6.1";
const version = "11.10.0";
/**
* @license
@@ -505,7 +505,7 @@ class FirebaseServerAppImpl extends FirebaseAppImpl {
// Build configuration parameters for the FirebaseAppImpl base class.
const automaticDataCollectionEnabled = serverConfig.automaticDataCollectionEnabled !== undefined
? serverConfig.automaticDataCollectionEnabled
: false;
: true;
// Create the FirebaseAppSettings object for the FirebaseAppImp constructor.
const config = {
name,
@@ -616,7 +616,7 @@ function initializeApp(_options, rawConfig = {}) {
const name = rawConfig;
rawConfig = { name };
}
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: true }, rawConfig);
const name = config.name;
if (typeof name !== 'string' || !name) {
throw ERROR_FACTORY.create("bad-app-name" /* AppError.BAD_APP_NAME */, {
@@ -652,7 +652,7 @@ function initializeServerApp(_options, _serverAppConfig) {
throw ERROR_FACTORY.create("invalid-server-app-environment" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */);
}
if (_serverAppConfig.automaticDataCollectionEnabled === undefined) {
_serverAppConfig.automaticDataCollectionEnabled = false;
_serverAppConfig.automaticDataCollectionEnabled = true;
}
let appOptions;
if (_isFirebaseApp(_options)) {
@@ -1694,7 +1694,7 @@ __webpack_require__.r(__webpack_exports__);
const name = "@firebase/installations";
const version = "0.6.13";
const version = "0.6.18";
/**
* @license
@@ -4133,7 +4133,7 @@ async function messageEventListener(messaging, event) {
}
const name = "@firebase/messaging";
const version = "0.12.17";
const version = "0.12.22";
/**
* @license
@@ -4419,6 +4419,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ isAdmin: function() { return /* binding */ isAdmin; },
/* harmony export */ isBrowser: function() { return /* binding */ isBrowser; },
/* harmony export */ isBrowserExtension: function() { return /* binding */ isBrowserExtension; },
/* harmony export */ isCloudWorkstation: function() { return /* binding */ isCloudWorkstation; },
/* harmony export */ isCloudflareWorker: function() { return /* binding */ isCloudflareWorker; },
/* harmony export */ isElectron: function() { return /* binding */ isElectron; },
/* harmony export */ isEmpty: function() { return /* binding */ isEmpty; },
@@ -4429,6 +4430,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ isNodeSdk: function() { return /* binding */ isNodeSdk; },
/* harmony export */ isReactNative: function() { return /* binding */ isReactNative; },
/* harmony export */ isSafari: function() { return /* binding */ isSafari; },
/* harmony export */ isSafariOrWebkit: function() { return /* binding */ isSafariOrWebkit; },
/* harmony export */ isUWP: function() { return /* binding */ isUWP; },
/* harmony export */ isValidFormat: function() { return /* binding */ isValidFormat; },
/* harmony export */ isValidTimestamp: function() { return /* binding */ isValidTimestamp; },
@@ -4437,6 +4439,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ jsonEval: function() { return /* binding */ jsonEval; },
/* harmony export */ map: function() { return /* binding */ map; },
/* harmony export */ ordinal: function() { return /* binding */ ordinal; },
/* harmony export */ pingServer: function() { return /* binding */ pingServer; },
/* harmony export */ promiseWithTimeout: function() { return /* binding */ promiseWithTimeout; },
/* harmony export */ querystring: function() { return /* binding */ querystring; },
/* harmony export */ querystringDecode: function() { return /* binding */ querystringDecode; },
@@ -4444,6 +4447,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ stringLength: function() { return /* binding */ stringLength; },
/* harmony export */ stringToByteArray: function() { return /* binding */ stringToByteArray; },
/* harmony export */ stringify: function() { return /* binding */ stringify; },
/* harmony export */ updateEmulatorBanner: function() { return /* binding */ updateEmulatorBanner; },
/* harmony export */ validateArgCount: function() { return /* binding */ validateArgCount; },
/* harmony export */ validateCallback: function() { return /* binding */ validateCallback; },
/* harmony export */ validateContextObject: function() { return /* binding */ validateContextObject; },
@@ -5120,6 +5124,53 @@ class Deferred {
}
}
/**
* @license
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Checks whether host is a cloud workstation or not.
* @public
*/
function isCloudWorkstation(url) {
// `isCloudWorkstation` is called without protocol in certain connect*Emulator functions
// In HTTP request builders, it's called with the protocol.
// If called with protocol prefix, it's a valid URL, so we extract the hostname
// If called without, we assume the string is the hostname.
try {
const host = url.startsWith('http://') || url.startsWith('https://')
? new URL(url).hostname
: url;
return host.endsWith('.cloudworkstations.dev');
}
catch (_a) {
return false;
}
}
/**
* Makes a fetch request to the given server.
* Mostly used for forwarding cookies in Firebase Studio.
* @public
*/
async function pingServer(endpoint) {
const result = await fetch(endpoint, {
credentials: 'include'
});
return result.ok;
}
/**
* @license
* Copyright 2021 Google LLC
@@ -5165,6 +5216,152 @@ function createMockUserToken(token, projectId) {
signature
].join('.');
}
const emulatorStatus = {};
// Checks whether any products are running on an emulator
function getEmulatorSummary() {
const summary = {
prod: [],
emulator: []
};
for (const key of Object.keys(emulatorStatus)) {
if (emulatorStatus[key]) {
summary.emulator.push(key);
}
else {
summary.prod.push(key);
}
}
return summary;
}
function getOrCreateEl(id) {
let parentDiv = document.getElementById(id);
let created = false;
if (!parentDiv) {
parentDiv = document.createElement('div');
parentDiv.setAttribute('id', id);
created = true;
}
return { created, element: parentDiv };
}
let previouslyDismissed = false;
/**
* Updates Emulator Banner. Primarily used for Firebase Studio
* @param name
* @param isRunningEmulator
* @public
*/
function updateEmulatorBanner(name, isRunningEmulator) {
if (typeof window === 'undefined' ||
typeof document === 'undefined' ||
!isCloudWorkstation(window.location.host) ||
emulatorStatus[name] === isRunningEmulator ||
emulatorStatus[name] || // If already set to use emulator, can't go back to prod.
previouslyDismissed) {
return;
}
emulatorStatus[name] = isRunningEmulator;
function prefixedId(id) {
return `__firebase__banner__${id}`;
}
const bannerId = '__firebase__banner';
const summary = getEmulatorSummary();
const showError = summary.prod.length > 0;
function tearDown() {
const element = document.getElementById(bannerId);
if (element) {
element.remove();
}
}
function setupBannerStyles(bannerEl) {
bannerEl.style.display = 'flex';
bannerEl.style.background = '#7faaf0';
bannerEl.style.position = 'fixed';
bannerEl.style.bottom = '5px';
bannerEl.style.left = '5px';
bannerEl.style.padding = '.5em';
bannerEl.style.borderRadius = '5px';
bannerEl.style.alignItems = 'center';
}
function setupIconStyles(prependIcon, iconId) {
prependIcon.setAttribute('width', '24');
prependIcon.setAttribute('id', iconId);
prependIcon.setAttribute('height', '24');
prependIcon.setAttribute('viewBox', '0 0 24 24');
prependIcon.setAttribute('fill', 'none');
prependIcon.style.marginLeft = '-6px';
}
function setupCloseBtn() {
const closeBtn = document.createElement('span');
closeBtn.style.cursor = 'pointer';
closeBtn.style.marginLeft = '16px';
closeBtn.style.fontSize = '24px';
closeBtn.innerHTML = ' &times;';
closeBtn.onclick = () => {
previouslyDismissed = true;
tearDown();
};
return closeBtn;
}
function setupLinkStyles(learnMoreLink, learnMoreId) {
learnMoreLink.setAttribute('id', learnMoreId);
learnMoreLink.innerText = 'Learn more';
learnMoreLink.href =
'https://firebase.google.com/docs/studio/preview-apps#preview-backend';
learnMoreLink.setAttribute('target', '__blank');
learnMoreLink.style.paddingLeft = '5px';
learnMoreLink.style.textDecoration = 'underline';
}
function setupDom() {
const banner = getOrCreateEl(bannerId);
const firebaseTextId = prefixedId('text');
const firebaseText = document.getElementById(firebaseTextId) || document.createElement('span');
const learnMoreId = prefixedId('learnmore');
const learnMoreLink = document.getElementById(learnMoreId) ||
document.createElement('a');
const prependIconId = prefixedId('preprendIcon');
const prependIcon = document.getElementById(prependIconId) ||
document.createElementNS('http://www.w3.org/2000/svg', 'svg');
if (banner.created) {
// update styles
const bannerEl = banner.element;
setupBannerStyles(bannerEl);
setupLinkStyles(learnMoreLink, learnMoreId);
const closeBtn = setupCloseBtn();
setupIconStyles(prependIcon, prependIconId);
bannerEl.append(prependIcon, firebaseText, learnMoreLink, closeBtn);
document.body.appendChild(bannerEl);
}
if (showError) {
firebaseText.innerText = `Preview backend disconnected.`;
prependIcon.innerHTML = `<g clip-path="url(#clip0_6013_33858)">
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6013_33858">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`;
}
else {
prependIcon.innerHTML = `<g clip-path="url(#clip0_6083_34804)">
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6083_34804">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`;
firebaseText.innerText = 'Preview backend running in this workspace.';
}
firebaseText.setAttribute('id', firebaseTextId);
}
if (document.readyState === 'loading') {
window.addEventListener('DOMContentLoaded', setupDom);
}
else {
setupDom();
}
}
/**
* @license
@@ -5299,6 +5496,14 @@ function isSafari() {
navigator.userAgent.includes('Safari') &&
!navigator.userAgent.includes('Chrome'));
}
/** Returns true if we are running in Safari or WebKit */
function isSafariOrWebkit() {
return (!isNode() &&
!!navigator.userAgent &&
(navigator.userAgent.includes('Safari') ||
navigator.userAgent.includes('WebKit')) &&
!navigator.userAgent.includes('Chrome'));
}
/**
* This method checks if indexedDB is supported by current browser/service worker context
* @return true if indexedDB is supported by current browser/service worker context
@@ -6615,7 +6820,7 @@ __webpack_require__.r(__webpack_exports__);
var name = "firebase";
var version = "11.6.1";
var version = "11.10.0";
/**
* @license
@@ -6985,7 +7190,8 @@ const unwrap = (value) => reverseTransformCache.get(value);
var m = __webpack_require__(/*! react-dom */ "react-dom");
if (false) {} else {
if (false) // removed by dead control flow
{} else {
var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
exports.createRoot = function(c, o) {
i.usingClientEntryPoint = true;
@@ -7026,6 +7232,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ DEFAULT_HOST: function() { return /* binding */ DEFAULT_HOST; },
/* harmony export */ DEFAULT_P2P_ACCESS_MODE: function() { return /* binding */ DEFAULT_P2P_ACCESS_MODE; },
/* harmony export */ DEFAULT_TEXT_SIZE: function() { return /* binding */ DEFAULT_TEXT_SIZE; },
/* harmony export */ DRAFTY_FR_MIME_TYPE_LEGACY: function() { return /* binding */ DRAFTY_FR_MIME_TYPE_LEGACY; },
/* harmony export */ EDIT_PREVIEW_LENGTH: function() { return /* binding */ EDIT_PREVIEW_LENGTH; },
/* harmony export */ FORWARDED_PREVIEW_LENGTH: function() { return /* binding */ FORWARDED_PREVIEW_LENGTH; },
/* harmony export */ IMAGE_PREVIEW_DIM: function() { return /* binding */ IMAGE_PREVIEW_DIM; },
@@ -7124,6 +7331,7 @@ const SELF_AVATAR_URI = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlb
const TOAST_DURATION = 3_000;
const DEFAULT_COLOR_SCHEME = 'light dark';
const DEFAULT_TEXT_SIZE = 10;
const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json';
/***/ }),
@@ -7735,7 +7943,7 @@ function previewFormatter(style, data, values, key) {
break;
case 'EX':
if (data) {
if (data.mime == 'application/json') {
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(data.mime)) {
return null;
}
delete data.val;
@@ -7854,7 +8062,7 @@ function quoteFormatter(style, data, values, key) {
case 'EX':
let fname;
if (data) {
if (data.mime == 'application/json') {
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(data.mime)) {
return null;
}
fname = data.name;
@@ -8453,7 +8661,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ PACKAGE_VERSION: function() { return /* binding */ PACKAGE_VERSION; }
/* harmony export */ });
const PACKAGE_VERSION = "0.24.0";
const PACKAGE_VERSION = "0.25.0";
/***/ }),
@@ -10092,6 +10300,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
}
sendFileAttachment(file) {
const maxInbandAttachmentSize = this.props.tinode.getServerParam('maxMessageSize', _config_js__WEBPACK_IMPORTED_MODULE_18__.MAX_INBAND_ATTACHMENT_SIZE) * 0.75 - 1024 | 0;
const jsonMimeConverter = fileType => fileType === _config_js__WEBPACK_IMPORTED_MODULE_18__.DRAFTY_FR_MIME_TYPE_LEGACY ? 'application/octet-stream' : fileType;
if (file.size > maxInbandAttachmentSize) {
const uploader = this.props.tinode.getLargeFileHelper();
if (!uploader) {
@@ -10100,7 +10309,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
}
const uploadCompletionPromise = uploader.upload(file);
const msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachFile(null, {
mime: file.type,
mime: jsonMimeConverter(file.type),
filename: file.name,
size: file.size,
urlPromise: uploadCompletionPromise
@@ -10108,7 +10317,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
this.sendMessage(msg, uploadCompletionPromise, uploader);
} else {
(0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_20__.fileToBase64)(file).then(b64 => this.sendMessage(tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachFile(null, {
mime: b64.mime,
mime: jsonMimeConverter(b64.mime),
data: b64.bits,
filename: b64.name,
size: file.size
@@ -15514,7 +15723,7 @@ class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
const attachments = [];
if (this.props.mimeType == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.getContentType() && tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isValid(content)) {
tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.attachments(content, (att, i) => {
if (att.mime == 'application/json') {
if (tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.isFormResponseType(att.mime)) {
return;
}
attachments.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_attachment_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
@@ -17147,7 +17356,7 @@ class DocPreview extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompo
}, "close"))), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
id: "image-preview-container"
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "flex-column narrow"
className: "doc-card"
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("i", {
className: "material-icons gray"
}, iconFromMime(this.props.content.type)), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("b", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
@@ -20528,7 +20737,7 @@ module.exports = tinode;
/******/ __webpack_require__.r(ns);
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ Object.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; });
/******/ }
/******/ def['default'] = function() { return value; };
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
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
+24 -24
View File
@@ -25,12 +25,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-intl */ "react-intl");
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intl__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var _widgets_avatar_upload_jsx__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../widgets/avatar-upload.jsx */ "./src/widgets/avatar-upload.jsx");
/* harmony import */ var _widgets_badge_list_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../widgets/badge-list.jsx */ "./src/widgets/badge-list.jsx");
/* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js");
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../config.js */ "./src/config.js");
/* harmony import */ var _widgets_credential_edit_jsx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../widgets/credential-edit.jsx */ "./src/widgets/credential-edit.jsx");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var _widgets_avatar_upload_jsx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../widgets/avatar-upload.jsx */ "./src/widgets/avatar-upload.jsx");
/* harmony import */ var _widgets_badge_list_jsx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../widgets/badge-list.jsx */ "./src/widgets/badge-list.jsx");
/* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js");
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../config.js */ "./src/config.js");
/* harmony import */ var _widgets_credential_edit_jsx__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../widgets/credential-edit.jsx */ "./src/widgets/credential-edit.jsx");
@@ -47,9 +47,9 @@ class AccountSettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().
super(props);
const me = this.props.tinode.getMeTopic();
this.state = {
fullName: _clip(me.public ? me.public.fn : undefined, _config_js__WEBPACK_IMPORTED_MODULE_5__.MAX_TITLE_LENGTH),
description: _clip(me.public ? me.public.note : undefined, _config_js__WEBPACK_IMPORTED_MODULE_5__.MAX_TOPIC_DESCRIPTION_LENGTH),
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_4__.makeImageUrl)(me.public ? me.public.photo : null),
fullName: _clip(me.public ? me.public.fn : undefined, _config_js__WEBPACK_IMPORTED_MODULE_6__.MAX_TITLE_LENGTH),
description: _clip(me.public ? me.public.note : undefined, _config_js__WEBPACK_IMPORTED_MODULE_6__.MAX_TOPIC_DESCRIPTION_LENGTH),
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_5__.makeImageUrl)(me.public ? me.public.photo : null),
credentials: me.getCredentials() || [],
credEdit: undefined,
alias: ((me.tags() || []).find(tag => tag.startsWith('alias:')) || '').substring(6)
@@ -67,7 +67,7 @@ class AccountSettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().
}
render() {
if (this.state.credEdit) {
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_credential_edit_jsx__WEBPACK_IMPORTED_MODULE_6__["default"], {
return react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_credential_edit_jsx__WEBPACK_IMPORTED_MODULE_7__["default"], {
method: this.state.credEdit.meth,
val: this.state.credEdit.val,
done: this.state.credEdit.done,
@@ -93,7 +93,7 @@ class AccountSettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().
}
let val = cred.val;
if (cred.meth == 'tel') {
const number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_7__.parsePhoneNumberWithError)(cred.val);
const number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__.parsePhoneNumberWithError)(cred.val);
val = number ? number.formatInternational() : cred.val;
}
credentials.push(react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
@@ -150,7 +150,7 @@ class AccountSettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().
"type": 0,
"value": "Edit"
}]
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("center", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_avatar_upload_jsx__WEBPACK_IMPORTED_MODULE_2__["default"], {
})), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("center", null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_avatar_upload_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
tinode: this.props.tinode,
avatar: this.state.avatar,
readOnly: true,
@@ -190,7 +190,7 @@ class AccountSettingsView extends (react__WEBPACK_IMPORTED_MODULE_0___default().
}]
})), "\xA0", react__WEBPACK_IMPORTED_MODULE_0___default().createElement("tt", null, "@", this.state.alias)) : null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "group"
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_badge_list_jsx__WEBPACK_IMPORTED_MODULE_3__["default"], {
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_widgets_badge_list_jsx__WEBPACK_IMPORTED_MODULE_4__["default"], {
trustedBadges: this.props.trustedBadges
})), this.state.description ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "group"
@@ -527,12 +527,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-intl */ "react-intl");
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intl__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
@@ -552,7 +552,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
constructor(props) {
super(props);
this.codeMap = {};
_dcodes_json__WEBPACK_IMPORTED_MODULE_2__.forEach(dc => {
_dcodes_json__WEBPACK_IMPORTED_MODULE_6__.forEach(dc => {
this.codeMap[dc.code] = dc.dial;
});
const code = props.countryCode || 'US';
@@ -570,7 +570,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
}
handleChange(e) {
const prefix = `+${this.state.dialCode}`;
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
formatted = formatted.substring(prefix.length).trim();
this.setState({
localNumber: formatted
@@ -581,7 +581,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
const raw = `${this.state.dialCode}${this.state.localNumber.trim()}`.replace(/[^\d]/g, '');
let number = null;
try {
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__.parsePhoneNumberWithError)(`+${raw}`);
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__.parsePhoneNumberWithError)(`+${raw}`);
} catch (err) {}
if (!number || !number.isValid()) {
this.inputField.setCustomValidity(this.props.intl.formatMessage(messages.mobile_number_required));
@@ -611,7 +611,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
return number.replace(/[^-\s().\d]/g, '');
}
placeholderNumber(code, dial) {
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__["default"]);
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__["default"]);
return sample ? sample.formatInternational().substring(dial.length + 1).trim() : '123 0123';
}
render() {
@@ -620,7 +620,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
onClick: this.showCountrySelector
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
className: "country-flag"
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_3__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_7__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
type: "tel",
ref: ref => {
this.inputField = ref;
File diff suppressed because one or more lines are too long
+11 -11
View File
@@ -322,12 +322,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-intl */ "react-intl");
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intl__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
@@ -347,7 +347,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
constructor(props) {
super(props);
this.codeMap = {};
_dcodes_json__WEBPACK_IMPORTED_MODULE_2__.forEach(dc => {
_dcodes_json__WEBPACK_IMPORTED_MODULE_6__.forEach(dc => {
this.codeMap[dc.code] = dc.dial;
});
const code = props.countryCode || 'US';
@@ -365,7 +365,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
}
handleChange(e) {
const prefix = `+${this.state.dialCode}`;
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
formatted = formatted.substring(prefix.length).trim();
this.setState({
localNumber: formatted
@@ -376,7 +376,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
const raw = `${this.state.dialCode}${this.state.localNumber.trim()}`.replace(/[^\d]/g, '');
let number = null;
try {
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__.parsePhoneNumberWithError)(`+${raw}`);
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__.parsePhoneNumberWithError)(`+${raw}`);
} catch (err) {}
if (!number || !number.isValid()) {
this.inputField.setCustomValidity(this.props.intl.formatMessage(messages.mobile_number_required));
@@ -406,7 +406,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
return number.replace(/[^-\s().\d]/g, '');
}
placeholderNumber(code, dial) {
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__["default"]);
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__["default"]);
return sample ? sample.formatInternational().substring(dial.length + 1).trim() : '123 0123';
}
render() {
@@ -415,7 +415,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
onClick: this.showCountrySelector
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
className: "country-flag"
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_3__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_7__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
type: "tel",
ref: ref => {
this.inputField = ref;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+11 -11
View File
@@ -287,12 +287,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-intl */ "react-intl");
/* harmony import */ var react_intl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intl__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/parsePhoneNumberWithError.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/AsYouType.js");
/* harmony import */ var libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! libphonenumber-js/mobile */ "./node_modules/libphonenumber-js/mobile/exports/getExampleNumber.js");
/* harmony import */ var libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! libphonenumber-js/mobile/examples */ "./node_modules/libphonenumber-js/examples.mobile.json.js");
/* harmony import */ var _dcodes_json__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../dcodes.json */ "./src/dcodes.json");
/* harmony import */ var _lib_strformat__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/strformat */ "./src/lib/strformat.js");
@@ -312,7 +312,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
constructor(props) {
super(props);
this.codeMap = {};
_dcodes_json__WEBPACK_IMPORTED_MODULE_2__.forEach(dc => {
_dcodes_json__WEBPACK_IMPORTED_MODULE_6__.forEach(dc => {
this.codeMap[dc.code] = dc.dial;
});
const code = props.countryCode || 'US';
@@ -330,7 +330,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
}
handleChange(e) {
const prefix = `+${this.state.dialCode}`;
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
let formatted = new libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_3__.AsYouType().input(`${prefix}${this.filterNumber(e.target.value)}`);
formatted = formatted.substring(prefix.length).trim();
this.setState({
localNumber: formatted
@@ -341,7 +341,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
const raw = `${this.state.dialCode}${this.state.localNumber.trim()}`.replace(/[^\d]/g, '');
let number = null;
try {
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_5__.parsePhoneNumberWithError)(`+${raw}`);
number = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_2__.parsePhoneNumberWithError)(`+${raw}`);
} catch (err) {}
if (!number || !number.isValid()) {
this.inputField.setCustomValidity(this.props.intl.formatMessage(messages.mobile_number_required));
@@ -371,7 +371,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
return number.replace(/[^-\s().\d]/g, '');
}
placeholderNumber(code, dial) {
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_6__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_7__["default"]);
const sample = (0,libphonenumber_js_mobile__WEBPACK_IMPORTED_MODULE_4__.getExampleNumber)(code, libphonenumber_js_mobile_examples__WEBPACK_IMPORTED_MODULE_5__["default"]);
return sample ? sample.formatInternational().substring(dial.length + 1).trim() : '123 0123';
}
render() {
@@ -380,7 +380,7 @@ class PhoneEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
onClick: this.showCountrySelector
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
className: "country-flag"
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_3__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
}, (0,_lib_strformat__WEBPACK_IMPORTED_MODULE_7__.flagEmoji)(this.state.countryCode), "\xA0"), "+", this.state.dialCode, "\xA0"), react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
type: "tel",
ref: ref => {
this.inputField = ref;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
{"version":3,"file":"src_widgets_phone-country-selector_jsx.dev.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAE0B;AACc;AAEC;AAEI;AAE7C,MAAMI,oBAAoB,SAASJ,4DAAmB,CAAC;EACrDM,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,SAAS,GAAG,EAAE;IACnB,MAAM;MAAEC;IAAkB,CAAC,GAAGF,KAAK,CAACG,IAAI;IACxCR,yCAAc,CAACU,OAAO,CAACC,EAAE,IAAI;MAC3B,MAAMC,KAAK,GAAGD,EAAE,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;MAChCF,KAAK,CAACF,OAAO,CAACK,IAAI,IAAI;QACpB,IAAI,CAACT,SAAS,CAACU,IAAI,CAAC;UAClBH,IAAI,EAAEE,IAAI,CAACE,IAAI,CAAC,CAAC;UACjBC,IAAI,EAAEP,EAAE,CAACO,IAAI;UACbC,IAAI,EAAElB,yDAAS,CAACU,EAAE,CAACO,IAAI,CAAC;UACxBE,IAAI,EAAEb,iBAAiB,CAACI,EAAE,CAACO,IAAI,EAAE;YAACG,IAAI,EAAE;UAAQ,CAAC;QACnD,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,CAACf,SAAS,CAACgB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACH,IAAI,CAACK,aAAa,CAACD,CAAC,CAACJ,IAAI,CAAC,CAAC;EAC7D;EAEAM,iBAAiBA,CAAA,EAAG;IAClB,IAAI,IAAI,CAACC,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACC,cAAc,CAAC;QAACC,KAAK,EAAE,QAAQ;QAAEC,MAAM,EAAE;MAAS,CAAC,CAAC;IACvE;EACF;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAMzB,SAAS,GAAG,EAAE;IACpB,MAAM0B,QAAQ,GAAG,IAAI,CAAC3B,KAAK,CAAC2B,QAAQ,IAAI,IAAI;IAC5C,IAAI,CAAC1B,SAAS,CAACI,OAAO,CAAC,CAACuB,CAAC,EAAEC,GAAG,KAAK;MACjC,MAAMC,KAAK,GAAIF,CAAC,CAACf,IAAI,IAAIc,QAAQ,GAAG,WAAW,GAAG,EAAG;MACrD1B,SAAS,CAACU,IAAI,CAAClB,0DAAA;QAAIuC,SAAS,EAAEF,KAAM;QAACG,GAAG,EAAEJ,GAAI;QAC5CK,GAAG,EAAEA,GAAG,IAAI;UAAC,IAAIN,CAAC,CAACf,IAAI,IAAIc,QAAQ,EAAE;YAAC,IAAI,CAACL,WAAW,GAAGY,GAAG;UAAA;QAAC,CAAE;QAC/DC,OAAO,EAAEC,CAAC,IAAI,IAAI,CAACpC,KAAK,CAACqC,QAAQ,CAACT,CAAC,CAACf,IAAI,EAAEe,CAAC,CAACpB,IAAI;MAAE,GAClDf,0DAAA;QAAMuC,SAAS,EAAC;MAAc,GAAEJ,CAAC,CAACd,IAAW,CAAC,EAC9CrB,0DAAA;QAAMuC,SAAS,EAAC;MAAS,GAAC,MAAM,EAACJ,CAAC,CAACb,IAAW,CAAC,EAC/CtB,0DAAA;QAAMuC,SAAS,EAAC;MAAW,GAAC,OAAO,EAACJ,CAAC,CAACpB,IAAW,CAC/C,CAAC,CAAC;IACR,CAAC,CAAC;IAEF,OACEf,0DAAA;MAAKuC,SAAS,EAAC,kBAAkB;MAACF,KAAK,EAAE;QAACQ,MAAM,EAAE;MAAO;IAAE,GACzD7C,0DAAA;MAAIuC,SAAS,EAAC;IAAwB,GACnC/B,SACC,CACD,CAAC;EAEV;AACF;AAEA,+DAAeP,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 { formatDisplayName } = props.intl;\n dcodes.default.forEach(dc => {\n const parts = dc.dial.split(',');\n parts.forEach(part => {\n this.countries.push({\n dial: part.trim(),\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formatDisplayName(dc.code, {type: 'region'})\n });\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n componentDidMount() {\n if (this.selectedRef) {\n this.selectedRef.scrollIntoView({block: 'center', inline: 'nearest'});\n }\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach((c, idx) => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx}\n ref={ref => {if (c.code == selected) {this.selectedRef = ref}}}\n onClick={_ => this.props.onSubmit(c.code, c.dial)}>\n <span className=\"country-flag\">{c.flag}</span>\n <span className=\"country\">&nbsp;{c.name}</span>\n <span className=\"dial-code\">&nbsp;+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\" style={{height: '30rem'}}>\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","formatDisplayName","intl","default","forEach","dc","parts","dial","split","part","push","trim","code","flag","name","type","sort","a","b","localeCompare","componentDidMount","selectedRef","scrollIntoView","block","inline","render","selected","c","idx","style","createElement","className","key","ref","onClick","_","onSubmit","height"],"sourceRoot":""}
{"version":3,"file":"src_widgets_phone-country-selector_jsx.dev.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAE0B;AACc;AAEC;AAEI;AAE7C,MAAMI,oBAAoB,SAASJ,4DAAmB,CAAC;EACrDM,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZ,IAAI,CAACC,SAAS,GAAG,EAAE;IACnB,MAAM;MAAEC;IAAkB,CAAC,GAAGF,KAAK,CAACG,IAAI;IACxCR,yCAAc,CAACU,OAAO,CAACC,EAAE,IAAI;MAC3B,MAAMC,KAAK,GAAGD,EAAE,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;MAChCF,KAAK,CAACF,OAAO,CAACK,IAAI,IAAI;QACpB,IAAI,CAACT,SAAS,CAACU,IAAI,CAAC;UAClBH,IAAI,EAAEE,IAAI,CAACE,IAAI,CAAC,CAAC;UACjBC,IAAI,EAAEP,EAAE,CAACO,IAAI;UACbC,IAAI,EAAElB,yDAAS,CAACU,EAAE,CAACO,IAAI,CAAC;UACxBE,IAAI,EAAEb,iBAAiB,CAACI,EAAE,CAACO,IAAI,EAAE;YAACG,IAAI,EAAE;UAAQ,CAAC;QACnD,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,CAACf,SAAS,CAACgB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACH,IAAI,CAACK,aAAa,CAACD,CAAC,CAACJ,IAAI,CAAC,CAAC;EAC7D;EAEAM,iBAAiBA,CAAA,EAAG;IAClB,IAAI,IAAI,CAACC,WAAW,EAAE;MACpB,IAAI,CAACA,WAAW,CAACC,cAAc,CAAC;QAACC,KAAK,EAAE,QAAQ;QAAEC,MAAM,EAAE;MAAS,CAAC,CAAC;IACvE;EACF;EAEAC,MAAMA,CAAA,EAAG;IACP,MAAMzB,SAAS,GAAG,EAAE;IACpB,MAAM0B,QAAQ,GAAG,IAAI,CAAC3B,KAAK,CAAC2B,QAAQ,IAAI,IAAI;IAC5C,IAAI,CAAC1B,SAAS,CAACI,OAAO,CAAC,CAACuB,CAAC,EAAEC,GAAG,KAAK;MACjC,MAAMC,KAAK,GAAIF,CAAC,CAACf,IAAI,IAAIc,QAAQ,GAAG,WAAW,GAAG,EAAG;MACrD1B,SAAS,CAACU,IAAI,CAAClB,0DAAA;QAAIuC,SAAS,EAAEF,KAAM;QAACG,GAAG,EAAEJ,GAAI;QAC5CK,GAAG,EAAEA,GAAG,IAAI;UAAC,IAAIN,CAAC,CAACf,IAAI,IAAIc,QAAQ,EAAE;YAAC,IAAI,CAACL,WAAW,GAAGY,GAAG;UAAA;QAAC,CAAE;QAC/DC,OAAO,EAAEC,CAAC,IAAI,IAAI,CAACpC,KAAK,CAACqC,QAAQ,CAACT,CAAC,CAACf,IAAI,EAAEe,CAAC,CAACpB,IAAI;MAAE,GAClDf,0DAAA;QAAMuC,SAAS,EAAC;MAAc,GAAEJ,CAAC,CAACd,IAAW,CAAC,EAC9CrB,0DAAA;QAAMuC,SAAS,EAAC;MAAS,GAAC,MAAM,EAACJ,CAAC,CAACb,IAAW,CAAC,EAC/CtB,0DAAA;QAAMuC,SAAS,EAAC;MAAW,GAAC,OAAO,EAACJ,CAAC,CAACpB,IAAW,CAC/C,CAAC,CAAC;IACR,CAAC,CAAC;IAEF,OACEf,0DAAA;MAAKuC,SAAS,EAAC,kBAAkB;MAACF,KAAK,EAAE;QAACQ,MAAM,EAAE;MAAO;IAAE,GACzD7C,0DAAA;MAAIuC,SAAS,EAAC;IAAwB,GACnC/B,SACC,CACD,CAAC;EAEV;AACF;AAEA,+DAAeP,sDAAU,CAACG,oBAAoB,CAAC,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 { formatDisplayName } = props.intl;\n dcodes.default.forEach(dc => {\n const parts = dc.dial.split(',');\n parts.forEach(part => {\n this.countries.push({\n dial: part.trim(),\n code: dc.code,\n flag: flagEmoji(dc.code),\n name: formatDisplayName(dc.code, {type: 'region'})\n });\n });\n });\n\n this.countries.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n componentDidMount() {\n if (this.selectedRef) {\n this.selectedRef.scrollIntoView({block: 'center', inline: 'nearest'});\n }\n }\n\n render() {\n const countries = [];\n const selected = this.props.selected || 'US';\n this.countries.forEach((c, idx) => {\n const style = (c.code == selected ? 'selected ' : '');\n countries.push(<li className={style} key={idx}\n ref={ref => {if (c.code == selected) {this.selectedRef = ref}}}\n onClick={_ => this.props.onSubmit(c.code, c.dial)}>\n <span className=\"country-flag\">{c.flag}</span>\n <span className=\"country\">&nbsp;{c.name}</span>\n <span className=\"dial-code\">&nbsp;+{c.dial}</span>\n </li>);\n });\n\n return (\n <div className=\"scrollable-panel\" style={{height: '30rem'}}>\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","formatDisplayName","intl","default","forEach","dc","parts","dial","split","part","push","trim","code","flag","name","type","sort","a","b","localeCompare","componentDidMount","selectedRef","scrollIntoView","block","inline","render","selected","c","idx","style","createElement","className","key","ref","onClick","_","onSubmit","height"],"sourceRoot":""}
+45 -23
View File
@@ -829,6 +829,12 @@ class DB {
req.onsuccess = event => {
this.db = event.target.result;
this.disabled = false;
this.db.onversionchange = _ => {
this.#logger('PCache', "another tab tries to upgrade DB, shutting down");
this.db.close();
this.db = null;
this.disabled = true;
};
resolve(this.db);
};
req.onerror = event => {
@@ -842,24 +848,36 @@ class DB {
this.#logger('PCache', "failed to create storage", event);
this.#onError(event.target.error);
};
this.db.createObjectStore('topic', {
keyPath: 'name'
});
this.db.createObjectStore('user', {
keyPath: 'uid'
});
this.db.createObjectStore('subscription', {
keyPath: ['topic', 'uid']
});
this.db.createObjectStore('message', {
keyPath: ['topic', 'seq']
});
const dellog = this.db.createObjectStore('dellog', {
keyPath: ['topic', 'low', 'hi']
});
dellog.createIndex('topic_clear', ['topic', 'clear'], {
unique: false
});
if (!this.db.objectStoreNames.contains('topic')) {
this.db.createObjectStore('topic', {
keyPath: 'name'
});
}
if (!this.db.objectStoreNames.contains('user')) {
this.db.createObjectStore('user', {
keyPath: 'uid'
});
}
if (!this.db.objectStoreNames.contains('subscription')) {
this.db.createObjectStore('subscription', {
keyPath: ['topic', 'uid']
});
}
if (!this.db.objectStoreNames.contains('message')) {
this.db.createObjectStore('message', {
keyPath: ['topic', 'seq']
});
}
if (!this.db.objectStoreNames.contains('dellog')) {
const dellog = this.db.createObjectStore('dellog', {
keyPath: ['topic', 'low', 'hi']
});
if (!dellog.indexNames.contains('topic_clear')) {
dellog.createIndex('topic_clear', ['topic', 'clear'], {
unique: false
});
}
}
};
});
}
@@ -1434,8 +1452,9 @@ class DB {
const MAX_FORM_ELEMENTS = 8;
const MAX_PREVIEW_ATTACHMENTS = 3;
const MAX_PREVIEW_DATA_SIZE = 64;
const JSON_MIME_TYPE = 'application/json';
const DRAFTY_MIME_TYPE = 'text/x-drafty';
const DRAFTY_FR_MIME_TYPE = 'text/x-drafty-fr';
const DRAFTY_FR_MIME_TYPE_LEGACY = 'application/json';
const ALLOWED_ENT_FIELDS = ['act', 'height', 'duration', 'incoming', 'mime', 'name', 'premime', 'preref', 'preview', 'ref', 'size', 'state', 'url', 'val', 'width'];
const segmenter = new Intl.Segmenter();
const INLINE_STYLES = [{
@@ -2271,7 +2290,7 @@ Drafty.attachJSON = function (content, data) {
content.ent.push({
tp: 'EX',
data: {
mime: JSON_MIME_TYPE,
mime: DRAFTY_FR_MIME_TYPE,
val: data
}
});
@@ -2518,7 +2537,7 @@ Drafty.sanitizeEntities = function (content) {
};
Drafty.getDownloadUrl = function (entData) {
let url = null;
if (entData.mime != JSON_MIME_TYPE && entData.val) {
if (!Drafty.isFormResponseType(entData.mime) && entData.val) {
url = base64toObjectUrl(entData.val, entData.mime, Drafty.logger);
} else if (typeof entData.ref == 'string') {
url = entData.ref;
@@ -2549,6 +2568,9 @@ Drafty.attrValue = function (style, data) {
Drafty.getContentType = function () {
return DRAFTY_MIME_TYPE;
};
Drafty.isFormResponseType = function (mimeType) {
return mimeType === DRAFTY_FR_MIME_TYPE || mimeType === DRAFTY_FR_MIME_TYPE_LEGACY;
};
function chunkify(line, start, end, spans) {
const chunks = [];
if (spans.length == 0) {
@@ -3002,7 +3024,7 @@ function attachmentsToEnd(tree, limit) {
if (attachments.length == limit) {
continue;
}
if (c.data['mime'] == JSON_MIME_TYPE) {
if (Drafty.isFormResponseType(c.data['mime'])) {
continue;
}
delete c.att;
@@ -5378,7 +5400,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.24.0";
const PACKAGE_VERSION = "0.24.4";
/***/ })
File diff suppressed because one or more lines are too long
+1 -1
View File
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
@@ -7321,7 +7321,8 @@ function fixWebmDuration(blob) {
readerBlob = readstream.getReader();
_b.label = 1;
case 1:
if (false) {}
if (false) // removed by dead control flow
{}
return [4 /*yield*/, readerBlob.read()];
case 2:
_a = _b.sent(), done = _a.done, value = _a.value;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit.
const PACKAGE_VERSION = "0.24.0";
const PACKAGE_VERSION = "0.25.0";