Skip to content
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

[MBL-1599] Add Shipping Location Dropdown to Rewards Carousel #2103

Merged
merged 10 commits into from
Jul 30, 2024

Conversation

scottkicks
Copy link
Contributor

@scottkicks scottkicks commented Jul 24, 2024

📲 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 and RewardsWithShippingCollectionViewHeaderView

Implementation Details

  • Updates PledgeShippingLocationViewModel using the new logic above
  • Adds the shipping dropdown to a new RewardsWithShippingCollectionViewController with associated RewardsWithShippingCollectionViewModel and RewardsWithShippingCollectionViewHeaderView
  • Updates Snapshot Tests

The PledgeShippingLocationViewController currently works by passing in the selected reward and fetching the ShippingRule 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 ShippingRules.

Instead, need to do the following when the feature flag is enabled:

  • Filter all of the project's rewards and check for a reward with an 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.
  • For the case where there isn’t an unrestricted reward, we’ll call the query for every reward with a restricted 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

Simulator Screen Recording - iPhone 15 Pro Max - 2024-07-24 at 11 14 11

🏎 Performance

✅ Acceptance criteria

  • The shipping dropdown shows all available shipping locations for the current project's shippable rewards
  • If there are no shippable rewards, the dropdown doesn't show
  • Late pledge/crowdfunding checkouts still function as expected. They still show the standard shipping selection as well.

@scottkicks scottkicks self-assigned this Jul 24, 2024
@nativeksr
Copy link
Collaborator

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@scottkicks scottkicks force-pushed the scott/add-shipping-dropdown-to-rewards-carousel branch from 7bae5a3 to 6e2380f Compare July 29, 2024 18:29
@scottkicks scottkicks requested a review from ifosli July 29, 2024 20:43
@scottkicks scottkicks marked this pull request as ready for review July 29, 2024 20:43
@scottkicks scottkicks merged commit 475d9f3 into main Jul 30, 2024
5 checks passed
@scottkicks scottkicks deleted the scott/add-shipping-dropdown-to-rewards-carousel branch July 30, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants