Skip to content

Commit 0b3522b

Browse files
fix: added missing import
1 parent 1084c1d commit 0b3522b

File tree

20 files changed

+94
-52
lines changed

20 files changed

+94
-52
lines changed

.changeset/eleven-chicken-wish.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@o2s/integrations.strapi-cms': patch
3+
'@o2s/blocks.article-search': patch
4+
'@o2s/blocks.article-list': patch
5+
'@o2s/integrations.mocked': patch
6+
'@o2s/blocks.category': patch
7+
'@o2s/blocks.article': patch
8+
'@o2s/api-harmonization': patch
9+
'@o2s/framework': patch
10+
'@o2s/ui': patch
11+
---
12+
13+
improvements for knowledge base blocks and layouts

apps/api-harmonization/src/modules/page/page.mapper.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ export const mapArticle = (
6868
main: [
6969
{
7070
__typename: 'ArticleBlock',
71+
layout: {
72+
variant: 'full',
73+
spacing: 'none',
74+
background: 'none',
75+
},
7176
...article,
7277
},
7378
],

packages/blocks/article-list/src/api-harmonization/article-list.mapper.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import { ArticleListBlock } from './article-list.model';
77
export const mapArticleList = (
88
cms: CMS.Model.ArticleListBlock.ArticleListBlock,
99
articles: Articles.Model.Articles,
10+
category: Articles.Model.Category | undefined,
1011
locale: string,
1112
): ArticleListBlock => {
1213
return {
1314
__typename: 'ArticleListBlock',
1415
id: cms.id,
1516
title: cms.title,
1617
description: cms.description,
17-
categoryLink:
18-
cms.categorySlug && cms.parent?.slug
19-
? {
20-
url: `/${cms.parent?.slug}/${cms.categorySlug}`,
21-
label: cms.labels.seeAllArticles,
22-
}
23-
: undefined,
18+
categoryLink: category
19+
? {
20+
url: category.slug,
21+
label: cms.labels.seeAllArticles,
22+
}
23+
: undefined,
2424
items: {
2525
...articles,
2626
data: articles.data.map((article) => mapArticle(article, cms, locale)),

packages/blocks/article-list/src/api-harmonization/article-list.service.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { Articles, CMS } from '@o2s/configs.integrations';
3-
import { Observable, concatMap, forkJoin, map } from 'rxjs';
3+
import { Observable, concatMap, forkJoin, map, of } from 'rxjs';
44

55
import { Models as ApiModels } from '@o2s/utils.api-harmonization';
66

@@ -23,14 +23,19 @@ export class ArticleListService {
2323

2424
return forkJoin([cms]).pipe(
2525
concatMap(([cms]) => {
26-
return this.articlesService
27-
.getArticleList({
28-
limit: cms.articlesToShow || 4,
29-
locale: headers['x-locale'],
30-
ids: cms.articleIds,
31-
category: cms.categorySlug,
32-
})
33-
.pipe(map((articles) => mapArticleList(cms, articles, headers['x-locale'])));
26+
const articles = this.articlesService.getArticleList({
27+
limit: cms.articlesToShow || 4,
28+
locale: headers['x-locale'],
29+
ids: cms.articleIds,
30+
category: cms.categoryId,
31+
});
32+
const category = cms.categoryId
33+
? this.articlesService.getCategory({ id: cms.categoryId, locale: headers['x-locale'] })
34+
: of(undefined);
35+
36+
return forkJoin([articles, category]).pipe(
37+
map(([articles, category]) => mapArticleList(cms, articles, category, headers['x-locale'])),
38+
);
3439
}),
3540
);
3641
}

packages/blocks/article-list/src/frontend/ArticleList.client.stories.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const Default: Story = {
4545
lead: 'Learn how to efficiently manage your PowerPro tools through our self-service portal available 24/7.',
4646
tags: ['tag1', 'tag2'],
4747
image: {
48-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
48+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
4949
width: 640,
5050
height: 427,
5151
alt: '',
@@ -77,13 +77,13 @@ export const Default: Story = {
7777
lead: 'Learn about our certification program ensuring your tools meet industry safety standards.',
7878
tags: ['certification', 'safety', 'standards'],
7979
image: {
80-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
80+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
8181
width: 640,
8282
height: 427,
8383
alt: 'PowerPro certification program',
8484
},
8585
thumbnail: {
86-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
86+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-managing-thumb.jpg',
8787
alt: 'PowerPro certification program thumbnail',
8888
},
8989
category: {
@@ -109,13 +109,13 @@ export const Default: Story = {
109109
lead: "Everything you need to know about PowerPro's warranty coverage for your professional tools.",
110110
tags: ['warranty', 'coverage', 'terms'],
111111
image: {
112-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-maintenance-thumb.jpg',
112+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-maintenance-thumb.jpg',
113113
width: 640,
114114
height: 427,
115115
alt: 'PowerPro warranty coverage',
116116
},
117117
thumbnail: {
118-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-maintenance-thumb.jpg',
118+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-maintenance-thumb.jpg',
119119
alt: 'PowerPro warranty coverage thumbnail',
120120
},
121121
category: {
@@ -141,13 +141,13 @@ export const Default: Story = {
141141
lead: "Learn how regular maintenance can extend your tool's lifespan and prevent costly repairs.",
142142
tags: ['maintenance', 'prevention', 'care'],
143143
image: {
144-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-safety-thumb.jpg',
144+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-safety-thumb.jpg',
145145
width: 640,
146146
height: 427,
147147
alt: 'Preventive maintenance of PowerPro tools',
148148
},
149149
thumbnail: {
150-
url: 'https://raw.githubusercontent.com/o2sdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-safety-thumb.jpg',
150+
url: 'https://raw.githubusercontent.com/dxpdev/openselfservice/refs/heads/main/packages/integrations/mocked/public/images/article-safety-thumb.jpg',
151151
alt: 'Preventive maintenance thumbnail',
152152
},
153153
category: {

packages/blocks/article-search/src/api-harmonization/article-search.mapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const mapArticleSearch = (
1111
id: cms.id,
1212
title: cms.title,
1313
inputLabel: cms.inputLabel,
14+
category: cms.category,
1415
noResults: cms.noResults,
1516
};
1617
};

packages/blocks/article-search/src/api-harmonization/article-search.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export class ArticleSearchBlock extends ApiModels.Block.Block {
44
__typename!: 'ArticleSearchBlock';
55
title?: string;
66
inputLabel!: string;
7+
category?: string;
78
noResults!: {
89
title: string;
910
description?: string;

packages/blocks/article-search/src/api-harmonization/article-search.request.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export class SearchArticlesQuery implements Omit<Articles.Request.SearchArticles
88
query!: string;
99
limit!: number;
1010
offset!: number;
11+
category?: string;
1112
}

packages/blocks/article-search/src/frontend/ArticleSearch.client.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const ArticleSearchPure: React.FC<ArticleSearchPureProps> = ({
1818
title,
1919
inputLabel,
2020
noResults,
21+
category,
2122
accessToken,
2223
locale,
2324
routing,
@@ -31,7 +32,7 @@ export const ArticleSearchPure: React.FC<ArticleSearchPureProps> = ({
3132
const getSuggestions = debounce(300, async (value: string) => {
3233
startTransition(async () => {
3334
const result = await sdk.blocks.searchArticles(
34-
{ query: value, limit: 5, offset: 0 },
35+
{ query: value, limit: 5, offset: 0, category },
3536
{ 'x-locale': locale },
3637
accessToken,
3738
);

0 commit comments

Comments
 (0)