@sitecore-content-sdk/nextjs 0.1.0-beta.19 → 0.1.0-beta.20

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.
@@ -18,7 +18,7 @@ class SitecoreNextjsClient extends client_1.SitecoreClient {
18
18
  constructor(initOptions) {
19
19
  super(initOptions);
20
20
  this.initOptions = initOptions;
21
- this.componentPropsService = new component_props_service_1.ComponentPropsService();
21
+ this.componentPropsService = this.getComponentPropsService();
22
22
  }
23
23
  // since path rewrite we rely on is only working in nextjs
24
24
  resolveSiteFromPath(path) {
@@ -47,7 +47,12 @@ class SitecoreNextjsClient extends client_1.SitecoreClient {
47
47
  const resolvedPath = this.parsePath(path);
48
48
  // Get variant(s) for personalization (from path), must ensure path is of type string
49
49
  const personalizeData = pageOptions.personalize || (0, personalize_1.getPersonalizedRewriteData)(_super.parsePath.call(this, path));
50
- const page = yield _super.getPage.call(this, resolvedPath, { locale: pageOptions.locale, site: pageOptions.site, personalize: personalizeData }, options);
50
+ const site = pageOptions.site || this.resolveSiteFromPath(path).name;
51
+ const page = yield _super.getPage.call(this, resolvedPath, {
52
+ locale: pageOptions.locale,
53
+ site,
54
+ personalize: personalizeData,
55
+ }, options);
51
56
  return page;
52
57
  });
53
58
  }
@@ -97,5 +102,8 @@ class SitecoreNextjsClient extends client_1.SitecoreClient {
97
102
  return componentProps;
98
103
  });
99
104
  }
105
+ getComponentPropsService() {
106
+ return new component_props_service_1.ComponentPropsService();
107
+ }
100
108
  }
101
109
  exports.SitecoreNextjsClient = SitecoreNextjsClient;
@@ -15,7 +15,7 @@ export class SitecoreNextjsClient extends SitecoreClient {
15
15
  constructor(initOptions) {
16
16
  super(initOptions);
17
17
  this.initOptions = initOptions;
18
- this.componentPropsService = new ComponentPropsService();
18
+ this.componentPropsService = this.getComponentPropsService();
19
19
  }
20
20
  // since path rewrite we rely on is only working in nextjs
21
21
  resolveSiteFromPath(path) {
@@ -44,7 +44,12 @@ export class SitecoreNextjsClient extends SitecoreClient {
44
44
  const resolvedPath = this.parsePath(path);
45
45
  // Get variant(s) for personalization (from path), must ensure path is of type string
46
46
  const personalizeData = pageOptions.personalize || getPersonalizedRewriteData(_super.parsePath.call(this, path));
47
- const page = yield _super.getPage.call(this, resolvedPath, { locale: pageOptions.locale, site: pageOptions.site, personalize: personalizeData }, options);
47
+ const site = pageOptions.site || this.resolveSiteFromPath(path).name;
48
+ const page = yield _super.getPage.call(this, resolvedPath, {
49
+ locale: pageOptions.locale,
50
+ site,
51
+ personalize: personalizeData,
52
+ }, options);
48
53
  return page;
49
54
  });
50
55
  }
@@ -94,4 +99,7 @@ export class SitecoreNextjsClient extends SitecoreClient {
94
99
  return componentProps;
95
100
  });
96
101
  }
102
+ getComponentPropsService() {
103
+ return new ComponentPropsService();
104
+ }
97
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/nextjs",
3
- "version": "0.1.0-beta.19",
3
+ "version": "0.1.0-beta.20",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -15,7 +15,7 @@
15
15
  "test": "mocha --require ./test/setup.js \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\" --exit",
16
16
  "prepublishOnly": "npm run build",
17
17
  "coverage": "nyc npm test",
18
- "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/nextjs --entryPoints src/index.ts --entryPoints src/monitoring/index.ts --entryPoints src/editing/index.ts --entryPoints src/middleware/index.ts --entryPoints src/context/index.ts --entryPoints src/utils/index.ts --entryPoints src/site/index.ts --entryPoints src/graphql/index.ts --entryPoints src/tools/index.ts --githubPages false"
18
+ "generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/nextjs --entryPoints src/index.ts --entryPoints src/monitoring/index.ts --entryPoints src/editing/index.ts --entryPoints src/middleware/index.ts --entryPoints src/context/index.ts --entryPoints src/utils/index.ts --entryPoints src/site/index.ts --entryPoints src/client/index.ts --entryPoints src/tools/index.ts --githubPages false"
19
19
  },
20
20
  "engines": {
21
21
  "node": ">=22"
@@ -74,8 +74,8 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@babel/parser": "^7.26.10",
77
- "@sitecore-content-sdk/core": "0.1.0-beta.19",
78
- "@sitecore-content-sdk/react": "0.1.0-beta.19",
77
+ "@sitecore-content-sdk/core": "0.1.0-beta.20",
78
+ "@sitecore-content-sdk/react": "0.1.0-beta.20",
79
79
  "@vercel/kv": "^3.0.0",
80
80
  "prop-types": "^15.8.1",
81
81
  "recast": "^0.23.11",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  "description": "",
86
86
  "types": "types/index.d.ts",
87
- "gitHead": "a7c2c7af7497eb791b942e04f36a36feb06c9ea0",
87
+ "gitHead": "2e40659cd4f0858c509c8df228bf93f5b6d5c110",
88
88
  "files": [
89
89
  "dist",
90
90
  "types",
@@ -36,4 +36,5 @@ export declare class SitecoreNextjsClient extends SitecoreClient {
36
36
  * @returns {ComponentPropsCollection} component props
37
37
  */
38
38
  getComponentData(layoutData: LayoutServiceData, context: GetServerSidePropsContext | GetStaticPropsContext, moduleFactory: ModuleFactory): Promise<ComponentPropsCollection>;
39
+ protected getComponentPropsService(): ComponentPropsService;
39
40
  }