Skip to content

Commit

Permalink
Remove MyMoney feature flag and related code, no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
alebedev committed Sep 19, 2024
1 parent 42f8739 commit 5ca4a97
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 339 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ const TIER_OPTIONS = [
{ name: 'Full insurance', value: '2' },
]

const PRODUCT_OPTIONS = [
{ name: 'Hedvig', value: 'HEDVIG' },
{ name: 'My Money', value: 'MYMONEY' },
]
const PRODUCT_OPTIONS = [{ name: 'Hedvig', value: 'HEDVIG' }]

export const CarTrialDebuggerForm = () => {
const [state, formAction] = useFormState(createCarTrial, {
Expand Down
36 changes: 1 addition & 35 deletions apps/store/src/features/carDealership/CarTrialExtensionBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import { type QueryHookOptions } from '@apollo/client'
import { datadogLogs } from '@datadog/browser-logs'
import { datadogRum } from '@datadog/browser-rum'
import { storyblokEditable } from '@storyblok/react'
import { addDays } from 'date-fns'
import { useSetAtom } from 'jotai'
Expand All @@ -13,9 +12,8 @@ import { Space } from 'ui'
import { globalBannerAtom } from '@/components/GlobalBanner/globalBannerState'
import * as GridLayout from '@/components/GridLayout/GridLayout'
import { CarDealershipBanners } from '@/features/carDealership/carDearlership.constants'
import { useCarTrialExtensionQuery, useUpdateConsentMutation } from '@/services/graphql/generated'
import { useCarTrialExtensionQuery } from '@/services/graphql/generated'
import { type SbBaseBlockProps } from '@/services/storyblok/storyblok'
import { Features } from '@/utils/Features'
import { useRoutingLocale } from '@/utils/l10n/useRoutingLocale'
import { PageLink } from '@/utils/PageLink'
import { useFormatter } from '@/utils/useFormatter'
Expand All @@ -42,15 +40,6 @@ export const CarTrialExtensionBlock = (props: Props) => {
},
})

const [updateMyMoneyConsent] = useUpdateConsentMutation({
onCompleted() {
datadogLogs.logger.info('Car Trial | MyMoney consent updated')
},
onError() {
datadogLogs.logger.error('Car Trial | Failed to update MyMoney consent')
},
})

const trialContact: TrialContract | null = useMemo(() => {
if (data?.carTrial) {
return {
Expand All @@ -62,21 +51,6 @@ export const CarTrialExtensionBlock = (props: Props) => {
return null
}, [data])

const handleMyMoneyConsent = useCallback(
(consentGiven: boolean) => {
if (data?.carTrial) {
updateMyMoneyConsent({
variables: {
trialId: data.carTrial.id,
consentGiven: consentGiven,
},
})
datadogRum.addAction('MyMoney Consent | consent given', { value: consentGiven })
}
},
[updateMyMoneyConsent, data?.carTrial],
)

return (
<GridLayout.Root>
<GridLayout.Content width="1/3" align="center">
Expand All @@ -91,21 +65,13 @@ export const CarTrialExtensionBlock = (props: Props) => {
priceIntent={data.carTrial.priceIntent}
shopSession={data.carTrial.shopSession}
requirePaymentConnection={props.blok.requirePaymentConnection ?? false}
{...(Features.enabled('MYMONEY') && {
collectConsent: data.carTrial.collectConsent,
onConsentChange: handleMyMoneyConsent,
})}
/>
) : (
<PayForTrial
trialContract={trialContact}
shopSessionId={data.carTrial.shopSession.id}
defaultOffer={data.carTrial.priceIntent.defaultOffer ?? undefined}
ssn={data.carTrial.shopSession.customer?.ssn ?? undefined}
{...(Features.enabled('MYMONEY') && {
collectConsent: data.carTrial.collectConsent,
onConsentChange: handleMyMoneyConsent,
})}
/>
)}
</Space>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 3 additions & 19 deletions apps/store/src/features/carDealership/PayForTrial.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { datadogRum } from '@datadog/browser-rum'
import { useAtom, useSetAtom } from 'jotai'
import { useSetAtom } from 'jotai'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
import { Space } from 'ui'
Expand All @@ -14,34 +14,23 @@ import { useFormatter } from '@/utils/useFormatter'
import { type TrialContract } from './carDealership.types'
import { ConfirmPayWithoutExtensionButton } from './ConfirmPayWithoutExtensionButton'
import { ExtensionOfferToggle } from './ExtensionOfferToggle'
import { concentAcceptedAtom } from './MyMoneyConsent/myMoneyConcentAtom'
import { MyMoneyConsent } from './MyMoneyConsent/MyMoneyConsent'
import { PriceBreakdown } from './PriceBreakdown'
import { ProductItemContractContainerCar } from './ProductItemContractContainer'
import { type MyMoneyConsentProps } from './TrialExtensionForm/TrialExtensionForm'

type Props = {
trialContract: TrialContract
shopSessionId: string
defaultOffer?: ProductOfferFragment
ssn?: string
} & MyMoneyConsentProps
}

export const PayForTrial = ({
trialContract,
shopSessionId,
defaultOffer,
ssn,
collectConsent,
onConsentChange,
}: Props) => {
export const PayForTrial = ({ trialContract, shopSessionId, defaultOffer, ssn }: Props) => {
const router = useRouter()
const { t } = useTranslation('carDealership')
const formatter = useFormatter()
const locale = useRoutingLocale()
const setDismissedBannerId = useSetAtom(dismissedBannerIdAtom)
const { startLogin } = useBankIdContext()
const [concentAccepted] = useAtom(concentAcceptedAtom)

const handleConfirmPay = () => {
datadogRum.addAction('Car dealership | Decline extension offer')
Expand All @@ -50,9 +39,6 @@ export const PayForTrial = ({
throw new Error('Must have customer ssn')
}

// Send MyMoney consent state
onConsentChange?.(concentAccepted)

startLogin({
ssn,
async onSuccess() {
Expand Down Expand Up @@ -99,8 +85,6 @@ export const PayForTrial = ({
})}
/>

{collectConsent && <MyMoneyConsent />}

<ConfirmPayWithoutExtensionButton onConfirm={handleConfirmPay} />
</Space>
)
Expand Down
Loading

0 comments on commit 5ca4a97

Please sign in to comment.