From 1977cc445dc61abb5d6c1f5d2a925eff4242c801 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Mon, 14 Aug 2023 14:02:36 -0500 Subject: [PATCH] Use different Give links for different download types --- .../give-before-pdf/give-before-pdf.js | 9 ++++-- .../give-before-pdf/give-links.ts | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/app/pages/details/common/get-this-title-files/give-before-pdf/give-links.ts diff --git a/src/app/pages/details/common/get-this-title-files/give-before-pdf/give-before-pdf.js b/src/app/pages/details/common/get-this-title-files/give-before-pdf/give-before-pdf.js index 88d9f6c68..fe0ccd8b3 100644 --- a/src/app/pages/details/common/get-this-title-files/give-before-pdf/give-before-pdf.js +++ b/src/app/pages/details/common/get-this-title-files/give-before-pdf/give-before-pdf.js @@ -6,6 +6,7 @@ import {faHeart} from '@fortawesome/free-solid-svg-icons/faHeart'; import ThankYou from './thank-you-form'; import {enroll} from '@openstax/experiments'; import './give-before-pdf.scss'; +import giveLinks from './give-links'; function Downloading({data}) { return ( @@ -47,14 +48,16 @@ function GiveBeforePdfAfterConditionals({onThankYouClick, link, data, close, onD [close, onDownload] ); + const [controlLink, alternateLink] = giveLinks(); const donationExperiment = enroll({ name: 'Donation Experiment 2023', variants: [ // eslint-disable-next-line camelcase - {name: 'control', header_subtitle: data.header_subtitle}, + {name: 'control', header_subtitle: data.header_subtitle, giveLink: controlLink}, {name: 'public good', // eslint-disable-next-line camelcase - header_subtitle: 'Join us in sustaining OpenStax as a public good for years to come by giving today.' + header_subtitle: 'Join us in sustaining OpenStax as a public good for years to come by giving today.', + giveLink: alternateLink } ] }); @@ -80,7 +83,7 @@ function GiveBeforePdfAfterConditionals({onThankYouClick, link, data, close, onD

getLinks(search), [search]); +} + +function getLinks(search: string) { + if (search.includes('Instructor')) { + return [ + 'https://riceconnect.rice.edu/donation/support-openstax-instructor-resources', + 'https://riceconnect.rice.edu/donation/support-openstax-instructor-resources-b' + ]; + } + if (search.includes('Student')) { + return [ + 'https://riceconnect.rice.edu/donation/support-openstax-student-resources', + 'https://riceconnect.rice.edu/donation/support-openstax-student-resources-b' + ]; + } + return [ + 'https://riceconnect.rice.edu/donation/support-openstax-subject', + 'https://riceconnect.rice.edu/donation/support-openstax-subject-b' + ]; +}