Try your search with a different keyword or use * as a wildcard.
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ViewComponents;
using Nop.Plugin.Widgets.FacebookPixel.Services;
using Nop.Web.Framework.Components;
using Nop.Web.Framework.Infrastructure;
namespace Nop.Plugin.Widgets.FacebookPixel.Components;
///
/// Represents Facebook Pixel view component
///
public class FacebookPixelViewComponent : NopViewComponent
{
#region Fields
protected readonly FacebookPixelService _facebookPixelService;
#endregion
#region Ctor
public FacebookPixelViewComponent(FacebookPixelService facebookPixelService)
{
_facebookPixelService = facebookPixelService;
}
#endregion
#region Methods
///
/// Invoke view component
///
/// Widget zone name
/// Additional data
///
/// A task that represents the asynchronous operation
/// The task result contains the view component result
///
public async Task InvokeAsync(string widgetZone, object additionalData)
{
var script = widgetZone != PublicWidgetZones.HeadHtmlTag
? await _facebookPixelService.PrepareCustomEventsScriptAsync(widgetZone)
: await _facebookPixelService.PrepareScriptAsync();
return new HtmlContentViewComponentResult(new HtmlString(script ?? string.Empty));
}
#endregion
}