Skip to content

Commit ad77d93

Browse files
committed
Merge branch 'main' into feature/aprimo-integration
# Conflicts: # src/Umbraco.Cms.Integrations.sln
2 parents b10448c + 63b6c4e commit ad77d93

File tree

43 files changed

+665
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+665
-155
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This repository houses open-source extensions, created for Umbraco CMS, that int
44

55
## Available Integrations
66

7+
### Analytics
8+
9+
[Cookiebot](./src/Umbraco.Cms.Integrations.Analytics.Cookiebot/) - a Razor Class Library serving as an implementation model for Cookiebot banner and declaration.
10+
711
### Commerce
812

913
[CommerceTools](./src/Umbraco.Cms.Integrations.Commerce.CommerceTools/) - a product and category picker that can be added as a property editor for content, with a value converter providing a strongly typed model for rendering.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
trigger:
2+
- main
3+
4+
pool:
5+
vmImage: 'windows-latest'
6+
7+
variables:
8+
projectName: 'Umbraco.Cms.Integrations.Analytics.Cookiebot'
9+
project: 'src/$(projectName)/$(projectName).csproj'
10+
buildPlatform: 'Any CPU'
11+
buildConfiguration: 'Release'
12+
13+
steps:
14+
- task: NuGetToolInstaller@1
15+
displayName: 'Install NuGet'
16+
17+
- task: DotNetCoreCLI@2
18+
displayName: 'NuGet Restore'
19+
inputs:
20+
command: 'restore'
21+
feedsToUse: 'select'
22+
projects: '$(project)'
23+
includeNuGetOrg: true
24+
25+
- task: VSBuild@1
26+
displayName: 'Build Project'
27+
inputs:
28+
solution: '$(project)'
29+
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
30+
platform: '$(buildPlatform)'
31+
configuration: '$(buildConfiguration)'
32+
33+
- task: DotNetCoreCLI@2
34+
displayName: 'Create NuGet Package'
35+
inputs:
36+
command: 'pack'
37+
arguments: '--configuration $(buildConfiguration)'
38+
packagesToPack: '$(project)'
39+
versioningScheme: 'off'
40+
41+
- task: PublishBuildArtifacts@1
42+
displayName: 'Publish Build Artifacts'
43+
inputs:
44+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
45+
ArtifactName: 'drop'
46+
publishLocation: 'Container'

azure-pipeline - Script.Cookiebot.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
trigger:
2+
- main
3+
4+
pool:
5+
vmImage: 'windows-latest'
6+
7+
variables:
8+
projectName: 'Umbraco.Cms.Integrations.Script.Cookiebot'
9+
project: 'src/$(projectName)/$(projectName).csproj'
10+
buildPlatform: 'Any CPU'
11+
buildConfiguration: 'Release'
12+
13+
steps:
14+
- task: NuGetToolInstaller@1
15+
displayName: 'Install NuGet'
16+
17+
- task: DotNetCoreCLI@2
18+
displayName: 'NuGet Restore'
19+
inputs:
20+
command: 'restore'
21+
feedsToUse: 'select'
22+
projects: '$(project)'
23+
includeNuGetOrg: true
24+
25+
- task: VSBuild@1
26+
displayName: 'Build Project'
27+
inputs:
28+
solution: '$(project)'
29+
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
30+
platform: '$(buildPlatform)'
31+
configuration: '$(buildConfiguration)'
32+
33+
- task: DotNetCoreCLI@2
34+
displayName: 'Create NuGet Package'
35+
inputs:
36+
command: 'pack'
37+
arguments: '--configuration $(buildConfiguration)'
38+
packagesToPack: '$(project)'
39+
versioningScheme: 'off'
40+
41+
- task: PublishBuildArtifacts@1
42+
displayName: 'Publish Build Artifacts'
43+
inputs:
44+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
45+
ArtifactName: 'drop'
46+
publishLocation: 'Container'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
5+
<EnableDefaultContentItems>false</EnableDefaultContentItems>
6+
<TargetFramework>net6.0</TargetFramework>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<PropertyGroup>
12+
<PackageId>Umbraco.Cms.Integrations.Analytics.Cookiebot</PackageId>
13+
<Title>Umbraco CMS Integrations: Analytics - Cookiebot</Title>
14+
<Description>An extension for Umbraco CMS providing an implementation model for Cookiebot banner and declaration.</Description>
15+
<PackageIconUrl></PackageIconUrl>
16+
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main/src/Umbraco.Cms.Integrations.Analytics.Cookiebot</PackageProjectUrl>
17+
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
18+
<Version>1.0.1</Version>
19+
<Authors>Umbraco HQ</Authors>
20+
<Company>Umbraco</Company>
21+
<PackageTags>Umbraco;Umbraco-Marketplace</PackageTags>
22+
<PackageIcon>cookiebot.png</PackageIcon>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Umbraco.Cms.Web.Website" Version="10.0.0" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<SupportedPlatform Include="browser" />
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Content Include="Views\**" />
35+
<Content Include="cookiebot.png">
36+
<Pack>true</Pack>
37+
<PackagePath>\</PackagePath>
38+
</Content>
39+
</ItemGroup>
40+
41+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
2+
3+
@{
4+
var cbid = Configuration["Umbraco:Cookiebot:Settings:Id"];
5+
}
6+
7+
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js"
8+
data-cbid="@cbid"
9+
data-blockingmode="auto"
10+
type="text/javascript">
11+
</script>
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
2+
3+
@{
4+
var scriptSrc = "https://consent.cookiebot.com/" + Configuration["Umbraco:Cookiebot:Settings:Id"] + "/cd.js";
5+
}
6+
7+
<script id="CookieDeclaration"
8+
src="@scriptSrc"
9+
type="text/javascript" async>
10+
</script>
11+
4.19 KB
Loading
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Umbraco.Cms.Integrations.Analytics.Cookiebot
2+
3+
This integration provides an implementation model for [Cookiebot](https://www.cookiebot.com/) banner and declaration.
4+
5+
## Prerequisites
6+
7+
Requires minimum versions of Umbraco CMS:
8+
- CMS: 10.0.0
9+
10+
## How To Use
11+
12+
### Configuration
13+
14+
The following configuration is required for the Cookiebot scripts to be loaded correctly:
15+
16+
```
17+
"Umbraco": {
18+
"Cookiebot": {
19+
"Settings": {
20+
"Id": "[YOUR_CBID]"
21+
}
22+
}
23+
}
24+
```
25+
`CBID` = `Cookiebot Identifier`
26+
27+
### Working with the Umbraco CMS - Cookiebot integration
28+
The package is a reusable [Razor class library](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-6.0&tabs=visual-studio) which will allow editors to load the Cookiebot Banner and Declaration scripts.
29+
30+
Per Cookiebot documentation, the Banner script needs to be inserted as the __very first script__ of the website, by placing it in the _HEAD_ tag using this syntax:
31+
32+
`@await Html.PartialAsync("~/Views/Partials/UmbracoCms.Integrations/Analytics/Cookiebot/Banner.cshtml")`
33+
34+
The Declaration script can be added in whatever page you want, using this syntax:
35+
`@await Html.PartialAsync("~/Views/Partials/UmbracoCms.Integrations/Scripts/Cookiebot/Declaration.cshtml")`
36+
37+
Both scripts "pick up" the `CBID` from the website's settings file
38+
`Configuration["Umbraco:Cookiebot:Settings:Id"]`
39+
and update the details accordingly.
40+
41+
42+
### Custom implementations
43+
This integration showcases how easy it is to work with a script-based provider, just by using partial views and Microsoft's `IConfiguration` interface.
44+
45+
You can use this package as reference for creating your own. To do so, please follow these steps:
46+
- Create a new Razor class library for your integration
47+
- Add partial(s) view(s) where you insert your custom script code
48+
- Inject the `IConfiguration` interface into your view: `@inject Microsoft.Extensions.Configuration.IConfiguration Configuration`
49+
- Use `Configuration[YOUR_SETTINGS_PATH:KEY]` to retrieve the required configuration values
50+
- Add `umbraco-markertplace.json` file with Marketplace details of the package
51+
52+
Once your integration is ready, all that remains to do is to deploy the package to NuGet.
53+
You can use [this](https://learn.microsoft.com/en-us/nuget/what-is-nuget) section of the documentation from Microsoft to get started.
54+
55+
56+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"AuthorDetails": {
3+
"Description": "Umbraco HQ",
4+
"Url": "https://umbraco.com/",
5+
"ImageUrl": "https://avatars.githubusercontent.com/u/1419552?s=200&v=4"
6+
},
7+
"Category": "Analytics & Insights",
8+
"LicenseType": "Free",
9+
"PackageType": "Integration",
10+
"PackagesByAuthor": [
11+
"Umbraco.Cms.Integrations.Commerce.CommerceTools",
12+
"Umbraco.Cms.Integrations.Commerce.Shopify",
13+
"Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.URLInspectionTool",
14+
"Umbraco.Cms.Integrations.SEO.Semrush",
15+
"Umbraco.Cms.Integrations.Crm.Hubspot",
16+
"Umbraco.Cms.Integrations.Crm.Dynamics",
17+
"Umbraco.Cms.Integrations.Crm.ActiveCampaign",
18+
"Umbraco.Cms.Integrations.Automation.Zapier",
19+
"Umbraco.Cms.Integrations.Search.Algolia",
20+
"Umbraco.Cms.Integrations.PIM.Inriver"
21+
],
22+
"RelatedPackages": [],
23+
"Tags": [],
24+
"Title": "Cookiebot"
25+
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/js/configuration.controller.js

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
var vm = this;
33

44
vm.oauthConfig = {};
5-
vm.oauthSuccessEventCount = 0;
65

76
umbracoCmsIntegrationsCrmDynamicsResource.checkOAuthConfiguration().then(function (response) {
87
if (response && response.isAuthorized) {
@@ -19,6 +18,7 @@
1918

2019
vm.onConnectClick = function () {
2120

21+
window.addEventListener("message", getAccessToken, false);
2222
umbracoCmsIntegrationsCrmDynamicsResource.getAuthorizationUrl().then(function (response) {
2323
vm.authWindow = window.open(response,
2424
"Authorize", "width=900,height=700,modal=yes,alwaysRaised=yes");
@@ -37,42 +37,38 @@
3737

3838
if (typeof $scope.revoked === "function")
3939
$scope.revoked();
40+
41+
window.removeEventListener("message", getAccessToken);
4042
});
4143
}
4244

43-
// authorization listener
44-
window.addEventListener("message", function (event) {
45+
function getAccessToken(event) {
4546
if (event.data.type === "hubspot:oauth:success") {
46-
vm.oauthSuccessEventCount += 1;
47-
48-
if (vm.oauthSuccessEventCount == 1) {
49-
umbracoCmsIntegrationsCrmDynamicsResource.getAccessToken(event.data.code).then(function (response) {
50-
51-
if (response.startsWith("Error:")) {
52-
53-
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
54-
// if directive runs from data type, the notifications are displayed
55-
if (typeof $scope.connected === "undefined")
56-
notificationsService.error("Dynamics Configuration", response);
57-
} else {
58-
vm.oauthConfig.isConnected = true;
59-
60-
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
61-
// if directive runs from data type, the notifications are displayed
62-
if (typeof $scope.connected === "undefined")
63-
notificationsService.success("Dynamics Configuration", "OAuth connected.");
64-
65-
umbracoCmsIntegrationsCrmDynamicsResource.getSystemUserFullName().then(function (response) {
66-
vm.oauthConfig.fullName = response;
67-
});
68-
69-
if (typeof $scope.connected === "function")
70-
$scope.connected();
71-
}
72-
});
73-
}
47+
umbracoCmsIntegrationsCrmDynamicsResource.getAccessToken(event.data.code).then(function (response) {
48+
if (response.startsWith("Error:")) {
49+
50+
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
51+
// if directive runs from data type, the notifications are displayed
52+
if (typeof $scope.connected === "undefined")
53+
notificationsService.error("Dynamics Configuration", response);
54+
} else {
55+
vm.oauthConfig.isConnected = true;
56+
57+
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
58+
// if directive runs from data type, the notifications are displayed
59+
if (typeof $scope.connected === "undefined")
60+
notificationsService.success("Dynamics Configuration", "OAuth connected.");
61+
62+
umbracoCmsIntegrationsCrmDynamicsResource.getSystemUserFullName().then(function (response) {
63+
vm.oauthConfig.fullName = response;
64+
});
65+
66+
if (typeof $scope.connected === "function")
67+
$scope.connected();
68+
}
69+
});
7470
}
75-
}, false);
71+
}
7672
}
7773

7874
angular.module("umbraco")

0 commit comments

Comments
 (0)