Skip to content

Commit 82709ef

Browse files
committed
Merge branch 'trunk' into woomob-1138-woo-poshistorical-orders-order-details-wireframe-ui
2 parents f969b12 + ff9ee39 commit 82709ef

File tree

51 files changed

+2627
-704
lines changed

Some content is hidden

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

51 files changed

+2627
-704
lines changed

Modules/Sources/Fakes/Networking.generated.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,12 +753,11 @@ extension Networking.POSProduct {
753753
productID: .fake(),
754754
name: .fake(),
755755
productTypeKey: .fake(),
756+
fullDescription: .fake(),
757+
shortDescription: .fake(),
756758
sku: .fake(),
757759
globalUniqueID: .fake(),
758760
price: .fake(),
759-
regularPrice: .fake(),
760-
salePrice: .fake(),
761-
onSale: .fake(),
762761
downloadable: .fake(),
763762
parentID: .fake(),
764763
images: .fake(),
@@ -779,12 +778,10 @@ extension Networking.POSProductVariation {
779778
productVariationID: .fake(),
780779
attributes: .fake(),
781780
image: .fake(),
781+
fullDescription: .fake(),
782782
sku: .fake(),
783783
globalUniqueID: .fake(),
784784
price: .fake(),
785-
regularPrice: .fake(),
786-
salePrice: .fake(),
787-
onSale: .fake(),
788785
downloadable: .fake(),
789786
manageStock: .fake(),
790787
stockQuantity: .fake(),

Modules/Sources/Networking/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,12 +1246,11 @@ extension Networking.POSProduct {
12461246
productID: CopiableProp<Int64> = .copy,
12471247
name: CopiableProp<String> = .copy,
12481248
productTypeKey: CopiableProp<String> = .copy,
1249+
fullDescription: NullableCopiableProp<String> = .copy,
1250+
shortDescription: NullableCopiableProp<String> = .copy,
12491251
sku: NullableCopiableProp<String> = .copy,
12501252
globalUniqueID: NullableCopiableProp<String> = .copy,
12511253
price: CopiableProp<String> = .copy,
1252-
regularPrice: NullableCopiableProp<String> = .copy,
1253-
salePrice: NullableCopiableProp<String> = .copy,
1254-
onSale: CopiableProp<Bool> = .copy,
12551254
downloadable: CopiableProp<Bool> = .copy,
12561255
parentID: CopiableProp<Int64> = .copy,
12571256
images: CopiableProp<[ProductImage]> = .copy,
@@ -1264,12 +1263,11 @@ extension Networking.POSProduct {
12641263
let productID = productID ?? self.productID
12651264
let name = name ?? self.name
12661265
let productTypeKey = productTypeKey ?? self.productTypeKey
1266+
let fullDescription = fullDescription ?? self.fullDescription
1267+
let shortDescription = shortDescription ?? self.shortDescription
12671268
let sku = sku ?? self.sku
12681269
let globalUniqueID = globalUniqueID ?? self.globalUniqueID
12691270
let price = price ?? self.price
1270-
let regularPrice = regularPrice ?? self.regularPrice
1271-
let salePrice = salePrice ?? self.salePrice
1272-
let onSale = onSale ?? self.onSale
12731271
let downloadable = downloadable ?? self.downloadable
12741272
let parentID = parentID ?? self.parentID
12751273
let images = images ?? self.images
@@ -1283,12 +1281,11 @@ extension Networking.POSProduct {
12831281
productID: productID,
12841282
name: name,
12851283
productTypeKey: productTypeKey,
1284+
fullDescription: fullDescription,
1285+
shortDescription: shortDescription,
12861286
sku: sku,
12871287
globalUniqueID: globalUniqueID,
12881288
price: price,
1289-
regularPrice: regularPrice,
1290-
salePrice: salePrice,
1291-
onSale: onSale,
12921289
downloadable: downloadable,
12931290
parentID: parentID,
12941291
images: images,
@@ -1307,12 +1304,10 @@ extension Networking.POSProductVariation {
13071304
productVariationID: CopiableProp<Int64> = .copy,
13081305
attributes: CopiableProp<[ProductVariationAttribute]> = .copy,
13091306
image: NullableCopiableProp<ProductImage> = .copy,
1307+
fullDescription: NullableCopiableProp<String> = .copy,
13101308
sku: NullableCopiableProp<String> = .copy,
13111309
globalUniqueID: NullableCopiableProp<String> = .copy,
13121310
price: CopiableProp<String> = .copy,
1313-
regularPrice: NullableCopiableProp<String> = .copy,
1314-
salePrice: NullableCopiableProp<String> = .copy,
1315-
onSale: CopiableProp<Bool> = .copy,
13161311
downloadable: CopiableProp<Bool> = .copy,
13171312
manageStock: CopiableProp<Bool> = .copy,
13181313
stockQuantity: NullableCopiableProp<Decimal> = .copy,
@@ -1323,12 +1318,10 @@ extension Networking.POSProductVariation {
13231318
let productVariationID = productVariationID ?? self.productVariationID
13241319
let attributes = attributes ?? self.attributes
13251320
let image = image ?? self.image
1321+
let fullDescription = fullDescription ?? self.fullDescription
13261322
let sku = sku ?? self.sku
13271323
let globalUniqueID = globalUniqueID ?? self.globalUniqueID
13281324
let price = price ?? self.price
1329-
let regularPrice = regularPrice ?? self.regularPrice
1330-
let salePrice = salePrice ?? self.salePrice
1331-
let onSale = onSale ?? self.onSale
13321325
let downloadable = downloadable ?? self.downloadable
13331326
let manageStock = manageStock ?? self.manageStock
13341327
let stockQuantity = stockQuantity ?? self.stockQuantity
@@ -1340,12 +1333,10 @@ extension Networking.POSProductVariation {
13401333
productVariationID: productVariationID,
13411334
attributes: attributes,
13421335
image: image,
1336+
fullDescription: fullDescription,
13431337
sku: sku,
13441338
globalUniqueID: globalUniqueID,
13451339
price: price,
1346-
regularPrice: regularPrice,
1347-
salePrice: salePrice,
1348-
onSale: onSale,
13491340
downloadable: downloadable,
13501341
manageStock: manageStock,
13511342
stockQuantity: stockQuantity,

Modules/Sources/Networking/Model/POSProduct.swift

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
1212
public let productID: Int64
1313
public let name: String
1414
public let productTypeKey: String
15+
public let fullDescription: String?
16+
// periphery:ignore - Will be used for search in future
17+
public let shortDescription: String?
1518
public let sku: String?
1619
public let globalUniqueID: String?
1720

1821
public let price: String
19-
public let regularPrice: String?
20-
public let salePrice: String?
21-
public let onSale: Bool
2222

2323
public let downloadable: Bool
2424

@@ -47,12 +47,11 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
4747
productID: Int64,
4848
name: String,
4949
productTypeKey: String,
50+
fullDescription: String?,
51+
shortDescription: String?,
5052
sku: String?,
5153
globalUniqueID: String?,
5254
price: String,
53-
regularPrice: String?,
54-
salePrice: String?,
55-
onSale: Bool,
5655
downloadable: Bool,
5756
parentID: Int64,
5857
images: [ProductImage],
@@ -64,13 +63,12 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
6463
self.productID = productID
6564
self.name = name
6665
self.productTypeKey = productTypeKey
66+
self.fullDescription = fullDescription
67+
self.shortDescription = shortDescription
6768
self.sku = sku
6869
self.globalUniqueID = globalUniqueID
6970

7071
self.price = price
71-
self.regularPrice = regularPrice
72-
self.salePrice = salePrice
73-
self.onSale = onSale
7472

7573
self.downloadable = downloadable
7674

@@ -101,6 +99,8 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
10199
let productID = try container.decode(Int64.self, forKey: .productID)
102100
let name = try container.decode(String.self, forKey: .name)
103101
let productTypeKey = try container.decode(String.self, forKey: .productTypeKey)
102+
let fullDescription = try container.decodeIfPresent(String.self, forKey: .fullDescription)
103+
let shortDescription = try container.decodeIfPresent(String.self, forKey: .shortDescription)
104104
let sku = container.failsafeDecodeIfPresent(
105105
targetType: String.self,
106106
forKey: .sku,
@@ -111,24 +111,6 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
111111
targetType: String.self,
112112
forKey: .price,
113113
alternativeTypes: [decimalString]) ?? ""
114-
let regularPrice = container.failsafeDecodeIfPresent(
115-
targetType: String.self,
116-
forKey: .regularPrice,
117-
alternativeTypes: [decimalString])
118-
let onSale = container.failsafeDecodeIfPresent(
119-
targetType: Bool.self,
120-
forKey: .onSale,
121-
alternativeTypes: [ .string(transform: { NSString(string: $0).boolValue })]) ?? false
122-
123-
// Even though a plain install of WooCommerce Core provides string values,
124-
// some plugins alter the field value from String to Int or Decimal.
125-
let salePrice = container.failsafeDecodeIfPresent(
126-
targetType: String.self,
127-
forKey: .salePrice,
128-
shouldDecodeTargetTypeFirst: false,
129-
alternativeTypes: [
130-
.string(transform: { (onSale && $0.isEmpty) ? "0" : $0 }),
131-
decimalString])
132114

133115
let downloadable = try container.decode(Bool.self, forKey: .downloadable)
134116

@@ -146,12 +128,11 @@ public struct POSProduct: Codable, Equatable, GeneratedCopiable, GeneratedFakeab
146128
productID: productID,
147129
name: name,
148130
productTypeKey: productTypeKey,
131+
fullDescription: fullDescription,
132+
shortDescription: shortDescription,
149133
sku: sku,
150134
globalUniqueID: globalUniqueID,
151135
price: price,
152-
regularPrice: regularPrice,
153-
salePrice: salePrice,
154-
onSale: onSale,
155136
downloadable: downloadable,
156137
parentID: parentID,
157138
images: images,
@@ -179,12 +160,11 @@ private extension POSProduct {
179160
case productID = "id"
180161
case name
181162
case productTypeKey = "type"
163+
case fullDescription = "description"
164+
case shortDescription = "short_description"
182165
case sku
183166
case globalUniqueID = "global_unique_id"
184167
case price
185-
case regularPrice = "regular_price"
186-
case salePrice = "sale_price"
187-
case onSale = "on_sale"
188168
case downloadable
189169
case parentID = "parent_id"
190170
case images

Modules/Sources/Networking/Model/POSProductVariation.swift

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
1717
public let attributes: [ProductVariationAttribute]
1818
public let image: ProductImage?
1919

20+
// periphery:ignore - Will be used for search in future
21+
public let fullDescription: String?
2022
public let sku: String?
2123
public let globalUniqueID: String?
2224

2325
public let price: String
24-
public let regularPrice: String?
25-
public let salePrice: String?
26-
public let onSale: Bool
27-
2826
public let downloadable: Bool
2927

3028
public let manageStock: Bool
@@ -40,12 +38,10 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
4038
productVariationID: Int64,
4139
attributes: [ProductVariationAttribute],
4240
image: ProductImage?,
41+
fullDescription: String?,
4342
sku: String?,
4443
globalUniqueID: String?,
4544
price: String,
46-
regularPrice: String?,
47-
salePrice: String?,
48-
onSale: Bool,
4945
downloadable: Bool,
5046
manageStock: Bool,
5147
stockQuantity: Decimal?,
@@ -55,12 +51,10 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
5551
self.productVariationID = productVariationID
5652
self.attributes = attributes
5753
self.image = image
54+
self.fullDescription = fullDescription
5855
self.sku = sku
5956
self.globalUniqueID = globalUniqueID
6057
self.price = price
61-
self.regularPrice = regularPrice
62-
self.salePrice = salePrice
63-
self.onSale = onSale
6458
self.downloadable = downloadable
6559
self.manageStock = manageStock
6660
self.stockQuantity = stockQuantity
@@ -81,6 +75,7 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
8175
let productID = try container.decode(Int64.self, forKey: .productID)
8276
let attributes = try container.decode([ProductVariationAttribute].self, forKey: .attributes)
8377
let image = try container.decodeIfPresent(ProductImage.self, forKey: .image)
78+
let fullDescription = try container.decodeIfPresent(String.self, forKey: .fullDescription)
8479
let sku = container.failsafeDecodeIfPresent(
8580
targetType: String.self,
8681
forKey: .sku,
@@ -90,18 +85,6 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
9085
targetType: String.self,
9186
forKey: .price,
9287
alternativeTypes: [decimalString]) ?? ""
93-
let regularPrice = container.failsafeDecodeIfPresent(
94-
targetType: String.self,
95-
forKey: .regularPrice,
96-
alternativeTypes: [decimalString])
97-
let salePrice = container.failsafeDecodeIfPresent(
98-
targetType: String.self,
99-
forKey: .salePrice,
100-
alternativeTypes: [decimalString])
101-
let onSale = container.failsafeDecodeIfPresent(
102-
targetType: Bool.self,
103-
forKey: .onSale,
104-
alternativeTypes: [.string(transform: { NSString(string: $0).boolValue })]) ?? false
10588
let downloadable = try container.decode(Bool.self, forKey: .downloadable)
10689
let manageStock = container.failsafeDecodeIfPresent(
10790
targetType: Bool.self,
@@ -125,12 +108,10 @@ public struct POSProductVariation: Codable, Equatable, GeneratedCopiable, Genera
125108
productVariationID: productVariationID,
126109
attributes: attributes,
127110
image: image,
111+
fullDescription: fullDescription,
128112
sku: sku,
129113
globalUniqueID: globalUniqueID,
130114
price: price,
131-
regularPrice: regularPrice,
132-
salePrice: salePrice,
133-
onSale: onSale,
134115
downloadable: downloadable,
135116
manageStock: manageStock,
136117
stockQuantity: stockQuantity,
@@ -158,9 +139,7 @@ private extension POSProductVariation {
158139
case attributes
159140
case image
160141
case price
161-
case regularPrice = "regular_price"
162-
case salePrice = "sale_price"
163-
case onSale = "on_sale"
142+
case fullDescription = "description"
164143
case sku
165144
case globalUniqueID = "global_unique_id"
166145
case downloadable

0 commit comments

Comments
 (0)