@quintype/framework 7.18.2-webengage.7 → 7.18.2
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 +2 -0
- package/package.json +3 -3
- package/server/routes.js +0 -6
- package/server/handlers/webengage.js +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.18.2](https://github.com/quintype/quintype-node-framework/compare/v7.18.1...v7.18.2) (2023-02-14)
|
|
6
|
+
|
|
5
7
|
### [7.18.1](https://github.com/quintype/quintype-node-framework/compare/v7.18.0...v7.18.1) (2023-01-30)
|
|
6
8
|
|
|
7
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.18.2
|
|
3
|
+
"version": "7.18.2",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"coverage": "nyc --all npm test",
|
|
15
15
|
"coverage-html": "nyc --all --reporter=html npm test",
|
|
16
16
|
"docs": "rimraf docs && jsdoc -c jsdoc.json",
|
|
17
|
-
"sync-files-to": "npx onchange --verbose --await-write-finish
|
|
17
|
+
"sync-files-to": "npx onchange --verbose --wait --await-write-finish 'client/**/*' 'server/**/*' 'isomorphic/**/*' -- ./bin-dev-scripts/sync-to.sh "
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"homepage": "https://github.com/quintype/quintype-node-framework#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
|
-
"@quintype/amp": "^2.9.
|
|
34
|
+
"@quintype/amp": "^2.9.2",
|
|
35
35
|
"@quintype/backend": "^2.3.3",
|
|
36
36
|
"@quintype/components": "^3.3.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
package/server/routes.js
CHANGED
|
@@ -23,7 +23,6 @@ const { redirectStory } = require("./handlers/story-redirect");
|
|
|
23
23
|
const { simpleJsonHandler } = require("./handlers/simple-json-handler");
|
|
24
24
|
const { makePickComponentSync } = require("../isomorphic/impl/make-pick-component-sync");
|
|
25
25
|
const { registerFCMTopic } = require("./handlers/fcm-registration-handler");
|
|
26
|
-
const { webengageApi } = require("./handlers/webengage");
|
|
27
26
|
const rp = require("request-promise");
|
|
28
27
|
const bodyParser = require("body-parser");
|
|
29
28
|
const get = require("lodash/get");
|
|
@@ -312,7 +311,6 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
312
311
|
handleNotFound = true,
|
|
313
312
|
redirectRootLevelStories = false,
|
|
314
313
|
mobileApiEnabled = true,
|
|
315
|
-
feEnabled = true,
|
|
316
314
|
mobileConfigFields = {},
|
|
317
315
|
templateOptions = false,
|
|
318
316
|
lightPages = false,
|
|
@@ -334,8 +332,6 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
334
332
|
sMaxAge = 900,
|
|
335
333
|
appLoadingPlaceholder = "",
|
|
336
334
|
fcmServerKey = "",
|
|
337
|
-
webengageLicenseCode,
|
|
338
|
-
webengageApiKey,
|
|
339
335
|
}
|
|
340
336
|
) {
|
|
341
337
|
const withConfig = withConfigPartial(getClient, logError, publisherConfig, configWrapper);
|
|
@@ -430,8 +426,6 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
430
426
|
|
|
431
427
|
app.post("/register-fcm-topic", bodyParser.json(), withConfig(registerFCMTopic, { publisherConfig, fcmServerKey }));
|
|
432
428
|
|
|
433
|
-
app.post("/webengage-api", bodyParser.json(), webengageApi);
|
|
434
|
-
|
|
435
429
|
if (manifestFn) {
|
|
436
430
|
app.get("/manifest.json", withConfig(handleManifest, { manifestFn, logError }));
|
|
437
431
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const request = require("request-promise");
|
|
2
|
-
|
|
3
|
-
exports.webengageApi = async function webengageApi(req, res) {
|
|
4
|
-
const webengageLicenseCode = "311c5229";
|
|
5
|
-
const webengageApiKey = "2d5cb58e-7160-4f2a-b423-0c0d8007dd9c";
|
|
6
|
-
let eventData = {};
|
|
7
|
-
const eventName = req.body.v1.event.name;
|
|
8
|
-
|
|
9
|
-
switch (eventName) {
|
|
10
|
-
case "story-publish":
|
|
11
|
-
const { "author-name": author, headline } = req.body;
|
|
12
|
-
eventData = { author, headline };
|
|
13
|
-
break;
|
|
14
|
-
case "push-notification-triggered":
|
|
15
|
-
const { title, message } = req.body;
|
|
16
|
-
eventData = { title, message };
|
|
17
|
-
break;
|
|
18
|
-
default:
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
console.log("hit /webengage-api by syncing ---->", eventName, eventData);
|
|
23
|
-
const url = `https://api.webengage.com/v1/accounts/${webengageLicenseCode}/events`;
|
|
24
|
-
try {
|
|
25
|
-
await request({
|
|
26
|
-
uri: url,
|
|
27
|
-
method: "POST",
|
|
28
|
-
headers: {
|
|
29
|
-
Authorization: `Bearer ${webengageApiKey}`,
|
|
30
|
-
"content-type": "application/json",
|
|
31
|
-
},
|
|
32
|
-
body: { eventName: eventName, eventData: { eventData }, userId: eventName },
|
|
33
|
-
json: true,
|
|
34
|
-
});
|
|
35
|
-
res.status(200).send("webengage event triggered successfully");
|
|
36
|
-
return;
|
|
37
|
-
} catch (error) {
|
|
38
|
-
res.status(500).send("webengage event failed");
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
};
|