subscriptions.ts 14 KB

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