@sitecore-jss/sitecore-jss-nextjs 22.8.0-canary.3 → 22.8.0-canary.4

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.
@@ -65,7 +65,7 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
65
65
  const { pathname: incomingURL, search: incomingQS = '' } = this.normalizeUrl(req.nextUrl.clone());
66
66
  const locale = this.getLanguage(req);
67
67
  const normalizedPath = incomingURL.replace(/\/*$/gi, '');
68
- const redirects = yield this.redirectsService.fetchRedirects(siteName);
68
+ const redirects = yield this.getRedirects(siteName);
69
69
  const language = this.getLanguage(req);
70
70
  const modifyRedirects = structuredClone(redirects);
71
71
  let matchedQueryString;
@@ -221,6 +221,17 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
221
221
  return response;
222
222
  });
223
223
  }
224
+ /**
225
+ * Fetches all redirects for a given site from the Sitecore instance
226
+ * @param {string} siteName - The name of the site to fetch redirects for
227
+ * @returns {Promise<RedirectInfo[]>} A promise that resolves to an array of redirect information
228
+ * @protected
229
+ */
230
+ getRedirects(siteName) {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ return yield this.redirectsService.fetchRedirects(siteName);
233
+ });
234
+ }
224
235
  /**
225
236
  * When a user clicks on a link generated by the Link component from next/link,
226
237
  * Next.js adds special parameters in the route called path.
@@ -59,7 +59,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
59
59
  const { pathname: incomingURL, search: incomingQS = '' } = this.normalizeUrl(req.nextUrl.clone());
60
60
  const locale = this.getLanguage(req);
61
61
  const normalizedPath = incomingURL.replace(/\/*$/gi, '');
62
- const redirects = yield this.redirectsService.fetchRedirects(siteName);
62
+ const redirects = yield this.getRedirects(siteName);
63
63
  const language = this.getLanguage(req);
64
64
  const modifyRedirects = structuredClone(redirects);
65
65
  let matchedQueryString;
@@ -215,6 +215,17 @@ export class RedirectsMiddleware extends MiddlewareBase {
215
215
  return response;
216
216
  });
217
217
  }
218
+ /**
219
+ * Fetches all redirects for a given site from the Sitecore instance
220
+ * @param {string} siteName - The name of the site to fetch redirects for
221
+ * @returns {Promise<RedirectInfo[]>} A promise that resolves to an array of redirect information
222
+ * @protected
223
+ */
224
+ getRedirects(siteName) {
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ return yield this.redirectsService.fetchRedirects(siteName);
227
+ });
228
+ }
218
229
  /**
219
230
  * When a user clicks on a link generated by the Link component from next/link,
220
231
  * Next.js adds special parameters in the route called path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-jss/sitecore-jss-nextjs",
3
- "version": "22.8.0-canary.3",
3
+ "version": "22.8.0-canary.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "sideEffects": false,
@@ -72,16 +72,16 @@
72
72
  "react-dom": "^19.1.0"
73
73
  },
74
74
  "dependencies": {
75
- "@sitecore-jss/sitecore-jss": "22.8.0-canary.3",
76
- "@sitecore-jss/sitecore-jss-dev-tools": "22.8.0-canary.3",
77
- "@sitecore-jss/sitecore-jss-react": "22.8.0-canary.3",
75
+ "@sitecore-jss/sitecore-jss": "22.8.0-canary.4",
76
+ "@sitecore-jss/sitecore-jss-dev-tools": "22.8.0-canary.4",
77
+ "@sitecore-jss/sitecore-jss-react": "22.8.0-canary.4",
78
78
  "@vercel/kv": "^0.2.1",
79
79
  "regex-parser": "^2.2.11",
80
80
  "sync-disk-cache": "^2.1.0"
81
81
  },
82
82
  "description": "",
83
83
  "types": "types/index.d.ts",
84
- "gitHead": "79696336a6cfd4ee3fd533cc28ebd87dd748ad41",
84
+ "gitHead": "4bafb2e560ac0742ead12179574fe4080f4e8c77",
85
85
  "files": [
86
86
  "dist",
87
87
  "types",
@@ -45,6 +45,13 @@ export declare class RedirectsMiddleware extends MiddlewareBase {
45
45
  * @returns {Promise<NextResponse>} The redirect response.
46
46
  */
47
47
  protected processRedirectRequest(req: NextRequest, res?: NextResponse): Promise<NextResponse>;
48
+ /**
49
+ * Fetches all redirects for a given site from the Sitecore instance
50
+ * @param {string} siteName - The name of the site to fetch redirects for
51
+ * @returns {Promise<RedirectInfo[]>} A promise that resolves to an array of redirect information
52
+ * @protected
53
+ */
54
+ protected getRedirects(siteName: string): Promise<RedirectInfo[]>;
48
55
  /**
49
56
  * When a user clicks on a link generated by the Link component from next/link,
50
57
  * Next.js adds special parameters in the route called path.