fix(storefront): read active event social media from bootstrap
This commit is contained in:
@@ -64,9 +64,14 @@ export interface ActiveEventDate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TenantEvent {
|
export interface TenantEvent {
|
||||||
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
location: string;
|
subtitle: string | null;
|
||||||
|
description: string | null;
|
||||||
|
location: string | null;
|
||||||
|
date_text: string | null;
|
||||||
dates: ActiveEventDate[];
|
dates: ActiveEventDate[];
|
||||||
|
social_media: SocialMedia[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebsiteExtras {
|
export interface WebsiteExtras {
|
||||||
@@ -129,7 +134,6 @@ export interface Tenant {
|
|||||||
footer_bg_image?: string | null;
|
footer_bg_image?: string | null;
|
||||||
storefront_website_type_code?: string | null;
|
storefront_website_type_code?: string | null;
|
||||||
header_type?: 'standard' | 'immersive';
|
header_type?: 'standard' | 'immersive';
|
||||||
event_date_text?: string | null;
|
|
||||||
extras?: WebsiteExtras;
|
extras?: WebsiteExtras;
|
||||||
event?: TenantEvent | null;
|
event?: TenantEvent | null;
|
||||||
selected_bank_account_id?: number | null;
|
selected_bank_account_id?: number | null;
|
||||||
|
|||||||
@@ -216,8 +216,20 @@ describe('StoreHomePageComponent', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
tenant.event = {
|
tenant.event = {
|
||||||
|
id: 1,
|
||||||
title: 'Fiesta Fútbol Infantil',
|
title: 'Fiesta Fútbol Infantil',
|
||||||
|
subtitle: null,
|
||||||
|
description: null,
|
||||||
location: 'Rosario, Santa Fe',
|
location: 'Rosario, Santa Fe',
|
||||||
|
date_text: '5 y 6 de Diciembre 2026',
|
||||||
|
social_media: [
|
||||||
|
{
|
||||||
|
code: 'whatsapp',
|
||||||
|
icon: 'fa-brands fa-whatsapp',
|
||||||
|
name: 'WhatsApp',
|
||||||
|
url: 'https://wa.me/5493410000000',
|
||||||
|
},
|
||||||
|
],
|
||||||
dates: [
|
dates: [
|
||||||
{
|
{
|
||||||
id: 20,
|
id: 20,
|
||||||
@@ -237,16 +249,7 @@ describe('StoreHomePageComponent', () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
tenant.event_date_text = '5 y 6 de Diciembre 2026';
|
|
||||||
tenant.storefront_website_type_code = 'onticket';
|
tenant.storefront_website_type_code = 'onticket';
|
||||||
tenant.social_media = [
|
|
||||||
{
|
|
||||||
code: 'whatsapp',
|
|
||||||
icon: 'fa-brands fa-whatsapp',
|
|
||||||
name: 'WhatsApp',
|
|
||||||
url: 'https://wa.me/5493410000000',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [StoreHomePageComponent],
|
imports: [StoreHomePageComponent],
|
||||||
@@ -279,7 +282,7 @@ describe('StoreHomePageComponent', () => {
|
|||||||
expect(hero.textContent).toContain('5 y 6 de Diciembre 2026');
|
expect(hero.textContent).toContain('5 y 6 de Diciembre 2026');
|
||||||
const heroComponent = fixture.debugElement.query(By.directive(HeroBannerComponent))
|
const heroComponent = fixture.debugElement.query(By.directive(HeroBannerComponent))
|
||||||
.componentInstance as HeroBannerComponent;
|
.componentInstance as HeroBannerComponent;
|
||||||
expect(heroComponent.eventConfig?.contact).toEqual(tenant.social_media);
|
expect(heroComponent.eventConfig?.contact).toEqual(tenant.event.social_media);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders additional information as an HTML section', async () => {
|
it('renders additional information as an HTML section', async () => {
|
||||||
@@ -347,8 +350,13 @@ describe('StoreHomePageComponent', () => {
|
|||||||
it('renders only the active event data when the tenant does not have the hero extra', async () => {
|
it('renders only the active event data when the tenant does not have the hero extra', async () => {
|
||||||
const tenant = createTenant();
|
const tenant = createTenant();
|
||||||
tenant.event = {
|
tenant.event = {
|
||||||
|
id: 2,
|
||||||
title: 'Fiesta Fútbol Infantil',
|
title: 'Fiesta Fútbol Infantil',
|
||||||
|
subtitle: null,
|
||||||
|
description: null,
|
||||||
location: 'Sunchales, Santa Fe',
|
location: 'Sunchales, Santa Fe',
|
||||||
|
date_text: null,
|
||||||
|
social_media: [],
|
||||||
dates: [
|
dates: [
|
||||||
{
|
{
|
||||||
id: 25,
|
id: 25,
|
||||||
|
|||||||
@@ -75,15 +75,14 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
protected readonly eventConfig = computed(() => {
|
protected readonly eventConfig = computed(() => {
|
||||||
const tenant = this.tenant();
|
const tenant = this.tenant();
|
||||||
const contact = tenant?.social_media ?? [];
|
|
||||||
const event = tenant?.event;
|
const event = tenant?.event;
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
return {
|
return {
|
||||||
id: tenant.id,
|
id: event.id,
|
||||||
title: event.title,
|
title: event.title,
|
||||||
location: event.location,
|
location: event.location,
|
||||||
dates_text: tenant.event_date_text,
|
dates_text: event.date_text,
|
||||||
dates: event.dates.map((eventDate) => ({
|
dates: event.dates.map((eventDate) => ({
|
||||||
id: eventDate.id,
|
id: eventDate.id,
|
||||||
date: eventDate.date,
|
date: eventDate.date,
|
||||||
@@ -92,7 +91,7 @@ export class StoreHomePageComponent implements OnInit, OnDestroy {
|
|||||||
info_text: eventDate.info_text,
|
info_text: eventDate.info_text,
|
||||||
isCanceled: eventDate.isCanceled,
|
isCanceled: eventDate.isCanceled,
|
||||||
})),
|
})),
|
||||||
contact,
|
contact: event.social_media,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user