Skip to content

Commit

Permalink
Revert "refact(OfferPresenter): hide changes under DISCOUNTS feature …
Browse files Browse the repository at this point in the history
…flag"

This reverts commit b109c63.
  • Loading branch information
guilhermespopolin committed Jul 5, 2023
1 parent b109c63 commit 2ce3dab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
1 change: 0 additions & 1 deletion apps/store/.env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ NEXT_PUBLIC_FEATURE_ENGLISH_LANGUAGE=true
NEXT_PUBLIC_FEATURE_COUNTRY_SELECTOR=true
NEXT_PUBLIC_FEATURE_SAS_PARTNERSHIP=true
NEXT_PUBLIC_FEATURE_HOMECOMING=true
NEXT_PUBLIC_FEATURE_DISCOUNTS=true

# Vercel Edge Config Connection String (https://github.com/vercel/edge-config)
EDGE_CONFIG=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { PriceIntent } from '@/services/priceIntent/priceIntent.types'
import { ShopSession } from '@/services/shopSession/ShopSession.types'
import { useTracking } from '@/services/Tracking/useTracking'
import { convertToDate } from '@/utils/date'
import { Features } from '@/utils/Features'
import { PageLink } from '@/utils/PageLink'
import { useGetDiscountExplanation } from '@/utils/useDiscountExplanation'
import { useFormatter } from '@/utils/useFormatter'
Expand Down Expand Up @@ -297,7 +296,7 @@ const useDiscountTooltipProps = (
if (selectedOffer.priceMatch) {
const company = selectedOffer.priceMatch.externalInsurer.displayName

if (selectedOffer.priceMatch.priceReduction.amount <= 0) {
if (selectedOffer.priceMatch.priceReduction.amount < 1) {
// No price reduction due to incomparable offers
const amount = formatter.monthlyPrice(selectedOffer.priceMatch.externalPrice)
return {
Expand All @@ -316,21 +315,19 @@ const useDiscountTooltipProps = (
} as const
}

if (Features.enabled('DISCOUNTS')) {
const redeemedCampaign = redeemedCampaigns?.[0]
if (redeemedCampaign && selectedOffer.cost.discount.amount > 0) {
return {
children: getDiscountExplanation({
...redeemedCampaign.discount,
amount: selectedOffer.cost.discount,
}),
subtitle: t('DISCOUNT_PRICE_AFTER_EXPIRATION', {
amount: formatter.monthlyPrice(selectedOffer.cost.gross),
ns: 'cart',
}),
color: 'green',
} as const
}
const redeemedCampaign = redeemedCampaigns?.[0]
if (redeemedCampaign && selectedOffer.cost.discount.amount > 0) {
return {
children: getDiscountExplanation({
...redeemedCampaign.discount,
amount: selectedOffer.cost.discount,
}),
subtitle: t('DISCOUNT_PRICE_AFTER_EXPIRATION', {
amount: formatter.monthlyPrice(selectedOffer.cost.gross),
ns: 'cart',
}),
color: 'green',
} as const
}
}, [t, formatter, getDiscountExplanation, selectedOffer, redeemedCampaigns])

Expand Down
1 change: 0 additions & 1 deletion apps/store/src/utils/Features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const config = {
SAS_PARTNERSHIP: process.env.NEXT_PUBLIC_FEATURE_SAS_PARTNERSHIP === 'true',
INSURELY_CAR: process.env.NEXT_PUBLIC_FEATURE_INSURELY_CAR === 'true',
HOMECOMING: process.env.NEXT_PUBLIC_FEATURE_HOMECOMING === 'true',
DISCOUNTS: process.env.NEXT_PUBLIC_FEATURE_DISCOUNTS === 'true',
} as const

export type FeatureFlag = keyof typeof config

0 comments on commit 2ce3dab

Please sign in to comment.