@remkoj/optimizely-one-nextjs 4.1.0 → 4.2.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.
@@ -1,12 +1,20 @@
1
1
  import { ContentRecs } from '../products';
2
+ import getConfig, { checkProductStatus } from '../config';
3
+ import * as Responses from './responses';
2
4
  export const ContentRecsGoalsService = {
3
5
  for: { path: '/cgoals', verb: 'get' },
4
6
  handler: async (query, cookies) => {
7
+ const config = getConfig();
8
+ if (!config.HelperEnabled)
9
+ return Responses.NotFound;
10
+ const products = checkProductStatus(config);
11
+ if (!products.contentRecsApi)
12
+ return Responses.NotFound;
5
13
  const crId = ContentRecs.Tools.getVisitorID(cookies);
6
14
  if (!crId)
7
15
  return [{ goals: [] }, 200];
8
16
  const contentRecs = new ContentRecs.Client();
9
- const nextBestGoals = await contentRecs.getNextBestGoals(crId);
17
+ const nextBestGoals = await contentRecs.getNextBestGoals(crId).catch(() => []);
10
18
  return [{ goals: nextBestGoals }, 200];
11
19
  }
12
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"content-goals.js","sourceRoot":"","sources":["../../src/api/content-goals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAgBzC,MAAM,CAAC,MAAM,uBAAuB,GAA8B;IAC9D,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE;IACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI;YACL,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAC,GAAG,CAAC,CAAA;QAC5B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,MAAM,WAAW,C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AG,CAAC,CAAA;IAC1C,CAAC;CACJ,CAAA;AAED,eAAe,uBAAuB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@remkoj/optimizely-one-nextjs",
3
3
  "license": "Apache-2.0",
4
- "version": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "repository": "https://github.com/remkoj/optimizely-dxp-clients.git",
6
6
  "author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
7
7
  "homepage": "https://github.com/remkoj/optimizely-dxp-clients",
@@ -42,32 +42,32 @@
42
42
  "@headlessui/react": "^2.2.0",
43
43
  "@headlessui/tailwindcss": "^0.2.1",
44
44
  "@heroicons/react": "^2.2.0",
45
- "@remkoj/optimizely-graph-client": "^4.1.0",
46
- "@types/node": "^22.10.2",
47
- "@types/react": "^18.3.17",
45
+ "@remkoj/optimizely-graph-client": "^4.2.0",
46
+ "@types/node": "^22.10.7",
47
+ "@types/react": "^18.3.18",
48
48
  "@types/react-dom": "18.3.5",
49
49
  "@types/uuid": "^10.0.0",
50
- "browserslist": "^4.24.3",
51
- "next": "^14.2.20",
50
+ "browserslist": "^4.24.4",
51
+ "next": "^14.2.23",
52
52
  "prop-types": "^15.8.1",
53
53
  "react": "^18.3.1",
54
54
  "react-dom": "^18.3.1",
55
55
  "scheduler": "^0.25.0",
56
- "swr": "^2.2.5",
56
+ "swr": "^2.3.0",
57
57
  "tailwindcss": "^3.4.17",
58
- "typescript": "^5.7.2",
59
- "update-browserslist-db": "^1.1.1",
60
- "uuid": "^11.0.3"
58
+ "typescript": "^5.7.3",
59
+ "update-browserslist-db": "^1.1.2",
60
+ "uuid": "^11.0.5"
61
61
  },
62
62
  "peerDependencies": {
63
- "@headlessui/react": "*",
64
- "@heroicons/react": "*",
65
- "@remkoj/optimizely-graph-client": "^4.1.0",
66
- "next": "*",
67
- "react": "*",
68
- "react-dom": "*",
69
- "swr": "*",
70
- "uuid": "*"
63
+ "@headlessui/react": "^2",
64
+ "@heroicons/react": "^2",
65
+ "@remkoj/optimizely-graph-client": "^4",
66
+ "next": "^14",
67
+ "react": "^18",
68
+ "react-dom": "^18",
69
+ "swr": "^2",
70
+ "uuid": "^11"
71
71
  },
72
72
  "scripts": {
73
73
  "clean": "tsc --build --clean",