-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12403 from guardian/use-product-for-selected-tier
Use product and ratePlan qs params over amounts for support epic
- Loading branch information
Showing
9 changed files
with
154 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 23 additions & 31 deletions
54
dotcom-rendering/src/components/marketing/epics/utils/threeTierChoiceCardAmounts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,42 @@ | ||
import { | ||
countryCodeToCountryGroupId, | ||
type CountryGroupId, | ||
} from '@guardian/support-dotcom-components'; | ||
import { type CountryGroupId } from '@guardian/support-dotcom-components'; | ||
|
||
export type SupportTier = 'support' | 'allAccess' | 'other'; | ||
export type SupportTier = 'Contribution' | 'SupporterPlus' | 'OneOff'; | ||
|
||
// ToDo: fetch this in a way that isn't hardcoded | ||
export const threeTierChoiceCardAmounts = { | ||
GBPCountries: { | ||
support: 4, | ||
allAccess: 12, | ||
other: 0, | ||
Contribution: 4, | ||
SupporterPlus: 12, | ||
OneOff: 0, | ||
}, | ||
UnitedStates: { | ||
support: 5, | ||
allAccess: 15, | ||
other: 0, | ||
Contribution: 5, | ||
SupporterPlus: 15, | ||
OneOff: 0, | ||
}, | ||
AUDCountries: { | ||
support: 10, | ||
allAccess: 20, | ||
other: 0, | ||
Contribution: 10, | ||
SupporterPlus: 20, | ||
OneOff: 0, | ||
}, | ||
EURCountries: { | ||
support: 4, | ||
allAccess: 12, | ||
other: 0, | ||
Contribution: 4, | ||
SupporterPlus: 12, | ||
OneOff: 0, | ||
}, | ||
NZDCountries: { | ||
support: 10, | ||
allAccess: 20, | ||
other: 0, | ||
Contribution: 10, | ||
SupporterPlus: 20, | ||
OneOff: 0, | ||
}, | ||
Canada: { | ||
support: 5, | ||
allAccess: 15, | ||
other: 0, | ||
Contribution: 5, | ||
SupporterPlus: 15, | ||
OneOff: 0, | ||
}, | ||
International: { | ||
support: 3, | ||
allAccess: 15, | ||
other: 0, | ||
Contribution: 3, | ||
SupporterPlus: 15, | ||
OneOff: 0, | ||
}, | ||
} as const satisfies Record<CountryGroupId, Record<SupportTier, number>>; | ||
|
||
export function getDefaultThreeTierAmount(countryCode?: string): number { | ||
const countryGroupId = countryCodeToCountryGroupId(countryCode); | ||
return threeTierChoiceCardAmounts[countryGroupId].allAccess; | ||
} |
Oops, something went wrong.