import {Button} from "../../components/Button/Button"; import {ConditionalWrapper} from "../../components/ConditionalWrapper/ConditionalWrapper"; import React from "react"; import {RichText} from "../../components/RichText/RichText"; import {safeURI} from "../../template-utils"; import {SnippetBase} from "../../components/SnippetBase/SnippetBase"; const DEFAULT_ICON_PATH = "chrome://branding/content/icon64.png"; export class SimpleSnippet extends React.PureComponent { constructor(props) { super(props); this.onButtonClick = this.onButtonClick.bind(this); } onButtonClick() { if (this.props.provider !== "preview") { this.props.sendUserActionTelemetry({event: "CLICK_BUTTON", id: this.props.UISurface}); } const {button_url} = this.props.content; // If button_url is defined handle it as OPEN_URL action const type = this.props.content.button_action || (button_url && "OPEN_URL"); this.props.onAction({ type, data: {args: this.props.content.button_action_args || button_url}, }); if (!this.props.content.do_not_autoblock) { this.props.onBlock(); } } _shouldRenderButton() { return this.props.content.button_action || this.props.onButtonClick || this.props.content.button_url; } renderTitle() { const {title} = this.props.content; return title ?
{this.renderText()}
{this.props.extraContent}