@quintype/framework 7.34.5-fw-amp-access-flag.0 → 7.34.5-fw-amp-access-flag.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.34.5-fw-amp-access-flag.0",
3
+ "version": "7.34.5-fw-amp-access-flag.1",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -33,7 +33,7 @@
33
33
  "@ampproject/toolbox-optimizer": "2.8.3",
34
34
  "@grpc/grpc-js": "^1.12.5",
35
35
  "@jsdoc/salty": "^0.2.9",
36
- "@quintype/amp": "2.22.1-amp-access-flag.0",
36
+ "@quintype/amp": "2.22.1-amp-access-flag.1",
37
37
  "@quintype/backend": "^2.7.0",
38
38
  "@quintype/components": "^3.5.0",
39
39
  "@quintype/prerender-node": "^3.2.26",
@@ -68,6 +68,8 @@ async function ampStoryPageHandler(
68
68
 
69
69
  return res.redirect(301, redirectUrl);
70
70
  }
71
+ const enableAmpAccess = get(opts, ["enableAmpAccess"], false);
72
+ const isAmpAccessEnabled = typeof enableAmpAccess === "function" && opts.enableAmpAccess(story);
71
73
 
72
74
  const domainSpecificOpts = getDomainSpecificOpts(opts, domainSlug);
73
75
  const url = urlLib.parse(req.url, true);
@@ -144,6 +146,9 @@ async function ampStoryPageHandler(
144
146
  });
145
147
  merge(mergedAdditionalConfig, additionalConfig, fetchedAdditionalConfig);
146
148
  }
149
+ if (isAmpAccessEnabled) {
150
+ merge(additionalConfig, { isAmpAccessEnabled: isAmpAccessEnabled });
151
+ }
147
152
  const optimizeAmpHtml = get(domainSpecificOpts, ["featureConfig", "optimizeAmpHtml"], true);
148
153
  const ampHtml = ampifyStory({
149
154
  story,