Do not crash in MessagesView.handleMessageUpdate if topic gets unset.
This commit is contained in:
@@ -672,6 +672,9 @@ class MessagesView extends React.Component {
|
|||||||
|
|
||||||
// The 'msg' could be false-ish if some message ranges were deleted.
|
// The 'msg' could be false-ish if some message ranges were deleted.
|
||||||
handleMessageUpdate(msg) {
|
handleMessageUpdate(msg) {
|
||||||
|
if (!this.state.topic) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
// msg could be null if one or more messages were deleted.
|
// msg could be null if one or more messages were deleted.
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+203
-201
@@ -635,8 +635,13 @@ function isSafari() {
|
|||||||
* @return true if indexedDB is supported by current browser/service worker context
|
* @return true if indexedDB is supported by current browser/service worker context
|
||||||
*/
|
*/
|
||||||
function isIndexedDBAvailable() {
|
function isIndexedDBAvailable() {
|
||||||
|
try {
|
||||||
return typeof indexedDB === 'object';
|
return typeof indexedDB === 'object';
|
||||||
}
|
}
|
||||||
|
catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
|
* This method validates browser/sw context for indexedDB by opening a dummy indexedDB database and reject
|
||||||
* if errors occur during the database open operation.
|
* if errors occur during the database open operation.
|
||||||
@@ -6030,6 +6035,9 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleMessageUpdate(msg) {
|
handleMessageUpdate(msg) {
|
||||||
|
if (!this.state.topic) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -7670,8 +7678,8 @@ __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__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__ = __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 react_intl__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intl__WEBPACK_IMPORTED_MODULE_1__);
|
||||||
/* harmony import */ var firebase_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! firebase/app */ "./node_modules/firebase/app/dist/index.esm.js");
|
/* harmony import */ var firebase_app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! firebase/app */ "./node_modules/firebase/app/dist/esm/index.esm.js");
|
||||||
/* harmony import */ var firebase_messaging__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! firebase/messaging */ "./node_modules/firebase/messaging/dist/index.esm.js");
|
/* harmony import */ var firebase_messaging__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! firebase/messaging */ "./node_modules/firebase/messaging/dist/esm/index.esm.js");
|
||||||
/* harmony import */ var tinode_sdk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tinode-sdk */ "tinode-sdk");
|
/* harmony import */ var tinode_sdk__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tinode-sdk */ "tinode-sdk");
|
||||||
/* harmony import */ var tinode_sdk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(tinode_sdk__WEBPACK_IMPORTED_MODULE_4__);
|
/* harmony import */ var tinode_sdk__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(tinode_sdk__WEBPACK_IMPORTED_MODULE_4__);
|
||||||
/* harmony import */ var _widgets_alert_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../widgets/alert.jsx */ "./src/widgets/alert.jsx");
|
/* harmony import */ var _widgets_alert_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../widgets/alert.jsx */ "./src/widgets/alert.jsx");
|
||||||
@@ -16900,83 +16908,6 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./node_modules/firebase/app/dist/index.esm.js":
|
|
||||||
/*!*****************************************************!*\
|
|
||||||
!*** ./node_modules/firebase/app/dist/index.esm.js ***!
|
|
||||||
\*****************************************************/
|
|
||||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ "FirebaseError": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.FirebaseError),
|
|
||||||
/* harmony export */ "SDK_VERSION": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.SDK_VERSION),
|
|
||||||
/* harmony export */ "_DEFAULT_ENTRY_NAME": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._DEFAULT_ENTRY_NAME),
|
|
||||||
/* harmony export */ "_addComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addComponent),
|
|
||||||
/* harmony export */ "_addOrOverwriteComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addOrOverwriteComponent),
|
|
||||||
/* harmony export */ "_apps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._apps),
|
|
||||||
/* harmony export */ "_clearComponents": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._clearComponents),
|
|
||||||
/* harmony export */ "_components": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._components),
|
|
||||||
/* harmony export */ "_getProvider": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._getProvider),
|
|
||||||
/* harmony export */ "_registerComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent),
|
|
||||||
/* harmony export */ "_removeServiceInstance": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._removeServiceInstance),
|
|
||||||
/* harmony export */ "deleteApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.deleteApp),
|
|
||||||
/* harmony export */ "getApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApp),
|
|
||||||
/* harmony export */ "getApps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApps),
|
|
||||||
/* harmony export */ "initializeApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp),
|
|
||||||
/* harmony export */ "onLog": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.onLog),
|
|
||||||
/* harmony export */ "registerVersion": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion),
|
|
||||||
/* harmony export */ "setLogLevel": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.setLogLevel)
|
|
||||||
/* harmony export */ });
|
|
||||||
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var name = "firebase";
|
|
||||||
var version = "9.14.0";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright 2020 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.
|
|
||||||
*/
|
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version, 'app');
|
|
||||||
//# sourceMappingURL=index.esm.js.map
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./node_modules/firebase/messaging/dist/index.esm.js":
|
|
||||||
/*!***********************************************************!*\
|
|
||||||
!*** ./node_modules/firebase/messaging/dist/index.esm.js ***!
|
|
||||||
\***********************************************************/
|
|
||||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ "deleteToken": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.deleteToken),
|
|
||||||
/* harmony export */ "getMessaging": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.getMessaging),
|
|
||||||
/* harmony export */ "getToken": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.getToken),
|
|
||||||
/* harmony export */ "isSupported": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.isSupported),
|
|
||||||
/* harmony export */ "onMessage": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.onMessage)
|
|
||||||
/* harmony export */ });
|
|
||||||
/* harmony import */ var _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/messaging */ "./node_modules/@firebase/messaging/dist/esm/index.esm2017.js");
|
|
||||||
|
|
||||||
//# sourceMappingURL=index.esm.js.map
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/react-dom/client.js":
|
/***/ "./node_modules/react-dom/client.js":
|
||||||
@@ -17138,11 +17069,11 @@ class PlatformLoggerServiceImpl {
|
|||||||
*/
|
*/
|
||||||
function isVersionServiceProvider(provider) {
|
function isVersionServiceProvider(provider) {
|
||||||
const component = provider.getComponent();
|
const component = provider.getComponent();
|
||||||
return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* VERSION */;
|
return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* ComponentType.VERSION */;
|
||||||
}
|
}
|
||||||
|
|
||||||
const name$o = "@firebase/app";
|
const name$o = "@firebase/app";
|
||||||
const version$1 = "0.8.4";
|
const version$1 = "0.9.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -17209,7 +17140,7 @@ const name$2 = "@firebase/firestore";
|
|||||||
const name$1 = "@firebase/firestore-compat";
|
const name$1 = "@firebase/firestore-compat";
|
||||||
|
|
||||||
const name = "firebase";
|
const name = "firebase";
|
||||||
const version = "9.14.0";
|
const version = "9.15.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -17384,19 +17315,19 @@ function _clearComponents() {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
const ERRORS = {
|
const ERRORS = {
|
||||||
["no-app" /* NO_APP */]: "No Firebase App '{$appName}' has been created - " +
|
["no-app" /* AppError.NO_APP */]: "No Firebase App '{$appName}' has been created - " +
|
||||||
'call Firebase App.initializeApp()',
|
'call Firebase App.initializeApp()',
|
||||||
["bad-app-name" /* BAD_APP_NAME */]: "Illegal App name: '{$appName}",
|
["bad-app-name" /* AppError.BAD_APP_NAME */]: "Illegal App name: '{$appName}",
|
||||||
["duplicate-app" /* DUPLICATE_APP */]: "Firebase App named '{$appName}' already exists with different options or config",
|
["duplicate-app" /* AppError.DUPLICATE_APP */]: "Firebase App named '{$appName}' already exists with different options or config",
|
||||||
["app-deleted" /* APP_DELETED */]: "Firebase App named '{$appName}' already deleted",
|
["app-deleted" /* AppError.APP_DELETED */]: "Firebase App named '{$appName}' already deleted",
|
||||||
["no-options" /* NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',
|
["no-options" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',
|
||||||
["invalid-app-argument" /* INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
|
["invalid-app-argument" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +
|
||||||
'Firebase App instance.',
|
'Firebase App instance.',
|
||||||
["invalid-log-argument" /* INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',
|
["invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',
|
||||||
["idb-open" /* IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',
|
["idb-open" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',
|
||||||
["idb-get" /* IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',
|
["idb-get" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',
|
||||||
["idb-set" /* IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',
|
["idb-set" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',
|
||||||
["idb-delete" /* IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.'
|
["idb-delete" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.'
|
||||||
};
|
};
|
||||||
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_2__.ErrorFactory('app', 'Firebase', ERRORS);
|
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_2__.ErrorFactory('app', 'Firebase', ERRORS);
|
||||||
|
|
||||||
@@ -17425,7 +17356,7 @@ class FirebaseAppImpl {
|
|||||||
this._automaticDataCollectionEnabled =
|
this._automaticDataCollectionEnabled =
|
||||||
config.automaticDataCollectionEnabled;
|
config.automaticDataCollectionEnabled;
|
||||||
this._container = container;
|
this._container = container;
|
||||||
this.container.addComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('app', () => this, "PUBLIC" /* PUBLIC */));
|
this.container.addComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('app', () => this, "PUBLIC" /* ComponentType.PUBLIC */));
|
||||||
}
|
}
|
||||||
get automaticDataCollectionEnabled() {
|
get automaticDataCollectionEnabled() {
|
||||||
this.checkDestroyed();
|
this.checkDestroyed();
|
||||||
@@ -17462,7 +17393,7 @@ class FirebaseAppImpl {
|
|||||||
*/
|
*/
|
||||||
checkDestroyed() {
|
checkDestroyed() {
|
||||||
if (this.isDeleted) {
|
if (this.isDeleted) {
|
||||||
throw ERROR_FACTORY.create("app-deleted" /* APP_DELETED */, { appName: this._name });
|
throw ERROR_FACTORY.create("app-deleted" /* AppError.APP_DELETED */, { appName: this._name });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17498,13 +17429,13 @@ function initializeApp(_options, rawConfig = {}) {
|
|||||||
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
|
const config = Object.assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
|
||||||
const name = config.name;
|
const name = config.name;
|
||||||
if (typeof name !== 'string' || !name) {
|
if (typeof name !== 'string' || !name) {
|
||||||
throw ERROR_FACTORY.create("bad-app-name" /* BAD_APP_NAME */, {
|
throw ERROR_FACTORY.create("bad-app-name" /* AppError.BAD_APP_NAME */, {
|
||||||
appName: String(name)
|
appName: String(name)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
options || (options = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getDefaultAppConfig)());
|
options || (options = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getDefaultAppConfig)());
|
||||||
if (!options) {
|
if (!options) {
|
||||||
throw ERROR_FACTORY.create("no-options" /* NO_OPTIONS */);
|
throw ERROR_FACTORY.create("no-options" /* AppError.NO_OPTIONS */);
|
||||||
}
|
}
|
||||||
const existingApp = _apps.get(name);
|
const existingApp = _apps.get(name);
|
||||||
if (existingApp) {
|
if (existingApp) {
|
||||||
@@ -17514,7 +17445,7 @@ function initializeApp(_options, rawConfig = {}) {
|
|||||||
return existingApp;
|
return existingApp;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ERROR_FACTORY.create("duplicate-app" /* DUPLICATE_APP */, { appName: name });
|
throw ERROR_FACTORY.create("duplicate-app" /* AppError.DUPLICATE_APP */, { appName: name });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const container = new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.ComponentContainer(name);
|
const container = new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.ComponentContainer(name);
|
||||||
@@ -17560,7 +17491,7 @@ function getApp(name = DEFAULT_ENTRY_NAME) {
|
|||||||
return initializeApp();
|
return initializeApp();
|
||||||
}
|
}
|
||||||
if (!app) {
|
if (!app) {
|
||||||
throw ERROR_FACTORY.create("no-app" /* NO_APP */, { appName: name });
|
throw ERROR_FACTORY.create("no-app" /* AppError.NO_APP */, { appName: name });
|
||||||
}
|
}
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
@@ -17632,7 +17563,7 @@ function registerVersion(libraryKeyOrName, version, variant) {
|
|||||||
logger.warn(warning.join(' '));
|
logger.warn(warning.join(' '));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component(`${library}-version`, () => ({ library, version }), "VERSION" /* VERSION */));
|
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component(`${library}-version`, () => ({ library, version }), "VERSION" /* ComponentType.VERSION */));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sets log handler for all Firebase SDKs.
|
* Sets log handler for all Firebase SDKs.
|
||||||
@@ -17643,7 +17574,7 @@ function registerVersion(libraryKeyOrName, version, variant) {
|
|||||||
*/
|
*/
|
||||||
function onLog(logCallback, options) {
|
function onLog(logCallback, options) {
|
||||||
if (logCallback !== null && typeof logCallback !== 'function') {
|
if (logCallback !== null && typeof logCallback !== 'function') {
|
||||||
throw ERROR_FACTORY.create("invalid-log-argument" /* INVALID_LOG_ARGUMENT */);
|
throw ERROR_FACTORY.create("invalid-log-argument" /* AppError.INVALID_LOG_ARGUMENT */);
|
||||||
}
|
}
|
||||||
(0,_firebase_logger__WEBPACK_IMPORTED_MODULE_1__.setUserLogHandler)(logCallback, options);
|
(0,_firebase_logger__WEBPACK_IMPORTED_MODULE_1__.setUserLogHandler)(logCallback, options);
|
||||||
}
|
}
|
||||||
@@ -17695,7 +17626,7 @@ function getDbPromise() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
throw ERROR_FACTORY.create("idb-open" /* IDB_OPEN */, {
|
throw ERROR_FACTORY.create("idb-open" /* AppError.IDB_OPEN */, {
|
||||||
originalErrorMessage: e.message
|
originalErrorMessage: e.message
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -17703,7 +17634,6 @@ function getDbPromise() {
|
|||||||
return dbPromise;
|
return dbPromise;
|
||||||
}
|
}
|
||||||
async function readHeartbeatsFromIndexedDB(app) {
|
async function readHeartbeatsFromIndexedDB(app) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
return db
|
return db
|
||||||
@@ -17716,15 +17646,14 @@ async function readHeartbeatsFromIndexedDB(app) {
|
|||||||
logger.warn(e.message);
|
logger.warn(e.message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const idbGetError = ERROR_FACTORY.create("idb-get" /* IDB_GET */, {
|
const idbGetError = ERROR_FACTORY.create("idb-get" /* AppError.IDB_GET */, {
|
||||||
originalErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
||||||
});
|
});
|
||||||
logger.warn(idbGetError.message);
|
logger.warn(idbGetError.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
const tx = db.transaction(STORE_NAME, 'readwrite');
|
const tx = db.transaction(STORE_NAME, 'readwrite');
|
||||||
@@ -17737,8 +17666,8 @@ async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
|||||||
logger.warn(e.message);
|
logger.warn(e.message);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const idbGetError = ERROR_FACTORY.create("idb-set" /* IDB_WRITE */, {
|
const idbGetError = ERROR_FACTORY.create("idb-set" /* AppError.IDB_WRITE */, {
|
||||||
originalErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
originalErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
||||||
});
|
});
|
||||||
logger.warn(idbGetError.message);
|
logger.warn(idbGetError.message);
|
||||||
}
|
}
|
||||||
@@ -17997,8 +17926,8 @@ function countBytes(heartbeatsCache) {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
function registerCoreComponents(variant) {
|
function registerCoreComponents(variant) {
|
||||||
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('platform-logger', container => new PlatformLoggerServiceImpl(container), "PRIVATE" /* PRIVATE */));
|
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('platform-logger', container => new PlatformLoggerServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
|
||||||
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* PRIVATE */));
|
_registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_0__.Component('heartbeat', container => new HeartbeatServiceImpl(container), "PRIVATE" /* ComponentType.PRIVATE */));
|
||||||
// Register `app` package.
|
// Register `app` package.
|
||||||
registerVersion(name$o, version$1, variant);
|
registerVersion(name$o, version$1, variant);
|
||||||
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
||||||
@@ -18055,7 +17984,7 @@ class Component {
|
|||||||
* Properties to be added to the service namespace
|
* Properties to be added to the service namespace
|
||||||
*/
|
*/
|
||||||
this.serviceProps = {};
|
this.serviceProps = {};
|
||||||
this.instantiationMode = "LAZY" /* LAZY */;
|
this.instantiationMode = "LAZY" /* InstantiationMode.LAZY */;
|
||||||
this.onInstanceCreated = null;
|
this.onInstanceCreated = null;
|
||||||
}
|
}
|
||||||
setInstantiationMode(mode) {
|
setInstantiationMode(mode) {
|
||||||
@@ -18361,7 +18290,7 @@ class Provider {
|
|||||||
}
|
}
|
||||||
shouldAutoInitialize() {
|
shouldAutoInitialize() {
|
||||||
return (!!this.component &&
|
return (!!this.component &&
|
||||||
this.component.instantiationMode !== "EXPLICIT" /* EXPLICIT */);
|
this.component.instantiationMode !== "EXPLICIT" /* InstantiationMode.EXPLICIT */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// undefined should be passed to the service factory for the default instance
|
// undefined should be passed to the service factory for the default instance
|
||||||
@@ -18369,7 +18298,7 @@ function normalizeIdentifierForFactory(identifier) {
|
|||||||
return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;
|
return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;
|
||||||
}
|
}
|
||||||
function isComponentEager(component) {
|
function isComponentEager(component) {
|
||||||
return component.instantiationMode === "EAGER" /* EAGER */;
|
return component.instantiationMode === "EAGER" /* InstantiationMode.EAGER */;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18471,7 +18400,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
const name = "@firebase/installations";
|
const name = "@firebase/installations";
|
||||||
const version = "0.5.16";
|
const version = "0.6.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -18514,18 +18443,18 @@ const SERVICE_NAME = 'Installations';
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
const ERROR_DESCRIPTION_MAP = {
|
const ERROR_DESCRIPTION_MAP = {
|
||||||
["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: "{$valueName}"',
|
["missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: "{$valueName}"',
|
||||||
["not-registered" /* NOT_REGISTERED */]: 'Firebase Installation is not registered.',
|
["not-registered" /* ErrorCode.NOT_REGISTERED */]: 'Firebase Installation is not registered.',
|
||||||
["installation-not-found" /* INSTALLATION_NOT_FOUND */]: 'Firebase Installation not found.',
|
["installation-not-found" /* ErrorCode.INSTALLATION_NOT_FOUND */]: 'Firebase Installation not found.',
|
||||||
["request-failed" /* REQUEST_FAILED */]: '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
["request-failed" /* ErrorCode.REQUEST_FAILED */]: '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
||||||
["app-offline" /* APP_OFFLINE */]: 'Could not process request. Application offline.',
|
["app-offline" /* ErrorCode.APP_OFFLINE */]: 'Could not process request. Application offline.',
|
||||||
["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */]: "Can't delete installation while there is a pending registration request."
|
["delete-pending-registration" /* ErrorCode.DELETE_PENDING_REGISTRATION */]: "Can't delete installation while there is a pending registration request."
|
||||||
};
|
};
|
||||||
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_2__.ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
|
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_2__.ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
|
||||||
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
||||||
function isServerError(error) {
|
function isServerError(error) {
|
||||||
return (error instanceof _firebase_util__WEBPACK_IMPORTED_MODULE_2__.FirebaseError &&
|
return (error instanceof _firebase_util__WEBPACK_IMPORTED_MODULE_2__.FirebaseError &&
|
||||||
error.code.includes("request-failed" /* REQUEST_FAILED */));
|
error.code.includes("request-failed" /* ErrorCode.REQUEST_FAILED */));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18550,7 +18479,7 @@ function getInstallationsEndpoint({ projectId }) {
|
|||||||
function extractAuthTokenInfoFromResponse(response) {
|
function extractAuthTokenInfoFromResponse(response) {
|
||||||
return {
|
return {
|
||||||
token: response.token,
|
token: response.token,
|
||||||
requestStatus: 2 /* COMPLETED */,
|
requestStatus: 2 /* RequestStatus.COMPLETED */,
|
||||||
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
||||||
creationTime: Date.now()
|
creationTime: Date.now()
|
||||||
};
|
};
|
||||||
@@ -18558,7 +18487,7 @@ function extractAuthTokenInfoFromResponse(response) {
|
|||||||
async function getErrorFromResponse(requestName, response) {
|
async function getErrorFromResponse(requestName, response) {
|
||||||
const responseJson = await response.json();
|
const responseJson = await response.json();
|
||||||
const errorData = responseJson.error;
|
const errorData = responseJson.error;
|
||||||
return ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, {
|
return ERROR_FACTORY.create("request-failed" /* ErrorCode.REQUEST_FAILED */, {
|
||||||
requestName,
|
requestName,
|
||||||
serverCode: errorData.code,
|
serverCode: errorData.code,
|
||||||
serverMessage: errorData.message,
|
serverMessage: errorData.message,
|
||||||
@@ -18643,7 +18572,7 @@ async function createInstallationRequest({ appConfig, heartbeatServiceProvider }
|
|||||||
const responseValue = await response.json();
|
const responseValue = await response.json();
|
||||||
const registeredInstallationEntry = {
|
const registeredInstallationEntry = {
|
||||||
fid: responseValue.fid || fid,
|
fid: responseValue.fid || fid,
|
||||||
registrationStatus: 2 /* COMPLETED */,
|
registrationStatus: 2 /* RequestStatus.COMPLETED */,
|
||||||
refreshToken: responseValue.refreshToken,
|
refreshToken: responseValue.refreshToken,
|
||||||
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
||||||
};
|
};
|
||||||
@@ -18981,7 +18910,7 @@ async function getInstallationEntry(installations) {
|
|||||||
function updateOrCreateInstallationEntry(oldEntry) {
|
function updateOrCreateInstallationEntry(oldEntry) {
|
||||||
const entry = oldEntry || {
|
const entry = oldEntry || {
|
||||||
fid: generateFid(),
|
fid: generateFid(),
|
||||||
registrationStatus: 0 /* NOT_STARTED */
|
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
||||||
};
|
};
|
||||||
return clearTimedOutRequest(entry);
|
return clearTimedOutRequest(entry);
|
||||||
}
|
}
|
||||||
@@ -18993,10 +18922,10 @@ function updateOrCreateInstallationEntry(oldEntry) {
|
|||||||
* to be registered.
|
* to be registered.
|
||||||
*/
|
*/
|
||||||
function triggerRegistrationIfNecessary(installations, installationEntry) {
|
function triggerRegistrationIfNecessary(installations, installationEntry) {
|
||||||
if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
if (installationEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
// Registration required but app is offline.
|
// Registration required but app is offline.
|
||||||
const registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */));
|
const registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */));
|
||||||
return {
|
return {
|
||||||
installationEntry,
|
installationEntry,
|
||||||
registrationPromise: registrationPromiseWithError
|
registrationPromise: registrationPromiseWithError
|
||||||
@@ -19005,13 +18934,13 @@ function triggerRegistrationIfNecessary(installations, installationEntry) {
|
|||||||
// Try registering. Change status to IN_PROGRESS.
|
// Try registering. Change status to IN_PROGRESS.
|
||||||
const inProgressEntry = {
|
const inProgressEntry = {
|
||||||
fid: installationEntry.fid,
|
fid: installationEntry.fid,
|
||||||
registrationStatus: 1 /* IN_PROGRESS */,
|
registrationStatus: 1 /* RequestStatus.IN_PROGRESS */,
|
||||||
registrationTime: Date.now()
|
registrationTime: Date.now()
|
||||||
};
|
};
|
||||||
const registrationPromise = registerInstallation(installations, inProgressEntry);
|
const registrationPromise = registerInstallation(installations, inProgressEntry);
|
||||||
return { installationEntry: inProgressEntry, registrationPromise };
|
return { installationEntry: inProgressEntry, registrationPromise };
|
||||||
}
|
}
|
||||||
else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) {
|
else if (installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
||||||
return {
|
return {
|
||||||
installationEntry,
|
installationEntry,
|
||||||
registrationPromise: waitUntilFidRegistration(installations)
|
registrationPromise: waitUntilFidRegistration(installations)
|
||||||
@@ -19037,7 +18966,7 @@ async function registerInstallation(installations, installationEntry) {
|
|||||||
// Registration failed. Set FID as not registered.
|
// Registration failed. Set FID as not registered.
|
||||||
await set(installations.appConfig, {
|
await set(installations.appConfig, {
|
||||||
fid: installationEntry.fid,
|
fid: installationEntry.fid,
|
||||||
registrationStatus: 0 /* NOT_STARTED */
|
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
@@ -19049,12 +18978,12 @@ async function waitUntilFidRegistration(installations) {
|
|||||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||||
// so we need to poll.
|
// so we need to poll.
|
||||||
let entry = await updateInstallationRequest(installations.appConfig);
|
let entry = await updateInstallationRequest(installations.appConfig);
|
||||||
while (entry.registrationStatus === 1 /* IN_PROGRESS */) {
|
while (entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
||||||
// createInstallation request still in progress.
|
// createInstallation request still in progress.
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
entry = await updateInstallationRequest(installations.appConfig);
|
entry = await updateInstallationRequest(installations.appConfig);
|
||||||
}
|
}
|
||||||
if (entry.registrationStatus === 0 /* NOT_STARTED */) {
|
if (entry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
||||||
// The request timed out or failed in a different call. Try again.
|
// The request timed out or failed in a different call. Try again.
|
||||||
const { installationEntry, registrationPromise } = await getInstallationEntry(installations);
|
const { installationEntry, registrationPromise } = await getInstallationEntry(installations);
|
||||||
if (registrationPromise) {
|
if (registrationPromise) {
|
||||||
@@ -19078,7 +19007,7 @@ async function waitUntilFidRegistration(installations) {
|
|||||||
function updateInstallationRequest(appConfig) {
|
function updateInstallationRequest(appConfig) {
|
||||||
return update(appConfig, oldEntry => {
|
return update(appConfig, oldEntry => {
|
||||||
if (!oldEntry) {
|
if (!oldEntry) {
|
||||||
throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */);
|
throw ERROR_FACTORY.create("installation-not-found" /* ErrorCode.INSTALLATION_NOT_FOUND */);
|
||||||
}
|
}
|
||||||
return clearTimedOutRequest(oldEntry);
|
return clearTimedOutRequest(oldEntry);
|
||||||
});
|
});
|
||||||
@@ -19087,13 +19016,13 @@ function clearTimedOutRequest(entry) {
|
|||||||
if (hasInstallationRequestTimedOut(entry)) {
|
if (hasInstallationRequestTimedOut(entry)) {
|
||||||
return {
|
return {
|
||||||
fid: entry.fid,
|
fid: entry.fid,
|
||||||
registrationStatus: 0 /* NOT_STARTED */
|
registrationStatus: 0 /* RequestStatus.NOT_STARTED */
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
function hasInstallationRequestTimedOut(installationEntry) {
|
function hasInstallationRequestTimedOut(installationEntry) {
|
||||||
return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ &&
|
return (installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */ &&
|
||||||
installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now());
|
installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19177,14 +19106,14 @@ async function refreshAuthToken(installations, forceRefresh = false) {
|
|||||||
let tokenPromise;
|
let tokenPromise;
|
||||||
const entry = await update(installations.appConfig, oldEntry => {
|
const entry = await update(installations.appConfig, oldEntry => {
|
||||||
if (!isEntryRegistered(oldEntry)) {
|
if (!isEntryRegistered(oldEntry)) {
|
||||||
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
throw ERROR_FACTORY.create("not-registered" /* ErrorCode.NOT_REGISTERED */);
|
||||||
}
|
}
|
||||||
const oldAuthToken = oldEntry.authToken;
|
const oldAuthToken = oldEntry.authToken;
|
||||||
if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
|
if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
|
||||||
// There is a valid token in the DB.
|
// There is a valid token in the DB.
|
||||||
return oldEntry;
|
return oldEntry;
|
||||||
}
|
}
|
||||||
else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) {
|
else if (oldAuthToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
||||||
// There already is a token request in progress.
|
// There already is a token request in progress.
|
||||||
tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh);
|
tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh);
|
||||||
return oldEntry;
|
return oldEntry;
|
||||||
@@ -19192,7 +19121,7 @@ async function refreshAuthToken(installations, forceRefresh = false) {
|
|||||||
else {
|
else {
|
||||||
// No token or token expired.
|
// No token or token expired.
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
throw ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */);
|
||||||
}
|
}
|
||||||
const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
|
const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
|
||||||
tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry);
|
tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry);
|
||||||
@@ -19215,13 +19144,13 @@ async function waitUntilAuthTokenRequest(installations, forceRefresh) {
|
|||||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||||
// so we need to poll.
|
// so we need to poll.
|
||||||
let entry = await updateAuthTokenRequest(installations.appConfig);
|
let entry = await updateAuthTokenRequest(installations.appConfig);
|
||||||
while (entry.authToken.requestStatus === 1 /* IN_PROGRESS */) {
|
while (entry.authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
||||||
// generateAuthToken still in progress.
|
// generateAuthToken still in progress.
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
entry = await updateAuthTokenRequest(installations.appConfig);
|
entry = await updateAuthTokenRequest(installations.appConfig);
|
||||||
}
|
}
|
||||||
const authToken = entry.authToken;
|
const authToken = entry.authToken;
|
||||||
if (authToken.requestStatus === 0 /* NOT_STARTED */) {
|
if (authToken.requestStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
||||||
// The request timed out or failed in a different call. Try again.
|
// The request timed out or failed in a different call. Try again.
|
||||||
return refreshAuthToken(installations, forceRefresh);
|
return refreshAuthToken(installations, forceRefresh);
|
||||||
}
|
}
|
||||||
@@ -19240,11 +19169,11 @@ async function waitUntilAuthTokenRequest(installations, forceRefresh) {
|
|||||||
function updateAuthTokenRequest(appConfig) {
|
function updateAuthTokenRequest(appConfig) {
|
||||||
return update(appConfig, oldEntry => {
|
return update(appConfig, oldEntry => {
|
||||||
if (!isEntryRegistered(oldEntry)) {
|
if (!isEntryRegistered(oldEntry)) {
|
||||||
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
throw ERROR_FACTORY.create("not-registered" /* ErrorCode.NOT_REGISTERED */);
|
||||||
}
|
}
|
||||||
const oldAuthToken = oldEntry.authToken;
|
const oldAuthToken = oldEntry.authToken;
|
||||||
if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
|
if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
|
||||||
return Object.assign(Object.assign({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
return Object.assign(Object.assign({}, oldEntry), { authToken: { requestStatus: 0 /* RequestStatus.NOT_STARTED */ } });
|
||||||
}
|
}
|
||||||
return oldEntry;
|
return oldEntry;
|
||||||
});
|
});
|
||||||
@@ -19264,7 +19193,7 @@ async function fetchAuthTokenFromServer(installations, installationEntry) {
|
|||||||
await remove(installations.appConfig);
|
await remove(installations.appConfig);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), { authToken: { requestStatus: 0 /* RequestStatus.NOT_STARTED */ } });
|
||||||
await set(installations.appConfig, updatedInstallationEntry);
|
await set(installations.appConfig, updatedInstallationEntry);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
@@ -19272,10 +19201,10 @@ async function fetchAuthTokenFromServer(installations, installationEntry) {
|
|||||||
}
|
}
|
||||||
function isEntryRegistered(installationEntry) {
|
function isEntryRegistered(installationEntry) {
|
||||||
return (installationEntry !== undefined &&
|
return (installationEntry !== undefined &&
|
||||||
installationEntry.registrationStatus === 2 /* COMPLETED */);
|
installationEntry.registrationStatus === 2 /* RequestStatus.COMPLETED */);
|
||||||
}
|
}
|
||||||
function isAuthTokenValid(authToken) {
|
function isAuthTokenValid(authToken) {
|
||||||
return (authToken.requestStatus === 2 /* COMPLETED */ &&
|
return (authToken.requestStatus === 2 /* RequestStatus.COMPLETED */ &&
|
||||||
!isAuthTokenExpired(authToken));
|
!isAuthTokenExpired(authToken));
|
||||||
}
|
}
|
||||||
function isAuthTokenExpired(authToken) {
|
function isAuthTokenExpired(authToken) {
|
||||||
@@ -19286,13 +19215,13 @@ function isAuthTokenExpired(authToken) {
|
|||||||
/** Returns an updated InstallationEntry with an InProgressAuthToken. */
|
/** Returns an updated InstallationEntry with an InProgressAuthToken. */
|
||||||
function makeAuthTokenRequestInProgressEntry(oldEntry) {
|
function makeAuthTokenRequestInProgressEntry(oldEntry) {
|
||||||
const inProgressAuthToken = {
|
const inProgressAuthToken = {
|
||||||
requestStatus: 1 /* IN_PROGRESS */,
|
requestStatus: 1 /* RequestStatus.IN_PROGRESS */,
|
||||||
requestTime: Date.now()
|
requestTime: Date.now()
|
||||||
};
|
};
|
||||||
return Object.assign(Object.assign({}, oldEntry), { authToken: inProgressAuthToken });
|
return Object.assign(Object.assign({}, oldEntry), { authToken: inProgressAuthToken });
|
||||||
}
|
}
|
||||||
function hasAuthTokenRequestTimedOut(authToken) {
|
function hasAuthTokenRequestTimedOut(authToken) {
|
||||||
return (authToken.requestStatus === 1 /* IN_PROGRESS */ &&
|
return (authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */ &&
|
||||||
authToken.requestTime + PENDING_TIMEOUT_MS < Date.now());
|
authToken.requestTime + PENDING_TIMEOUT_MS < Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19430,20 +19359,20 @@ function getDeleteEndpoint(appConfig, { fid }) {
|
|||||||
async function deleteInstallations(installations) {
|
async function deleteInstallations(installations) {
|
||||||
const { appConfig } = installations;
|
const { appConfig } = installations;
|
||||||
const entry = await update(appConfig, oldEntry => {
|
const entry = await update(appConfig, oldEntry => {
|
||||||
if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
if (oldEntry && oldEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {
|
||||||
// Delete the unregistered entry without sending a deleteInstallation request.
|
// Delete the unregistered entry without sending a deleteInstallation request.
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return oldEntry;
|
return oldEntry;
|
||||||
});
|
});
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (entry.registrationStatus === 1 /* IN_PROGRESS */) {
|
if (entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {
|
||||||
// Can't delete while trying to register.
|
// Can't delete while trying to register.
|
||||||
throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */);
|
throw ERROR_FACTORY.create("delete-pending-registration" /* ErrorCode.DELETE_PENDING_REGISTRATION */);
|
||||||
}
|
}
|
||||||
else if (entry.registrationStatus === 2 /* COMPLETED */) {
|
else if (entry.registrationStatus === 2 /* RequestStatus.COMPLETED */) {
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
throw ERROR_FACTORY.create("app-offline" /* ErrorCode.APP_OFFLINE */);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await deleteInstallationRequest(appConfig, entry);
|
await deleteInstallationRequest(appConfig, entry);
|
||||||
@@ -19556,7 +19485,7 @@ function extractAppConfig(app) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function getMissingValueError(valueName) {
|
function getMissingValueError(valueName) {
|
||||||
return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, {
|
return ERROR_FACTORY.create("missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */, {
|
||||||
valueName
|
valueName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -19603,8 +19532,8 @@ const internalFactory = (container) => {
|
|||||||
return installationsInternal;
|
return installationsInternal;
|
||||||
};
|
};
|
||||||
function registerInstallations() {
|
function registerInstallations() {
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component(INSTALLATIONS_NAME, publicFactory, "PUBLIC" /* PUBLIC */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component(INSTALLATIONS_NAME, publicFactory, "PUBLIC" /* ComponentType.PUBLIC */));
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component(INSTALLATIONS_NAME_INTERNAL, internalFactory, "PRIVATE" /* PRIVATE */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component(INSTALLATIONS_NAME_INTERNAL, internalFactory, "PRIVATE" /* ComponentType.PRIVATE */));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20195,26 +20124,26 @@ function getKey({ appConfig }) {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
const ERROR_MAP = {
|
const ERROR_MAP = {
|
||||||
["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: "{$valueName}"',
|
["missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: "{$valueName}"',
|
||||||
["only-available-in-window" /* AVAILABLE_IN_WINDOW */]: 'This method is available in a Window context.',
|
["only-available-in-window" /* ErrorCode.AVAILABLE_IN_WINDOW */]: 'This method is available in a Window context.',
|
||||||
["only-available-in-sw" /* AVAILABLE_IN_SW */]: 'This method is available in a service worker context.',
|
["only-available-in-sw" /* ErrorCode.AVAILABLE_IN_SW */]: 'This method is available in a service worker context.',
|
||||||
["permission-default" /* PERMISSION_DEFAULT */]: 'The notification permission was not granted and dismissed instead.',
|
["permission-default" /* ErrorCode.PERMISSION_DEFAULT */]: 'The notification permission was not granted and dismissed instead.',
|
||||||
["permission-blocked" /* PERMISSION_BLOCKED */]: 'The notification permission was not granted and blocked instead.',
|
["permission-blocked" /* ErrorCode.PERMISSION_BLOCKED */]: 'The notification permission was not granted and blocked instead.',
|
||||||
["unsupported-browser" /* UNSUPPORTED_BROWSER */]: "This browser doesn't support the API's required to use the Firebase SDK.",
|
["unsupported-browser" /* ErrorCode.UNSUPPORTED_BROWSER */]: "This browser doesn't support the API's required to use the Firebase SDK.",
|
||||||
["indexed-db-unsupported" /* INDEXED_DB_UNSUPPORTED */]: "This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)",
|
["indexed-db-unsupported" /* ErrorCode.INDEXED_DB_UNSUPPORTED */]: "This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)",
|
||||||
["failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */]: 'We are unable to register the default service worker. {$browserErrorMessage}',
|
["failed-service-worker-registration" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */]: 'We are unable to register the default service worker. {$browserErrorMessage}',
|
||||||
["token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */]: 'A problem occurred while subscribing the user to FCM: {$errorInfo}',
|
["token-subscribe-failed" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */]: 'A problem occurred while subscribing the user to FCM: {$errorInfo}',
|
||||||
["token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */]: 'FCM returned no token when subscribing the user to push.',
|
["token-subscribe-no-token" /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */]: 'FCM returned no token when subscribing the user to push.',
|
||||||
["token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */]: 'A problem occurred while unsubscribing the ' +
|
["token-unsubscribe-failed" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */]: 'A problem occurred while unsubscribing the ' +
|
||||||
'user from FCM: {$errorInfo}',
|
'user from FCM: {$errorInfo}',
|
||||||
["token-update-failed" /* TOKEN_UPDATE_FAILED */]: 'A problem occurred while updating the user from FCM: {$errorInfo}',
|
["token-update-failed" /* ErrorCode.TOKEN_UPDATE_FAILED */]: 'A problem occurred while updating the user from FCM: {$errorInfo}',
|
||||||
["token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */]: 'FCM returned no token when updating the user to push.',
|
["token-update-no-token" /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */]: 'FCM returned no token when updating the user to push.',
|
||||||
["use-sw-after-get-token" /* USE_SW_AFTER_GET_TOKEN */]: 'The useServiceWorker() method may only be called once and must be ' +
|
["use-sw-after-get-token" /* ErrorCode.USE_SW_AFTER_GET_TOKEN */]: 'The useServiceWorker() method may only be called once and must be ' +
|
||||||
'called before calling getToken() to ensure your service worker is used.',
|
'called before calling getToken() to ensure your service worker is used.',
|
||||||
["invalid-sw-registration" /* INVALID_SW_REGISTRATION */]: 'The input to useServiceWorker() must be a ServiceWorkerRegistration.',
|
["invalid-sw-registration" /* ErrorCode.INVALID_SW_REGISTRATION */]: 'The input to useServiceWorker() must be a ServiceWorkerRegistration.',
|
||||||
["invalid-bg-handler" /* INVALID_BG_HANDLER */]: 'The input to setBackgroundMessageHandler() must be a function.',
|
["invalid-bg-handler" /* ErrorCode.INVALID_BG_HANDLER */]: 'The input to setBackgroundMessageHandler() must be a function.',
|
||||||
["invalid-vapid-key" /* INVALID_VAPID_KEY */]: 'The public VAPID key must be a string.',
|
["invalid-vapid-key" /* ErrorCode.INVALID_VAPID_KEY */]: 'The public VAPID key must be a string.',
|
||||||
["use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */]: 'The usePublicVapidKey() method may only be called once and must be ' +
|
["use-vapid-key-after-get-token" /* ErrorCode.USE_VAPID_KEY_AFTER_GET_TOKEN */]: 'The usePublicVapidKey() method may only be called once and must be ' +
|
||||||
'called before calling getToken() to ensure your VAPID key is used.'
|
'called before calling getToken() to ensure your VAPID key is used.'
|
||||||
};
|
};
|
||||||
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_3__.ErrorFactory('messaging', 'Messaging', ERROR_MAP);
|
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_3__.ErrorFactory('messaging', 'Messaging', ERROR_MAP);
|
||||||
@@ -20236,7 +20165,6 @@ const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_3__.ErrorFacto
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
async function requestGetToken(firebaseDependencies, subscriptionOptions) {
|
async function requestGetToken(firebaseDependencies, subscriptionOptions) {
|
||||||
var _a;
|
|
||||||
const headers = await getHeaders(firebaseDependencies);
|
const headers = await getHeaders(firebaseDependencies);
|
||||||
const body = getBody(subscriptionOptions);
|
const body = getBody(subscriptionOptions);
|
||||||
const subscribeOptions = {
|
const subscribeOptions = {
|
||||||
@@ -20250,23 +20178,22 @@ async function requestGetToken(firebaseDependencies, subscriptionOptions) {
|
|||||||
responseData = await response.json();
|
responseData = await response.json();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, {
|
throw ERROR_FACTORY.create("token-subscribe-failed" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */, {
|
||||||
errorInfo: (_a = err) === null || _a === void 0 ? void 0 : _a.toString()
|
errorInfo: err === null || err === void 0 ? void 0 : err.toString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (responseData.error) {
|
if (responseData.error) {
|
||||||
const message = responseData.error.message;
|
const message = responseData.error.message;
|
||||||
throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, {
|
throw ERROR_FACTORY.create("token-subscribe-failed" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */, {
|
||||||
errorInfo: message
|
errorInfo: message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!responseData.token) {
|
if (!responseData.token) {
|
||||||
throw ERROR_FACTORY.create("token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */);
|
throw ERROR_FACTORY.create("token-subscribe-no-token" /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */);
|
||||||
}
|
}
|
||||||
return responseData.token;
|
return responseData.token;
|
||||||
}
|
}
|
||||||
async function requestUpdateToken(firebaseDependencies, tokenDetails) {
|
async function requestUpdateToken(firebaseDependencies, tokenDetails) {
|
||||||
var _a;
|
|
||||||
const headers = await getHeaders(firebaseDependencies);
|
const headers = await getHeaders(firebaseDependencies);
|
||||||
const body = getBody(tokenDetails.subscriptionOptions);
|
const body = getBody(tokenDetails.subscriptionOptions);
|
||||||
const updateOptions = {
|
const updateOptions = {
|
||||||
@@ -20280,23 +20207,22 @@ async function requestUpdateToken(firebaseDependencies, tokenDetails) {
|
|||||||
responseData = await response.json();
|
responseData = await response.json();
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, {
|
throw ERROR_FACTORY.create("token-update-failed" /* ErrorCode.TOKEN_UPDATE_FAILED */, {
|
||||||
errorInfo: (_a = err) === null || _a === void 0 ? void 0 : _a.toString()
|
errorInfo: err === null || err === void 0 ? void 0 : err.toString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (responseData.error) {
|
if (responseData.error) {
|
||||||
const message = responseData.error.message;
|
const message = responseData.error.message;
|
||||||
throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, {
|
throw ERROR_FACTORY.create("token-update-failed" /* ErrorCode.TOKEN_UPDATE_FAILED */, {
|
||||||
errorInfo: message
|
errorInfo: message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!responseData.token) {
|
if (!responseData.token) {
|
||||||
throw ERROR_FACTORY.create("token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */);
|
throw ERROR_FACTORY.create("token-update-no-token" /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */);
|
||||||
}
|
}
|
||||||
return responseData.token;
|
return responseData.token;
|
||||||
}
|
}
|
||||||
async function requestDeleteToken(firebaseDependencies, token) {
|
async function requestDeleteToken(firebaseDependencies, token) {
|
||||||
var _a;
|
|
||||||
const headers = await getHeaders(firebaseDependencies);
|
const headers = await getHeaders(firebaseDependencies);
|
||||||
const unsubscribeOptions = {
|
const unsubscribeOptions = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -20307,14 +20233,14 @@ async function requestDeleteToken(firebaseDependencies, token) {
|
|||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
if (responseData.error) {
|
if (responseData.error) {
|
||||||
const message = responseData.error.message;
|
const message = responseData.error.message;
|
||||||
throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, {
|
throw ERROR_FACTORY.create("token-unsubscribe-failed" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */, {
|
||||||
errorInfo: message
|
errorInfo: message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, {
|
throw ERROR_FACTORY.create("token-unsubscribe-failed" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */, {
|
||||||
errorInfo: (_a = err) === null || _a === void 0 ? void 0 : _a.toString()
|
errorInfo: err === null || err === void 0 ? void 0 : err.toString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20637,7 +20563,7 @@ function extractAppConfig(app) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function getMissingValueError(valueName) {
|
function getMissingValueError(valueName) {
|
||||||
return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, {
|
return ERROR_FACTORY.create("missing-app-config-values" /* ErrorCode.MISSING_APP_CONFIG_VALUES */, {
|
||||||
valueName
|
valueName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -20696,7 +20622,6 @@ class MessagingService {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
async function registerDefaultSw(messaging) {
|
async function registerDefaultSw(messaging) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
messaging.swRegistration = await navigator.serviceWorker.register(DEFAULT_SW_PATH, {
|
messaging.swRegistration = await navigator.serviceWorker.register(DEFAULT_SW_PATH, {
|
||||||
scope: DEFAULT_SW_SCOPE
|
scope: DEFAULT_SW_SCOPE
|
||||||
@@ -20711,8 +20636,8 @@ async function registerDefaultSw(messaging) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw ERROR_FACTORY.create("failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */, {
|
throw ERROR_FACTORY.create("failed-service-worker-registration" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */, {
|
||||||
browserErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
browserErrorMessage: e === null || e === void 0 ? void 0 : e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20741,7 +20666,7 @@ async function updateSwReg(messaging, swRegistration) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(swRegistration instanceof ServiceWorkerRegistration)) {
|
if (!(swRegistration instanceof ServiceWorkerRegistration)) {
|
||||||
throw ERROR_FACTORY.create("invalid-sw-registration" /* INVALID_SW_REGISTRATION */);
|
throw ERROR_FACTORY.create("invalid-sw-registration" /* ErrorCode.INVALID_SW_REGISTRATION */);
|
||||||
}
|
}
|
||||||
messaging.swRegistration = swRegistration;
|
messaging.swRegistration = swRegistration;
|
||||||
}
|
}
|
||||||
@@ -20789,13 +20714,13 @@ async function updateVapidKey(messaging, vapidKey) {
|
|||||||
*/
|
*/
|
||||||
async function getToken$1(messaging, options) {
|
async function getToken$1(messaging, options) {
|
||||||
if (!navigator) {
|
if (!navigator) {
|
||||||
throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
|
throw ERROR_FACTORY.create("only-available-in-window" /* ErrorCode.AVAILABLE_IN_WINDOW */);
|
||||||
}
|
}
|
||||||
if (Notification.permission === 'default') {
|
if (Notification.permission === 'default') {
|
||||||
await Notification.requestPermission();
|
await Notification.requestPermission();
|
||||||
}
|
}
|
||||||
if (Notification.permission !== 'granted') {
|
if (Notification.permission !== 'granted') {
|
||||||
throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */);
|
throw ERROR_FACTORY.create("permission-blocked" /* ErrorCode.PERMISSION_BLOCKED */);
|
||||||
}
|
}
|
||||||
await updateVapidKey(messaging, options === null || options === void 0 ? void 0 : options.vapidKey);
|
await updateVapidKey(messaging, options === null || options === void 0 ? void 0 : options.vapidKey);
|
||||||
await updateSwReg(messaging, options === null || options === void 0 ? void 0 : options.serviceWorkerRegistration);
|
await updateSwReg(messaging, options === null || options === void 0 ? void 0 : options.serviceWorkerRegistration);
|
||||||
@@ -20880,7 +20805,7 @@ async function messageEventListener(messaging, event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const name = "@firebase/messaging";
|
const name = "@firebase/messaging";
|
||||||
const version = "0.11.0";
|
const version = "0.12.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -20913,8 +20838,8 @@ const WindowMessagingInternalFactory = (container) => {
|
|||||||
return messagingInternal;
|
return messagingInternal;
|
||||||
};
|
};
|
||||||
function registerMessagingInWindow() {
|
function registerMessagingInWindow() {
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* PUBLIC */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* ComponentType.PUBLIC */));
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* PRIVATE */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* ComponentType.PRIVATE */));
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version);
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version);
|
||||||
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version, 'esm2017');
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version, 'esm2017');
|
||||||
@@ -20983,7 +20908,7 @@ async function isWindowSupported() {
|
|||||||
*/
|
*/
|
||||||
async function deleteToken$1(messaging) {
|
async function deleteToken$1(messaging) {
|
||||||
if (!navigator) {
|
if (!navigator) {
|
||||||
throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
|
throw ERROR_FACTORY.create("only-available-in-window" /* ErrorCode.AVAILABLE_IN_WINDOW */);
|
||||||
}
|
}
|
||||||
if (!messaging.swRegistration) {
|
if (!messaging.swRegistration) {
|
||||||
await registerDefaultSw(messaging);
|
await registerDefaultSw(messaging);
|
||||||
@@ -21009,7 +20934,7 @@ async function deleteToken$1(messaging) {
|
|||||||
*/
|
*/
|
||||||
function onMessage$1(messaging, nextOrObserver) {
|
function onMessage$1(messaging, nextOrObserver) {
|
||||||
if (!navigator) {
|
if (!navigator) {
|
||||||
throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
|
throw ERROR_FACTORY.create("only-available-in-window" /* ErrorCode.AVAILABLE_IN_WINDOW */);
|
||||||
}
|
}
|
||||||
messaging.onMessageHandler = nextOrObserver;
|
messaging.onMessageHandler = nextOrObserver;
|
||||||
return () => {
|
return () => {
|
||||||
@@ -21048,11 +20973,11 @@ function getMessagingInWindow(app = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4_
|
|||||||
isWindowSupported().then(isSupported => {
|
isWindowSupported().then(isSupported => {
|
||||||
// If `isWindowSupported()` resolved, but returned false.
|
// If `isWindowSupported()` resolved, but returned false.
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
throw ERROR_FACTORY.create("unsupported-browser" /* UNSUPPORTED_BROWSER */);
|
throw ERROR_FACTORY.create("unsupported-browser" /* ErrorCode.UNSUPPORTED_BROWSER */);
|
||||||
}
|
}
|
||||||
}, _ => {
|
}, _ => {
|
||||||
// If `isWindowSupported()` rejected.
|
// If `isWindowSupported()` rejected.
|
||||||
throw ERROR_FACTORY.create("indexed-db-unsupported" /* INDEXED_DB_UNSUPPORTED */);
|
throw ERROR_FACTORY.create("indexed-db-unsupported" /* ErrorCode.INDEXED_DB_UNSUPPORTED */);
|
||||||
});
|
});
|
||||||
return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._getProvider)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(app), 'messaging').getImmediate();
|
return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._getProvider)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(app), 'messaging').getImmediate();
|
||||||
}
|
}
|
||||||
@@ -21118,6 +21043,83 @@ registerMessagingInWindow();
|
|||||||
//# sourceMappingURL=index.esm2017.js.map
|
//# sourceMappingURL=index.esm2017.js.map
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/firebase/app/dist/esm/index.esm.js":
|
||||||
|
/*!*********************************************************!*\
|
||||||
|
!*** ./node_modules/firebase/app/dist/esm/index.esm.js ***!
|
||||||
|
\*********************************************************/
|
||||||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "FirebaseError": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.FirebaseError),
|
||||||
|
/* harmony export */ "SDK_VERSION": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.SDK_VERSION),
|
||||||
|
/* harmony export */ "_DEFAULT_ENTRY_NAME": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._DEFAULT_ENTRY_NAME),
|
||||||
|
/* harmony export */ "_addComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addComponent),
|
||||||
|
/* harmony export */ "_addOrOverwriteComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._addOrOverwriteComponent),
|
||||||
|
/* harmony export */ "_apps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._apps),
|
||||||
|
/* harmony export */ "_clearComponents": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._clearComponents),
|
||||||
|
/* harmony export */ "_components": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._components),
|
||||||
|
/* harmony export */ "_getProvider": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._getProvider),
|
||||||
|
/* harmony export */ "_registerComponent": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._registerComponent),
|
||||||
|
/* harmony export */ "_removeServiceInstance": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__._removeServiceInstance),
|
||||||
|
/* harmony export */ "deleteApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.deleteApp),
|
||||||
|
/* harmony export */ "getApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApp),
|
||||||
|
/* harmony export */ "getApps": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.getApps),
|
||||||
|
/* harmony export */ "initializeApp": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.initializeApp),
|
||||||
|
/* harmony export */ "onLog": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.onLog),
|
||||||
|
/* harmony export */ "registerVersion": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion),
|
||||||
|
/* harmony export */ "setLogLevel": () => (/* reexport safe */ _firebase_app__WEBPACK_IMPORTED_MODULE_0__.setLogLevel)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var name = "firebase";
|
||||||
|
var version = "9.15.0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2020 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.
|
||||||
|
*/
|
||||||
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_0__.registerVersion)(name, version, 'app');
|
||||||
|
//# sourceMappingURL=index.esm.js.map
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ "./node_modules/firebase/messaging/dist/esm/index.esm.js":
|
||||||
|
/*!***************************************************************!*\
|
||||||
|
!*** ./node_modules/firebase/messaging/dist/esm/index.esm.js ***!
|
||||||
|
\***************************************************************/
|
||||||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
__webpack_require__.r(__webpack_exports__);
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ "deleteToken": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.deleteToken),
|
||||||
|
/* harmony export */ "getMessaging": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.getMessaging),
|
||||||
|
/* harmony export */ "getToken": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.getToken),
|
||||||
|
/* harmony export */ "isSupported": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.isSupported),
|
||||||
|
/* harmony export */ "onMessage": () => (/* reexport safe */ _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__.onMessage)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var _firebase_messaging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/messaging */ "./node_modules/@firebase/messaging/dist/esm/index.esm2017.js");
|
||||||
|
|
||||||
|
//# sourceMappingURL=index.esm.js.map
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./node_modules/idb/build/index.js":
|
/***/ "./node_modules/idb/build/index.js":
|
||||||
|
|||||||
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
+6
-3
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user