Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / helpers / blackfriday.ts
blobccec1cdd61f6fa02b92c3555ac6cf76aa393b937
1 import { isWithinInterval } from 'date-fns';
3 import { BLACK_FRIDAY, CYCLE, PLANS } from '../constants';
4 import { getHas2023OfferCoupon } from '../helpers/subscription';
5 import type { PlanIDs } from '../interfaces';
7 export const isBlackFridayPeriod = () => {
8     return isWithinInterval(new Date(), { start: BLACK_FRIDAY.START, end: BLACK_FRIDAY.END });
9 };
11 export const isCyberMonday = () => {
12     return isWithinInterval(new Date(), { start: BLACK_FRIDAY.CYBER_START, end: BLACK_FRIDAY.CYBER_END });
15 export const canUpsellToVPNPassBundle = (planIDs: PlanIDs, cycle: CYCLE, couponCode?: string) => {
16     if (planIDs[PLANS.VPN] && [CYCLE.FIFTEEN, CYCLE.THIRTY].includes(cycle) && getHas2023OfferCoupon(couponCode)) {
17         return true;
18     }
19     return false;