Skip to content

Commit 749d3a7

Browse files
committed
Merge branch 'main' into feature/Shopify-Integration
# Conflicts: # src/Umbraco.Cms.Integrations.Testsite.V8/Umbraco.Cms.Integrations.Testsite.V8.csproj # src/Umbraco.Cms.Integrations.sln
2 parents c2ea5d7 + 2376dd4 commit 749d3a7

File tree

72 files changed

+3322
-265
lines changed

Some content is hidden

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

72 files changed

+3322
-265
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,8 @@ src/Umbraco.Cms.Integrations.Testsite.V9/App_Plugins
324324
src/Umbraco.Cms.Integrations.Testsite.V9/umbraco
325325
src/Umbraco.Cms.Integrations.Testsite.V9/wwwroot/media
326326

327+
src/Umbraco.Cms.Integrations.Crm.Hubspot.Testsite.V8/App_Data/
328+
src/Umbraco.Cms.Integrations.Crm.Hubspot.Testsite.V8/App_Plugins/
329+
src/Umbraco.Cms.Integrations.Crm.Hubspot.Testsite.V8/Media/
330+
src/Umbraco.Cms.Integrations.SEO.Semrush.Testsite.V8/App_Data/
331+
src/Umbraco.Cms.Integrations.SEO.Semrush.Testsite.V8/App_Plugins/

README.md

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

99
[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.
1010

11+
### SEO
12+
1113
[Semrush](./src/Umbraco.Cms.Integrations.SEO.Semrush/) - a search tool available as a content app, helping editors research and use appropriate keywords for their content, to help with website search engine optimisation.
14+
15+
### CRM
16+
17+
[HubSpot](./src/Umbraco.Cms.Integrations.Crm.HubSpot/) - a form picker and rendering component for Hubspot forms.

Umbraco.Cms.Integrations.Crm.Hubspot.yml renamed to azure-pipeline - Crm.Hubspot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trigger:
2-
- feature/add-hubspot-integration
2+
- main
33

44
pool:
55
vmImage: 'windows-latest'
@@ -52,4 +52,4 @@ steps:
5252
inputs:
5353
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
5454
ArtifactName: 'drop'
55-
publishLocation: 'Container'
55+
publishLocation: 'Container'

src/Umbraco.Cms.Integrations.Commerce.CommerceTools/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This integration provides a product and category picker, with data sourced from
44

55
## Prerequisites
66

7-
Requires minimum versions of Umbraco CMS: 8.5.0
7+
Requires minimum version of Umbraco CMS: 8.5.4.
88

99
## How To Use
1010

src/Umbraco.Cms.Integrations.Commerce.Shopify/App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js/productPicker.controller.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
function ProductPickerController($scope) {
1+
function ProductPickerController($scope, umbracoCmsIntegrationsCommerceShopifyResource) {
2+
3+
var vm = this;
4+
5+
umbracoCmsIntegrationsCommerceShopifyResource.getProductsList().then(function(response) {
6+
console.log(response);
7+
});
28

39
}
410

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
angular.module("umbraco.resources")
2+
.factory("umbracoCmsIntegrationsCommerceShopifyResource",
3+
function($http, umbRequestHelper) {
4+
const apiEndpoint = "backoffice/UmbracoCmsIntegrationsCommerceShopify/Products";
5+
6+
return {
7+
getProductsList: function() {
8+
return umbRequestHelper.resourcePromise(
9+
$http.get(`${apiEndpoint}/GetList`), "Failed to get resource");
10+
}
11+
};
12+
});
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"javascript": [
3-
"~/App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js/productPicker.controller.js"
3+
"~/App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js/productPicker.controller.js",
4+
"~/App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js/shopify.resource.js"
45
]
56
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<p>
2-
SETTINGS
3-
</p>
1+
<div ng-controller="Umbraco.Cms.Integrations.Commerce.Shopify.ProductPickerController as vm">
2+
<p>TEST</p>
3+
</div>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+

2+
namespace Umbraco.Cms.Integrations.Commerce.Shopify
3+
{
4+
public class Constants
5+
{
6+
public static string UmbracoCmsIntegrationsCommerceShopifyApiVersion =
7+
"Umbraco.Cms.Integrations.Commerce.Shopify.ApiVersion";
8+
9+
public static string UmbracoCmsIntegrationsCommerceShopifyShop =
10+
"Umbraco.Cms.Integrations.Commerce.Shopify.Shop";
11+
12+
public static string UmbracoCmsIntegrationsCommerceShopifyAccessToken =
13+
"Umbraco.Cms.Integrations.Commerce.Shopify.AccessToken";
14+
}
15+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System;
2+
using System.Net;
3+
using System.Net.Http;
4+
using System.Threading.Tasks;
5+
6+
using Newtonsoft.Json;
7+
8+
using Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos;
9+
using Umbraco.Cms.Integrations.Shared.Configuration;
10+
using Umbraco.Cms.Integrations.Shared.Controllers;
11+
using Umbraco.Core.Logging;
12+
using Umbraco.Web.Mvc;
13+
using Umbraco.Cms.Integrations.Shared.Models.Dtos;
14+
using Umbraco.Cms.Integrations.Shared.Resolvers;
15+
16+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Controllers
17+
{
18+
[PluginController("UmbracoCmsIntegrationsCommerceShopify")]
19+
public class ProductsController : BaseAuthorizedApiController
20+
{
21+
public const string ProductsApiEndpoint = "https://{0}.myshopify.com/admin/api/{1}/products.json";
22+
23+
private readonly JsonSerializerSettings _serializerSettings;
24+
25+
public ProductsController(ILogger logger, IAppSettings appSettings) : base(logger, appSettings)
26+
{
27+
var resolver = new JsonPropertyRenameContractResolver();
28+
resolver.RenameProperty(typeof(ResponseDto<ProductsListDto>), "Result", "products");
29+
30+
_serializerSettings = new JsonSerializerSettings();
31+
_serializerSettings.ContractResolver = resolver;
32+
}
33+
34+
public async Task<ResponseDto<ProductsListDto>> GetList()
35+
{
36+
var accessToken = AppSettings[Constants.UmbracoCmsIntegrationsCommerceShopifyAccessToken];
37+
38+
if (string.IsNullOrEmpty(accessToken))
39+
{
40+
ApiLogger.Info<ProductsController>(message: "Cannot access Shopify - Access Token is missing.");
41+
42+
return new ResponseDto<ProductsListDto>();
43+
}
44+
45+
var requestMessage = new HttpRequestMessage
46+
{
47+
Method = HttpMethod.Get,
48+
RequestUri = new Uri(string.Format(ProductsApiEndpoint,
49+
AppSettings[Constants.UmbracoCmsIntegrationsCommerceShopifyShop],
50+
AppSettings[Constants.UmbracoCmsIntegrationsCommerceShopifyApiVersion]))
51+
};
52+
requestMessage.Headers.Add("X-Shopify-Access-Token", accessToken);
53+
54+
var response = await ClientFactory().SendAsync(requestMessage);
55+
if (response.StatusCode == HttpStatusCode.Unauthorized)
56+
{
57+
ApiLogger.Error<ProductsController>($"Failed to fetch products from Shopify store using access token: {response.ReasonPhrase}");
58+
59+
return new ResponseDto<ProductsListDto> { Message = response.ReasonPhrase };
60+
}
61+
62+
if (response.IsSuccessStatusCode)
63+
{
64+
65+
66+
var result = await response.Content.ReadAsStringAsync();
67+
return new ResponseDto<ProductsListDto>
68+
{
69+
IsValid = true,
70+
Result = JsonConvert.DeserializeObject<ProductsListDto>(result, _serializerSettings)
71+
};
72+
}
73+
74+
return new ResponseDto<ProductsListDto>();
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)