@quintype/framework 7.18.2-webengage.4 → 7.18.2-webengage.6

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