Skip to content

Commit 5112f63

Browse files
committed
Merge branch 'trunk' into feat/WOOMOB-687-fix-ios-screenshots-gen-ci
2 parents 172b470 + 233057b commit 5112f63

File tree

322 files changed

+14978
-11399
lines changed

Some content is hidden

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

322 files changed

+14978
-11399
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<!--
22
Contains editorialized release notes. Raw release notes should go into `RELEASE-NOTES.txt`.
33
-->
4+
## 22.8
5+
Our latest update brings smoother split shipment screens and improved accessibility for Shipping Labels, plus easier label size selection, and POS badges within the order list. In Point of Sale, enjoy a new barcode scan flow, and a safer cart clear button.
6+
47
## 22.7
5-
Say hello to smoother shipping and sales! 🎉 We’ve enhanced Shipping Labels with UPS extras and smarter forms, fixed price and display glitches, and made shipment management easier. Plus, Point of Sale now has its own tab for eligible stores, barcode scanning, and smoother product refresh for faster checkout.
8+
Say hello to smoother shipping and sales! We’ve enhanced Shipping Labels with UPS extras and smarter forms, fixed price and display glitches, and made shipment management easier. Plus, Point of Sale now has its own tab for eligible stores, barcode scanning, and smoother product refresh for faster checkout.
69

710
## 22.6
811
Shipping just got a major upgrade! Our revamped flow makes it easier than ever to create and manage shipping labels for stores using WooCommerce Shipping. We've also improved some icons and fixed a display issue with the order list's last updated time. This release includes some behind-the-scenes performance improvements too.

Modules/Package.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ let package = Package(
109109
.target(
110110
name: "Experiments",
111111
dependencies: [
112+
"WooFoundationCore",
112113
.product(name: "AutomatticTracks", package: "Automattic-Tracks-iOS"),
113114
]
114115
),
@@ -341,16 +342,14 @@ enum XcodeSupport {
341342
.xcodeTarget(
342343
XcodeTargetNames.notificationExtension,
343344
dependencies: [
344-
"Networking",
345+
"NetworkingCore",
345346
"WooFoundation",
346-
"Yosemite",
347347
.product(name: "KeychainAccess", package: "KeychainAccess"),
348348
]
349349
),
350350
.xcodeTarget(
351351
XcodeTargetNames.storeWidgetsExtension,
352352
dependencies: [
353-
"Experiments",
354353
"Networking",
355354
"WooFoundation",
356355
.product(name: "KeychainAccess", package: "KeychainAccess"),

Modules/Sources/Experiments/DefaultFeatureFlagService.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import enum WooFoundationCore.BuildConfiguration
2+
13
public struct DefaultFeatureFlagService: FeatureFlagService {
24
public init() {}
35

@@ -93,6 +95,14 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
9395
return false
9496
case .pointOfSaleAsATabi1:
9597
return true
98+
case .pointOfSaleAsATabi2:
99+
return true
100+
case .pointOfSaleOrdersi1:
101+
return true
102+
case .pointOfSaleOrdersi2:
103+
return true
104+
case .pointOfSaleBarcodeScanningi2:
105+
return buildConfig == .localDeveloper || buildConfig == .alpha
96106
default:
97107
return true
98108
}

Modules/Sources/Experiments/FeatureFlag.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,20 @@ public enum FeatureFlag: Int {
195195
/// Enables displaying POS as a tab in the tab bar with the same eligibility as the previous entry point
196196
///
197197
case pointOfSaleAsATabi1
198+
199+
/// Enables displaying POS as a tab in the tab bar for stores in eligible countries
200+
///
201+
case pointOfSaleAsATabi2
202+
203+
/// Enables displaying Point Of Sale details in order list and order details
204+
///
205+
case pointOfSaleOrdersi1
206+
207+
/// Enables displaying Point Of Sale as a filter in order list
208+
///
209+
case pointOfSaleOrdersi2
210+
211+
/// Enables the Point of Sale Barcode Scanner set up flows, as part of i2
212+
///
213+
case pointOfSaleBarcodeScanningi2
198214
}

Modules/Sources/Fakes/Networking.generated.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,7 @@ extension Networking.ShippingLabelAccountSettings {
14511451
isEmailReceiptsEnabled: .fake(),
14521452
paperSize: .fake(),
14531453
lastSelectedPackageID: .fake(),
1454+
lastOrderCompleted: .fake(),
14541455
addPaymentMethodURL: .fake()
14551456
)
14561457
}
@@ -2483,6 +2484,19 @@ extension Networking.WooShippingSelectedRate {
24832484
)
24842485
}
24852486
}
2487+
extension Networking.WooShippingShipment {
2488+
/// Returns a "ready to use" type filled with fake values.
2489+
///
2490+
public static func fake() -> Networking.WooShippingShipment {
2491+
.init(
2492+
siteID: .fake(),
2493+
orderID: .fake(),
2494+
index: .fake(),
2495+
items: .fake(),
2496+
shippingLabel: .fake()
2497+
)
2498+
}
2499+
}
24862500
extension Networking.WooShippingShipmentItem {
24872501
/// Returns a "ready to use" type filled with fake values.
24882502
///

Modules/Sources/Fakes/NetworkingCore.generated.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ extension NetworkingCore.Order {
185185
renewalSubscriptionID: .fake(),
186186
appliedGiftCards: .fake(),
187187
attributionInfo: .fake(),
188-
shippingLabels: .fake()
188+
shippingLabels: .fake(),
189+
createdVia: .fake()
189190
)
190191
}
191192
}

Modules/Sources/Networking/Mapper/SingleItemMapper.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ import Foundation
22

33
/// SingleItemMapper: Maps generic REST API requests for a single item
44
///
5-
struct SingleItemMapper<Output: Decodable>: Mapper {
5+
public struct SingleItemMapper<Output: Decodable>: Mapper {
66
/// Site Identifier associated to the items that will be parsed.
77
///
88
/// We're injecting this field via `JSONDecoder.userInfo` because SiteID is not returned by our endpoints.
99
///
1010
let siteID: Int64
1111

12+
public init(siteID: Int64) {
13+
self.siteID = siteID
14+
}
15+
1216
/// (Attempts) to convert a dictionary into Output.
1317
///
14-
func map(response: Data) throws -> Output {
18+
public func map(response: Data) throws -> Output {
1519
let decoder = JSONDecoder()
1620
decoder.dateDecodingStrategy = .formatted(DateFormatter.Defaults.dateTimeFormatter)
1721
decoder.userInfo = [

Modules/Sources/Networking/Mapper/WooShippingConfigMapper.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@ private struct WooShippingConfigMapperEnvelope: Decodable {
4444
extension WooShippingConfigMapper {
4545
/// Load only the relevant fields from remote
4646
///
47-
static let fieldsToLoad = "config.shipments, config.shippingLabelData.currentOrderLabels"
47+
static let fieldsToLoad = [
48+
"config.shipments",
49+
"config.shippingLabelData.currentOrderLabels",
50+
"config.shippingLabelData.storedData.selected_destination",
51+
"config.shippingLabelData.storedData.selected_origin"
52+
].joined(separator: ", ")
4853
}

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2424,6 +2424,7 @@ extension Networking.ShippingLabelAccountSettings {
24242424
isEmailReceiptsEnabled: CopiableProp<Bool> = .copy,
24252425
paperSize: CopiableProp<ShippingLabelPaperSize> = .copy,
24262426
lastSelectedPackageID: CopiableProp<String> = .copy,
2427+
lastOrderCompleted: CopiableProp<Bool> = .copy,
24272428
addPaymentMethodURL: NullableCopiableProp<URL> = .copy
24282429
) -> Networking.ShippingLabelAccountSettings {
24292430
let siteID = siteID ?? self.siteID
@@ -2438,6 +2439,7 @@ extension Networking.ShippingLabelAccountSettings {
24382439
let isEmailReceiptsEnabled = isEmailReceiptsEnabled ?? self.isEmailReceiptsEnabled
24392440
let paperSize = paperSize ?? self.paperSize
24402441
let lastSelectedPackageID = lastSelectedPackageID ?? self.lastSelectedPackageID
2442+
let lastOrderCompleted = lastOrderCompleted ?? self.lastOrderCompleted
24412443
let addPaymentMethodURL = addPaymentMethodURL ?? self.addPaymentMethodURL
24422444

24432445
return Networking.ShippingLabelAccountSettings(
@@ -2453,6 +2455,7 @@ extension Networking.ShippingLabelAccountSettings {
24532455
isEmailReceiptsEnabled: isEmailReceiptsEnabled,
24542456
paperSize: paperSize,
24552457
lastSelectedPackageID: lastSelectedPackageID,
2458+
lastOrderCompleted: lastOrderCompleted,
24562459
addPaymentMethodURL: addPaymentMethodURL
24572460
)
24582461
}
@@ -3481,7 +3484,7 @@ extension Networking.WooShippingAddress {
34813484
extension Networking.WooShippingConfig {
34823485
public func copy(
34833486
siteID: CopiableProp<Int64> = .copy,
3484-
shipments: CopiableProp<[String: [WooShippingShipmentItem]]> = .copy,
3487+
shipments: CopiableProp<[WooShippingShipment]> = .copy,
34853488
shippingLabelData: NullableCopiableProp<WooShippingLabelData> = .copy
34863489
) -> Networking.WooShippingConfig {
34873490
let siteID = siteID ?? self.siteID
@@ -3724,6 +3727,30 @@ extension Networking.WooShippingPackagesResponse {
37243727
}
37253728
}
37263729

3730+
extension Networking.WooShippingShipment {
3731+
public func copy(
3732+
siteID: CopiableProp<Int64> = .copy,
3733+
orderID: CopiableProp<Int64> = .copy,
3734+
index: CopiableProp<String> = .copy,
3735+
items: CopiableProp<[WooShippingShipmentItem]> = .copy,
3736+
shippingLabel: NullableCopiableProp<ShippingLabel> = .copy
3737+
) -> Networking.WooShippingShipment {
3738+
let siteID = siteID ?? self.siteID
3739+
let orderID = orderID ?? self.orderID
3740+
let index = index ?? self.index
3741+
let items = items ?? self.items
3742+
let shippingLabel = shippingLabel ?? self.shippingLabel
3743+
3744+
return Networking.WooShippingShipment(
3745+
siteID: siteID,
3746+
orderID: orderID,
3747+
index: index,
3748+
items: items,
3749+
shippingLabel: shippingLabel
3750+
)
3751+
}
3752+
}
3753+
37273754
extension Networking.WooShippingShipmentItem {
37283755
public func copy(
37293756
id: CopiableProp<Int64> = .copy,

Modules/Sources/Networking/Model/ShippingLabel/Packages/WooShippingPackagePurchase.swift

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ extension WooShippingPackagePurchase {
7373

7474
return rates
7575
}
76+
77+
/// shipment ID to set for hazmat and customs form
78+
var formattedShipmentID: String {
79+
return WooShippingShipmentIDFormatter.formattedShipmentID(shipmentID)
80+
}
7681
}
7782

7883
// MARK: Enodable
@@ -86,7 +91,11 @@ extension WooShippingPackagePurchase: Encodable {
8691
try container.encode(package.boxID, forKey: .boxID)
8792
try container.encode(package.length, forKey: .length)
8893
try container.encode(package.width, forKey: .width)
89-
try container.encode(package.height, forKey: .height)
94+
95+
// workaround because 0 would cause an error for the API request
96+
let packageHeight = package.height > 0 ? package.height : 0.25
97+
try container.encode(packageHeight, forKey: .height)
98+
9099
try container.encode(package.weight, forKey: .weight)
91100
try container.encode(package.isLetter, forKey: .isLetter)
92101
try container.encode(rate.shipmentID, forKey: .shipmentID)
@@ -96,6 +105,20 @@ extension WooShippingPackagePurchase: Encodable {
96105
try container.encode(rate.title, forKey: .serviceName)
97106
try container.encode(productIDs, forKey: .products)
98107

108+
if let hazmat = package.hazmatCategory {
109+
try container.encode(hazmat, forKey: .hazmat)
110+
}
111+
112+
if let form = package.customsForm {
113+
try container.encode(form.contentsType.rawValue, forKey: .contentsType)
114+
try container.encode(form.contentExplanation, forKey: .contentsExplanation)
115+
try container.encode(form.restrictionType.rawValue, forKey: .restrictionType)
116+
try container.encode(form.restrictionComments, forKey: .restrictionComments)
117+
try container.encode(form.nonDeliveryOption.rawValue, forKey: .nonDeliveryOption)
118+
try container.encode(form.itn, forKey: .itn)
119+
try container.encode(form.items, forKey: .items)
120+
}
121+
99122
if selectedRate.signatureRate != nil {
100123
try container.encode(Values.yes, forKey: .signature)
101124
} else if selectedRate.adultSignatureRate != nil {
@@ -140,7 +163,7 @@ extension WooShippingPackagePurchase: Encodable {
140163
/// Converts the hazmat settings to a dictionary as the API expects it.
141164
/// Includes the shipment ID if there are hazmat settings to report.
142165
public func encodedHazmat() -> [String: Any] {
143-
[shipmentID: [
166+
[formattedShipmentID: [
144167
ParameterKeys.isHazmat: package.hazmatCategory != nil,
145168
ParameterKeys.category: package.hazmatCategory ?? String()
146169
]]
@@ -150,9 +173,9 @@ extension WooShippingPackagePurchase: Encodable {
150173
/// Includes the shipment ID with the encoded customs form.
151174
public func encodedCustomsForm() throws -> [String: Any] {
152175
guard let form = package.customsForm else {
153-
return [shipmentID: [:]]
176+
return [formattedShipmentID: [:]]
154177
}
155-
return [shipmentID: [
178+
return [formattedShipmentID: [
156179
ParameterKeys.items: try form.items.map { try $0.toDictionary() },
157180
ParameterKeys.contentsType: form.contentsType.rawValue,
158181
ParameterKeys.contentsExplanation: form.contentExplanation,
@@ -181,6 +204,14 @@ extension WooShippingPackagePurchase: Encodable {
181204
case carbonNeutral = "carbon_neutral"
182205
case saturdayDelivery = "saturday_delivery"
183206
case additionalHandling = "additional_handling"
207+
case hazmat
208+
case contentsType = "contents_type"
209+
case contentsExplanation = "contents_explanation"
210+
case restrictionType = "restriction_type"
211+
case restrictionComments = "restriction_comments"
212+
case nonDeliveryOption = "non_delivery_option"
213+
case itn
214+
case items
184215
}
185216

186217
private enum ParameterKeys {

0 commit comments

Comments
 (0)