@quintype/framework 7.7.0-beta-amp-cta.2 → 7.7.1

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,19 @@
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.7.1](https://github.com/quintype/quintype-node-framework/compare/v7.7.0...v7.7.1) (2022-07-06)
6
+
7
+ ## [7.7.0](https://github.com/quintype/quintype-node-framework/compare/v7.4.1...v7.7.0) (2022-07-05)
8
+
9
+
10
+ ### Features
11
+
12
+ * **api-client:** Implement wildcard_to_api_host ⚡ ([#308](https://github.com/quintype/quintype-node-framework/issues/308)) ([9c585f4](https://github.com/quintype/quintype-node-framework/commit/9c585f49fece1cba7271a47465633ca9c40034ff))
13
+
14
+ ### [7.6.2](https://github.com/quintype/quintype-node-framework/compare/v7.6.1...v7.6.2) (2022-07-01)
15
+
16
+ ### [7.6.1](https://github.com/quintype/quintype-node-framework/compare/v7.6.0...v7.6.1) (2022-06-30)
17
+
5
18
  ## [7.6.0](https://github.com/quintype/quintype-node-framework/compare/v7.4.0...v7.6.0) (2022-06-28)
6
19
 
7
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.7.0-beta-amp-cta.2",
3
+ "version": "7.7.1",
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 --recursive --require ./test/babel",
12
+ "test": "NODE_ENV=test npx mocha --timeout 5000 --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,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.4.22-cta-feature.2",
34
+ "@quintype/amp": "^2.4.23",
35
35
  "@quintype/backend": "^2.3.1",
36
36
  "@quintype/components": "^3.0.0",
37
37
  "@quintype/prerender-node": "^3.2.24",
@@ -34,22 +34,21 @@ async function ampStoryPageHandler(
34
34
  ampLibrary = require("@quintype/amp"),
35
35
  additionalConfig = require("../../publisher-config"),
36
36
  InfiniteScrollAmp = require("../helpers/infinite-scroll"),
37
+ isVisualStory = false,
37
38
  ...rest
38
39
  }
39
40
  ) {
40
41
  try {
41
42
  const opts = cloneDeep(rest);
42
-
43
43
  const redirectUrls = opts && opts.redirectUrls;
44
44
  const getEnableAmp = get(opts, ["enableAmp"], true);
45
-
46
45
  const enableAmp = typeof getEnableAmp === "function" ? opts.enableAmp(config) : getEnableAmp;
47
46
 
48
47
  if (typeof redirectUrls === "function" || (redirectUrls && Object.keys(redirectUrls).length > 0)) {
49
48
  await getRedirectUrl(req, res, next, { redirectUrls, config });
50
49
  }
51
50
 
52
- if (!enableAmp) {
51
+ if (!isVisualStory && !enableAmp) {
53
52
  return res.redirect(301, `/${req.params[0]}`);
54
53
  }
55
54
 
@@ -2,6 +2,7 @@ const urlLib = require("url");
2
2
  const ejs = require("ejs");
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const set = require("lodash/set");
5
6
 
6
7
  const staticPageTemplateStr = fs.readFileSync(path.join(__dirname, "../views/static-page.ejs"), { encoding: "utf-8" });
7
8
  const staticPageTemplate = ejs.compile(staticPageTemplateStr);
@@ -29,7 +30,9 @@ function writeStaticPageResponse(res, url, page, result, { config, renderLayout,
29
30
  });
30
31
 
31
32
  const seoInstance = typeof seo === "function" ? seo(config) : seo;
32
- const seoTags = seoInstance && seoInstance.getMetaTags(config, page.type, {}, { url });
33
+
34
+ const seoTags =
35
+ seoInstance && seoInstance.getMetaTags(config, page.type, set(result, ["data", "page"], page), { url });
33
36
 
34
37
  res.status(page["status-code"] || 200);
35
38
 
package/server/routes.js CHANGED
@@ -630,5 +630,5 @@ exports.ampRoutes = (app, opts = {}) => {
630
630
  getWithConfig(app, "/amp/story/*", ampStoryPageHandler, opts);
631
631
  getWithConfig(app, "/amp/api/v1/amp-infinite-scroll", storyPageInfiniteScrollHandler, opts);
632
632
  getWithConfig(app, "/amp/api/v1/bookend.json", bookendHandler, opts);
633
- getWithConfig(app, "/ampstories/*", ampStoryPageHandler, opts);
633
+ getWithConfig(app, "/ampstories/*", ampStoryPageHandler, { ...opts, isVisualStory: true });
634
634
  };