Skip to content

Commit d345253

Browse files
committed
Remove Newtonsoft.Json references; remove unused app settings keys.
1 parent 36d2c26 commit d345253

24 files changed

+86
-232
lines changed

src/Umbraco.Cms.Integrations.Commerce.Shopify/Client/src/property-editor/shopify-product-picker-property-editor.element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ export class ShopifyProductPickerPropertyEditor extends UmbLitElement implements
121121
});
122122
}
123123

124-
deleteForm(id: number){
124+
deleteProduct(id: number) {
125125
var index = this.products.map(p => p.id).indexOf(id);
126-
this.products.splice(index, 1);
126+
this.products.splice(index);
127127
this.value = JSON.stringify(this.products.map(product => product.id));
128128
this.dispatchEvent(new CustomEvent('property-value-change'));
129129
}
@@ -144,7 +144,7 @@ export class ShopifyProductPickerPropertyEditor extends UmbLitElement implements
144144
html`
145145
<uui-ref-node-form name=${product.title} detail=${product.vendor}>
146146
<uui-action-bar slot="actions">
147-
<uui-button label="Remove" @click=${() => this.deleteForm(product.id)}>Remove</uui-button>
147+
<uui-button label="Remove" @click=${() => this.deleteProduct(product.id)}>Remove</uui-button>
148148
</uui-action-bar>
149149
</uui-ref-node-form>
150150
`
Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
using System.Collections.Specialized;
2-
3-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Configuration
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Configuration
42
{
53
public class ShopifyOAuthSettings
64
{
7-
public ShopifyOAuthSettings() { }
8-
9-
public ShopifyOAuthSettings(NameValueCollection appSettings)
10-
{
11-
ClientId = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyClientIdKey];
12-
13-
ClientSecret = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyClientSecretKey];
14-
15-
RedirectUri = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyRedirectUriKey];
16-
17-
Scopes = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyScopesKey];
18-
19-
TokenEndpoint = appSettings[Constants.Configuration.UmbracoCmsIntegrationsCommerceShopifyTokenEndpointKey];
20-
}
21-
22-
public string ClientId { get; set; }
5+
public string ClientId { get; set; } = string.Empty;
236

24-
public string ClientSecret { get; set; }
7+
public string ClientSecret { get; set; } = string.Empty;
258

26-
public string RedirectUri { get; set; }
9+
public string RedirectUri { get; set; } = string.Empty;
2710

28-
public string Scopes { get; set; }
11+
public string Scopes { get; set; } = string.Empty;
2912

30-
public string TokenEndpoint { get; set; }
13+
public string TokenEndpoint { get; set; } = string.Empty;
3114
}
3215
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Constants.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,8 @@ public static class Configuration
3838

3939
public const string OAuthSettings = "Umbraco:Cms:Integrations:Commerce:Shopify:OAuthSettings";
4040

41-
public const string UmbracoCmsIntegrationsCommerceShopifyApiVersion =
42-
"Umbraco.Cms.Integrations.Commerce.Shopify.ApiVersion";
43-
44-
public const string UmbracoCmsIntegrationsCommerceShopifyShop =
45-
"Umbraco.Cms.Integrations.Commerce.Shopify.Shop";
46-
4741
public const string UmbracoCmsIntegrationsCommerceShopifyAccessToken =
4842
"Umbraco.Cms.Integrations.Commerce.Shopify.AccessToken";
49-
50-
public const string UmbracoCmsIntegrationsCommerceShopifyUseUmbracoAuthorizationKey =
51-
"Umbraco.Cms.Integrations.Commerce.Shopify.UseUmbracoAuthorization";
52-
53-
public const string UmbracoCmsIntegrationsCommerceShopifyClientIdKey = "Umbraco.Cms.Integrations.Commerce.Shopify.ClientId";
54-
55-
public const string UmbracoCmsIntegrationsCommerceShopifyClientSecretKey = "Umbraco.Cms.Integrations.Commerce.Shopify.ClientSecret";
56-
57-
public const string UmbracoCmsIntegrationsCommerceShopifyRedirectUriKey = "Umbraco.Cms.Integrations.Commerce.Shopify.RedirectUri";
58-
59-
public const string UmbracoCmsIntegrationsCommerceShopifyScopesKey = "Umbraco.Cms.Integrations.Commerce.Shopify.Scopes";
60-
61-
public const string UmbracoCmsIntegrationsCommerceShopifyTokenEndpointKey = "Umbraco.Cms.Integrations.Commerce.Shopify.TokenEndpoint";
6243
}
6344

6445
public static class PropertyEditors

src/Umbraco.Cms.Integrations.Commerce.Shopify/Editors/ShopifyProductPickerValueConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Newtonsoft.Json;
1+
using System.Text.Json;
22
using Umbraco.Cms.Core.Models.PublishedContent;
33
using Umbraco.Cms.Core.PropertyEditors;
44
using Umbraco.Cms.Integrations.Commerce.Shopify.Models.ViewModels;
@@ -28,7 +28,7 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
2828
{
2929
if (source == null) return null;
3030

31-
return JsonConvert.DeserializeObject<long[]>(source.ToString());
31+
return JsonSerializer.Deserialize<long[]>(source.ToString());
3232
}
3333

3434
public override object ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType,

src/Umbraco.Cms.Integrations.Commerce.Shopify/Models/ConfigurationType.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using Newtonsoft.Json;
2-
3-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models
42
{
53
public class ConfigurationType
64
{
7-
[JsonProperty("value")]
5+
[JsonPropertyName("value")]
86
public string Value { get; private set; }
97

108
private ConfigurationType(string value)
@@ -15,6 +13,7 @@ private ConfigurationType(string value)
1513
public static ConfigurationType Api => new ConfigurationType("API");
1614

1715
public static ConfigurationType OAuth => new ConfigurationType("OAuth");
16+
1817
public static ConfigurationType OAuthConnected => new ConfigurationType("OAuthConnected");
1918

2019
public static ConfigurationType None => new ConfigurationType("None");
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
using Newtonsoft.Json;
2-
3-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
42
{
53
public class ErrorDto
64
{
7-
[JsonProperty("status")]
5+
[JsonPropertyName("status")]
86
public string Status { get; set; }
97

10-
[JsonProperty("message")]
8+
[JsonPropertyName("message")]
119
public string Message { get; set; }
1210
}
1311
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using Newtonsoft.Json;
2-
3-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
42
{
53
public class OAuthRequestDto
64
{
7-
[JsonProperty("code")]
5+
[JsonPropertyName("code")]
86
public string Code { get; set; }
97
}
108
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
2+
{
3+
public class ProductCountDto
4+
{
5+
[JsonPropertyName("count")]
6+
public int Count { get; set; }
7+
}
8+
}

src/Umbraco.Cms.Integrations.Commerce.Shopify/Models/Dtos/ProductDto.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
using System.Collections.Generic;
2-
3-
using Newtonsoft.Json;
4-
5-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
62
{
73
public class ProductDto
84
{
9-
[JsonProperty("id")]
5+
[JsonPropertyName("id")]
106
public long Id { get; set; }
117

12-
[JsonProperty("title")]
8+
[JsonPropertyName("title")]
139
public string Title { get; set; }
1410

15-
[JsonProperty("body_html")]
11+
[JsonPropertyName("body_html")]
1612
public string Body { get; set; }
1713

18-
[JsonProperty("vendor")]
14+
[JsonPropertyName("vendor")]
1915
public string Vendor { get; set; }
2016

21-
[JsonProperty("status")]
17+
[JsonPropertyName("status")]
2218
public string Status { get; set; }
2319

24-
[JsonProperty("tags")]
20+
[JsonPropertyName("tags")]
2521
public string Tags { get; set; }
2622

27-
[JsonProperty("variants")]
23+
[JsonPropertyName("variants")]
2824
public IEnumerable<ProductVariantDto> Variants { get; set; }
2925

30-
[JsonProperty("image")]
26+
[JsonPropertyName("image")]
3127
public ProductImageDto Image { get; set; }
3228
}
3329

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
using Newtonsoft.Json;
2-
3-
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
1+
namespace Umbraco.Cms.Integrations.Commerce.Shopify.Models.Dtos
42
{
53
public class ProductImageDto
64
{
7-
[JsonProperty("src")]
5+
[JsonPropertyName("src")]
86
public string Src { get; set; }
97
}
108
}

0 commit comments

Comments
 (0)