/** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { html } from "chrome://global/content/vendor/lit.all.mjs"; import { MozLitElement } from "chrome://global/content/lit-utils.mjs"; window.MozXULElement.insertFTLIfNeeded("preview/linkPreview.ftl"); /** * Class representing a link preview onboarding card element. * This component is shown when onboarding state is true. * * @augments MozLitElement */ class LinkPreviewCardOnboarding extends MozLitElement { static get properties() { return { onboardingType: { type: String }, }; } constructor() { super(); this.onboardingType = "shiftKey"; } /** * Handles click on the "Try it now" button. * * @param {MouseEvent} _event - The click event. */ handleTryLinkPreview(_event) { this.dispatchEvent(new CustomEvent("LinkPreviewCard:onboardingComplete")); } /** * Handles click on the "Close" button. * * @param {MouseEvent} _event - The click event. */ handleCloseOnboarding(_event) { this.dispatchEvent(new CustomEvent("LinkPreviewCard:onboardingClose")); } /** * Renders the link preview onboarding element. * * @returns {import('lit').TemplateResult} The rendered HTML template. */ render() { const titleL10nId = this.onboardingType === "longPress" ? "link-preview-onboarding-title-long-press" : "link-preview-onboarding-title-shift"; const descriptionL10nId = this.onboardingType === "longPress" ? "link-preview-onboarding-description-long-press" : "link-preview-onboarding-description-shift"; const imageSrc = this.onboardingType === "longPress" ? "chrome://browser/content/genai/assets/onboarding-link-preview-image-longpress.svg" : "chrome://browser/content/genai/assets/onboarding-link-preview-image-shift.svg"; return html`

`; } } customElements.define( "link-preview-card-onboarding", LinkPreviewCardOnboarding );