This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Feature.Hubspot.Models | |
{ | |
using Sitecore.XConnect; | |
using System; | |
[FacetKey(DefaultFacetKey)] | |
[Serializable] | |
public class ScoreFacet : Facet | |
{ | |
public const string DefaultFacetKey = "HubspotScore"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Feature.Hubspot.Models | |
{ | |
using Sitecore.XConnect; | |
using System; | |
[FacetKey(DefaultFacetKey)] | |
[Serializable] | |
public class ScoreNameFacet : Facet | |
{ | |
public const string DefaultFacetKey = "HubspotScoreName"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Feature.Hubspot.Models | |
{ | |
using Sitecore.XConnect; | |
using Sitecore.XConnect.Collection.Model; | |
using Sitecore.XConnect.Schema; | |
public class HubspotScoreFacetModel | |
{ | |
public static XdbModel Model { get; } = HubspotScoreFacetModel.BuilddCustomModel(); | |
private static XdbModel BuilddCustomModel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
using Sitecore.Feature.Hubspot.Models; | |
public static void Main(string[] args) | |
{ | |
var model = Sitecore.XConnect.Serialization.XdbModelWriter.Serialize(HubspotScoreFacetModel.Model); | |
File.WriteAllText(HubspotScoreFacetModel.Model.FullName + .json, model); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Name": "HubspotScoreFacetModel", | |
"Version": "1.0", | |
"References": [ | |
{ | |
"Name": "XConnect", | |
"Version": "1.0" | |
}, | |
{ | |
"Name": "Sitecore.XConnect.Collection.Model", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Feature.Hubspot.Extension | |
{ | |
using Sitecore.Feature.Hubspot.Models; | |
using Sitecore.Analytics; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Rules; | |
using Sitecore.Rules.Conditions; | |
using Sitecore.XConnect; | |
using Sitecore.XConnect.Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sitecore.Feature.Hubspot.Extension | |
{ | |
using Sitecore.Feature.Hubspot.Models; | |
using Sitecore.Analytics; | |
using Sitecore.Data.Items; | |
using Sitecore.Diagnostics; | |
using Sitecore.Rules; | |
using Sitecore.Rules.Conditions; | |
using Sitecore.XConnect; | |
using Sitecore.XConnect.Client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private HubspotSettingsModel GetHubspotSettingsModel(Item dataSource) | |
{ | |
var hubspotConfigItemId = Settings.GetSetting(ConfigItemId); | |
if (string.IsNullOrEmpty(hubspotConfigItemId)) | |
{ | |
hubspotConfigItemId = "{1F0F4461-60CB-4132-94DB-5C93E185FDA8}"; | |
} | |
var hubspotConfigItem = Sitecore.Context.Database.GetItem(hubspotConfigItemId); | |
var portalId = (!string.IsNullOrWhiteSpace(dataSource[Templates.HubspotFormSettings.Fields.HubspotPortalId]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Form() | |
{ | |
var dataSourceId = RenderingContext.CurrentOrNull.Rendering.DataSource; | |
var dataSource = Sitecore.Context.Database.Items.GetItem(dataSourceId); | |
if (dataSource == null) | |
{ | |
return View(); | |
} | |
var hubspotFormSettings = GetHubspotSettingsModel(dataSource); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[ValidateInput(false)] | |
public ActionResult DownloadGatedContent(string articleId) | |
{ | |
if (!Sitecore.Context.PageMode.IsExperienceEditor) | |
{ | |
HttpCookie cookie = new HttpCookie("CapcoCookie"); | |
var userEntryId = Guid.NewGuid(); | |
cookie["UserEntryId"] = userEntryId.ToString(); | |
cookie.Expires = DateTime.Now.AddYears(1); |
OlderNewer