Skip to content

Commit

Permalink
Membership options changes for release (MyCryptoHQ#3661)
Browse files Browse the repository at this point in the history
* hide 3 & 6 month membership options for now

* disabled memberships instead of remove them, so we can still poll for pre-existing memberships

* fixed test
  • Loading branch information
blurpesec authored Dec 16, 2020
1 parent 5812582 commit a17fbdd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/TransactionFlow/TxReceipt.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const transactionReceiptDeFiZap = wrapInProvider(
</div>
);

const membershipSelected = MEMBERSHIP_CONFIG[IMembershipId.threemonths];
const membershipSelected = MEMBERSHIP_CONFIG[IMembershipId.twelvemonths];

export const transactionReceiptMembership = wrapInProvider(
<div className="sb-container" style={{ maxWidth: '620px' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@ const MembershipEducation = withRouter(({ history }) => {
</ListContainer>
<Title>{translate('WHAT_IT_COST')}</Title>
<PlanContainer>
{Object.keys(MEMBERSHIP_CONFIG).map((key) => (
<MembershipPlanCard key={key} plan={MEMBERSHIP_CONFIG[key as IMembershipId]} />
))}
{Object.values(MEMBERSHIP_CONFIG)
.filter(({ disabled }) => !disabled)
.map((membershipConfig) => (
<MembershipPlanCard
key={membershipConfig.key}
plan={MEMBERSHIP_CONFIG[membershipConfig.key as IMembershipId]}
/>
))}
</PlanContainer>
<SButton onClick={handleSubmit}>{translate('BUY_MEMBERSHIP_NOW')}</SButton>
<Disclaimer>{translate('MEMBERSHIP_NOTE')}</Disclaimer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const MembershipFormUI = ({
}: UIProps) => {
const { getAssetByUUID } = useAssets();
const { defaultAccount } = useContext(StoreContext);
const defaultMembership = MEMBERSHIP_CONFIG[IMembershipId.sixmonths];
const defaultMembership = MEMBERSHIP_CONFIG[IMembershipId.twelvemonths];
const defaultAsset = (getAssetByUUID(defaultMembership.assetUUID as TUuid) || {}) as Asset;
const initialFormikValues: MembershipSimpleTxFormFull = {
membershipSelected: defaultMembership,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('MembershipSelector', () => {

// Ensure each plan is displayed in the list.
Object.values(MEMBERSHIP_CONFIG)
.filter(({ disabled }) => !disabled)
.map((p) => p.title)
.forEach((t) => expect(getByText(t)).toBeInTheDocument());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export interface MembershipSelectorProps {
}

export default function MembershipSelector({ name, value, onSelect }: MembershipSelectorProps) {
const options: IMembershipConfig[] = Object.values(MEMBERSHIP_CONFIG);
const options: IMembershipConfig[] = Object.values(MEMBERSHIP_CONFIG).filter(
({ disabled }) => !disabled
);

return (
<Selector<IMembershipConfig>
Expand Down
11 changes: 7 additions & 4 deletions src/features/PurchaseMembership/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IMembershipConfig {
assetUUID: string;
durationInDays: number;
discountNotice: string;
disabled?: boolean;
}

export type IMembershipConfigObject = {
Expand Down Expand Up @@ -77,9 +78,10 @@ export const MEMBERSHIP_CONFIG: IMembershipConfigObject = {
icon: threemonthsIcon,
price: '10.5',
discount: '10',
disabled: true,
assetUUID: DAIUUID,
durationInDays: 90,
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '10%' })
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '~12.5%' })
},

sixmonths: {
Expand All @@ -90,9 +92,10 @@ export const MEMBERSHIP_CONFIG: IMembershipConfigObject = {
icon: sixMonthsIcon,
price: '18',
discount: '20',
disabled: true,
assetUUID: DAIUUID,
durationInDays: 180,
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '20%' })
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '~25%' })
},

twelvemonths: {
Expand All @@ -105,7 +108,7 @@ export const MEMBERSHIP_CONFIG: IMembershipConfigObject = {
discount: '40',
assetUUID: DAIUUID,
durationInDays: 366,
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '40%' })
discountNotice: translateRaw('MEMBERSHIP_DISCOUNT', { $percentage: '~37.5%' })
},

lifetime: {
Expand All @@ -114,7 +117,7 @@ export const MEMBERSHIP_CONFIG: IMembershipConfigObject = {
contractAddress: '0x098D8b363933D742476DDd594c4A5a5F1a62326a',
description: '',
icon: lifetimeIcon,
price: '5',
price: '2',
assetUUID: ETHUUID,
durationInDays: 36500,
discountNotice: translateRaw('MEMBERSHIP_LIFETIME_DESC')
Expand Down

0 comments on commit a17fbdd

Please sign in to comment.