gatsby-core-theme 20.0.3 → 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 +20 -0
- package/package.json +1 -1
- package/src/components/app.js +3 -2
- package/src/helpers/api.js +7 -1
- package/src/helpers/getters.js +1 -1
- package/src/helpers/processor/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
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
|
+
|
|
11
|
+
## [20.0.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.3...v20.0.4) (2023-04-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* preview operator review pages ([732f8af](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/732f8afe0becc43694fa765cc00c2dc8212e938d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([a58d979](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a58d9795a5c666083ddff3e95a4a622f9dba3d0b))
|
|
20
|
+
|
|
1
21
|
## [20.0.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v20.0.2...v20.0.3) (2023-04-17)
|
|
2
22
|
|
|
3
23
|
|
package/package.json
CHANGED
package/src/components/app.js
CHANGED
|
@@ -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
|
package/src/helpers/api.js
CHANGED
|
@@ -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:
|
|
28
|
+
page: pagePreviewProcessed,
|
|
23
29
|
siteInfo: processed.general,
|
|
24
30
|
});
|
|
25
31
|
})
|
package/src/helpers/getters.js
CHANGED
|
@@ -374,7 +374,7 @@ export function shiftFirstOperator(pageId, module, pagesMappedById) {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
export const getModuleTitle = (module, page) => {
|
|
377
|
-
if (page && page.relation_type === 'operator') {
|
|
377
|
+
if (page && page.relation && page.relation_type === 'operator') {
|
|
378
378
|
return (
|
|
379
379
|
module.module_title && module.module_title.replace('[operator_name]', page.relation.name)
|
|
380
380
|
);
|
|
@@ -259,13 +259,13 @@ export default {
|
|
|
259
259
|
prefilledMarketModules = data.prefilled_market_modules || {};
|
|
260
260
|
prefilledMarketModulesRaw = cloneDeep(data.prefilled_market_modules);
|
|
261
261
|
Object.keys(transformedPages[market]).forEach((pageType) => {
|
|
262
|
-
transformedPages[market][pageType].forEach(
|
|
262
|
+
transformedPages[market][pageType].forEach((page, index) => {
|
|
263
263
|
// process page extra fields
|
|
264
264
|
page.extra_fields && processExtraFields(page.extra_fields);
|
|
265
265
|
updatePlaceholders(page, data);
|
|
266
266
|
|
|
267
267
|
// set page relation
|
|
268
|
-
|
|
268
|
+
processRelations(page, pageType, transformedPages, market, data, index);
|
|
269
269
|
|
|
270
270
|
// add author object to page
|
|
271
271
|
if (page.author_id !== null && data.authors[page.author_id]) {
|