@financial-times/dotcom-server-navigation 4.1.0 → 5.1.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.
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSubscribeAction = void 0;
4
+ function getSubscribeAction() {
5
+ return {
6
+ id: 'subscribe',
7
+ name: 'Subscribe for full access',
8
+ url: '/products?segmentId=72adc702-369e-fc3e-1b5d-cacb5d193d80'
9
+ };
10
+ }
11
+ exports.getSubscribeAction = getSubscribeAction;
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./editions"), exports);
14
+ __exportStar(require("./actions"), exports);
14
15
  __exportStar(require("./navigation"), exports);
@@ -11,6 +11,7 @@ const node_fetch_1 = __importDefault(require("node-fetch"));
11
11
  const selectMenuDataForEdition_1 = require("./selectMenuDataForEdition");
12
12
  const decorateMenuData_1 = require("./decorateMenuData");
13
13
  const editions_1 = require("./editions");
14
+ const actions_1 = require("./actions");
14
15
  // Makes the navigation data completely immutable,
15
16
  // To modify the data, clone the parts you need to change then modify in your app
16
17
  const parseData = (data) => {
@@ -68,5 +69,8 @@ class Navigation {
68
69
  throw Error(`The provided edition "${currentEdition}" is not a valid edition`);
69
70
  }
70
71
  }
72
+ getSubscribeAction() {
73
+ return actions_1.getSubscribeAction();
74
+ }
71
75
  }
72
76
  exports.Navigation = Navigation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-server-navigation",
3
- "version": "4.1.0",
3
+ "version": "5.1.0",
4
4
  "description": "",
5
5
  "main": "dist/node/index.js",
6
6
  "types": "src/index.ts",
@@ -19,7 +19,7 @@
19
19
  "author": "",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@financial-times/dotcom-types-navigation": "^4.1.0",
22
+ "@financial-times/dotcom-types-navigation": "^5.1.0",
23
23
  "@types/deep-freeze": "^0.1.1",
24
24
  "deep-freeze": "0.0.1",
25
25
  "ft-poller": "^5.0.0",
@@ -32,7 +32,7 @@
32
32
  "nock": "^12.0.0"
33
33
  },
34
34
  "engines": {
35
- "node": ">= 12.0.0",
35
+ "node": ">= 14.0.0",
36
36
  "npm": "7.x || 8.x"
37
37
  },
38
38
  "repository": {
package/src/actions.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { TNavAction } from '@financial-times/dotcom-types-navigation'
2
+
3
+ export function getSubscribeAction(): TNavAction {
4
+ return {
5
+ id: 'subscribe',
6
+ name: 'Subscribe for full access',
7
+ url: '/products?segmentId=72adc702-369e-fc3e-1b5d-cacb5d193d80'
8
+ }
9
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './editions'
2
+ export * from './actions'
2
3
  export * from './navigation'
package/src/navigation.ts CHANGED
@@ -6,11 +6,13 @@ import {
6
6
  TNavMenus,
7
7
  TNavMenusForEdition,
8
8
  TNavSubNavigation,
9
- TNavEditions
9
+ TNavEditions,
10
+ TNavAction
10
11
  } from '@financial-times/dotcom-types-navigation'
11
12
  import { selectMenuDataForEdition } from './selectMenuDataForEdition'
12
13
  import { decorateMenuData } from './decorateMenuData'
13
14
  import { getEditions, isEdition } from './editions'
15
+ import { getSubscribeAction } from './actions'
14
16
 
15
17
  // Makes the navigation data completely immutable,
16
18
  // To modify the data, clone the parts you need to change then modify in your app
@@ -90,4 +92,8 @@ export class Navigation {
90
92
  throw Error(`The provided edition "${currentEdition}" is not a valid edition`)
91
93
  }
92
94
  }
95
+
96
+ getSubscribeAction(): TNavAction {
97
+ return getSubscribeAction()
98
+ }
93
99
  }