@quintype/framework 7.8.0-prerender-query-param.2 → 7.8.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 CHANGED
@@ -2,6 +2,39 @@
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.8.0](https://github.com/quintype/quintype-node-framework/compare/v7.7.7...v7.8.0) (2022-09-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * add video support to web stories ([#322](https://github.com/quintype/quintype-node-framework/issues/322)) ([f41b82b](https://github.com/quintype/quintype-node-framework/commit/f41b82be8285b555970527204ec6478f21c47782))
11
+
12
+ ### [7.7.7](https://github.com/quintype/quintype-node-framework/compare/v7.7.0...v7.7.7) (2022-07-29)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * remove prerender query param after the prerender check ([#314](https://github.com/quintype/quintype-node-framework/issues/314)) ([94eac28](https://github.com/quintype/quintype-node-framework/commit/94eac28bfd04483cc665c5ce4d2fc8768c84a31b))
18
+ * remove prerender query param after the prerender check [#314](https://github.com/quintype/quintype-node-framework/issues/314) ([#317](https://github.com/quintype/quintype-node-framework/issues/317)) ([0067d81](https://github.com/quintype/quintype-node-framework/commit/0067d81fe545a726948db14a44768876b41f6ba8))
19
+
20
+ ### [7.7.6](https://github.com/quintype/quintype-node-framework/compare/v7.7.5...v7.7.6) (2022-07-28)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * remove prerender query param after the prerender check [#314](https://github.com/quintype/quintype-node-framework/issues/314) ([#317](https://github.com/quintype/quintype-node-framework/issues/317)) ([0067d81](https://github.com/quintype/quintype-node-framework/commit/0067d81fe545a726948db14a44768876b41f6ba8))
26
+
27
+ ### [7.7.5](https://github.com/quintype/quintype-node-framework/compare/v7.7.4...v7.7.5) (2022-07-14)
28
+
29
+ ### [7.7.4](https://github.com/quintype/quintype-node-framework/compare/v7.7.3...v7.7.4) (2022-07-13)
30
+
31
+ ### [7.7.3](https://github.com/quintype/quintype-node-framework/compare/v7.7.2...v7.7.3) (2022-07-13)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * remove prerender query param after the prerender check ([#314](https://github.com/quintype/quintype-node-framework/issues/314)) ([94eac28](https://github.com/quintype/quintype-node-framework/commit/94eac28bfd04483cc665c5ce4d2fc8768c84a31b))
37
+
5
38
  ### [7.7.2](https://github.com/quintype/quintype-node-framework/compare/v7.7.1...v7.7.2) (2022-07-08)
6
39
 
7
40
  ### [7.7.1](https://github.com/quintype/quintype-node-framework/compare/v7.7.0...v7.7.1) (2022-07-06)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.8.0-prerender-query-param.2",
3
+ "version": "7.8.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "scripts": {
11
11
  "prepublishOnly": "npm test && ./bin-dev-scripts/standard-version-release.sh",
12
- "test": "NODE_ENV=test npx mocha --timeout 5000 --recursive --require ./test/babel",
12
+ "test": "NODE_ENV=test npx mocha --recursive --require ./test/babel",
13
13
  "watch-test": "NODE_ENV=test npx mocha --recursive --watch --require ./test/babel",
14
14
  "coverage": "nyc --all npm test",
15
15
  "coverage-html": "nyc --all --reporter=html npm test",
@@ -31,10 +31,10 @@
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.4.23",
34
+ "@quintype/amp": "^2.5.0",
35
35
  "@quintype/backend": "^2.3.1",
36
36
  "@quintype/components": "^3.0.0",
37
- "@quintype/prerender-node": "^3.2.24",
37
+ "@quintype/prerender-node": "^3.2.26",
38
38
  "@quintype/seo": "^1.39.0",
39
39
  "atob": "^2.1.2",
40
40
  "babel-plugin-react-css-modules": "^5.2.6",
@@ -1,9 +1,7 @@
1
1
  const { ampStoryPageHandler } = require("./story-page");
2
2
  const { storyPageInfiniteScrollHandler } = require("./infinite-scroll");
3
- const { bookendHandler } = require("./visual-stories-bookend");
4
3
 
5
4
  module.exports = {
6
5
  ampStoryPageHandler,
7
6
  storyPageInfiniteScrollHandler,
8
- bookendHandler,
9
7
  };
package/server/routes.js CHANGED
@@ -627,10 +627,9 @@ exports.mountQuintypeAt = function (app, mountAt) {
627
627
  *
628
628
  */
629
629
  exports.ampRoutes = (app, opts = {}) => {
630
- const { ampStoryPageHandler, storyPageInfiniteScrollHandler, bookendHandler } = require("./amp/handlers");
630
+ const { ampStoryPageHandler, storyPageInfiniteScrollHandler } = require("./amp/handlers");
631
631
 
632
632
  getWithConfig(app, "/amp/story/*", ampStoryPageHandler, opts);
633
633
  getWithConfig(app, "/amp/api/v1/amp-infinite-scroll", storyPageInfiniteScrollHandler, opts);
634
- getWithConfig(app, "/amp/api/v1/bookend.json", bookendHandler, opts);
635
634
  getWithConfig(app, "/ampstories/*", ampStoryPageHandler, { ...opts, isVisualStory: true });
636
635
  };
@@ -446,41 +446,3 @@ describe("Amp infinite scroll handler", () => {
446
446
  });
447
447
  });
448
448
  });
449
-
450
- describe("Amp visual stories bookend handler", () => {
451
- it("returns the bookend if there are related stories", function (done) {
452
- const app = createApp({
453
- clientStub: getClientStubWithRelatedStories([{ headline: "foo" }]),
454
- });
455
- supertest(app)
456
- .get("/amp/api/v1/bookend.json?storyId=111&sectionId=222")
457
- .expect("Content-Type", /json/)
458
- .expect("Cache-Control", /public/)
459
- .expect(200)
460
- .then((res) => {
461
- const response = JSON.parse(res.text);
462
- assert.equal("v1.0", response.bookendVersion);
463
- assert.equal(3, response.components.length);
464
- assert.equal("foo", response.components[1].title);
465
- })
466
- .then(() => done());
467
- });
468
- it("returns a 404 if there are no related stories", (done) => {
469
- const app = createApp({ clientStub: getClientStubWithRelatedStories([]) });
470
- supertest(app)
471
- .get("/amp/api/v1/bookend.json?storyId=111&sectionId=222")
472
- .expect("Content-Type", /json/)
473
- .expect(404)
474
- .then(() => done());
475
- });
476
- it("returns a 400 if 'storyId' and 'sectionId' query params aren't passed", (done) => {
477
- const app = createApp({
478
- clientStub: getClientStubWithRelatedStories([{ headline: "foo" }]),
479
- });
480
- supertest(app)
481
- .get("/amp/api/v1/bookend.json")
482
- .expect("Content-Type", /json/)
483
- .expect(400)
484
- .then(() => done());
485
- });
486
- });
@@ -1,77 +0,0 @@
1
- const get = require("lodash/get");
2
-
3
- function getStoryUrl(story, config) {
4
- if (get(story, ["story-template"]) === "news-elsewhere") {
5
- return get(story, ["metadata", "reference-url"], "");
6
- }
7
- return `${config["sketches-host"]}/${story.slug}`;
8
- }
9
-
10
- async function bookendHandler(req, res, next, { config, client, sMaxAge = "900" }) {
11
- const { storyId, sectionId } = req.query;
12
- if (!storyId || !sectionId) {
13
- res.status(400).json({
14
- error: {
15
- message: "Please provide 'storyId' and 'sectionId' query parameters",
16
- },
17
- });
18
- return;
19
- }
20
-
21
- const relatedStoriesResponse = await client.getRelatedStories(storyId, sectionId);
22
- const relatedStories = relatedStoriesResponse["related-stories"];
23
-
24
- if (!relatedStories.length) {
25
- res.status(404).json({ error: { message: "Not Found" } });
26
- return;
27
- }
28
-
29
- const fbAppId = get(config, ["public-integrations", "facebook", "app-id"], "");
30
-
31
- const jsonPayLoad = {
32
- bookendVersion: "v1.0",
33
- shareProviders: [
34
- "twitter",
35
- "email",
36
- {
37
- provider: "facebook",
38
- app_id: fbAppId,
39
- },
40
- "whatsapp",
41
- "linkedin",
42
- "gplus",
43
- ],
44
- components: [].concat(
45
- [
46
- {
47
- type: "heading",
48
- text: "More to read",
49
- },
50
- ],
51
- relatedStories.map((story) => ({
52
- type: "small",
53
- title: `${story.headline}`,
54
- image: `${config["cdn-name"]}${story["hero-image-s3-key"]}?w=480&auto=format&compress`,
55
- url: getStoryUrl(story, config),
56
- })),
57
- [
58
- {
59
- type: "cta-link",
60
- links: [
61
- {
62
- text: "More stories",
63
- url: `${config["sketches-host"]}`,
64
- },
65
- ],
66
- },
67
- ]
68
- ),
69
- };
70
-
71
- res.header("Cache-Control", `public,max-age=15,s-maxage=${sMaxAge},stale-while-revalidate=1000,stale-if-error=14400`);
72
- res.header("Vary", "Accept-Encoding");
73
-
74
- res.json(jsonPayLoad);
75
- }
76
-
77
- module.exports = { bookendHandler };