subscriptions.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. import {
  2. CustomSubscription,
  3. GroupSubscription,
  4. PaidSubscription,
  5. } from '../../../../../types/subscription/dashboard/subscription'
  6. import dateformat from 'dateformat'
  7. const today = new Date()
  8. const oneYearFromToday = new Date().setFullYear(today.getFullYear() + 1)
  9. const nextPaymentDueAt = dateformat(oneYearFromToday, 'dS mmmm yyyy')
  10. const nextPaymentDueDate = dateformat(oneYearFromToday, 'dS mmmm yyyy')
  11. const sevenDaysFromToday = new Date().setDate(today.getDate() + 7)
  12. const sevenDaysFromTodayFormatted = dateformat(
  13. sevenDaysFromToday,
  14. 'dS mmmm yyyy'
  15. )
  16. export const annualActiveSubscription: PaidSubscription = {
  17. manager_ids: ['abc123'],
  18. member_ids: [],
  19. invited_emails: [],
  20. groupPlan: false,
  21. membersLimit: 0,
  22. _id: 'def456',
  23. admin_id: 'abc123',
  24. teamInvites: [],
  25. planCode: 'collaborator-annual',
  26. plan: {
  27. planCode: 'collaborator-annual',
  28. name: 'Standard (Collaborator) Annual',
  29. price_in_cents: 21900,
  30. annual: true,
  31. featureDescription: [],
  32. },
  33. payment: {
  34. taxRate: 0,
  35. billingDetailsLink: '/user/subscription/payment/billing-details',
  36. accountManagementLink: '/user/subscription/payment/account-management',
  37. additionalLicenses: 0,
  38. totalLicenses: 0,
  39. nextPaymentDueAt,
  40. nextPaymentDueDate,
  41. currency: 'USD',
  42. state: 'active',
  43. trialEndsAtFormatted: null,
  44. trialEndsAt: null,
  45. activeCoupons: [],
  46. accountEmail: 'fake@example.com',
  47. hasPastDueInvoice: false,
  48. displayPrice: '$199.00',
  49. planOnlyDisplayPrice: '',
  50. addOns: [],
  51. addOnDisplayPricesWithoutAdditionalLicense: {},
  52. isEligibleForGroupPlan: true,
  53. isEligibleForPause: false,
  54. isEligibleForDowngradeUpsell: false,
  55. },
  56. }
  57. export const annualActiveSubscriptionEuro: PaidSubscription = {
  58. manager_ids: ['abc123'],
  59. member_ids: [],
  60. invited_emails: [],
  61. groupPlan: false,
  62. membersLimit: 0,
  63. _id: 'def456',
  64. admin_id: 'abc123',
  65. teamInvites: [],
  66. planCode: 'collaborator-annual',
  67. plan: {
  68. planCode: 'collaborator-annual',
  69. name: 'Standard (Collaborator) Annual',
  70. price_in_cents: 21900,
  71. annual: true,
  72. featureDescription: [],
  73. },
  74. payment: {
  75. taxRate: 0.24,
  76. billingDetailsLink: '/user/subscription/payment/billing-details',
  77. accountManagementLink: '/user/subscription/payment/account-management',
  78. additionalLicenses: 0,
  79. totalLicenses: 0,
  80. nextPaymentDueAt,
  81. nextPaymentDueDate,
  82. currency: 'EUR',
  83. state: 'active',
  84. trialEndsAtFormatted: null,
  85. trialEndsAt: null,
  86. activeCoupons: [],
  87. accountEmail: 'fake@example.com',
  88. hasPastDueInvoice: false,
  89. displayPrice: '€221.96',
  90. planOnlyDisplayPrice: '',
  91. addOns: [],
  92. addOnDisplayPricesWithoutAdditionalLicense: {},
  93. isEligibleForGroupPlan: true,
  94. isEligibleForPause: true,
  95. isEligibleForDowngradeUpsell: false,
  96. },
  97. }
  98. export const annualActiveSubscriptionPro: PaidSubscription = {
  99. manager_ids: ['abc123'],
  100. member_ids: [],
  101. invited_emails: [],
  102. groupPlan: false,
  103. membersLimit: 0,
  104. _id: 'def456',
  105. admin_id: 'abc123',
  106. teamInvites: [],
  107. planCode: 'professional',
  108. plan: {
  109. planCode: 'professional',
  110. name: 'Professional',
  111. price_in_cents: 4500,
  112. featureDescription: [],
  113. },
  114. payment: {
  115. taxRate: 0,
  116. billingDetailsLink: '/user/subscription/payment/billing-details',
  117. accountManagementLink: '/user/subscription/payment/account-management',
  118. additionalLicenses: 0,
  119. totalLicenses: 0,
  120. nextPaymentDueAt,
  121. nextPaymentDueDate,
  122. currency: 'USD',
  123. state: 'active',
  124. trialEndsAtFormatted: null,
  125. trialEndsAt: null,
  126. activeCoupons: [],
  127. accountEmail: 'fake@example.com',
  128. hasPastDueInvoice: false,
  129. displayPrice: '$42.00',
  130. planOnlyDisplayPrice: '',
  131. addOns: [],
  132. addOnDisplayPricesWithoutAdditionalLicense: {},
  133. isEligibleForGroupPlan: true,
  134. isEligibleForPause: true,
  135. isEligibleForDowngradeUpsell: false,
  136. },
  137. }
  138. export const pastDueExpiredSubscription: PaidSubscription = {
  139. manager_ids: ['abc123'],
  140. member_ids: [],
  141. invited_emails: [],
  142. groupPlan: false,
  143. membersLimit: 0,
  144. _id: 'def456',
  145. admin_id: 'abc123',
  146. teamInvites: [],
  147. planCode: 'collaborator-annual',
  148. plan: {
  149. planCode: 'collaborator-annual',
  150. name: 'Standard (Collaborator) Annual',
  151. price_in_cents: 21900,
  152. annual: true,
  153. featureDescription: [],
  154. },
  155. payment: {
  156. taxRate: 0,
  157. billingDetailsLink: '/user/subscription/payment/billing-details',
  158. accountManagementLink: '/user/subscription/payment/account-management',
  159. additionalLicenses: 0,
  160. totalLicenses: 0,
  161. nextPaymentDueAt,
  162. nextPaymentDueDate,
  163. currency: 'USD',
  164. state: 'expired',
  165. trialEndsAtFormatted: null,
  166. trialEndsAt: null,
  167. activeCoupons: [],
  168. accountEmail: 'fake@example.com',
  169. hasPastDueInvoice: true,
  170. displayPrice: '$199.00',
  171. planOnlyDisplayPrice: '',
  172. addOns: [],
  173. addOnDisplayPricesWithoutAdditionalLicense: {},
  174. isEligibleForGroupPlan: true,
  175. isEligibleForPause: true,
  176. isEligibleForDowngradeUpsell: false,
  177. },
  178. }
  179. export const canceledSubscription: PaidSubscription = {
  180. manager_ids: ['abc123'],
  181. member_ids: [],
  182. invited_emails: [],
  183. groupPlan: false,
  184. membersLimit: 0,
  185. _id: 'def456',
  186. admin_id: 'abc123',
  187. teamInvites: [],
  188. planCode: 'collaborator-annual',
  189. plan: {
  190. planCode: 'collaborator-annual',
  191. name: 'Standard (Collaborator) Annual',
  192. price_in_cents: 21900,
  193. annual: true,
  194. featureDescription: [],
  195. },
  196. payment: {
  197. taxRate: 0,
  198. billingDetailsLink: '/user/subscription/payment/billing-details',
  199. accountManagementLink: '/user/subscription/payment/account-management',
  200. additionalLicenses: 0,
  201. totalLicenses: 0,
  202. nextPaymentDueAt,
  203. nextPaymentDueDate,
  204. currency: 'USD',
  205. state: 'canceled',
  206. trialEndsAtFormatted: null,
  207. trialEndsAt: null,
  208. activeCoupons: [],
  209. accountEmail: 'fake@example.com',
  210. hasPastDueInvoice: false,
  211. displayPrice: '$199.00',
  212. planOnlyDisplayPrice: '',
  213. addOns: [],
  214. addOnDisplayPricesWithoutAdditionalLicense: {},
  215. isEligibleForGroupPlan: true,
  216. isEligibleForPause: true,
  217. isEligibleForDowngradeUpsell: false,
  218. },
  219. }
  220. export const pendingSubscriptionChange: PaidSubscription = {
  221. manager_ids: ['abc123'],
  222. member_ids: [],
  223. invited_emails: [],
  224. groupPlan: false,
  225. membersLimit: 0,
  226. _id: 'def456',
  227. admin_id: 'abc123',
  228. teamInvites: [],
  229. planCode: 'collaborator-annual',
  230. plan: {
  231. planCode: 'collaborator-annual',
  232. name: 'Standard (Collaborator) Annual',
  233. price_in_cents: 21900,
  234. annual: true,
  235. featureDescription: [],
  236. },
  237. payment: {
  238. taxRate: 0,
  239. billingDetailsLink: '/user/subscription/payment/billing-details',
  240. accountManagementLink: '/user/subscription/payment/account-management',
  241. additionalLicenses: 0,
  242. totalLicenses: 0,
  243. nextPaymentDueAt,
  244. nextPaymentDueDate,
  245. currency: 'USD',
  246. state: 'active',
  247. trialEndsAtFormatted: null,
  248. trialEndsAt: null,
  249. activeCoupons: [],
  250. accountEmail: 'fake@example.com',
  251. hasPastDueInvoice: false,
  252. displayPrice: '$199.00',
  253. planOnlyDisplayPrice: '',
  254. addOns: [],
  255. addOnDisplayPricesWithoutAdditionalLicense: {},
  256. isEligibleForGroupPlan: true,
  257. isEligibleForPause: false,
  258. isEligibleForDowngradeUpsell: false,
  259. },
  260. pendingPlan: {
  261. planCode: 'professional-annual',
  262. name: 'Professional Annual',
  263. price_in_cents: 42900,
  264. annual: true,
  265. featureDescription: [],
  266. },
  267. }
  268. export const groupActiveSubscription: GroupSubscription = {
  269. manager_ids: ['abc123'],
  270. member_ids: ['abc123'],
  271. invited_emails: [],
  272. groupPlan: true,
  273. teamName: 'GAS',
  274. membersLimit: 10,
  275. _id: 'bcd567',
  276. admin_id: 'abc123',
  277. teamInvites: [],
  278. planCode: 'group_collaborator_10_enterprise',
  279. plan: {
  280. planCode: 'group_collaborator_10_enterprise',
  281. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  282. hideFromUsers: true,
  283. price_in_cents: 129000,
  284. annual: true,
  285. groupPlan: true,
  286. membersLimit: 10,
  287. membersLimitAddOn: 'additional-license',
  288. },
  289. payment: {
  290. taxRate: 0,
  291. billingDetailsLink: '/user/subscription/payment/billing-details',
  292. accountManagementLink: '/user/subscription/payment/account-management',
  293. additionalLicenses: 0,
  294. totalLicenses: 10,
  295. nextPaymentDueAt,
  296. nextPaymentDueDate,
  297. currency: 'USD',
  298. state: 'active',
  299. trialEndsAtFormatted: null,
  300. trialEndsAt: null,
  301. activeCoupons: [],
  302. accountEmail: 'fake@example.com',
  303. hasPastDueInvoice: false,
  304. displayPrice: '$1290.00',
  305. planOnlyDisplayPrice: '',
  306. addOns: [],
  307. addOnDisplayPricesWithoutAdditionalLicense: {},
  308. isEligibleForGroupPlan: true,
  309. isEligibleForPause: false,
  310. isEligibleForDowngradeUpsell: false,
  311. },
  312. }
  313. export const groupActiveSubscriptionWithPendingLicenseChange: GroupSubscription =
  314. {
  315. manager_ids: ['abc123'],
  316. member_ids: ['abc123'],
  317. invited_emails: [],
  318. groupPlan: true,
  319. teamName: 'GASWPLC',
  320. membersLimit: 10,
  321. _id: 'def456',
  322. admin_id: 'abc123',
  323. teamInvites: [],
  324. planCode: 'group_collaborator_10_enterprise',
  325. plan: {
  326. planCode: 'group_collaborator_10_enterprise',
  327. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  328. hideFromUsers: true,
  329. price_in_cents: 129000,
  330. annual: true,
  331. groupPlan: true,
  332. membersLimit: 10,
  333. membersLimitAddOn: 'additional-license',
  334. },
  335. payment: {
  336. taxRate: 0,
  337. billingDetailsLink: '/user/subscription/payment/billing-details',
  338. accountManagementLink: '/user/subscription/payment/account-management',
  339. additionalLicenses: 11,
  340. totalLicenses: 21,
  341. nextPaymentDueAt,
  342. nextPaymentDueDate,
  343. currency: 'USD',
  344. state: 'active',
  345. trialEndsAtFormatted: null,
  346. trialEndsAt: null,
  347. activeCoupons: [],
  348. accountEmail: 'fake@example.com',
  349. hasPastDueInvoice: false,
  350. displayPrice: '$2967.00',
  351. pendingAdditionalLicenses: 13,
  352. pendingTotalLicenses: 23,
  353. planOnlyDisplayPrice: '',
  354. addOns: [],
  355. addOnDisplayPricesWithoutAdditionalLicense: {},
  356. isEligibleForGroupPlan: true,
  357. isEligibleForPause: false,
  358. isEligibleForDowngradeUpsell: false,
  359. },
  360. pendingPlan: {
  361. planCode: 'group_collaborator_10_enterprise',
  362. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  363. hideFromUsers: true,
  364. price_in_cents: 129000,
  365. annual: true,
  366. groupPlan: true,
  367. membersLimit: 10,
  368. membersLimitAddOn: 'additional-license',
  369. },
  370. }
  371. export const trialSubscription: PaidSubscription = {
  372. manager_ids: ['abc123'],
  373. member_ids: [],
  374. invited_emails: [],
  375. groupPlan: false,
  376. membersLimit: 0,
  377. _id: 'def456',
  378. admin_id: 'abc123',
  379. teamInvites: [],
  380. planCode: 'paid-personal_free_trial_7_days',
  381. plan: {
  382. planCode: 'paid-personal_free_trial_7_days',
  383. name: 'Personal',
  384. price_in_cents: 1500,
  385. featureDescription: [],
  386. hideFromUsers: true,
  387. },
  388. payment: {
  389. taxRate: 0,
  390. billingDetailsLink: '/user/subscription/payment/billing-details',
  391. accountManagementLink: '/user/subscription/payment/account-management',
  392. additionalLicenses: 0,
  393. totalLicenses: 0,
  394. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  395. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  396. currency: 'USD',
  397. state: 'active',
  398. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  399. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  400. activeCoupons: [],
  401. accountEmail: 'fake@example.com',
  402. hasPastDueInvoice: false,
  403. displayPrice: '$14.00',
  404. planOnlyDisplayPrice: '',
  405. addOns: [],
  406. addOnDisplayPricesWithoutAdditionalLicense: {},
  407. isEligibleForGroupPlan: true,
  408. isEligibleForPause: false,
  409. isEligibleForDowngradeUpsell: false,
  410. },
  411. }
  412. export const customSubscription: CustomSubscription = {
  413. manager_ids: ['abc123'],
  414. member_ids: [],
  415. invited_emails: [],
  416. groupPlan: false,
  417. membersLimit: 0,
  418. _id: 'def456',
  419. admin_id: 'abc123',
  420. teamInvites: [],
  421. planCode: 'collaborator-annual',
  422. plan: {
  423. planCode: 'collaborator-annual',
  424. name: 'Standard (Collaborator) Annual',
  425. price_in_cents: 21900,
  426. annual: true,
  427. featureDescription: [],
  428. },
  429. customAccount: true,
  430. }
  431. export const trialCollaboratorSubscription: PaidSubscription = {
  432. manager_ids: ['abc123'],
  433. member_ids: [],
  434. invited_emails: [],
  435. groupPlan: false,
  436. membersLimit: 0,
  437. _id: 'def456',
  438. admin_id: 'abc123',
  439. teamInvites: [],
  440. planCode: 'collaborator_free_trial_7_days',
  441. plan: {
  442. planCode: 'collaborator_free_trial_7_days',
  443. name: 'Standard (Collaborator)',
  444. price_in_cents: 2300,
  445. featureDescription: [],
  446. hideFromUsers: true,
  447. },
  448. payment: {
  449. taxRate: 0,
  450. billingDetailsLink: '/user/subscription/payment/billing-details',
  451. accountManagementLink: '/user/subscription/payment/account-management',
  452. additionalLicenses: 0,
  453. totalLicenses: 0,
  454. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  455. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  456. currency: 'USD',
  457. state: 'active',
  458. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  459. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  460. activeCoupons: [],
  461. accountEmail: 'foo@example.com',
  462. hasPastDueInvoice: false,
  463. displayPrice: '$21.00',
  464. planOnlyDisplayPrice: '',
  465. addOns: [],
  466. addOnDisplayPricesWithoutAdditionalLicense: {},
  467. isEligibleForGroupPlan: true,
  468. isEligibleForPause: true,
  469. isEligibleForDowngradeUpsell: false,
  470. },
  471. }
  472. export const monthlyActiveCollaborator: PaidSubscription = {
  473. manager_ids: ['abc123'],
  474. member_ids: [],
  475. invited_emails: [],
  476. groupPlan: false,
  477. membersLimit: 0,
  478. _id: 'def456',
  479. admin_id: 'abc123',
  480. teamInvites: [],
  481. planCode: 'collaborator',
  482. plan: {
  483. planCode: 'collaborator',
  484. name: 'Standard (Collaborator)',
  485. price_in_cents: 212300900,
  486. featureDescription: [],
  487. },
  488. payment: {
  489. taxRate: 0,
  490. billingDetailsLink: '/user/subscription/payment/billing-details',
  491. accountManagementLink: '/user/subscription/payment/account-management',
  492. additionalLicenses: 0,
  493. totalLicenses: 0,
  494. nextPaymentDueAt,
  495. nextPaymentDueDate,
  496. currency: 'USD',
  497. state: 'active',
  498. trialEndsAtFormatted: null,
  499. trialEndsAt: null,
  500. activeCoupons: [],
  501. accountEmail: 'foo@example.com',
  502. hasPastDueInvoice: false,
  503. displayPrice: '$21.00',
  504. planOnlyDisplayPrice: '',
  505. addOns: [],
  506. addOnDisplayPricesWithoutAdditionalLicense: {},
  507. isEligibleForGroupPlan: true,
  508. isEligibleForPause: true,
  509. isEligibleForDowngradeUpsell: true,
  510. },
  511. }