Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9afae0b
[Local catalog] Add analytics tracking for local search
joshheald Nov 19, 2025
9d13321
Add SearchDebounceStrategy enum for configurable search debouncing
joshheald Nov 20, 2025
3637ba0
Add debounceStrategy property to fetch strategy protocols
joshheald Nov 19, 2025
6acb890
Implement strategy-based debouncing in search UI
joshheald Nov 19, 2025
5dae392
Apply simple debouncing strategy to local product search
joshheald Nov 19, 2025
753ca24
Add tests for SearchDebounceStrategy
joshheald Nov 19, 2025
a81e1c7
Fix line length lint violations in SearchDebounceStrategyTests
joshheald Nov 20, 2025
b78f674
Fix SearchDebounceStrategyTests to use existing mocks
joshheald Nov 20, 2025
fe4b43c
Merge PR3: includes SQL LIKE escaping fix
joshheald Nov 20, 2025
ebe7eaa
Merge PR4: includes SQL LIKE escaping fix
joshheald Nov 20, 2025
976fff5
Merge PR3: GRDBManager access fix
joshheald Nov 20, 2025
f112338
Merge PR4: GRDBManager access fix
joshheald Nov 20, 2025
60f51e1
Add currentDebounceStrategy to mock controllers
joshheald Nov 20, 2025
d37005d
Fix lint
joshheald Nov 20, 2025
adf6e1f
Merge factory-integration branch with version fix
joshheald Nov 20, 2025
3aa198b
Merge analytics branch with version fix
joshheald Nov 20, 2025
0a668f1
Add loadingDelayThreshold to smart debounce strategy
joshheald Nov 20, 2025
9656089
Fix loading indicators not showing on first remote search
joshheald Nov 20, 2025
de5a625
Remove unnecessary comment
joshheald Nov 20, 2025
42335af
Fix test build
joshheald Nov 20, 2025
5e4e396
Fix periphery issues
joshheald Nov 20, 2025
2dc3ff6
Rename debounceStrategy to currentDebounceStrategy for clarity
joshheald Nov 20, 2025
61837ab
Merge branch 'woomob-1112-woo-poslocal-catalog-factory-integration' i…
joshheald Nov 21, 2025
59f976f
Merge branch 'woomob-1112-woo-poslocal-catalog-analytics' into woomob…
joshheald Nov 21, 2025
d1bf02e
Merge branch 'woomob-1112-woo-poslocal-catalog-factory-integration' i…
joshheald Nov 21, 2025
bf2d785
Merge branch 'woomob-1112-woo-poslocal-catalog-analytics' into woomob…
joshheald Nov 21, 2025
992afaf
Escape the escape!
joshheald Nov 21, 2025
37b4e98
Don’t show intermittent cancellation errors in search
joshheald Nov 21, 2025
6d45ae6
Remove unnecessary `await` call
joshheald Nov 24, 2025
094c919
Use a default duration for smart debounce
joshheald Nov 24, 2025
6efe96f
Split up debounce logic
joshheald Nov 24, 2025
851119c
[Local catalog] Add configurable search debounce strategies (#16377)
joshheald Nov 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ struct POSItemFetchAnalytics: POSItemFetchAnalyticsTracking {

/// Tracks when a local search results fetch completes
/// - Parameters:
/// - milliseconds: The time taken to fetch results in milliseconds
/// - millisecondsSinceRequestSent: The time taken to fetch results in milliseconds
/// - totalItems: The total number of items found in the search
func trackSearchLocalResultsFetchComplete(millisecondsSinceRequestSent: Int, totalItems: Int) {
// TODO: Implement analytics event for local search results
// This will be implemented in the final PR
analytics.track(
event: .PointOfSale.pointOfSaleSearchResultsFetched(
itemType: itemType,
resultsCount: totalItems,
millisecondsSinceRequestSent: millisecondsSinceRequestSent
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ extension WooAnalyticsEvent {
])
}

static func pointOfSaleSearchResultsFetched(itemType: POSItemType,
resultsCount: Int,
millisecondsSinceRequestSent: Int) -> WooAnalyticsEvent {
WooAnalyticsEvent(statName: .pointOfSaleSearchResultsFetched,
properties: [
Key.sourceView: SourceView(itemType: itemType).rawValue,
Key.resultsCount: "\(resultsCount)",
Key.millisecondsSinceRequestSent: "\(millisecondsSinceRequestSent)"
])
}

static func pointOfSaleItemsFetched(itemType: POSItemType,
totalItems: Int) -> WooAnalyticsEvent {
WooAnalyticsEvent(statName: .pointOfSaleItemsFetched,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ public enum WooAnalyticsStat: String {
case pointOfSaleKeyboardDismissedInSearch = "keyboard_dismissed_in_search"
case pointOfSaleItemsNextPageLoaded = "items_next_page_loaded"
case pointOfSaleSearchRemoteResultsFetched = "search_remote_results_fetched"
case pointOfSaleSearchResultsFetched = "search_results_fetched"
case pointOfSaleBarcodeScanningMenuItemTapped = "barcode_scanning_menu_item_tapped"
case pointOfSaleBarcodeScanningExplanationDialogShown = "barcode_scanning_explanation_dialog_shown"
case pointOfSaleBarcodeScannerSetupFlowShown = "barcode_scanner_setup_flow_shown"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public struct PointOfSaleLocalSearchPurchasableItemFetchStrategy: PointOfSalePur
}

public func fetchProducts(pageNumber: Int) async throws -> PagedItems<POSProduct> {
let startTime = Date()

// Get total count and persisted products in one transaction
let (persistedProducts, totalCount) = try await grdbManager.databaseConnection.read { db in
let totalCount = try PersistedProduct
Expand All @@ -49,6 +51,12 @@ public struct PointOfSaleLocalSearchPurchasableItemFetchStrategy: PointOfSalePur

let hasMorePages = (pageNumber * pageSize) < totalCount

if pageNumber == 1 {
let milliseconds = Int(Date().timeIntervalSince(startTime) * Double(MSEC_PER_SEC))
analytics.trackSearchLocalResultsFetchComplete(millisecondsSinceRequestSent: milliseconds,
totalItems: totalCount)
}

return PagedItems(items: products,
hasMorePages: hasMorePages,
totalItems: totalCount)
Expand Down
1 change: 1 addition & 0 deletions WooCommerce/Classes/Analytics/TracksProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private extension TracksProvider {
WooAnalyticsStat.pointOfSaleKeyboardDismissedInSearch,
WooAnalyticsStat.pointOfSaleItemsNextPageLoaded,
WooAnalyticsStat.pointOfSaleSearchRemoteResultsFetched,
WooAnalyticsStat.pointOfSaleSearchResultsFetched,
WooAnalyticsStat.pointOfSaleBarcodeScanningMenuItemTapped,
WooAnalyticsStat.pointOfSaleBarcodeScanningExplanationDialogShown,
WooAnalyticsStat.pointOfSaleBarcodeScannerSetupFlowShown,
Expand Down