subscriptions.tsx 14 KB

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