Skip to content

Commit

Permalink
Merge pull request #789 from Financial-Times/remove-is-fixed-term-offer
Browse files Browse the repository at this point in the history
Remove isFixedTermOffer
  • Loading branch information
andygout committed Mar 18, 2024
2 parents 87d6d8c + ceadad1 commit af7d875
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 75 deletions.
28 changes: 8 additions & 20 deletions components/payment-term.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export function PaymentTerm({
isPrintOrBundle = false,
isEpaper = false,
options = [],
isFixedTermOffer = false,
offerDisplayName,
showLegal = true,
largePrice = false,
optionsInARow = false,
Expand Down Expand Up @@ -133,15 +131,11 @@ export function PaymentTerm({
</React.Fragment>
),
monthlyPrice: () => {},
renewsText: (isFixedTermOffer) => {
const textToDisplay = isFixedTermOffer
? 'This subscription is for 3 months, charged monthly. You can cancel at anytime'
: 'Renews monthly unless cancelled';

return (
<p className="ncf__payment-term__renews-text">{textToDisplay}</p>
);
},
renewsText: () => (
<p className="ncf__payment-term__renews-text">
{'Renews monthly unless cancelled'}
</p>
),
},
custom: {
price: (price) => (
Expand Down Expand Up @@ -235,7 +229,7 @@ export function PaymentTerm({
<div className="ncf__payment-term__description">
{nameMap[option.name].price(option.price)}
{nameMap[option.name].monthlyPrice(option.monthlyPrice)}
{nameMap[option.name].renewsText(isFixedTermOffer)}
{nameMap[option.name].renewsText()}
{/* Remove this discount text temporarily in favour of monthly price */}
{/* <br />Save up to 25% when you pay annually */}
</div>
Expand Down Expand Up @@ -287,13 +281,9 @@ export function PaymentTerm({
return labelOverride;
}

const defaultTitle =
const title =
option.name && nameMap[option.name] ? nameMap[option.name].title : '';

const title = isFixedTermOffer
? `${offerDisplayName} - ${defaultTitle}`
: defaultTitle;

let termDisplayName = '';
if (showTrialCopyInTitle) {
const termName = option.displayName
Expand Down Expand Up @@ -363,7 +353,7 @@ export function PaymentTerm({

{showLegal && (
<div className="ncf__payment-term__legal">
{isTermedSubscriptionTermType || isFixedTermOffer ? (
{isTermedSubscriptionTermType ? (
<p>
Find out more about our cancellation policy in our{' '}
<a
Expand Down Expand Up @@ -434,9 +424,7 @@ PaymentTerm.propTypes = {
fulfilmentOption: PropTypes.string,
})
),
isFixedTermOffer: PropTypes.bool,
isTermedSubscriptionTermType: PropTypes.bool,
offerDisplayName: PropTypes.string,
showLegal: PropTypes.bool,
largePrice: PropTypes.bool,
optionsInARow: PropTypes.bool,
Expand Down
36 changes: 0 additions & 36 deletions components/payment-term.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,42 +117,6 @@ describe('PaymentTerm', () => {
});
});

describe('given isFixedTermOffer prop is set to true', () => {
const options = [
{
name: 'monthly',
price: '$5.00',
value: 'monthly',
monthlyPrice: '$5.00',
},
];
const wrapper = shallow(
<PaymentTerm
isFixedTermOffer={true}
options={options}
offerDisplayName="Mix & Match"
/>
);

it('does not include renewal text', () => {
expect(
wrapper.find('.ncf__payment-term__renews-text').text()
).not.toMatch(/Renews (annually|monthly|quarterly) unless cancelled/);
});

it('renders fixed term renewal text in English', () => {
expect(wrapper.find('.ncf__payment-term__renews-text').text()).toMatch(
/This subscription is for 3 months, charged monthly. You can cancel at anytime/
);
});

it('renders offer name on payment term title', () => {
expect(wrapper.find('.ncf__payment-term__title').text()).toMatch(
'Mix & Match - Monthly'
);
});
});

describe('given isTermedSubscriptionTermType is true', () => {
describe('options include duration expressed in weeks', () => {
const options = [
Expand Down
19 changes: 0 additions & 19 deletions components/payment-term.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,6 @@ Basic.args = {
],
};

export const FixedTermOffer = (args) => (
<div className="ncf">
<Fieldset>
<PaymentTerm {...args} />
</Fieldset>
</div>
);
FixedTermOffer.args = {
options: [
{
name: 'monthly',
price: '$5.00',
value: 5.0,
},
],
isFixedTermOffer: true,
offerDisplayName: 'Mix & Match',
};

export const TermedSubscriptionTermType = (args) => (
<div className="ncf">
<Fieldset>
Expand Down

0 comments on commit af7d875

Please sign in to comment.