subscriptions.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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. recurlySubscription_id: 'ghi789',
  27. plan: {
  28. planCode: 'collaborator-annual',
  29. name: 'Standard (Collaborator) Annual',
  30. price_in_cents: 21900,
  31. annual: true,
  32. featureDescription: [],
  33. },
  34. payment: {
  35. taxRate: 0,
  36. billingDetailsLink: '/user/subscription/payment/billing-details',
  37. accountManagementLink: '/user/subscription/payment/account-management',
  38. additionalLicenses: 0,
  39. totalLicenses: 0,
  40. nextPaymentDueAt,
  41. nextPaymentDueDate,
  42. currency: 'USD',
  43. state: 'active',
  44. trialEndsAtFormatted: null,
  45. trialEndsAt: null,
  46. activeCoupons: [],
  47. accountEmail: 'fake@example.com',
  48. hasPastDueInvoice: false,
  49. displayPrice: '$199.00',
  50. planOnlyDisplayPrice: '',
  51. addOns: [],
  52. addOnDisplayPricesWithoutAdditionalLicense: {},
  53. isEligibleForGroupPlan: true,
  54. isEligibleForPause: 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. recurlySubscription_id: 'ghi789',
  68. plan: {
  69. planCode: 'collaborator-annual',
  70. name: 'Standard (Collaborator) Annual',
  71. price_in_cents: 21900,
  72. annual: true,
  73. featureDescription: [],
  74. },
  75. payment: {
  76. taxRate: 0.24,
  77. billingDetailsLink: '/user/subscription/payment/billing-details',
  78. accountManagementLink: '/user/subscription/payment/account-management',
  79. additionalLicenses: 0,
  80. totalLicenses: 0,
  81. nextPaymentDueAt,
  82. nextPaymentDueDate,
  83. currency: 'EUR',
  84. state: 'active',
  85. trialEndsAtFormatted: null,
  86. trialEndsAt: null,
  87. activeCoupons: [],
  88. accountEmail: 'fake@example.com',
  89. hasPastDueInvoice: false,
  90. displayPrice: '€221.96',
  91. planOnlyDisplayPrice: '',
  92. addOns: [],
  93. addOnDisplayPricesWithoutAdditionalLicense: {},
  94. isEligibleForGroupPlan: true,
  95. isEligibleForPause: true,
  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. recurlySubscription_id: 'ghi789',
  109. plan: {
  110. planCode: 'professional',
  111. name: 'Professional',
  112. price_in_cents: 4500,
  113. featureDescription: [],
  114. },
  115. payment: {
  116. taxRate: 0,
  117. billingDetailsLink: '/user/subscription/payment/billing-details',
  118. accountManagementLink: '/user/subscription/payment/account-management',
  119. additionalLicenses: 0,
  120. totalLicenses: 0,
  121. nextPaymentDueAt,
  122. nextPaymentDueDate,
  123. currency: 'USD',
  124. state: 'active',
  125. trialEndsAtFormatted: null,
  126. trialEndsAt: null,
  127. activeCoupons: [],
  128. accountEmail: 'fake@example.com',
  129. hasPastDueInvoice: false,
  130. displayPrice: '$42.00',
  131. planOnlyDisplayPrice: '',
  132. addOns: [],
  133. addOnDisplayPricesWithoutAdditionalLicense: {},
  134. isEligibleForGroupPlan: true,
  135. isEligibleForPause: true,
  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. recurlySubscription_id: 'ghi789',
  149. plan: {
  150. planCode: 'collaborator-annual',
  151. name: 'Standard (Collaborator) Annual',
  152. price_in_cents: 21900,
  153. annual: true,
  154. featureDescription: [],
  155. },
  156. payment: {
  157. taxRate: 0,
  158. billingDetailsLink: '/user/subscription/payment/billing-details',
  159. accountManagementLink: '/user/subscription/payment/account-management',
  160. additionalLicenses: 0,
  161. totalLicenses: 0,
  162. nextPaymentDueAt,
  163. nextPaymentDueDate,
  164. currency: 'USD',
  165. state: 'expired',
  166. trialEndsAtFormatted: null,
  167. trialEndsAt: null,
  168. activeCoupons: [],
  169. accountEmail: 'fake@example.com',
  170. hasPastDueInvoice: true,
  171. displayPrice: '$199.00',
  172. planOnlyDisplayPrice: '',
  173. addOns: [],
  174. addOnDisplayPricesWithoutAdditionalLicense: {},
  175. isEligibleForGroupPlan: true,
  176. isEligibleForPause: true,
  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. recurlySubscription_id: 'ghi789',
  190. plan: {
  191. planCode: 'collaborator-annual',
  192. name: 'Standard (Collaborator) Annual',
  193. price_in_cents: 21900,
  194. annual: true,
  195. featureDescription: [],
  196. },
  197. payment: {
  198. taxRate: 0,
  199. billingDetailsLink: '/user/subscription/payment/billing-details',
  200. accountManagementLink: '/user/subscription/payment/account-management',
  201. additionalLicenses: 0,
  202. totalLicenses: 0,
  203. nextPaymentDueAt,
  204. nextPaymentDueDate,
  205. currency: 'USD',
  206. state: 'canceled',
  207. trialEndsAtFormatted: null,
  208. trialEndsAt: null,
  209. activeCoupons: [],
  210. accountEmail: 'fake@example.com',
  211. hasPastDueInvoice: false,
  212. displayPrice: '$199.00',
  213. planOnlyDisplayPrice: '',
  214. addOns: [],
  215. addOnDisplayPricesWithoutAdditionalLicense: {},
  216. isEligibleForGroupPlan: true,
  217. isEligibleForPause: true,
  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. recurlySubscription_id: 'ghi789',
  231. plan: {
  232. planCode: 'collaborator-annual',
  233. name: 'Standard (Collaborator) Annual',
  234. price_in_cents: 21900,
  235. annual: true,
  236. featureDescription: [],
  237. },
  238. payment: {
  239. taxRate: 0,
  240. billingDetailsLink: '/user/subscription/payment/billing-details',
  241. accountManagementLink: '/user/subscription/payment/account-management',
  242. additionalLicenses: 0,
  243. totalLicenses: 0,
  244. nextPaymentDueAt,
  245. nextPaymentDueDate,
  246. currency: 'USD',
  247. state: 'active',
  248. trialEndsAtFormatted: null,
  249. trialEndsAt: null,
  250. activeCoupons: [],
  251. accountEmail: 'fake@example.com',
  252. hasPastDueInvoice: false,
  253. displayPrice: '$199.00',
  254. planOnlyDisplayPrice: '',
  255. addOns: [],
  256. addOnDisplayPricesWithoutAdditionalLicense: {},
  257. isEligibleForGroupPlan: true,
  258. isEligibleForPause: 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. recurlySubscription_id: 'ghi789',
  280. plan: {
  281. planCode: 'group_collaborator_10_enterprise',
  282. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  283. hideFromUsers: true,
  284. price_in_cents: 129000,
  285. annual: true,
  286. groupPlan: true,
  287. membersLimit: 10,
  288. membersLimitAddOn: 'additional-license',
  289. },
  290. payment: {
  291. taxRate: 0,
  292. billingDetailsLink: '/user/subscription/payment/billing-details',
  293. accountManagementLink: '/user/subscription/payment/account-management',
  294. additionalLicenses: 0,
  295. totalLicenses: 10,
  296. nextPaymentDueAt,
  297. nextPaymentDueDate,
  298. currency: 'USD',
  299. state: 'active',
  300. trialEndsAtFormatted: null,
  301. trialEndsAt: null,
  302. activeCoupons: [],
  303. accountEmail: 'fake@example.com',
  304. hasPastDueInvoice: false,
  305. displayPrice: '$1290.00',
  306. planOnlyDisplayPrice: '',
  307. addOns: [],
  308. addOnDisplayPricesWithoutAdditionalLicense: {},
  309. isEligibleForGroupPlan: true,
  310. isEligibleForPause: 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. recurlySubscription_id: 'ghi789',
  326. plan: {
  327. planCode: 'group_collaborator_10_enterprise',
  328. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  329. hideFromUsers: true,
  330. price_in_cents: 129000,
  331. annual: true,
  332. groupPlan: true,
  333. membersLimit: 10,
  334. membersLimitAddOn: 'additional-license',
  335. },
  336. payment: {
  337. taxRate: 0,
  338. billingDetailsLink: '/user/subscription/payment/billing-details',
  339. accountManagementLink: '/user/subscription/payment/account-management',
  340. additionalLicenses: 11,
  341. totalLicenses: 21,
  342. nextPaymentDueAt,
  343. nextPaymentDueDate,
  344. currency: 'USD',
  345. state: 'active',
  346. trialEndsAtFormatted: null,
  347. trialEndsAt: null,
  348. activeCoupons: [],
  349. accountEmail: 'fake@example.com',
  350. hasPastDueInvoice: false,
  351. displayPrice: '$2967.00',
  352. pendingAdditionalLicenses: 13,
  353. pendingTotalLicenses: 23,
  354. planOnlyDisplayPrice: '',
  355. addOns: [],
  356. addOnDisplayPricesWithoutAdditionalLicense: {},
  357. isEligibleForGroupPlan: true,
  358. isEligibleForPause: 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. recurlySubscription_id: 'ghi789',
  382. plan: {
  383. planCode: 'paid-personal_free_trial_7_days',
  384. name: 'Personal',
  385. price_in_cents: 1500,
  386. featureDescription: [],
  387. hideFromUsers: true,
  388. },
  389. payment: {
  390. taxRate: 0,
  391. billingDetailsLink: '/user/subscription/payment/billing-details',
  392. accountManagementLink: '/user/subscription/payment/account-management',
  393. additionalLicenses: 0,
  394. totalLicenses: 0,
  395. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  396. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  397. currency: 'USD',
  398. state: 'active',
  399. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  400. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  401. activeCoupons: [],
  402. accountEmail: 'fake@example.com',
  403. hasPastDueInvoice: false,
  404. displayPrice: '$14.00',
  405. planOnlyDisplayPrice: '',
  406. addOns: [],
  407. addOnDisplayPricesWithoutAdditionalLicense: {},
  408. isEligibleForGroupPlan: true,
  409. isEligibleForPause: 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. recurlySubscription_id: 'ghi789',
  423. plan: {
  424. planCode: 'collaborator-annual',
  425. name: 'Standard (Collaborator) Annual',
  426. price_in_cents: 21900,
  427. annual: true,
  428. featureDescription: [],
  429. },
  430. customAccount: true,
  431. }
  432. export const trialCollaboratorSubscription: PaidSubscription = {
  433. manager_ids: ['abc123'],
  434. member_ids: [],
  435. invited_emails: [],
  436. groupPlan: false,
  437. membersLimit: 0,
  438. _id: 'def456',
  439. admin_id: 'abc123',
  440. teamInvites: [],
  441. planCode: 'collaborator_free_trial_7_days',
  442. recurlySubscription_id: 'ghi789',
  443. plan: {
  444. planCode: 'collaborator_free_trial_7_days',
  445. name: 'Standard (Collaborator)',
  446. price_in_cents: 2300,
  447. featureDescription: [],
  448. hideFromUsers: true,
  449. },
  450. payment: {
  451. taxRate: 0,
  452. billingDetailsLink: '/user/subscription/payment/billing-details',
  453. accountManagementLink: '/user/subscription/payment/account-management',
  454. additionalLicenses: 0,
  455. totalLicenses: 0,
  456. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  457. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  458. currency: 'USD',
  459. state: 'active',
  460. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  461. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  462. activeCoupons: [],
  463. accountEmail: 'foo@example.com',
  464. hasPastDueInvoice: false,
  465. displayPrice: '$21.00',
  466. planOnlyDisplayPrice: '',
  467. addOns: [],
  468. addOnDisplayPricesWithoutAdditionalLicense: {},
  469. isEligibleForGroupPlan: true,
  470. isEligibleForPause: true,
  471. },
  472. }
  473. export const monthlyActiveCollaborator: PaidSubscription = {
  474. manager_ids: ['abc123'],
  475. member_ids: [],
  476. invited_emails: [],
  477. groupPlan: false,
  478. membersLimit: 0,
  479. _id: 'def456',
  480. admin_id: 'abc123',
  481. teamInvites: [],
  482. planCode: 'collaborator',
  483. recurlySubscription_id: 'ghi789',
  484. plan: {
  485. planCode: 'collaborator',
  486. name: 'Standard (Collaborator)',
  487. price_in_cents: 212300900,
  488. featureDescription: [],
  489. },
  490. payment: {
  491. taxRate: 0,
  492. billingDetailsLink: '/user/subscription/payment/billing-details',
  493. accountManagementLink: '/user/subscription/payment/account-management',
  494. additionalLicenses: 0,
  495. totalLicenses: 0,
  496. nextPaymentDueAt,
  497. nextPaymentDueDate,
  498. currency: 'USD',
  499. state: 'active',
  500. trialEndsAtFormatted: null,
  501. trialEndsAt: null,
  502. activeCoupons: [],
  503. accountEmail: 'foo@example.com',
  504. hasPastDueInvoice: false,
  505. displayPrice: '$21.00',
  506. planOnlyDisplayPrice: '',
  507. addOns: [],
  508. addOnDisplayPricesWithoutAdditionalLicense: {},
  509. isEligibleForGroupPlan: true,
  510. isEligibleForPause: true,
  511. },
  512. }