subscriptions.tsx 11 KB

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