[MBL-1599] Add Shipping Location Dropdown to Rewards Carousel #2103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📲 What
Adds the Shipping Dropdown Selector to the Rewards Carousel.
Gated behind No Shipping At Checkout feature flag.
🛠 How
The strategy here is to create duplicate classes with updates specific to this feature. In this flow, gating behind a feature flag is needed to make it more straightforward and still an effective rollout strategy. The alternative would be a tangled mess because of the refactoring required to remove shipping costs from checkout.
The new "duplicate" classes for this piece are:
RewardsWithShippingCollectionViewController
RewardsWithShippingCollectionViewModel
andRewardsWithShippingCollectionViewHeaderView
Implementation Details
PledgeShippingLocationViewModel
using the new logic aboveRewardsWithShippingCollectionViewController
with associatedRewardsWithShippingCollectionViewModel
andRewardsWithShippingCollectionViewHeaderView
The
PledgeShippingLocationViewController
currently works by passing in the selected reward and fetching theShippingRule
associated with it via our V1 endpoint.fetchRewardShippingRules(project.id, reward.id)
Adding the shipping dropdown to Rewards means we won't have a specific reward for fetching
ShippingRule
s.Instead, need to do the following when the feature flag is enabled:
unrestricted
shipping preference. If there is one, we’ll use it to fetch the shipping rules using the V1 fetch above. This will return ALL available locations.unrestricted
reward, we’ll call the query for every reward with arestricted
shipping preference to capture all possible shipping locations.This isn't ideal performance or networking and I don't want to write bootstrap code to work with our V1 API when the end game is to move completely to GraphQL.
I've made a ticket and discussed this with Santiago, who is looking into the lift for adding all possible shipping locations directly to the Project GraphQL model. This would solve both of my concerns. We can update this piece later if we decide to.
👀 See
🏎 Performance
✅ Acceptance criteria