Skip to content

[Woo POS][Coupons] Coupons search #14101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: trunk
Choose a base branch
from

Conversation

samiuelson
Copy link
Contributor

@samiuelson samiuelson commented May 22, 2025

Coupons Search in Woo POS

Description

This PR adds coupons search feature in Woo POS.

💡 I added a "do not merge" label to wait for the follow-up PRs to be merged into this PR first, to ship the feature as a whole.

Next PRs:

Steps to reproduce

N/A

Testing information

  1. Go to Woo POS > Coupons > Search
  2. Verify that remote search works
  3. Verify pagination of remote search results works

The tests that have been performed

Above

Images/gif

Screen_recording_20250523_154316.mp4
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@samiuelson samiuelson changed the title Wooprd 527 woo poscoupons add coupon search feature [Woo POS][Coupons] Coupons search May 22, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented May 22, 2025

3 Errors
🚫 Please add tests for class WooPosCouponsSearchDataSource (or add unit-tests-exemption label to ignore this).
🚫 Please add tests for class WooPosCouponsSearchViewModel (or add unit-tests-exemption label to ignore this).
🚫 This PR is tagged with status: do not merge label(s).
1 Warning
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 22, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitb17b710
Direct Downloadwoocommerce-wear-prototype-build-pr14101-b17b710.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 23, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitb17b710
Direct Downloadwoocommerce-prototype-build-pr14101-b17b710.apk

@samiuelson samiuelson requested a review from Copilot May 23, 2025 14:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces coupon search functionality to the Woo POS app by adding new string resources, analytics updates, new view models/screens, and navigation changes.

  • Added new string resources and error messages for coupon search
  • Renamed and updated analytics event properties for consistency
  • Added new view models, composables, and data source support for searching coupons
  • Updated toolbar and screen navigation logic to integrate the coupon search UI

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WooCommerce/src/main/res/values/strings.xml Introduces new localized strings for coupon search UI messages and error prompts.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/util/analytics/WooPosAnalyticsEvent.kt Renames the analytics event property from totalProductsCount to totalItemsCount.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/search/WooPosCouponsSearchScreen.kt Creates a new composable screen for coupon search with a placeholder implementation.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/coupons/search/… Adds view state, view model, UI events, and data source for handling coupon search.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsViewState.kt Adjusts search state and visibility flags for coupon and product lists.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsToolbar.kt Updates toolbar layout paddings and search state handling for coupons.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsSearchHelper.kt Modifies search helper to select the appropriate search hint based on the list type.
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/woopos/home/items/WooPosItemsScreen.kt Enhances navigation logic to include a separate screen state for coupon search.

Row(
modifier = Modifier
.fillMaxWidth()
.padding(start = WooPosSpacing.Medium.value.toAdaptivePadding()),
.padding(start = WooPosSpacing.Medium.value.toAdaptivePadding(), end = 64.dp),
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider extracting the hard-coded value '64.dp' into a design system constant to maintain consistent spacing across the app.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

@samiuelson samiuelson May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This custom end padding is needed to uncover the search icon; Previously, the search icon was hidden behind "+" icon. To make it cleaner, we'd need to refactor the WooPosSearchInput component, which needs to fill the whole width of the toolbar and show the search icon on its right end internally.

@@ -14,14 +14,15 @@ sealed class WooPosItemsViewState(
) : WooPosItemsViewState(
tabs = tabs,
search = search,
isAddCouponVisible = true,
isAddCouponVisible = false,
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Please confirm that setting 'isAddCouponVisible' to false for the ProductList is intentional. If so, consider adding a comment to clarify why the add coupon button is hidden for this view.

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the sarch button was behind the "+" button; now we are showing both buttons next to each other.

@samiuelson samiuelson added this to the 22.5 milestone May 23, 2025
@samiuelson samiuelson added the status: do not merge Dependent on another PR, ready for review but not ready for merge. label May 23, 2025
modifier: Modifier = Modifier,
onUIEvent: (WooPosCouponsSearchUiEvent) -> Unit
) {
// TODO: implement recent coupon searches row
Copy link
Contributor Author

@samiuelson samiuelson May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBD in next PR: #14101

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a coupons search feature for Woo POS, enhancing the UI and analytics reporting for coupon-related actions.

  • Adds localized strings for coupon search screens and error states.
  • Updates analytics events and UI view states to support coupon search.
  • Introduces new screens, view models, and data sources for handling coupon search functionality.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
res/values/strings.xml Added string resources for coupon search titles, empty states, and error messages.
ui/woopos/util/analytics/WooPosAnalyticsEvent.kt Renamed parameter from totalProductsCount to totalItemsCount for generalized reporting.
ui/woopos/home/items/coupons/search/* Introduced view state, view model, UI events, and composables for coupon search.
ui/woopos/home/items/WooPosItemsViewState.kt & WooPosItemsViewModel.kt Adjusted coupon list state configuration, including visibility of coupon creation action.
ui/woopos/home/items/WooPosItemsToolbar.kt Updated toolbar layout with additional end padding and minor spacing adjustments.
ui/woopos/home/items/WooPosItemsSearchHelper.kt & WooPosItemsScreen.kt Modified search helper and screen navigation logic to support coupon search state.
Comments suppressed due to low confidence (1)

WooCommerce/src/main/res/values/strings.xml:4427

  • The error description for coupon search still reuses the generic products error text. Consider adding a dedicated coupons error description for improved clarity and consistency on the coupons search screen.
<string name="woopos_search_items_error_description">Please try again.</string>

@samiuelson samiuelson marked this pull request as ready for review May 23, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: do not merge Dependent on another PR, ready for review but not ready for merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants