Skip to content

Commit 2bbc301

Browse files
committed
EU region value serialization. Updated notifications.
1 parent ce63454 commit 2bbc301

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

src/Umbraco.Cms.Integrations.Crm.Hubspot/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/Render/HubspotForm.cshtml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@
55
}
66

77
<script charset="utf-8" type="text/javascript" src="@hbsptScriptPath"></script>
8-
<script>
9-
hbspt.forms.create({
10-
region: "@Model.EuRegion ? 'eu1' : 'na1'",
11-
portalId: "@Model.PortalId",
12-
formId: "@Model.Id"
13-
});
14-
</script>
8+
@if (Model.EuRegion)
9+
{
10+
<script>
11+
hbspt.forms.create({
12+
region: "eu1",
13+
portalId: "@Model.PortalId",
14+
formId: "@Model.Id"
15+
});
16+
</script>
17+
}
18+
else
19+
{
20+
<script>
21+
hbspt.forms.create({
22+
portalId: "@Model.PortalId",
23+
formId: "@Model.Id"
24+
});
25+
</script>
26+
}
1527

src/Umbraco.Cms.Integrations.Crm.Hubspot/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/js/formpicker.controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
// use OAuth
8484
umbracoCmsIntegrationsCrmHubspotResource.validateAccessToken().then(function (response) {
8585
if (response.isExpired === true || response.isValid === false) {
86-
notificationsService.warning("Hubspot API", "Invalid Access Token");
86+
vm.loading = false;
87+
notificationsService.warning("Hubspot API", "Invalid access token. Please review OAuth settings of the editor.");
8788
return;
8889
}
8990

@@ -92,7 +93,7 @@
9293
vm.hubspotFormsList = data.forms;
9394

9495
if (data.isValid === false || data.isExpired === true) {
95-
notificationsService.error("Hubspot API", "Invalid Access Token");
96+
notificationsService.error("Hubspot API", "Invalid access token. Please review OAuth settings of the editor.");
9697
}
9798
});
9899
});
@@ -103,7 +104,7 @@
103104

104105
vm.hubspotFormsList = data.forms;
105106

106-
if (data.isValid === false || data.isExpired == true) {
107+
if (data.isValid === false || data.isExpired === true) {
107108
notificationsService.error("Hubspot API", "Invalid API key");
108109
}
109110
});

src/Umbraco.Cms.Integrations.Crm.Hubspot/Editors/FormPickerValueConverter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
2424
var jObject = JObject.Parse(source.ToString());
2525
var jformId = jObject["id"];
2626
var jportalId = jObject["portalId"];
27+
var jeuRegion = jObject["euRegion"];
2728

2829
if (jformId != null && jportalId != null)
2930
{
3031
var hubspotFormViewModel = new HubspotFormViewModel
3132
{
3233
Id = jformId.Value<string>(),
33-
PortalId = jportalId.Value<string>()
34+
PortalId = jportalId.Value<string>(),
35+
EuRegion = jeuRegion.Value<bool>()
3436
};
3537
return hubspotFormViewModel;
3638
}

0 commit comments

Comments
 (0)