Skip to content

Commit a9835fb

Browse files
committed
Merge branch 'main-v14' into v14/feature/42661-V14-Integrations-(ActiveCampaign)
# Conflicts: # .gitignore # src/Umbraco.Cms.Integrations.Testsite.V14/Umbraco.Cms.Integrations.Testsite.V14.csproj # src/Umbraco.Cms.Integrations.Testsite.V14/appsettings.json # src/Umbraco.Cms.Integrations.sln
2 parents 6d697f5 + 05b9d6e commit a9835fb

File tree

103 files changed

+9233
-1329
lines changed

Some content is hidden

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

103 files changed

+9233
-1329
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/Services/UserValidationService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ public class UserValidationService : IUserValidationService
99
{
1010
private readonly IUserService _userService;
1111

12-
private readonly AppSettings _zapierSettings;
12+
private readonly ZapierSettings _zapierSettings;
1313

1414
private readonly ZapierFormsSettings _zapierFormsSettings;
1515

1616
private readonly IBackOfficeUserManager _backOfficeUserManager;
1717

1818
public UserValidationService(
19-
IOptions<AppSettings> options,
19+
IOptions<ZapierSettings> options,
2020
IOptions<ZapierFormsSettings> zapierFormsSettings,
2121
IBackOfficeUserManager backOfficeUserManager)
2222
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const outputPath = 'Release' !== 'Release' ? '../wwwroot' : '../obj/Release/net8.0/clientassets'
1+
export const outputPath = 'Debug' !== 'Release' ? '../wwwroot' : '../obj/Debug/net8.0/clientassets'
Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
<Project>
2-
<!--
2+
<!--
33
Copied from: https://github.com/aspnet/AspLabs/blob/main/src/ClientAssets/Microsoft.AspNetCore.ClientAssets/build/netstandard2.0/Microsoft.AspNetCore.ClientAssets.targets
44
55
More information:
66
- https://devblogs.microsoft.com/dotnet/build-client-web-assets-for-your-razor-class-library/
77
- https://github.com/dotnet/aspnetcore/issues/38445
88
-->
9-
<PropertyGroup>
10-
<ClientAssetsDirectory Condition="'$(ClientAssetsDirectory)' == ''">Client\</ClientAssetsDirectory>
11-
<ClientAssetsRestoreInputs Condition="'$(ClientAssetsRestoreInputs)' == ''">$(ClientAssetsDirectory)\package-lock.json;$(ClientAssetsDirectory)\package.json</ClientAssetsRestoreInputs>
12-
<ClientAssetsRestoreOutputs Condition="'$(ClientAssetsRestoreOutputs)' == ''">$(ClientAssetsDirectory)node_modules\.package-lock.json</ClientAssetsRestoreOutputs>
13-
<ClientAssetsRestoreCommand Condition="'$(ClientAssetsRestoreCommand)' == ''">npm ci --no-fund --no-audit --prefer-offline</ClientAssetsRestoreCommand>
14-
<ClientAssetsBuildCommand Condition="'$(ClientAssetsBuildCommand)' == ''">npm run build</ClientAssetsBuildCommand>
15-
16-
<!-- Include project file to pick up changes in the above values -->
17-
<ClientAssetsRestoreInputs>$(MSBuildProjectFile);$(ClientAssetsRestoreInputs)</ClientAssetsRestoreInputs>
18-
<!-- Run restore only once for multi targeting builds -->
19-
<ClientAssetsRestoreBeforeTargets Condition="'$(TargetFramework)' == ''">DispatchToInnerBuilds</ClientAssetsRestoreBeforeTargets>
20-
<!-- Allow multitargeting projects to choose the target framework in which they run by setting this value to true only for a given target framework -->
21-
<ShouldRunClientAssetsBuild Condition="'$(ShouldRunClientAssetsBuild)' == ''">true</ShouldRunClientAssetsBuild>
22-
</PropertyGroup>
23-
24-
<ItemGroup>
25-
<ClientAssetsInputs Include="$(ClientAssetsDirectory)**" Exclude="$(DefaultItemExcludes)" />
26-
</ItemGroup>
27-
28-
<Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
29-
<Message Text="Restoring NPM packages" Importance="high" />
30-
<Exec Command="$(ClientAssetsRestoreCommand)" WorkingDirectory="$(ClientAssetsDirectory)"/>
31-
</Target>
32-
33-
<Target Name="ClientAssetsBuild" Condition="'$(ShouldRunClientAssetsBuild)' == 'true'" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt">
34-
<PropertyGroup>
35-
<_ClientAssetsOutputFullPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)clientassets'))</_ClientAssetsOutputFullPath>
36-
</PropertyGroup>
37-
38-
<Message Text="Executing NPM build script" Importance="High" />
39-
40-
<MakeDir Directories="$(_ClientAssetsOutputFullPath)" />
41-
<Exec Command="$(ClientAssetsBuildCommand)" WorkingDirectory="$(ClientAssetsDirectory)" />
42-
43-
<ItemGroup>
44-
<_ClientAssetsBuildOutput Include="$(IntermediateOutputPath)clientassets\**"></_ClientAssetsBuildOutput>
45-
</ItemGroup>
46-
47-
<WriteLinesToFile File="$(IntermediateOutputPath)clientassetsbuild.complete.txt" Lines="@(_ClientAssetsBuildOutput)" />
48-
</Target>
49-
50-
<Target Name="DefineClientAssets" AfterTargets="ClientAssetsBuild" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
51-
<ItemGroup>
52-
<FileWrites Include="@(_ClientAssetsBuildOutput)" />
53-
<FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
54-
</ItemGroup>
55-
56-
<DefineStaticWebAssets CandidateAssets="@(_ClientAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(_ClientAssetsOutputFullPath)" BasePath="$(StaticWebAssetBasePath)">
57-
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
58-
</DefineStaticWebAssets>
59-
</Target>
9+
<PropertyGroup>
10+
<ClientAssetsDirectory Condition="'$(ClientAssetsDirectory)' == ''">Client\</ClientAssetsDirectory>
11+
<ClientAssetsRestoreInputs Condition="'$(ClientAssetsRestoreInputs)' == ''">$(ClientAssetsDirectory)\package-lock.json;$(ClientAssetsDirectory)\package.json</ClientAssetsRestoreInputs>
12+
<ClientAssetsRestoreOutputs Condition="'$(ClientAssetsRestoreOutputs)' == ''">$(ClientAssetsDirectory)node_modules\.package-lock.json</ClientAssetsRestoreOutputs>
13+
<ClientAssetsRestoreCommand Condition="'$(ClientAssetsRestoreCommand)' == ''">npm ci --no-fund --no-audit --prefer-offline</ClientAssetsRestoreCommand>
14+
<ClientAssetsBuildCommand Condition="'$(ClientAssetsBuildCommand)' == ''">npm run build</ClientAssetsBuildCommand>
15+
16+
<!-- Include project file to pick up changes in the above values -->
17+
<ClientAssetsRestoreInputs>$(MSBuildProjectFile);$(ClientAssetsRestoreInputs)</ClientAssetsRestoreInputs>
18+
<!-- Run restore only once for multi targeting builds -->
19+
<ClientAssetsRestoreBeforeTargets Condition="'$(TargetFramework)' == ''">DispatchToInnerBuilds</ClientAssetsRestoreBeforeTargets>
20+
<!-- Allow multitargeting projects to choose the target framework in which they run by setting this value to true only for a given target framework -->
21+
<ShouldRunClientAssetsBuild Condition="'$(ShouldRunClientAssetsBuild)' == ''">true</ShouldRunClientAssetsBuild>
22+
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<ClientAssetsInputs Include="$(ClientAssetsDirectory)**" Exclude="$(DefaultItemExcludes)" />
26+
</ItemGroup>
27+
28+
<Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
29+
<Message Text="Restoring NPM packages" Importance="high" />
30+
<Exec Command="$(ClientAssetsRestoreCommand)" WorkingDirectory="$(ClientAssetsDirectory)"/>
31+
</Target>
32+
33+
<Target Name="ClientAssetsBuild" Condition="'$(ShouldRunClientAssetsBuild)' == 'true'" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt">
34+
<PropertyGroup>
35+
<_ClientAssetsOutputFullPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)clientassets'))</_ClientAssetsOutputFullPath>
36+
</PropertyGroup>
37+
38+
<Message Text="Executing NPM build script" Importance="High" />
39+
40+
<MakeDir Directories="$(_ClientAssetsOutputFullPath)" />
41+
<Exec Command="$(ClientAssetsBuildCommand)" WorkingDirectory="$(ClientAssetsDirectory)" />
42+
43+
<ItemGroup>
44+
<_ClientAssetsBuildOutput Include="$(IntermediateOutputPath)clientassets\**"></_ClientAssetsBuildOutput>
45+
</ItemGroup>
46+
47+
<WriteLinesToFile File="$(IntermediateOutputPath)clientassetsbuild.complete.txt" Lines="@(_ClientAssetsBuildOutput)" />
48+
</Target>
49+
50+
<Target Name="DefineClientAssets" AfterTargets="ClientAssetsBuild" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
51+
<ItemGroup>
52+
<FileWrites Include="@(_ClientAssetsBuildOutput)" />
53+
<FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
54+
</ItemGroup>
55+
56+
<DefineStaticWebAssets CandidateAssets="@(_ClientAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(_ClientAssetsOutputFullPath)" BasePath="$(StaticWebAssetBasePath)">
57+
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
58+
</DefineStaticWebAssets>
59+
</Target>
6060

6161
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Options;
4+
using Umbraco.Cms.Integrations.Crm.Dynamics.Configuration;
5+
using Umbraco.Cms.Integrations.Crm.Dynamics.Models.Dtos;
6+
using Umbraco.Cms.Integrations.Crm.Dynamics.Services;
7+
8+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
9+
{
10+
public class CheckOAuthConfigurationController : FormsControllerBase
11+
{
12+
public CheckOAuthConfigurationController(
13+
IOptions<DynamicsSettings> options,
14+
IDynamicsService dynamicsService,
15+
IDynamicsConfigurationStorage dynamicsConfigurationStorage,
16+
DynamicsComposer.AuthorizationImplementationFactory authorizationImplementationFactory)
17+
: base(options, dynamicsService, dynamicsConfigurationStorage, authorizationImplementationFactory)
18+
{
19+
}
20+
21+
[HttpGet("oauth-configuration")]
22+
[ProducesResponseType(typeof(OAuthConfigurationDto), StatusCodes.Status200OK)]
23+
public async Task<IActionResult> CheckOAuthConfiguration()
24+
{
25+
var oauthConfiguration = DynamicsConfigurationStorage.GetOAuthConfiguration();
26+
27+
if (oauthConfiguration == null) return Ok(new OAuthConfigurationDto { Message = string.Empty });
28+
29+
var identity = await DynamicsService.GetIdentity(oauthConfiguration.AccessToken);
30+
31+
if (!identity.IsAuthorized) return Ok(new OAuthConfigurationDto { Message = identity.Error != null ? identity.Error.Message : string.Empty });
32+
33+
oauthConfiguration.IsAuthorized = true;
34+
35+
return Ok(oauthConfiguration);
36+
}
37+
}
38+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Umbraco.Cms.Api.Common.Attributes;
3+
using Umbraco.Cms.Web.Common.Routing;
4+
5+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
6+
{
7+
[ApiController]
8+
[BackOfficeRoute($"{Constants.ManagementApi.RootPath}/v{{version:apiVersion}}")]
9+
[MapToApi(Constants.ManagementApi.ApiName)]
10+
public class DynamicsControllerBase : Controller
11+
{
12+
}
13+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Asp.Versioning;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Options;
4+
using Umbraco.Cms.Integrations.Crm.Dynamics.Configuration;
5+
using Umbraco.Cms.Integrations.Crm.Dynamics.Services;
6+
using static Umbraco.Cms.Integrations.Crm.Dynamics.DynamicsComposer;
7+
8+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
9+
{
10+
[ApiVersion("1.0")]
11+
[ApiExplorerSettings(GroupName = Constants.ManagementApi.GroupName)]
12+
[Route($"{Constants.ManagementApi.RootPath}/v{{version:apiVersion}}/forms")]
13+
public class FormsControllerBase : DynamicsControllerBase
14+
{
15+
protected readonly DynamicsSettings DynamicsSettings;
16+
17+
protected readonly IDynamicsAuthorizationService AuthorizationService;
18+
19+
protected readonly IDynamicsService DynamicsService;
20+
21+
protected readonly IDynamicsConfigurationStorage DynamicsConfigurationStorage;
22+
23+
public FormsControllerBase(IOptions<DynamicsSettings> options,
24+
IDynamicsService dynamicsService,
25+
IDynamicsConfigurationStorage dynamicsConfigurationStorage,
26+
AuthorizationImplementationFactory authorizationImplementationFactory)
27+
{
28+
29+
DynamicsSettings = options.Value;
30+
31+
AuthorizationService = authorizationImplementationFactory(DynamicsSettings.UseUmbracoAuthorization);
32+
33+
DynamicsService = dynamicsService;
34+
35+
DynamicsConfigurationStorage = dynamicsConfigurationStorage;
36+
}
37+
}
38+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Options;
4+
using Umbraco.Cms.Integrations.Crm.Dynamics.Configuration;
5+
using Umbraco.Cms.Integrations.Crm.Dynamics.Models.Dtos;
6+
using Umbraco.Cms.Integrations.Crm.Dynamics.Services;
7+
8+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
9+
{
10+
public class GetAccessTokenController : FormsControllerBase
11+
{
12+
public GetAccessTokenController(
13+
IOptions<DynamicsSettings> options,
14+
IDynamicsService dynamicsService,
15+
IDynamicsConfigurationStorage dynamicsConfigurationStorage,
16+
DynamicsComposer.AuthorizationImplementationFactory authorizationImplementationFactory)
17+
: base(options, dynamicsService, dynamicsConfigurationStorage, authorizationImplementationFactory)
18+
{
19+
}
20+
21+
[HttpPost("access-token")]
22+
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
23+
public async Task<IActionResult> GetAccessToken([FromBody] OAuthRequestDto authRequestDto) =>
24+
Ok(await AuthorizationService.GetAccessTokenAsync(authRequestDto.Code));
25+
}
26+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Options;
4+
using Umbraco.Cms.Integrations.Crm.Dynamics.Configuration;
5+
using Umbraco.Cms.Integrations.Crm.Dynamics.Services;
6+
7+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
8+
{
9+
public class GetAuthorizationUrlController : FormsControllerBase
10+
{
11+
public GetAuthorizationUrlController(
12+
IOptions<DynamicsSettings> options,
13+
IDynamicsService dynamicsService,
14+
IDynamicsConfigurationStorage dynamicsConfigurationStorage,
15+
DynamicsComposer.AuthorizationImplementationFactory authorizationImplementationFactory)
16+
: base(options, dynamicsService, dynamicsConfigurationStorage, authorizationImplementationFactory)
17+
{
18+
}
19+
20+
[HttpGet("authorization-url")]
21+
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
22+
public IActionResult GetAuthorizationUrl()
23+
{
24+
var url = AuthorizationService.GetAuthorizationUrl();
25+
return Ok(url);
26+
}
27+
}
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.AspNetCore.Http;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.Extensions.Options;
4+
using Umbraco.Cms.Integrations.Crm.Dynamics.Configuration;
5+
using Umbraco.Cms.Integrations.Crm.Dynamics.Services;
6+
7+
namespace Umbraco.Cms.Integrations.Crm.Dynamics.Api.Management.Controllers
8+
{
9+
public class GetEmbedCodeController : FormsControllerBase
10+
{
11+
public GetEmbedCodeController(
12+
IOptions<DynamicsSettings> options,
13+
IDynamicsService dynamicsService,
14+
IDynamicsConfigurationStorage dynamicsConfigurationStorage,
15+
DynamicsComposer.AuthorizationImplementationFactory authorizationImplementationFactory)
16+
: base(options, dynamicsService, dynamicsConfigurationStorage, authorizationImplementationFactory)
17+
{
18+
}
19+
20+
[HttpGet("embed-code")]
21+
[ProducesResponseType(typeof(Task<string>), StatusCodes.Status200OK)]
22+
public async Task<IActionResult> GetEmbedCode(string formId) => Ok(await DynamicsService.GetEmbedCode(formId));
23+
}
24+
}

0 commit comments

Comments
 (0)