@quintype/framework 7.18.2-webengage.3 → 7.18.2-webengage.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/package.json +1 -1
- package/server/routes.js +28 -24
package/package.json
CHANGED
package/server/routes.js
CHANGED
|
@@ -312,7 +312,6 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
312
312
|
handleNotFound = true,
|
|
313
313
|
redirectRootLevelStories = false,
|
|
314
314
|
mobileApiEnabled = true,
|
|
315
|
-
feEnabled = true,
|
|
316
315
|
mobileConfigFields = {},
|
|
317
316
|
templateOptions = false,
|
|
318
317
|
lightPages = false,
|
|
@@ -334,6 +333,7 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
334
333
|
sMaxAge = 900,
|
|
335
334
|
appLoadingPlaceholder = "",
|
|
336
335
|
fcmServerKey = "",
|
|
336
|
+
enableWebengage = false,
|
|
337
337
|
webengageLicenseCode,
|
|
338
338
|
webengageApiKey,
|
|
339
339
|
}
|
|
@@ -430,29 +430,33 @@ exports.isomorphicRoutes = function isomorphicRoutes(
|
|
|
430
430
|
|
|
431
431
|
app.post("/register-fcm-topic", bodyParser.json(), withConfig(registerFCMTopic, { publisherConfig, fcmServerKey }));
|
|
432
432
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
433
|
+
if (enableWebengage) {
|
|
434
|
+
app.post("/webengage-api", bodyParser.json(), async (req, res) => {
|
|
435
|
+
const eventName = req.body.v1.event.name;
|
|
436
|
+
const { headline, subheadline, slug } = req.body;
|
|
437
|
+
console.log("hit /webengage-api", webengageLicenseCode, webengageApiKey, headline, subheadline, slug, eventName);
|
|
438
|
+
const url = `https://api.webengage.com/v2/accounts/${webengageLicenseCode}/business/save-event`;
|
|
439
|
+
try {
|
|
440
|
+
await request({
|
|
441
|
+
uri: url,
|
|
442
|
+
method: "POST",
|
|
443
|
+
headers: {
|
|
444
|
+
Authorization: `Bearer ${webengageApiKey}`,
|
|
445
|
+
"content-type": "application/json",
|
|
446
|
+
},
|
|
447
|
+
body: { eventName: "Story Created", eventData: { app: "malibu" } },
|
|
448
|
+
json: true,
|
|
449
|
+
});
|
|
450
|
+
console.log("inside the try block before return", eventName);
|
|
451
|
+
res.status(200).send("webengage event triggered successfully");
|
|
452
|
+
return;
|
|
453
|
+
} catch (error) {
|
|
454
|
+
console.log("The error is -->", error);
|
|
455
|
+
res.status(500).send("webengage event Failed");
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
}
|
|
456
460
|
|
|
457
461
|
if (manifestFn) {
|
|
458
462
|
app.get("/manifest.json", withConfig(handleManifest, { manifestFn, logError }));
|