@quintype/framework 7.3.2-node16.1 → 7.3.2-node16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/impl/fcm.js +17 -26
- package/client/start.js +4 -4
- package/package.json +3 -3
package/client/impl/fcm.js
CHANGED
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
export function initializeFCM(
|
|
2
|
-
if (!
|
|
3
|
-
console.log("
|
|
1
|
+
export function initializeFCM(firebaseConfig) {
|
|
2
|
+
if (!firebaseConfig.messagingSenderId) {
|
|
3
|
+
console.log("messagingSenderId is required");
|
|
4
4
|
return false;
|
|
5
5
|
}
|
|
6
6
|
Promise.all([
|
|
7
7
|
import(/* webpackChunkName: "firebase-app" */ "firebase/app"),
|
|
8
8
|
import(/* webpackChunkName: "firebase-messaging" */ "firebase/messaging"),
|
|
9
|
-
])
|
|
10
|
-
|
|
11
|
-
firebase.initializeApp({
|
|
12
|
-
messagingSenderId:
|
|
9
|
+
])
|
|
10
|
+
.then(([firebase, m]) => {
|
|
11
|
+
const app = firebase.initializeApp({
|
|
12
|
+
messagingSenderId: firebaseConfig.messagingSenderId.toString(),
|
|
13
|
+
projectId: firebaseConfig.projectId,
|
|
14
|
+
apiKey: firebaseConfig.apiKey,
|
|
15
|
+
storageBucket: firebaseConfig.storageBucket,
|
|
16
|
+
authDomain: firebaseConfig.authDomain,
|
|
17
|
+
appId: firebaseConfig.appId,
|
|
13
18
|
});
|
|
14
|
-
const messaging =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
messaging.onTokenRefresh(() => updateToken(firebase));
|
|
19
|
-
})
|
|
20
|
-
.catch(console.error);
|
|
21
|
-
});
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error(error);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function updateToken(firebaseInstance) {
|
|
29
|
-
return firebaseInstance
|
|
30
|
-
.messaging()
|
|
31
|
-
.getToken()
|
|
19
|
+
const messaging = m.getMessaging(app);
|
|
20
|
+
return m.getToken(messaging);
|
|
21
|
+
// No need to refresh token https://github.com/firebase/firebase-js-sdk/issues/4132
|
|
22
|
+
})
|
|
32
23
|
.then((token) => {
|
|
33
24
|
return registerFCMTopic(token);
|
|
34
25
|
})
|
|
35
26
|
.catch((err) => {
|
|
36
|
-
|
|
27
|
+
console.error(err);
|
|
37
28
|
});
|
|
38
29
|
}
|
|
39
30
|
|
package/client/start.js
CHANGED
|
@@ -282,10 +282,10 @@ export function startApp(renderApplication, reducers, opts) {
|
|
|
282
282
|
|
|
283
283
|
store.dispatch({ type: NAVIGATE_TO_PAGE, page, currentPath: path });
|
|
284
284
|
|
|
285
|
-
if (opts.
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
mssgSenderId && initializeFCM(
|
|
285
|
+
if (opts.firebaseConfig) {
|
|
286
|
+
const fcm = typeof opts.firebaseConfig === "function" ? opts.firebaseConfig(page) : opts.firebaseConfig;
|
|
287
|
+
const mssgSenderId = fcm.messagingSenderId;
|
|
288
|
+
mssgSenderId && initializeFCM(fcm);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
const { config: { "theme-attributes": pageThemeAttributes = {} } = {} } = page;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.3.2-node16.
|
|
3
|
+
"version": "7.3.2-node16.4",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,8 +31,9 @@
|
|
|
31
31
|
"@quintype/backend": "^2.3.1",
|
|
32
32
|
"@quintype/components": "^3.0.0",
|
|
33
33
|
"@quintype/prerender-node": "^3.2.24",
|
|
34
|
-
"@quintype/seo": "^1.
|
|
34
|
+
"@quintype/seo": "^1.39.0",
|
|
35
35
|
"atob": "^2.1.2",
|
|
36
|
+
"babel-plugin-react-css-modules": "^5.2.6",
|
|
36
37
|
"chalk": "^4.1.2",
|
|
37
38
|
"cluster": "^0.7.7",
|
|
38
39
|
"compression": "^1.7.4",
|
|
@@ -62,7 +63,6 @@
|
|
|
62
63
|
"@loadable/server": "^5.15.1",
|
|
63
64
|
"@quintype/build": "^3.13.1",
|
|
64
65
|
"babel-plugin-quintype-assets": "^1.1.1",
|
|
65
|
-
"babel-plugin-react-css-modules": "^5.2.6",
|
|
66
66
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
67
67
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
68
68
|
"babel-preset-es2015": "^6.24.1",
|