@@ -25,6 +25,14 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
2525 ///
2626 public let plan : String
2727
28+ /// Whether the site has Jetpack-the-plugin installed.
29+ ///
30+ public let isJetpackThePluginInstalled : Bool
31+
32+ /// Whether the site is connected to Jetpack, either through Jetpack-the-plugin or other plugins that include Jetpack Connection Package.
33+ ///
34+ public let isJetpackConnected : Bool
35+
2836 /// Indicates if there is a WooCommerce Store Active.
2937 ///
3038 public let isWooCommerceActive : Bool
@@ -50,6 +58,8 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
5058 let name = try siteContainer. decode ( String . self, forKey: . name)
5159 let description = try siteContainer. decode ( String . self, forKey: . description)
5260 let url = try siteContainer. decode ( String . self, forKey: . url)
61+ let isJetpackThePluginInstalled = try siteContainer. decode ( Bool . self, forKey: . isJetpackThePluginInstalled)
62+ let isJetpackConnected = try siteContainer. decode ( Bool . self, forKey: . isJetpackConnected)
5363
5464 let optionsContainer = try siteContainer. nestedContainer ( keyedBy: OptionKeys . self, forKey: . options)
5565 let isWordPressStore = try optionsContainer. decode ( Bool . self, forKey: . isWordPressStore)
@@ -62,6 +72,8 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
6272 description: description,
6373 url: url,
6474 plan: String ( ) , // Not created on init. Added in supplementary API request.
75+ isJetpackThePluginInstalled: isJetpackThePluginInstalled,
76+ isJetpackConnected: isJetpackConnected,
6577 isWooCommerceActive: isWooCommerceActive,
6678 isWordPressStore: isWordPressStore,
6779 timezone: timezone,
@@ -75,6 +87,8 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
7587 description: String ,
7688 url: String ,
7789 plan: String ,
90+ isJetpackThePluginInstalled: Bool ,
91+ isJetpackConnected: Bool ,
7892 isWooCommerceActive: Bool ,
7993 isWordPressStore: Bool ,
8094 timezone: String ,
@@ -84,13 +98,22 @@ public struct Site: Decodable, Equatable, GeneratedFakeable, GeneratedCopiable {
8498 self . description = description
8599 self . url = url
86100 self . plan = plan
101+ self . isJetpackThePluginInstalled = isJetpackThePluginInstalled
102+ self . isJetpackConnected = isJetpackConnected
87103 self . isWordPressStore = isWordPressStore
88104 self . isWooCommerceActive = isWooCommerceActive
89105 self . timezone = timezone
90106 self . gmtOffset = gmtOffset
91107 }
92108}
93109
110+ public extension Site {
111+ /// Whether the site is connected to Jetpack with Jetpack Connection Package, and not with Jetpack-the-plugin.
112+ ///
113+ var isJetpackCPConnected : Bool {
114+ isJetpackConnected && !isJetpackThePluginInstalled
115+ }
116+ }
94117
95118/// Defines all of the Site CodingKeys.
96119///
@@ -103,6 +126,8 @@ private extension Site {
103126 case url = " URL "
104127 case options = " options "
105128 case plan = " plan "
129+ case isJetpackThePluginInstalled = " jetpack "
130+ case isJetpackConnected = " jetpack_connection "
106131 }
107132
108133 enum OptionKeys : String , CodingKey {
0 commit comments