Skip to content

Commit

Permalink
Merge branch 'development' into bugfix/fix-bapi-url
Browse files Browse the repository at this point in the history
  • Loading branch information
supproduction authored Oct 20, 2024
2 parents 2a349b8 + fc94309 commit 216257f
Show file tree
Hide file tree
Showing 44 changed files with 205 additions and 397 deletions.
3 changes: 2 additions & 1 deletion libs/domain/content/link/link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ export class ContentLinkComponent extends ContentMixin<

protected $link = computed(() => {
const { url, type, id, qualifier, params } = this.$options();

if (url) return of(url);
if (type)
return this.semanticLinkService.get({
type: type,
type,
id,
qualifier,
params,
Expand Down
1 change: 1 addition & 0 deletions libs/domain/content/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './feature';
export * from './models';
export * from './resolvers';
export * from './services';
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// TODO: create dynamic types and dependable dynamic pages.
export const cmsTypes = ['article', 'faq', 'about'];

declare global {
interface ContentFields {
article: undefined;
about: undefined;
faq: undefined;
about: undefined;
}
}

export interface ArticleContent {
export interface CmsContent {
heading: string;
description: string;
content: string;
type: string;
[key: string]: unknown;
}
3 changes: 3 additions & 0 deletions libs/domain/content/src/models/content.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
declare global {
interface ContentFields {
/**
* Page or component config. // ExperienceComponent
*/
component: undefined;
}
}
Expand Down
1 change: 1 addition & 0 deletions libs/domain/content/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './cms.model';
export * from './content.model';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
ContentContext,
ContentQualifier,
ContentService,
} from '@oryx-frontend/content';
import {
ContextService,
ElementResolver,
Expand All @@ -11,9 +6,10 @@ import {
import { inject } from '@oryx-frontend/di';
import { RouterService } from '@oryx-frontend/router';
import { Observable, combineLatest, map, of, switchMap } from 'rxjs';
import { ArticleContent } from '../article.model';
import { CmsContent, ContentQualifier } from '../models';
import { ContentContext, ContentService } from '../services';

export class ArticlePageDescriptionMetaResolver implements PageMetaResolver {
export class CmsPageDescriptionMetaResolver implements PageMetaResolver {
constructor(
protected context = inject(ContextService),
protected content = inject(ContentService),
Expand All @@ -26,7 +22,11 @@ export class ArticlePageDescriptionMetaResolver implements PageMetaResolver {
combineLatest([
this.context.get(null, ContentContext.Content),
this.router.currentRoute(),
]).pipe(map(([type, route]) => route.includes(`/${type}/`))),
]).pipe(
map(([qualifier, route]) =>
route.includes(`/${qualifier?.type}/${qualifier?.id}`)
)
),
]);
}

Expand All @@ -41,7 +41,7 @@ export class ArticlePageDescriptionMetaResolver implements PageMetaResolver {
if (!id || !type) return of({});

return this.content
.get<ArticleContent>({
.get<CmsContent>({
id,
type,
entities: [type],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
ContentContext,
ContentQualifier,
ContentService,
} from '@oryx-frontend/content';
import {
ContextService,
ElementResolver,
Expand All @@ -11,9 +6,10 @@ import {
import { inject } from '@oryx-frontend/di';
import { RouterService } from '@oryx-frontend/router';
import { Observable, combineLatest, map, of, switchMap } from 'rxjs';
import { ArticleContent } from '../article.model';
import { CmsContent, ContentQualifier } from '../models';
import { ContentContext, ContentService } from '../services';

export class ArticlePageTitleMetaResolver implements PageMetaResolver {
export class CmsPageTitleMetaResolver implements PageMetaResolver {
constructor(
protected context = inject(ContextService),
protected router = inject(RouterService),
Expand All @@ -26,7 +22,11 @@ export class ArticlePageTitleMetaResolver implements PageMetaResolver {
combineLatest([
this.context.get(null, ContentContext.Content),
this.router.currentRoute(),
]).pipe(map(([type, route]) => route.includes(`/${type}/`))),
]).pipe(
map(([qualifier, route]) =>
route.includes(`/${qualifier?.type}/${qualifier?.id}`)
)
),
]);
}

Expand All @@ -41,7 +41,7 @@ export class ArticlePageTitleMetaResolver implements PageMetaResolver {
if (!id || !type) return of({});

return this.content
.get<ArticleContent>({
.get<CmsContent>({
id,
type,
entities: [type],
Expand Down
2 changes: 2 additions & 0 deletions libs/domain/content/src/resolvers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './cms-page-description-meta.resolver';
export * from './cms-page-title-meta.resolver';
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ContentContext } from '@oryx-frontend/content';
import { ContextFallback } from '@oryx-frontend/core';
import { inject, Provider } from '@oryx-frontend/di';
import { RouterService } from '@oryx-frontend/router';
import { combineLatest, map } from 'rxjs';
import { ContentContext } from '../content-context';

export const ArticleQualifierContextFallback: Provider = {
export const CmsQualifierContextFallback: Provider = {
provide: `${ContextFallback}${ContentContext.Content}`,
useFactory: () =>
combineLatest([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import {
Content,
ContentConfig,
ContentQualifier,
ContentService,
} from '@oryx-frontend/content';
import { PageMetaResolver, provideEntity } from '@oryx-frontend/core';
import { Provider } from '@oryx-frontend/di';
import { provideExperienceData } from '@oryx-frontend/experience';
import { ArticleQualifierContextFallback } from './article-context';
import { experienceArticlePages } from './article-page';
import { articleTypes } from './article-types';
import { Content, ContentQualifier, cmsTypes } from '../../models';
import {
ArticlePageDescriptionMetaResolver,
ArticlePageTitleMetaResolver,
} from './resolvers';
CmsPageDescriptionMetaResolver,
CmsPageTitleMetaResolver,
} from '../../resolvers';
import { ContentConfig } from '../adapter';
import { ContentService } from '../content.service';
import { CmsQualifierContextFallback } from './cms-context';
import { contentfulProviders } from './contentful';
import { storyblokProviders } from './storyblok';
import { strapiProviders } from './strapi';

export const articleProviders: Provider[] = [
ArticleQualifierContextFallback,
provideExperienceData(experienceArticlePages),
export const cmsProviders: Provider[] = [
...contentfulProviders,
...storyblokProviders,
...strapiProviders,
CmsQualifierContextFallback,
{
provide: PageMetaResolver,
useClass: ArticlePageTitleMetaResolver,
useClass: CmsPageTitleMetaResolver,
},
{
provide: PageMetaResolver,
useClass: ArticlePageDescriptionMetaResolver,
useClass: CmsPageDescriptionMetaResolver,
},
{
provide: ContentConfig,
Expand All @@ -41,10 +40,10 @@ export const articleProviders: Provider[] = [
},
},
},
...articleTypes.map((type) =>
...cmsTypes.map((type) =>
provideEntity<Content | null | undefined, ContentQualifier>(type, {
service: ContentService,
context: type,
context: 'content',
get: (service, qualifier) =>
(service as ContentService).get({ ...qualifier, type }),
})
Expand Down
2 changes: 2 additions & 0 deletions libs/domain/content/src/services/cms/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './cms-context';
export * from './cms-providers';
export * from './contentful';
export * from './storyblok';
export * from './strapi';
10 changes: 2 additions & 8 deletions libs/domain/content/src/services/content.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { provideEntity } from '@oryx-frontend/core';
import { Provider } from '@oryx-frontend/di';
import { ExperienceAdapter } from '@oryx-frontend/experience';
import { ContentExperienceAdapter } from './adapter';
import {
contentfulProviders,
storyblokProviders,
strapiProviders,
} from './cms';
import { cmsProviders } from './cms';
import { ContentContext } from './content-context';
import { ContentService } from './content.service';
import { DefaultContentService } from './default-content.service';
Expand All @@ -25,11 +21,9 @@ export const contentProviders: Provider[] = [
provide: FontService,
useClass: DefaultFontService,
},
...contentfulProviders,
...storyblokProviders,
...strapiProviders,
provideEntity('content', {
service: ContentService,
context: ContentContext.Content,
}),
...cmsProviders,
];
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export class DefaultPageMetaResolverService implements PageMetaResolverService {
).pipe(
map((data) =>
data
.filter(([score]) => score !== ResolverScore.NotUsed)
.filter(
([score, data]) =>
score !== ResolverScore.NotUsed && Object.keys(data).length
)
.sort(([aScore], [bScore]) => aScore - bScore)
.reduce((acc, [_, elements]) => ({ ...acc, ...elements }), {})
)
Expand Down
1 change: 1 addition & 0 deletions libs/platform/experience/data-text/data-text.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class DataTextComponent extends TextMixin(

protected $data = computed<string | undefined>(() => {
const { entity: type, field } = this.$options();

return this.entityService
.getField<string>({ element: this, type, field })
.pipe(catchError(() => of()));
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/blue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const blue: Color = {
light: {
0: 'white',
1: 'hsl(206, 100%, 99.2%)',
2: 'hsl(210, 100%, 98%)',
3: 'hsl(209, 100%, 96.5%)',
Expand All @@ -16,6 +17,7 @@ export const blue: Color = {
12: 'hsl(211, 100%, 15%)',
},
dark: {
0: 'white',
1: 'hsl(212, 35%, 9.2%)',
2: 'hsl(216, 50%, 11.8%)',
3: 'hsl(214, 59.4%, 15.3%)',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/bronze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const bronze: Color = {
light: {
0: 'white',
1: '#fdfcfc',
2: '#fdf7f5',
3: '#f6edea',
Expand All @@ -16,6 +17,7 @@ export const bronze: Color = {
12: '#43302b',
},
dark: {
0: 'white',
1: '#141110',
2: '#1c1917',
3: '#262220',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/brown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const brown: Color = {
light: {
0: 'white',
1: 'hsl(30, 40.0%, 99.1%)',
2: 'hsl(30, 50.0%, 97.6%)',
3: 'hsl(30, 52.5%, 94.6%)',
Expand All @@ -16,6 +17,7 @@ export const brown: Color = {
12: 'hsl(20, 30.0%, 19.0%)',
},
dark: {
0: 'white',
1: 'hsl(22, 15.0%, 8.7%)',
2: 'hsl(20, 28.3%, 10.4%)',
3: 'hsl(20, 28.0%, 14.0%)',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/crimson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const crimson: Color = {
light: {
0: 'white',
1: 'hsl(332, 100%, 99.4%)',
2: 'hsl(330, 100%, 98.4%)',
3: 'hsl(331, 85.6%, 96.6%)',
Expand All @@ -16,6 +17,7 @@ export const crimson: Color = {
12: 'hsl(340, 65.0%, 14.5%)',
},
dark: {
0: 'white',
1: 'hsl(335, 20%, 9.6%)',
2: 'hsl(335, 32.2%, 11.6%)',
3: 'hsl(335, 42.5%, 16.5%)',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/cyan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const cyan: Color = {
light: {
0: 'white',
1: 'hsl(185, 60.0%, 98.7%)',
2: 'hsl(185, 73.3%, 97.1%)',
3: 'hsl(186, 70.2%, 94.4%)',
Expand All @@ -16,6 +17,7 @@ export const cyan: Color = {
12: 'hsl(192, 88.0%, 12.5%)',
},
dark: {
0: 'white',
1: 'hsl(192, 60.0%, 7.2%)',
2: 'hsl(192, 71.4%, 8.2%)',
3: 'hsl(192, 75.9%, 10.8%)',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/gold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const gold: Color = {
light: {
0: 'white',
1: '#fdfdfc',
2: '#faf9f2',
3: '#f2f0e7',
Expand All @@ -16,6 +17,7 @@ export const gold: Color = {
12: '#3b352b',
},
dark: {
0: 'white',
1: '#121211',
2: '#1b1a17',
3: '#24231f',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/grass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const grass: Color = {
light: {
0: 'white',
1: 'hsl(116, 50.0%, 98.9%)',
2: 'hsl(120, 60.0%, 97.1%)',
3: 'hsl(120, 53.6%, 94.8%)',
Expand All @@ -16,6 +17,7 @@ export const grass: Color = {
12: 'hsl(130, 30.0%, 14.9%)',
},
dark: {
0: 'white',
1: 'hsl(146, 30.0%, 7.4%)',
2: 'hsl(136, 33.3%, 8.8%)',
3: 'hsl(137, 36.0%, 11.4%)',
Expand Down
2 changes: 2 additions & 0 deletions libs/platform/experience/src/color/colors/colored/indigo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Color } from '../../color.model';

export const indigo: Color = {
light: {
0: 'white',
1: 'hsl(225, 60.0%, 99.4%)',
2: 'hsl(223, 100%, 98.6%)',
3: 'hsl(223, 98.4%, 97.1%)',
Expand All @@ -16,6 +17,7 @@ export const indigo: Color = {
12: 'hsl(226, 62.0%, 17.0%)',
},
dark: {
0: 'white',
1: 'hsl(229, 24.0%, 10.0%)',
2: 'hsl(230, 36.4%, 12.9%)',
3: 'hsl(228, 43.3%, 17.5%)',
Expand Down
Loading

0 comments on commit 216257f

Please sign in to comment.