subscriptions.ts 14 KB

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