diff --git a/src/app/core/services/tenant.interface.ts b/src/app/core/services/tenant.interface.ts index 6c3a25c..52e1524 100644 --- a/src/app/core/services/tenant.interface.ts +++ b/src/app/core/services/tenant.interface.ts @@ -64,9 +64,14 @@ export interface ActiveEventDate { } export interface TenantEvent { + id: number; title: string; - location: string; + subtitle: string | null; + description: string | null; + location: string | null; + date_text: string | null; dates: ActiveEventDate[]; + social_media: SocialMedia[]; } export interface WebsiteExtras { @@ -129,7 +134,6 @@ export interface Tenant { footer_bg_image?: string | null; storefront_website_type_code?: string | null; header_type?: 'standard' | 'immersive'; - event_date_text?: string | null; extras?: WebsiteExtras; event?: TenantEvent | null; selected_bank_account_id?: number | null; diff --git a/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts b/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts index 68b7349..2cf8555 100644 --- a/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts +++ b/src/app/features/store/pages/store-home-page/store-home-page.component.spec.ts @@ -216,8 +216,20 @@ describe('StoreHomePageComponent', () => { }, }); tenant.event = { + id: 1, title: 'Fiesta FĂștbol Infantil', + subtitle: null, + description: null, 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: [ { 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.social_media = [ - { - code: 'whatsapp', - icon: 'fa-brands fa-whatsapp', - name: 'WhatsApp', - url: 'https://wa.me/5493410000000', - }, - ]; await TestBed.configureTestingModule({ imports: [StoreHomePageComponent], @@ -279,7 +282,7 @@ describe('StoreHomePageComponent', () => { expect(hero.textContent).toContain('5 y 6 de Diciembre 2026'); const heroComponent = fixture.debugElement.query(By.directive(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 () => { @@ -347,8 +350,13 @@ describe('StoreHomePageComponent', () => { it('renders only the active event data when the tenant does not have the hero extra', async () => { const tenant = createTenant(); tenant.event = { + id: 2, title: 'Fiesta FĂștbol Infantil', + subtitle: null, + description: null, location: 'Sunchales, Santa Fe', + date_text: null, + social_media: [], dates: [ { id: 25, diff --git a/src/app/features/store/pages/store-home-page/store-home-page.component.ts b/src/app/features/store/pages/store-home-page/store-home-page.component.ts index 45e9c93..e33f14f 100644 --- a/src/app/features/store/pages/store-home-page/store-home-page.component.ts +++ b/src/app/features/store/pages/store-home-page/store-home-page.component.ts @@ -75,15 +75,14 @@ export class StoreHomePageComponent implements OnInit, OnDestroy { ); protected readonly eventConfig = computed(() => { const tenant = this.tenant(); - const contact = tenant?.social_media ?? []; const event = tenant?.event; if (event) { return { - id: tenant.id, + id: event.id, title: event.title, location: event.location, - dates_text: tenant.event_date_text, + dates_text: event.date_text, dates: event.dates.map((eventDate) => ({ id: eventDate.id, date: eventDate.date, @@ -92,7 +91,7 @@ export class StoreHomePageComponent implements OnInit, OnDestroy { info_text: eventDate.info_text, isCanceled: eventDate.isCanceled, })), - contact, + contact: event.social_media, }; }