| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -367,7 +367,7 @@ const countryGroups: CountryGroups = { | |||
| 367 | 367 | }, | |
| 368 | 368 | }; | |
| 369 | 369 | ||
| 370 | - // These are the different 'regions' we accept when taking payment. | ||
| 370 | + // These are the different 'country groups' we accept when taking payment. | ||
| 371 | 371 | // See https://github.com/guardian/support-internationalisation/blob/master/src/main/scala/com/gu/i18n/CountryGroup.scala for more context. | |
| 372 | 372 | const getSupporterCountryGroup = (location: string): CountryGroupId => { | |
| 373 | 373 | const availableCountryGroups = Object.keys(countryGroups); | |
@@ -380,53 +380,25 @@ const getSupporterCountryGroup = (location: string): CountryGroupId => { | |||
| 380 | 380 | return response || 'GBPCountries'; | |
| 381 | 381 | }; | |
| 382 | 382 | ||
| 383 | - const isInEurope = (): boolean => { | ||
| 384 | - const countryCode = getSync(); | ||
| 385 | - return ( | ||
| 386 | - countryGroups.EURCountries.countries.includes(countryCode) || | ||
| 387 | - countryCode === 'GB' | ||
| 388 | - ); | ||
| 389 | - }; | ||
| 390 | - | ||
| 391 | - const getLocalCurrencySymbol = (): string => | ||
| 392 | - ({ | ||
| 393 | - GBPCountries: '£', | ||
| 394 | - UnitedStates: '$', | ||
| 395 | - AUDCountries: '$', | ||
| 396 | - Canada: 'CA$', | ||
| 397 | - EURCountries: '€', | ||
| 398 | - NZDCountries: 'NZ$', | ||
| 399 | - International: '$', | ||
| 400 | - }[getSupporterCountryGroup(getSync())] || '£'); | ||
| 401 | - | ||
| 402 | 383 | const extendedCurrencySymbol = { | |
| 403 | 384 | GBPCountries: '£', | |
| 404 | 385 | UnitedStates: '$', | |
| 405 | - EURCountries: '€', | ||
| 386 | + AUDCountries: '$', | ||
| 406 | 387 | Canada: 'CA$', | |
| 388 | + EURCountries: '€', | ||
| 407 | 389 | NZDCountries: 'NZ$', | |
| 408 | - AUDCountries: '$', | ||
| 409 | 390 | International: '$', | |
| 410 | 391 | }; | |
| 411 | 392 | ||
| 412 | - const currencySymbol = { | ||
| 413 | - GBPCountries: '£', | ||
| 414 | - UnitedStates: '$', | ||
| 415 | - AUDCountries: '$', | ||
| 416 | - EURCountries: '€', | ||
| 417 | - NZDCountries: '$', | ||
| 418 | - International: '$', | ||
| 419 | - Canada: '$', | ||
| 420 | - }; | ||
| 393 | + const getLocalCurrencySymbol = (): string => | ||
| 394 | + extendedCurrencySymbol[getSupporterCountryGroup(getSync())] || '£'; | ||
| 421 | 395 | ||
| 422 | 396 | export { | |
| 423 | 397 | get, | |
| 424 | 398 | getSupporterCountryGroup, | |
| 425 | 399 | getSync, | |
| 426 | 400 | getLocalCurrencySymbol, | |
| 427 | - isInEurope, | ||
| 428 | 401 | init, | |
| 429 | 402 | setGeolocation, | |
| 430 | - currencySymbol, | ||
| 431 | 403 | extendedCurrencySymbol, | |
| 432 | 404 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | // @flow | |
| 2 | 2 | import { getLocalCurrencySymbol } from 'lib/geolocation'; | |
| 3 | - import { useSupportDomain } from 'common/modules/commercial/support-utilities'; | ||
| 3 | + | ||
| 4 | 4 | // control | |
| 5 | 5 | const controlHeading = 'Since you’re here …'; | |
| 6 | 6 | const controlP1 = | |
@@ -26,22 +26,12 @@ const ctaLinkSentence = ( | |||
| 26 | 26 | supportUrl: string, | |
| 27 | 27 | contributionUrl: string, | |
| 28 | 28 | currencySymbol: string | |
| 29 | - ): string => { | ||
| 30 | - if (useSupportDomain()) { | ||
| 31 | - return `<span class="contributions__highlight"> For as little as ${ | ||
| 32 | - currencySymbol | ||
| 33 | - }1, you can support the Guardian – and it only takes a minute.</span> <a href="${ | ||
| 34 | - supportUrl | ||
| 35 | - }" target="_blank" class="u-underline">Make a contribution</a>`; | ||
| 36 | - } | ||
| 37 | - return `<span class="contributions__highlight"> For as little as ${ | ||
| 29 | + ): string => | ||
| 30 | + `<span class="contributions__highlight"> For as little as ${ | ||
| 38 | 31 | currencySymbol | |
| 39 | 32 | }1, you can support the Guardian – and it only takes a minute.</span> <a href="${ | |
| 40 | 33 | supportUrl | |
| 41 | - }" target="_blank" class="u-underline">Become a monthly supporter</a> or <a href="${ | ||
| 42 | - contributionUrl | ||
| 43 | - }" target="_blank" class="u-underline">make a one-off contribution</a>`; | ||
| 44 | - }; | ||
| 34 | + }" target="_blank" class="u-underline">Make a contribution</a>`; | ||
| 45 | 35 | ||
| 46 | 36 | const cambridgeP1 = | |
| 47 | 37 | '… now is the time to support investigative reporting. The Guardian and Observer have spent a year analysing documents, working with whistleblowers and gathering eyewitness reports to untangle a complex story around data in the digital age. This took months of painstaking research by a small team of reporters and editors – and has led to investigations on both sides of the Atlantic. <span class="contributions__highlight">We have received legal threats, including from Facebook, but we are determined to continue publishing stories that raise important questions about the use of people’s data in political campaigns</span> – from the US election to Brexit.'; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,20 +24,14 @@ import { epicButtonsTemplate } from 'common/modules/commercial/templates/acquisi | |||
| 24 | 24 | import { acquisitionsEpicControlTemplate } from 'common/modules/commercial/templates/acquisitions-epic-control'; | |
| 25 | 25 | import { acquisitionsTestimonialBlockTemplate } from 'common/modules/commercial/templates/acquisitions-epic-testimonial-block'; | |
| 26 | 26 | import { shouldSeeReaderRevenue as userShouldSeeReaderRevenue } from 'common/modules/commercial/user-features'; | |
| 27 | - import { | ||
| 28 | - useSupportDomain, | ||
| 29 | - supportBaseURL, | ||
| 30 | - } from 'common/modules/commercial/support-utilities'; | ||
| 27 | + import { supportContributeURL } from 'common/modules/commercial/support-utilities'; | ||
| 31 | 28 | ||
| 32 | 29 | type EpicTemplate = (Variant, AcquisitionsEpicTemplateCopy) => string; | |
| 33 | 30 | ||
| 34 | 31 | export type CtaUrls = { | |
| 35 | - contributeUrl?: string, | ||
| 36 | - supportUrl?: string, | ||
| 32 | + supportUrl: string, | ||
| 37 | 33 | }; | |
| 38 | 34 | ||
| 39 | - const contributionsBaseURL = 'https://contribute.theguardian.com'; | ||
| 40 | - | ||
| 41 | 35 | // How many times the user can see the Epic, | |
| 42 | 36 | // e.g. 6 times within 7 days with minimum of 1 day in between views. | |
| 43 | 37 | const defaultMaxViews: { | |
@@ -50,16 +44,14 @@ const defaultMaxViews: { | |||
| 50 | 44 | minDaysBetweenViews: 0, | |
| 51 | 45 | }; | |
| 52 | 46 | ||
| 53 | - const defaultButtonTemplate = (urls: CtaUrls) => | ||
| 54 | - epicButtonsTemplate(urls, useSupportDomain()); | ||
| 47 | + const defaultButtonTemplate = (url: CtaUrls) => epicButtonsTemplate(url); | ||
| 55 | 48 | ||
| 56 | 49 | const controlTemplate: EpicTemplate = ({ options = {} }, copy) => | |
| 57 | 50 | acquisitionsEpicControlTemplate({ | |
| 58 | 51 | copy, | |
| 59 | 52 | componentName: options.componentName, | |
| 60 | 53 | testimonialBlock: options.testimonialBlock, | |
| 61 | 54 | buttonTemplate: options.buttonTemplate({ | |
| 62 | - contributeUrl: options.contributeURL, | ||
| 63 | 55 | supportUrl: options.supportURL, | |
| 64 | 56 | }), | |
| 65 | 57 | }); | |
@@ -186,18 +178,8 @@ const makeABTestVariant = ( | |||
| 186 | 178 | id, | |
| 187 | 179 | parentTest.campaignSuffix | |
| 188 | 180 | ), | |
| 189 | - contributeURL = addTrackingCodesToUrl({ | ||
| 190 | - base: contributionsBaseURL, | ||
| 191 | - componentType: parentTest.componentType, | ||
| 192 | - componentId: campaignCode, | ||
| 193 | - campaignCode, | ||
| 194 | - abTest: { | ||
| 195 | - name: parentTest.id, | ||
| 196 | - variant: id, | ||
| 197 | - }, | ||
| 198 | - }), | ||
| 199 | 181 | supportURL = addTrackingCodesToUrl({ | |
| 200 | - base: `${options.supportBaseURL || supportBaseURL}`, | ||
| 182 | + base: `${options.supportBaseURL || supportContributeURL}`, | ||
| 201 | 183 | componentType: parentTest.componentType, | |
| 202 | 184 | componentId: campaignCode, | |
| 203 | 185 | campaignCode, | |
@@ -272,7 +254,6 @@ const makeABTestVariant = ( | |||
| 272 | 254 | isUnlimited, | |
| 273 | 255 | products, | |
| 274 | 256 | campaignCode, | |
| 275 | - contributeURL, | ||
| 276 | 257 | supportURL, | |
| 277 | 258 | template, | |
| 278 | 259 | buttonTemplate, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,8 +4,7 @@ import { | |||
| 4 | 4 | getSupporterCountryGroup, | |
| 5 | 5 | extendedCurrencySymbol, | |
| 6 | 6 | } from 'lib/geolocation'; | |
| 7 | - import type { CountryGroupId } from 'lib/geolocation'; | ||
| 8 | - import { supportBaseURL } from './support-utilities'; | ||
| 7 | + import { supportContributeURL } from './support-utilities'; | ||
| 9 | 8 | ||
| 10 | 9 | const baseParams = { | |
| 11 | 10 | minArticles: 3, | |
@@ -21,40 +20,16 @@ const engagementBannerCopy = (): string => | |||
| 21 | 20 | produce. But the revenue we get from advertising is falling, so we increasingly need our readers to fund us. If | |
| 22 | 21 | everyone who reads our reporting, who likes it, helps fund it, our future would be much more secure.`; | |
| 23 | 22 | ||
| 24 | - // Prices taken from https://membership.theguardian.com/<region>/supporter | ||
| 23 | + const initialContribution = 1; | ||
| 25 | 24 | ||
| 26 | - const paymentAmounts = { | ||
| 27 | - MONTHLY: { | ||
| 28 | - GBPCountries: '5', | ||
| 29 | - UnitedStates: '6.99', | ||
| 30 | - AUDCountries: '10', | ||
| 31 | - Canada: '6.99', | ||
| 32 | - International: '6.99', | ||
| 33 | - NZDCountries: '10', | ||
| 34 | - EURCountries: '4.99', | ||
| 35 | - }, | ||
| 36 | - 'ONE-OFF': { | ||
| 37 | - GBPCountries: '1', | ||
| 38 | - UnitedStates: '1', | ||
| 39 | - AUDCountries: '1', | ||
| 40 | - Canada: '1', | ||
| 41 | - International: '1', | ||
| 42 | - NZDCountries: '1', | ||
| 43 | - EURCountries: '1', | ||
| 44 | - }, | ||
| 45 | - }; | ||
| 25 | + const supporterCost = (location: string): string => { | ||
| 26 | + const countryGroup = getSupporterCountryGroup(location); | ||
| 46 | 27 | ||
| 47 | - const supporterCost = ( | ||
| 48 | - location: string, | ||
| 49 | - contributionType: 'MONTHLY' | 'ONE-OFF' | ||
| 50 | - ): string => { | ||
| 51 | - const region = getSupporterCountryGroup(location); | ||
| 52 | - | ||
| 53 | - if (region === 'EURCountries') { | ||
| 28 | + if (countryGroup === 'EURCountries') { | ||
| 54 | 29 | // Format either 4.99 € or €4.99 depending on country | |
| 55 | 30 | // See https://en.wikipedia.org/wiki/Linguistic_issues_concerning_the_euro | |
| 56 | 31 | const euro = extendedCurrencySymbol.EURCountries; | |
| 57 | - const amount = paymentAmounts[contributionType].EURCountries; | ||
| 32 | + const amount = initialContribution; | ||
| 58 | 33 | ||
| 59 | 34 | const euroAfterCountryCodes = [ | |
| 60 | 35 | 'BG', | |
@@ -84,53 +59,21 @@ const supporterCost = ( | |||
| 84 | 59 | : euro + amount; | |
| 85 | 60 | } | |
| 86 | 61 | ||
| 87 | - return `${extendedCurrencySymbol[region]} | ||
| 88 | - ${paymentAmounts[contributionType][region]}`; | ||
| 62 | + return `${extendedCurrencySymbol[countryGroup]} | ||
| 63 | + ${initialContribution}`; | ||
| 89 | 64 | }; | |
| 90 | 65 | ||
| 91 | - const supporterEngagementCtaCopy = (location: string): string => | ||
| 92 | - `Support us for ${supporterCost(location, 'MONTHLY')} a month.`; | ||
| 93 | - | ||
| 94 | 66 | const supporterEngagementCtaCopyJustOne = (location: string): string => | |
| 95 | - `Support The Guardian from as little as ${supporterCost( | ||
| 96 | - location, | ||
| 97 | - 'ONE-OFF' | ||
| 98 | - )}.`; | ||
| 67 | + `Support The Guardian from as little as ${supporterCost(location)}.`; | ||
| 99 | 68 | ||
| 100 | - const supporterParams = (location: string): EngagementBannerParams => | ||
| 69 | + export const engagementBannerParams = ( | ||
| 70 | + location: string | ||
| 71 | + ): EngagementBannerParams => | ||
| 101 | 72 | Object.assign({}, baseParams, { | |
| 102 | 73 | buttonCaption: 'Support The Guardian', | |
| 103 | - linkUrl: supportBaseURL, | ||
| 74 | + linkUrl: supportContributeURL, | ||
| 104 | 75 | products: ['CONTRIBUTION', 'RECURRING_CONTRIBUTION'], | |
| 105 | 76 | messageText: engagementBannerCopy(), | |
| 106 | 77 | ctaText: supporterEngagementCtaCopyJustOne(location), | |
| 107 | 78 | pageviewId: config.get('ophan.pageViewId', 'not_found'), | |
| 108 | 79 | }); | |
| 109 | - | ||
| 110 | - const membershipSupporterParams = (location: string): EngagementBannerParams => | ||
| 111 | - Object.assign({}, baseParams, { | ||
| 112 | - buttonCaption: 'Become a Supporter', | ||
| 113 | - linkUrl: 'https://membership.theguardian.com/supporter', | ||
| 114 | - products: ['MEMBERSHIP_SUPPORTER'], | ||
| 115 | - messageText: engagementBannerCopy(), | ||
| 116 | - ctaText: supporterEngagementCtaCopy(location), | ||
| 117 | - pageviewId: config.get('ophan.pageViewId', 'not_found'), | ||
| 118 | - }); | ||
| 119 | - | ||
| 120 | - export const engagementBannerParams = ( | ||
| 121 | - location: string | ||
| 122 | - ): EngagementBannerParams => { | ||
| 123 | - const region = getSupporterCountryGroup(location); | ||
| 124 | - const supportRegions: CountryGroupId[] = [ | ||
| 125 | - 'UnitedStates', | ||
| 126 | - 'GBPCountries', | ||
| 127 | - 'EURCountries', | ||
| 128 | - 'International', | ||
| 129 | - 'NZDCountries', | ||
| 130 | - 'Canada', | ||
| 131 | - ]; | ||
| 132 | - if (supportRegions.includes(region)) { | ||
| 133 | - return supporterParams(location); | ||
| 134 | - } | ||
| 135 | - return membershipSupporterParams(location); | ||
| 136 | - }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,22 +1,5 @@ | |||
| 1 | 1 | // @flow | |
| 2 | - import { | ||
| 3 | - getSync as geolocationGetSync, | ||
| 4 | - getSupporterCountryGroup as geolocationGetSupporterPaymentRegion, | ||
| 5 | - } from 'lib/geolocation'; | ||
| 2 | + const supportContributeURL = 'https://support.theguardian.com/contribute'; | ||
| 3 | + const supportSubscribeURL = 'https://support.theguardian.com/subscribe'; | ||
| 6 | 4 | ||
| 7 | - const geo: string = geolocationGetSync(); | ||
| 8 | - const geoCountryGroup = geolocationGetSupporterPaymentRegion(geo); | ||
| 9 | - | ||
| 10 | - const useSupportDomain = (): boolean => | ||
| 11 | - geoCountryGroup === 'GBPCountries' || | ||
| 12 | - geoCountryGroup === 'UnitedStates' || | ||
| 13 | - geoCountryGroup === 'EURCountries' || | ||
| 14 | - geoCountryGroup === 'International' || | ||
| 15 | - geoCountryGroup === 'NZDCountries' || | ||
| 16 | - geoCountryGroup === 'Canada'; | ||
| 17 | - | ||
| 18 | - const supportBaseURL = useSupportDomain() | ||
| 19 | - ? 'https://support.theguardian.com/contribute' | ||
| 20 | - : 'https://membership.theguardian.com/supporter'; | ||
| 21 | - | ||
| 22 | - export { useSupportDomain, supportBaseURL }; | ||
| 5 | + export { supportContributeURL, supportSubscribeURL }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,26 +2,7 @@ | |||
| 2 | 2 | import type { CtaUrls } from 'common/modules/commercial/contributions-utilities'; | |
| 3 | 3 | import config from 'lib/config'; | |
| 4 | 4 | ||
| 5 | - export const epicButtonsTemplate = ( | ||
| 6 | - { supportUrl = '', contributeUrl = '' }: CtaUrls, | ||
| 7 | - useSupportDomain: boolean = false | ||
| 8 | - ) => { | ||
| 9 | - const contribButton = ` | ||
| 10 | - <div> | ||
| 11 | - <a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member" | ||
| 12 | - href="${contributeUrl}" | ||
| 13 | - target="_blank"> | ||
| 14 | - Make a contribution | ||
| 15 | - </a> | ||
| 16 | - </div>`; | ||
| 17 | - const supportButtonBecome = ` | ||
| 18 | - <div> | ||
| 19 | - <a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member" | ||
| 20 | - href="${supportUrl}" | ||
| 21 | - target="_blank"> | ||
| 22 | - Become a supporter | ||
| 23 | - </a> | ||
| 24 | - </div>`; | ||
| 5 | + export const epicButtonsTemplate = ({ supportUrl = '' }: CtaUrls) => { | ||
| 25 | 6 | const supportButtonSupport = ` | |
| 26 | 7 | <div> | |
| 27 | 8 | <a class="contributions__option-button contributions__contribute contributions__contribute--epic contributions__contribute--epic-member contributions__contribute--epic-single-button" | |
@@ -38,11 +19,7 @@ export const epicButtonsTemplate = ( | |||
| 38 | 19 | ||
| 39 | 20 | return ` | |
| 40 | 21 | <div class="contributions__amount-field"> | |
| 41 | - ${ | ||
| 42 | - useSupportDomain | ||
| 43 | - ? supportButtonSupport | ||
| 44 | - : supportButtonBecome + contribButton | ||
| 45 | - } | ||
| 22 | + ${supportButtonSupport} | ||
| 46 | 23 | ${paymentLogos} | |
| 47 | 24 | </div>`; | |
| 48 | 25 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments