create-sitecore-jss 22.6.0-canary.24 → 22.6.0-canary.26

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.
@@ -8,8 +8,8 @@
8
8
  "prepare:proxy-build": "ts-node --project src/tsconfig.webpack-server.json ./scripts/proxy-build.ts"
9
9
  },
10
10
  "dependencies": {
11
- "@sitecore-cloudsdk/core": "^0.4.2",
12
- "@sitecore-cloudsdk/events": "^0.4.2",
11
+ "@sitecore-cloudsdk/core": "^0.5.0",
12
+ "@sitecore-cloudsdk/events": "^0.5.0",
13
13
  "font-awesome": "^4.7.0",
14
14
  "sass": "^1.52.3",
15
15
  "sass-alias": "^1.0.5"
@@ -1,11 +1,8 @@
1
1
  import type { NextApiRequest, NextApiResponse } from 'next';
2
2
  import { NativeDataFetcher, GraphQLSitemapXmlService } from '@sitecore-jss/sitecore-jss-nextjs';
3
3
  import { siteResolver } from 'lib/site-resolver';
4
- import config from 'temp/config';
5
4
  import clientFactory from 'lib/graphql-client-factory';
6
5
 
7
- const ABSOLUTE_URL_REGEXP = '^(?:[a-z]+:)?//';
8
-
9
6
  const sitemapApi = async (
10
7
  req: NextApiRequest,
11
8
  res: NextApiResponse
@@ -30,13 +27,9 @@ const sitemapApi = async (
30
27
 
31
28
  // regular sitemap
32
29
  if (sitemapPath) {
33
- const isAbsoluteUrl = sitemapPath.match(ABSOLUTE_URL_REGEXP);
34
- const sitemapUrl = isAbsoluteUrl ? sitemapPath : `${config.sitecoreApiHost}${sitemapPath}`;
35
- res.setHeader('Content-Type', 'text/xml;charset=utf-8');
36
-
37
30
  try {
38
31
  const fetcher = new NativeDataFetcher();
39
- const xmlResponse = await fetcher.fetch<string>(sitemapUrl);
32
+ const xmlResponse = await fetcher.fetch<string>(sitemapPath);
40
33
 
41
34
  return res.send(xmlResponse.data);
42
35
  } catch (error) {
@@ -51,22 +44,23 @@ const sitemapApi = async (
51
44
  return res.redirect('/404');
52
45
  }
53
46
 
54
- const reqtHost = req.headers.host;
47
+ const reqHost = req.headers.host;
55
48
  const reqProtocol = req.headers['x-forwarded-proto'] || 'https';
56
49
  const SitemapLinks = sitemaps
57
50
  .map((item: string) => {
58
51
  const parseUrl = item.split('/');
59
52
  const lastSegment = parseUrl[parseUrl.length - 1];
53
+ const escapedUrl = `${reqProtocol}://${reqHost}/${lastSegment}`.replace(/&/g, '&amp;');
60
54
 
61
55
  return `<sitemap>
62
- <loc>${reqProtocol}://${reqtHost}/${lastSegment}</loc>
56
+ <loc>${escapedUrl}</loc>
63
57
  </sitemap>`;
64
58
  })
65
59
  .join('');
66
60
 
67
61
  res.setHeader('Content-Type', 'text/xml;charset=utf-8');
68
62
 
69
- return res.send(`
63
+ return res.send(`<?xml version="1.0" encoding="UTF-8"?>
70
64
  <sitemapindex xmlns="http://sitemaps.org/schemas/sitemap/0.9" encoding="UTF-8">${SitemapLinks}</sitemapindex>
71
65
  `);
72
66
  };
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@sitecore/components": "~2.0.1",
4
- "@sitecore-cloudsdk/core": "^0.4.2",
5
- "@sitecore-cloudsdk/events": "^0.4.2",
4
+ "@sitecore-cloudsdk/core": "^0.5.0",
5
+ "@sitecore-cloudsdk/events": "^0.5.0",
6
6
  "@sitecore-feaas/clientside": "^0.5.19"
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sitecore-jss",
3
- "version": "22.6.0-canary.24",
3
+ "version": "22.6.0-canary.26",
4
4
  "description": "Sitecore JSS initializer",
5
5
  "bin": "./dist/index.js",
6
6
  "scripts": {
@@ -65,5 +65,5 @@
65
65
  "ts-node": "^10.9.1",
66
66
  "typescript": "~5.6.3"
67
67
  },
68
- "gitHead": "d02b18a9957d453d3e7370bbee2278763668f4d2"
68
+ "gitHead": "829976f7fa59e56cf6f02bd8b39af76ccb13924c"
69
69
  }