subscriptions.ts 15 KB

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