diff --git a/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseDomainsService.swift b/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseDomainsService.swift index ec3e425a2..f5ac0b001 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseDomainsService.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseDomainsService.swift @@ -13,8 +13,8 @@ private extension BaseFirebaseInteractionService.URLSList { static var USER_PROFILE_URL: String { USER_URL.appendingURLPathComponent("profile") } static var DOMAIN_URL: String { baseAPIURL.appendingURLPathComponent("domain") } - static var DOMAIN_SEARCH_URL: String { DOMAIN_URL.appendingURLPathComponent("search") } - static var DOMAIN_AI_SUGGESTIONS_URL: String { DOMAIN_SEARCH_URL.appendingURLPathComponent("ai-suggestions") } + static var DOMAIN_SEARCH_URL: String { DOMAIN_URL.appendingURLPathComponents("search", "internal") } + static var DOMAIN_AI_SUGGESTIONS_URL: String { DOMAIN_URL.appendingURLPathComponents("search", "ai-suggestions") } static func DOMAIN_ENS_STATUS_URL(domain: String) -> String { DOMAIN_URL.appendingURLPathComponents(domain, "ens-status") } @@ -187,8 +187,8 @@ private extension FirebasePurchaseDomainsService { } func aiSearchForFBDomains(hint: String) async throws -> [DomainProductItem] { - let queryComponents = ["phrase" : hint, - "extension" : "All"] + let queryComponents = ["extension" : "All", + "phrase" : hint] let urlString = URLSList.DOMAIN_AI_SUGGESTIONS_URL.appendingURLQueryComponents(queryComponents) let request = try APIRequest(urlString: urlString, method: .get) diff --git a/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseEntities.swift b/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseEntities.swift index b981d8072..c12c9ede6 100644 --- a/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseEntities.swift +++ b/unstoppable-ios-app/domains-manager-ios/Services/Firebase/Purchase/FirebasePurchaseEntities.swift @@ -191,6 +191,25 @@ extension FirebasePurchaseDomainsService { @DecodeHashableIgnoringFailed var hiddenProducts: [UDProduct] + + init(from decoder: any Decoder) throws { + let container: KeyedDecodingContainer = try decoder.container(keyedBy: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.self) + self.reservedForUserId = try container.decodeIfPresent(String.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.reservedForUserId) + self.availability = try container.decode(Bool.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.availability) + self.domain = try container.decode(FirebasePurchaseDomainsService.DomainProductDetails.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.domain) + self.price = try container.decode(Int.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.price) + self.productId = try container.decodeIfPresent(Int.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.productId) + self.productType = try container.decode(String.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.productType) + self.productCode = try container.decode(String.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.productCode) + self.status = try container.decode(String.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.status) + self.tags = try container.decode([String].self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.tags) + if let hiddenProducts = try? container.decode(DecodeHashableIgnoringFailed.self, forKey: FirebasePurchaseDomainsService.DomainProductItem.CodingKeys.hiddenProducts) { + self._hiddenProducts = hiddenProducts + } else { + self._hiddenProducts = .init(value: []) + } + } + // Custom field var availableProducts: [UDProduct]? var ensStatus: ENSDomainProductStatusResponse?