Skip to content

Commit dcd4c49

Browse files
Merge branch 'trunk' into merge/10.9-final-into-trunk
2 parents d01afd2 + 78b92b1 commit dcd4c49

File tree

103 files changed

+4402
-482
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

+4402
-482
lines changed

Experiments/Experiments/ABTest.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ public enum ABTest: String, CaseIterable {
1414

1515
/// A/A test to make sure there is no bias in the logged out state.
1616
/// Experiment ref: pbxNRc-1S0-p2
17-
case aaTestLoggedOut202209 = "woocommerceios_explat_aa_test_logged_out_202209"
18-
19-
/// A/B test for the login button order on the prologues screen.
20-
/// Experiment ref: pbxNRc-1VA-p2
21-
case loginPrologueButtonOrder = "woocommerceios_login_prologue_button_order_202209"
17+
case aaTestLoggedOut = "woocommerceios_explat_aa_test_logged_out_202211"
2218

2319
/// Returns a variation for the given experiment
2420
public var variation: Variation {
@@ -32,7 +28,7 @@ public enum ABTest: String, CaseIterable {
3228
switch self {
3329
case .aaTestLoggedIn202210:
3430
return .loggedIn
35-
case .aaTestLoggedOut202209, .loginPrologueButtonOrder:
31+
case .aaTestLoggedOut:
3632
return .loggedOut
3733
case .null:
3834
return .none

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,19 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
3636
case .orderCreationSearchCustomers:
3737
return buildConfig == .localDeveloper || buildConfig == .alpha
3838
case .wpcomSignup:
39-
return buildConfig == .localDeveloper || buildConfig == .alpha
39+
guard isFeatureFlagEnabled(.simplifiedLoginFlowI1) else {
40+
return buildConfig == .localDeveloper || buildConfig == .alpha
41+
}
42+
// To disable automatically sending signup link for unknown email IDs
43+
return false
4044
case .inAppPurchases:
4145
return buildConfig == .localDeveloper || buildConfig == .alpha
4246
case .storeCreationMVP:
4347
return buildConfig == .localDeveloper || buildConfig == .alpha
48+
case .simplifiedLoginFlowI1:
49+
return buildConfig == .localDeveloper || buildConfig == .alpha
50+
case .productsOnboarding:
51+
return buildConfig == .localDeveloper || buildConfig == .alpha
4452
default:
4553
return true
4654
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,13 @@ public enum FeatureFlag: Int {
8585
/// Store creation MVP.
8686
///
8787
case storeCreationMVP
88+
89+
/// Temporary feature flag for the simplified login flow.
90+
/// TODO: replace with A/B testing.
91+
///
92+
case simplifiedLoginFlowI1
93+
94+
/// Hides products onboarding development.
95+
///
96+
case productsOnboarding
8897
}

Fakes/Fakes/Networking.generated.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,40 @@ extension JetpackUser {
261261
)
262262
}
263263
}
264+
extension JustInTimeMessage {
265+
/// Returns a "ready to use" type filled with fake values.
266+
///
267+
public static func fake() -> JustInTimeMessage {
268+
.init(
269+
siteID: .fake(),
270+
messageID: .fake(),
271+
featureClass: .fake(),
272+
ttl: .fake(),
273+
content: .fake(),
274+
cta: .fake()
275+
)
276+
}
277+
}
278+
extension JustInTimeMessage.CTA {
279+
/// Returns a "ready to use" type filled with fake values.
280+
///
281+
public static func fake() -> JustInTimeMessage.CTA {
282+
.init(
283+
message: .fake(),
284+
link: .fake()
285+
)
286+
}
287+
}
288+
extension JustInTimeMessage.Content {
289+
/// Returns a "ready to use" type filled with fake values.
290+
///
291+
public static func fake() -> JustInTimeMessage.Content {
292+
.init(
293+
message: .fake(),
294+
description: .fake()
295+
)
296+
}
297+
}
264298
extension Leaderboard {
265299
/// Returns a "ready to use" type filled with fake values.
266300
///
@@ -1475,6 +1509,7 @@ extension Site {
14751509
description: .fake(),
14761510
url: .fake(),
14771511
adminURL: .fake(),
1512+
loginURL: .fake(),
14781513
plan: .fake(),
14791514
isJetpackThePluginInstalled: .fake(),
14801515
isJetpackConnected: .fake(),

Fakes/Fakes/Yosemite.generated.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,18 @@ extension ProductReviewFromNoteParcel {
1616
)
1717
}
1818
}
19+
extension YosemiteJustInTimeMessage {
20+
/// Returns a "ready to use" type filled with fake values.
21+
///
22+
public static func fake() -> YosemiteJustInTimeMessage {
23+
.init(
24+
siteID: .fake(),
25+
messageID: .fake(),
26+
featureClass: .fake(),
27+
title: .fake(),
28+
detail: .fake(),
29+
buttonTitle: .fake(),
30+
url: .fake()
31+
)
32+
}
33+
}

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 74 additions & 6 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import Foundation
2+
3+
/// Mapper: Just In Time Message
4+
///
5+
struct JustInTimeMessageListMapper: Mapper {
6+
7+
/// Site we're parsing `JustInTimeMessage`s for
8+
/// We're injecting this field by copying it in after parsing response, because `siteID` is not returned in any of the JITM endpoints.
9+
///
10+
let siteID: Int64
11+
12+
/// (Attempts) to convert an array into a Just In Time Message.
13+
///
14+
func map(response: Data) throws -> [JustInTimeMessage] {
15+
let decoder = JSONDecoder()
16+
decoder.userInfo = [
17+
.siteID: siteID
18+
]
19+
return try decoder.decode(JustInTimeMessageListEnvelope.self, from: response).data
20+
}
21+
}
22+
23+
/// JustInTimeMessageEnvelope Disposable Entity:
24+
/// This entity allows us to parse JustInTimeMessage with JSONDecoder.
25+
///
26+
private struct JustInTimeMessageListEnvelope: Decodable {
27+
let data: [JustInTimeMessage]
28+
29+
private enum CodingKeys: String, CodingKey {
30+
case data
31+
}
32+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Foundation
2+
3+
/// Mapper: Product IDs
4+
///
5+
struct ProductIDMapper: Mapper {
6+
7+
/// (Attempts) to convert an instance of Data into an array of Product IDs
8+
///
9+
func map(response: Data) throws -> [Int64] {
10+
let decoder = JSONDecoder()
11+
12+
return try decoder.decode(ProductIDEnvelope.self, from: response).productIDs.compactMap { $0["id"] }
13+
}
14+
}
15+
16+
17+
/// ProductIDEnvelope Disposable Entity:
18+
/// `Products` endpoint returns if a product exists. This entity
19+
/// allows us to parse the product IDs with JSONDecoder.
20+
///
21+
private struct ProductIDEnvelope: Decodable {
22+
let productIDs: [[String: Int64]]
23+
24+
private enum CodingKeys: String, CodingKey {
25+
case productIDs = "data"
26+
}
27+
}

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,63 @@ extension JetpackUser {
313313
}
314314
}
315315

316+
extension JustInTimeMessage {
317+
public func copy(
318+
siteID: CopiableProp<Int64> = .copy,
319+
messageID: CopiableProp<String> = .copy,
320+
featureClass: CopiableProp<String> = .copy,
321+
ttl: CopiableProp<Int64> = .copy,
322+
content: CopiableProp<JustInTimeMessage.Content> = .copy,
323+
cta: CopiableProp<JustInTimeMessage.CTA> = .copy
324+
) -> JustInTimeMessage {
325+
let siteID = siteID ?? self.siteID
326+
let messageID = messageID ?? self.messageID
327+
let featureClass = featureClass ?? self.featureClass
328+
let ttl = ttl ?? self.ttl
329+
let content = content ?? self.content
330+
let cta = cta ?? self.cta
331+
332+
return JustInTimeMessage(
333+
siteID: siteID,
334+
messageID: messageID,
335+
featureClass: featureClass,
336+
ttl: ttl,
337+
content: content,
338+
cta: cta
339+
)
340+
}
341+
}
342+
343+
extension JustInTimeMessage.CTA {
344+
public func copy(
345+
message: CopiableProp<String> = .copy,
346+
link: CopiableProp<String> = .copy
347+
) -> JustInTimeMessage.CTA {
348+
let message = message ?? self.message
349+
let link = link ?? self.link
350+
351+
return JustInTimeMessage.CTA(
352+
message: message,
353+
link: link
354+
)
355+
}
356+
}
357+
358+
extension JustInTimeMessage.Content {
359+
public func copy(
360+
message: CopiableProp<String> = .copy,
361+
description: CopiableProp<String> = .copy
362+
) -> JustInTimeMessage.Content {
363+
let message = message ?? self.message
364+
let description = description ?? self.description
365+
366+
return JustInTimeMessage.Content(
367+
message: message,
368+
description: description
369+
)
370+
}
371+
}
372+
316373
extension Media {
317374
public func copy(
318375
mediaID: CopiableProp<Int64> = .copy,
@@ -1727,6 +1784,7 @@ extension Site {
17271784
description: CopiableProp<String> = .copy,
17281785
url: CopiableProp<String> = .copy,
17291786
adminURL: CopiableProp<String> = .copy,
1787+
loginURL: CopiableProp<String> = .copy,
17301788
plan: CopiableProp<String> = .copy,
17311789
isJetpackThePluginInstalled: CopiableProp<Bool> = .copy,
17321790
isJetpackConnected: CopiableProp<Bool> = .copy,
@@ -1741,6 +1799,7 @@ extension Site {
17411799
let description = description ?? self.description
17421800
let url = url ?? self.url
17431801
let adminURL = adminURL ?? self.adminURL
1802+
let loginURL = loginURL ?? self.loginURL
17441803
let plan = plan ?? self.plan
17451804
let isJetpackThePluginInstalled = isJetpackThePluginInstalled ?? self.isJetpackThePluginInstalled
17461805
let isJetpackConnected = isJetpackConnected ?? self.isJetpackConnected
@@ -1756,6 +1815,7 @@ extension Site {
17561815
description: description,
17571816
url: url,
17581817
adminURL: adminURL,
1818+
loginURL: loginURL,
17591819
plan: plan,
17601820
isJetpackThePluginInstalled: isJetpackThePluginInstalled,
17611821
isJetpackConnected: isJetpackConnected,

0 commit comments

Comments
 (0)