import { LightningElement, api } from "lwc"; import { track } from "dxUtils/analytics"; export default class CardBlogPost extends LightningElement { @api body!: string; @api datetime!: string; @api dateTime?: string | null = null; @api featured?: boolean = false; @api href!: string; @api imgAlt?: string; @api imgSrc?: string | null; @api label?: string; @api target?: string | null = null; @api header!: string; @api authors?: Array | null = null; @api origin?: string = "wordpress"; @api layout: "vertical" | "horizontal" = "vertical"; @api clickEvent?: () => void; // LWC is being compiled so that datetime is being interpreted as date-time // ONLY from from the implementation in dx-card-blog-post-provider private get _datetime() { return this.datetime || this.dateTime; } private onLinkClick(event: Event) { if (this.clickEvent) { this.clickEvent(); } const payload = { click_text: this.header, click_url: `${window.location.origin}${this.href}`, element_title: this.header, element_type: "card", content_category: "link", recommendation_type: this.origin }; track(event.target!, "custEv_blogCardClick", { ...payload, blog_author: this.authors, blog_title: this.header }); track(event.target!, "custEv_linkClick", payload); } }