gatsby-core-theme 20.0.4 → 20.0.5

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [20.0.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.4...v20.0.5) (2023-04-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * preview function ([deb168b](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/deb168bfbfe8e5807bb2580eb46841c542506c18))
7
+
8
+
9
+ * Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([4776a9a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4776a9abd931789d4b59f42d04388fafb229703b))
10
+
1
11
  ## [20.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.3...v20.0.4) (2023-04-17)
2
12
 
3
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "20.0.4",
3
+ "version": "20.0.5",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "main": "index.js",
6
6
  "GATSBY_RECAPTCHA_SITEKEY": "6LfoyvMUAAAAAO4nl_MQnqHb4XdHxEiu5cXgIqeB",
@@ -40,9 +40,10 @@ const App = ({ pageContext }) => {
40
40
  }
41
41
  getData(searchParams);
42
42
  globalHistory.listen(({ location }) => {
43
+ const searchParams2 =
44
+ typeof window !== 'undefined' ? new URLSearchParams(location.search) : null;
43
45
  setIsLoading(true);
44
-
45
- getData(null, location.search.replace('?path=', ''));
46
+ window.location = `${window.location.origin}/preview?path=${searchParams2.get('path')}`;
46
47
  });
47
48
  }
48
49
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -16,10 +16,16 @@ export async function getPreview(siteName, page = null, themeOptions) {
16
16
  console.log(response);
17
17
  const processed = processor.run(response.data.result, themeOptions);
18
18
  const siteMarket = Object.keys(processed.site_markets)[0];
19
+
20
+ const pagePreview = processed.pages[siteMarket].preview[0];
21
+ const pagePreviewProcessed = processed.pages[siteMarket][pagePreview.relation_type].find(
22
+ (page) => page.path === pagePreview.path
23
+ );
24
+
19
25
  resolve({
20
26
  marketSections: processed.market_sections[siteMarket],
21
27
  prefilledModules: processed.prefilled_market_modules[siteMarket],
22
- page: processed.pages[siteMarket].preview[0],
28
+ page: pagePreviewProcessed,
23
29
  siteInfo: processed.general,
24
30
  });
25
31
  })