@quintype/framework 7.34.0-gulfnews-amp-changes.0 → 7.34.0
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/CHANGELOG.md +29 -0
- package/README.md +1 -1
- package/client/impl/fcm.js +2 -3
- package/package.json +12 -7
- package/server/handlers/fcm-registration-handler.js +21 -25
- package/server/handlers/isomorphic-handler.js +4 -2
- package/server/routes.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [7.34.0](https://github.com/quintype/quintype-node-framework/compare/v7.33.6...v7.34.0) (2025-03-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* support JW player ([#459](https://github.com/quintype/quintype-node-framework/issues/459)) ([ce325df](https://github.com/quintype/quintype-node-framework/commit/ce325dfea69d4dc806b2b767c43d782dd096099e))
|
|
11
|
+
|
|
12
|
+
### [7.33.6](https://github.com/quintype/quintype-node-framework/compare/v7.33.5...v7.33.6) (2025-03-17)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **FCM:** remove deprecated server key & use firebase admin to register to topic ([#458](https://github.com/quintype/quintype-node-framework/issues/458)) ([b179dd4](https://github.com/quintype/quintype-node-framework/commit/b179dd4594e94cf5639b020b1991a061c6c11105))
|
|
18
|
+
|
|
19
|
+
### [7.33.5](https://github.com/quintype/quintype-node-framework/compare/v7.33.4...v7.33.5) (2025-02-13)
|
|
20
|
+
|
|
21
|
+
### [7.33.4](https://github.com/quintype/quintype-node-framework/compare/v7.33.3...v7.33.4) (2025-02-13)
|
|
22
|
+
|
|
23
|
+
### [7.33.3](https://github.com/quintype/quintype-node-framework/compare/v7.33.2...v7.33.3) (2025-02-13)
|
|
24
|
+
|
|
25
|
+
### [7.33.2](https://github.com/quintype/quintype-node-framework/compare/v7.33.1...v7.33.2) (2025-02-13)
|
|
26
|
+
|
|
27
|
+
### [7.33.1](https://github.com/quintype/quintype-node-framework/compare/v7.33.0...v7.33.1) (2025-01-20)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **Static routes:** support 404 if no loader ([#452](https://github.com/quintype/quintype-node-framework/issues/452)) ([735b778](https://github.com/quintype/quintype-node-framework/commit/735b77887ae0359b85fde8db1a203f7576244a3b))
|
|
33
|
+
|
|
5
34
|
## [7.33.0](https://github.com/quintype/quintype-node-framework/compare/v7.32.0...v7.33.0) (2024-12-10)
|
|
6
35
|
|
|
7
36
|
|
package/README.md
CHANGED
|
@@ -171,7 +171,7 @@ startApp(renderApplication,
|
|
|
171
171
|
```js
|
|
172
172
|
isomorphicRoutes(app, {
|
|
173
173
|
...
|
|
174
|
-
|
|
174
|
+
fcmServiceCreds: (config) => <ServiceCreds> || fcmServiceCreds: <ServiceCreds> {(function|object)}
|
|
175
175
|
...
|
|
176
176
|
});
|
|
177
177
|
|
package/client/impl/fcm.js
CHANGED
|
@@ -13,14 +13,13 @@ export function initializeFCM(firebaseConfig) {
|
|
|
13
13
|
appId: firebaseConfig.appId,
|
|
14
14
|
});
|
|
15
15
|
const messaging = m.getMessaging(app);
|
|
16
|
-
return m.getToken(messaging);
|
|
17
|
-
// No need to refresh token https://github.com/firebase/firebase-js-sdk/issues/4132
|
|
16
|
+
return m.getToken(messaging, { vapidKey: firebaseConfig.vapidKey });
|
|
18
17
|
})
|
|
19
18
|
.then((token) => {
|
|
20
19
|
return registerFCMTopic(token);
|
|
21
20
|
})
|
|
22
21
|
.catch((err) => {
|
|
23
|
-
console.error(err);
|
|
22
|
+
console.error(`Fcm initialization error: ${err}`);
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.34.0
|
|
3
|
+
"version": "7.34.0",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": "^
|
|
7
|
+
"node": "^20.0.0",
|
|
8
8
|
"npm": "^8.5.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
|
-
"@
|
|
34
|
+
"@grpc/grpc-js": "^1.12.5",
|
|
35
|
+
"@jsdoc/salty": "^0.2.9",
|
|
36
|
+
"@quintype/amp": "^2.21.0",
|
|
35
37
|
"@quintype/backend": "^2.7.0",
|
|
36
38
|
"@quintype/components": "^3.5.0",
|
|
37
39
|
"@quintype/prerender-node": "^3.2.26",
|
|
@@ -43,9 +45,9 @@
|
|
|
43
45
|
"compression": "^1.7.4",
|
|
44
46
|
"ejs": "^3.1.6",
|
|
45
47
|
"express": "^4.17.1",
|
|
46
|
-
"firebase": "^
|
|
48
|
+
"firebase": "^10.6.0",
|
|
49
|
+
"firebase-admin": "^13.1.0",
|
|
47
50
|
"get-youtube-id": "^1.0.1",
|
|
48
|
-
"grpc": "^1.21.1",
|
|
49
51
|
"http-proxy": "^1.18.1",
|
|
50
52
|
"js-yaml": "^4.1.0",
|
|
51
53
|
"lodash": "^4.17.21",
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"@babel/eslint-parser": "^7.15.7",
|
|
66
68
|
"@loadable/component": "^5.15.0",
|
|
67
69
|
"@loadable/server": "^5.15.1",
|
|
68
|
-
"@quintype/build": "^4.0.
|
|
70
|
+
"@quintype/build": "^4.0.1",
|
|
69
71
|
"babel-plugin-quintype-assets": "^1.1.1",
|
|
70
72
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
71
73
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"babel-preset-es2015-tree-shaking": "^1.0.1",
|
|
74
76
|
"babel-preset-react": "^6.24.1",
|
|
75
77
|
"babel-register": "^6.26.0",
|
|
76
|
-
"better-docs": "^2.3
|
|
78
|
+
"better-docs": "^2.7.3",
|
|
77
79
|
"eslint": "^7.32.0",
|
|
78
80
|
"eslint-config-prettier": "^8.3.0",
|
|
79
81
|
"eslint-config-standard": "^16.0.3",
|
|
@@ -120,5 +122,8 @@
|
|
|
120
122
|
"npx eslint --fix",
|
|
121
123
|
"git add"
|
|
122
124
|
]
|
|
125
|
+
},
|
|
126
|
+
"overrides": {
|
|
127
|
+
"grpc": "@grpc/grpc-js"
|
|
123
128
|
}
|
|
124
129
|
}
|
|
@@ -1,38 +1,34 @@
|
|
|
1
|
-
const { get } = require(
|
|
2
|
-
const
|
|
1
|
+
const { get } = require('lodash')
|
|
2
|
+
const admin = require('firebase-admin')
|
|
3
|
+
const logger = require('../logger')
|
|
3
4
|
|
|
4
|
-
exports.registerFCMTopic = async function registerFCM(
|
|
5
|
+
exports.registerFCMTopic = async function registerFCM (
|
|
5
6
|
req,
|
|
6
7
|
res,
|
|
7
8
|
next,
|
|
8
|
-
{ config, client, publisherConfig,
|
|
9
|
+
{ config, client, publisherConfig, fcmServiceCreds }
|
|
9
10
|
) {
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
const token = get(req, ['body', 'token'], null)
|
|
11
13
|
if (!token) {
|
|
12
|
-
res.status(400).send(
|
|
13
|
-
return
|
|
14
|
+
res.status(400).send('No Token Found')
|
|
15
|
+
return
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
const
|
|
18
|
+
const serviceAccount = typeof fcmServiceCreds === 'function' ? await fcmServiceCreds(config) : fcmServiceCreds
|
|
17
19
|
|
|
18
|
-
if (!
|
|
19
|
-
|
|
20
|
-
return;
|
|
20
|
+
if (!admin.apps.length) {
|
|
21
|
+
admin.initializeApp({ credential: admin.credential.cert(serviceAccount) })
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
try {
|
|
24
|
-
await
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
headers: {
|
|
28
|
-
Authorization: `key=${serverKey}`,
|
|
29
|
-
"content-type": "application/json",
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
res.status(200).send("Registration Done Suceessfuly");
|
|
33
|
-
return;
|
|
25
|
+
await admin.messaging().subscribeToTopic(token, 'all')
|
|
26
|
+
res.status(200).send('Topic Registered Successfully')
|
|
27
|
+
return
|
|
34
28
|
} catch (error) {
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const publisherId = get(config, ["config" , "publisher-id"], "");
|
|
30
|
+
res.status(500).send(`FCM Subscription Failed: ${error}`)
|
|
31
|
+
logger.error(`Fcm register to topic error for publisher ${publisherId}: ${error}`);
|
|
32
|
+
return
|
|
37
33
|
}
|
|
38
|
-
}
|
|
34
|
+
}
|
|
@@ -123,8 +123,10 @@ function loadDataForPageType(
|
|
|
123
123
|
)
|
|
124
124
|
)
|
|
125
125
|
.then((result) => {
|
|
126
|
-
if (result && result.data
|
|
127
|
-
|
|
126
|
+
if (result && result.data) {
|
|
127
|
+
if (result.data[ABORT_HANDLER] || (result.data.error && result.data.error.message)) {
|
|
128
|
+
return null
|
|
129
|
+
}
|
|
128
130
|
}
|
|
129
131
|
return result;
|
|
130
132
|
})
|
package/server/routes.js
CHANGED
|
@@ -304,7 +304,7 @@ function getWithConfig (app, route, handler, opts = {}) {
|
|
|
304
304
|
* @param {boolean|function} shouldEncodeAmpUri If set to true, then for every story-page request the slug will be encoded, in case of a vernacular slug this should be set to false. Receives path as param (default: true)
|
|
305
305
|
* @param {number} sMaxAge Overrides the s-maxage value, the default value is set to 900 seconds. We can set `isomorphicRoutesSmaxage: 900` under `publisher` in publisher.yml config file that comes from BlackKnight or pass sMaxAge as a param.
|
|
306
306
|
* @param {number} maxAge Overrides the max-age value, the default value is set to 15 seconds. We can set `isomorphicRoutesMaxage: 15` under `publisher` in publisher.yml config file that comes from BlackKnight or pass maxAge as a param.
|
|
307
|
-
* @param {(
|
|
307
|
+
* @param {(object|function)} fcmServiceCreds FCM service creds is used for registering FCM Topic.
|
|
308
308
|
* @param {string} appLoadingPlaceholder This string gets injected into the app container when the page is loaded via service worker. Can be used to show skeleton layouts, animations or other progress indicators before it is replaced by the page content.
|
|
309
309
|
* @param {boolean|function} enableExternalStories If set to true, then for every request an external story api call is made and renders the story-page if the story is found. (default: false)
|
|
310
310
|
* @param {string|function} externalIdPattern This string specifies the external id pattern the in the url. Mention `EXTERNAL_ID` to specify the position of external id in the url. Ex: "/parent-section/child-section/EXTERNAL_ID"
|
|
@@ -352,7 +352,7 @@ exports.isomorphicRoutes = function isomorphicRoutes (
|
|
|
352
352
|
sMaxAge = 900,
|
|
353
353
|
maxAge = 15,
|
|
354
354
|
appLoadingPlaceholder = '',
|
|
355
|
-
|
|
355
|
+
fcmServiceCreds = {},
|
|
356
356
|
webengageConfig = {},
|
|
357
357
|
externalIdPattern = '',
|
|
358
358
|
enableExternalStories = false,
|
|
@@ -469,7 +469,7 @@ exports.isomorphicRoutes = function isomorphicRoutes (
|
|
|
469
469
|
})
|
|
470
470
|
)
|
|
471
471
|
|
|
472
|
-
app.post('/register-fcm-topic', bodyParser.json(), withConfig(registerFCMTopic, { publisherConfig,
|
|
472
|
+
app.post('/register-fcm-topic', bodyParser.json(), withConfig(registerFCMTopic, { publisherConfig, fcmServiceCreds }))
|
|
473
473
|
|
|
474
474
|
if (webengageConfig.enableWebengage) {
|
|
475
475
|
app.post(
|