@firebase/messaging
Advanced tools
Comparing version
@@ -134,3 +134,2 @@ 'use strict'; | ||
upgrade: async (db, oldVersion, newVersion, upgradeTransaction) => { | ||
var _a; | ||
if (oldVersion < 2) { | ||
@@ -158,3 +157,3 @@ // Database too old, skip migration. | ||
token: oldDetails.fcmToken, | ||
createTime: (_a = oldDetails.createTime) !== null && _a !== void 0 ? _a : Date.now(), | ||
createTime: oldDetails.createTime ?? Date.now(), | ||
subscriptionOptions: { | ||
@@ -380,3 +379,3 @@ auth: oldDetails.auth, | ||
throw ERROR_FACTORY.create("token-subscribe-failed" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */, { | ||
errorInfo: err === null || err === void 0 ? void 0 : err.toString() | ||
errorInfo: err?.toString() | ||
}); | ||
@@ -410,3 +409,3 @@ } | ||
throw ERROR_FACTORY.create("token-update-failed" /* ErrorCode.TOKEN_UPDATE_FAILED */, { | ||
errorInfo: err === null || err === void 0 ? void 0 : err.toString() | ||
errorInfo: err?.toString() | ||
}); | ||
@@ -443,3 +442,3 @@ } | ||
throw ERROR_FACTORY.create("token-unsubscribe-failed" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */, { | ||
errorInfo: err === null || err === void 0 ? void 0 : err.toString() | ||
errorInfo: err?.toString() | ||
}); | ||
@@ -551,3 +550,7 @@ } | ||
const updatedToken = await requestUpdateToken(messaging.firebaseDependencies, tokenDetails); | ||
const updatedTokenDetails = Object.assign(Object.assign({}, tokenDetails), { token: updatedToken, createTime: Date.now() }); | ||
const updatedTokenDetails = { | ||
...tokenDetails, | ||
token: updatedToken, | ||
createTime: Date.now() | ||
}; | ||
await dbSet(messaging.firebaseDependencies, updatedTokenDetails); | ||
@@ -654,10 +657,10 @@ return updatedToken; | ||
function propagateFcmOptions(payload, messagePayloadInternal) { | ||
var _a, _b, _c, _d, _e; | ||
// fcmOptions.link value is written into notification.click_action. see more in b/232072111 | ||
if (!messagePayloadInternal.fcmOptions && | ||
!((_a = messagePayloadInternal.notification) === null || _a === void 0 ? void 0 : _a.click_action)) { | ||
!messagePayloadInternal.notification?.click_action) { | ||
return; | ||
} | ||
payload.fcmOptions = {}; | ||
const link = (_c = (_b = messagePayloadInternal.fcmOptions) === null || _b === void 0 ? void 0 : _b.link) !== null && _c !== void 0 ? _c : (_d = messagePayloadInternal.notification) === null || _d === void 0 ? void 0 : _d.click_action; | ||
const link = messagePayloadInternal.fcmOptions?.link ?? | ||
messagePayloadInternal.notification?.click_action; | ||
if (!!link) { | ||
@@ -667,3 +670,3 @@ payload.fcmOptions.link = link; | ||
// eslint-disable-next-line camelcase | ||
const analyticsLabel = (_e = messagePayloadInternal.fcmOptions) === null || _e === void 0 ? void 0 : _e.analytics_label; | ||
const analyticsLabel = messagePayloadInternal.fcmOptions?.analytics_label; | ||
if (!!analyticsLabel) { | ||
@@ -843,3 +846,3 @@ payload.fcmOptions.analyticsLabel = analyticsLabel; | ||
throw ERROR_FACTORY.create("failed-service-worker-registration" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */, { | ||
browserErrorMessage: e === null || e === void 0 ? void 0 : e.message | ||
browserErrorMessage: e?.message | ||
}); | ||
@@ -867,4 +870,3 @@ } | ||
incomingSw.onstatechange = ev => { | ||
var _a; | ||
if (((_a = ev.target) === null || _a === void 0 ? void 0 : _a.state) === 'activated') { | ||
if (ev.target?.state === 'activated') { | ||
incomingSw.onstatechange = null; | ||
@@ -963,4 +965,4 @@ clearTimeout(rejectTimeout); | ||
} | ||
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 updateVapidKey(messaging, options?.vapidKey); | ||
await updateSwReg(messaging, options?.serviceWorkerRegistration); | ||
return getTokenInternal(messaging); | ||
@@ -1047,3 +1049,3 @@ } | ||
const name = "@firebase/messaging"; | ||
const version = "0.12.22"; | ||
const version = "0.12.23-20250715195345"; | ||
@@ -1084,4 +1086,4 @@ /** | ||
app.registerVersion(name, version); | ||
// BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation | ||
app.registerVersion(name, version, 'cjs2017'); | ||
// BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation | ||
app.registerVersion(name, version, 'cjs2020'); | ||
} | ||
@@ -1088,0 +1090,0 @@ |
{ | ||
"name": "@firebase/messaging", | ||
"version": "0.12.22", | ||
"version": "0.12.23-20250715195345", | ||
"description": "", | ||
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"main": "dist/index.cjs.js", | ||
"browser": "dist/esm/index.esm2017.js", | ||
"module": "dist/esm/index.esm2017.js", | ||
"sw": "dist/esm/index.sw.esm2017.js", | ||
"browser": "dist/esm/index.esm.js", | ||
"module": "dist/esm/index.esm.js", | ||
"sw": "dist/esm/index.sw.esm.js", | ||
"sw-main": "dist/index.sw.cjs", | ||
@@ -15,4 +15,4 @@ "exports": { | ||
"require": "./dist/index.cjs.js", | ||
"module": "./dist/esm/index.esm2017.js", | ||
"default": "./dist/esm/index.esm2017.js" | ||
"module": "./dist/esm/index.esm.js", | ||
"default": "./dist/esm/index.esm.js" | ||
}, | ||
@@ -22,3 +22,3 @@ "./sw": { | ||
"require": "./dist/index.sw.cjs", | ||
"default": "./dist/esm/index.sw.esm2017.js" | ||
"default": "./dist/esm/index.sw.esm.js" | ||
}, | ||
@@ -54,9 +54,9 @@ "./package.json": "./package.json" | ||
"peerDependencies": { | ||
"@firebase/app": "0.x" | ||
"@firebase/app": "0.14.0-20250715195345" | ||
}, | ||
"dependencies": { | ||
"@firebase/installations": "0.6.18", | ||
"@firebase/installations": "0.6.19-20250715195345", | ||
"@firebase/messaging-interop-types": "0.2.3", | ||
"@firebase/util": "1.12.1", | ||
"@firebase/component": "0.6.18", | ||
"@firebase/util": "1.13.0-20250715195345", | ||
"@firebase/component": "0.7.0-20250715195345", | ||
"idb": "7.1.1", | ||
@@ -66,3 +66,3 @@ "tslib": "^2.1.0" | ||
"devDependencies": { | ||
"@firebase/app": "0.13.2", | ||
"@firebase/app": "0.14.0-20250715195345", | ||
"rollup": "2.79.2", | ||
@@ -69,0 +69,0 @@ "rollup-plugin-typescript2": "0.36.0", |
@@ -6,4 +6,4 @@ { | ||
"main": "../dist/index.sw.cjs", | ||
"module": "../dist/esm/index.sw.esm2017.js", | ||
"module": "../dist/esm/index.sw.esm.js", | ||
"typings": "../dist/src/index.sw.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
9072
0.04%764584
-0.92%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed