subscriptions.ts 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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. trialEndsAt: null,
  47. activeCoupons: [],
  48. accountEmail: 'fake@example.com',
  49. hasPastDueInvoice: false,
  50. displayPrice: '$199.00',
  51. planOnlyDisplayPrice: '',
  52. addOns: [],
  53. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  87. activeCoupons: [],
  88. accountEmail: 'fake@example.com',
  89. hasPastDueInvoice: false,
  90. displayPrice: '€221.96',
  91. planOnlyDisplayPrice: '',
  92. addOns: [],
  93. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  126. activeCoupons: [],
  127. accountEmail: 'fake@example.com',
  128. hasPastDueInvoice: false,
  129. displayPrice: '$42.00',
  130. planOnlyDisplayPrice: '',
  131. addOns: [],
  132. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  166. activeCoupons: [],
  167. accountEmail: 'fake@example.com',
  168. hasPastDueInvoice: true,
  169. displayPrice: '$199.00',
  170. planOnlyDisplayPrice: '',
  171. addOns: [],
  172. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  206. activeCoupons: [],
  207. accountEmail: 'fake@example.com',
  208. hasPastDueInvoice: false,
  209. displayPrice: '$199.00',
  210. planOnlyDisplayPrice: '',
  211. addOns: [],
  212. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  246. activeCoupons: [],
  247. accountEmail: 'fake@example.com',
  248. hasPastDueInvoice: false,
  249. displayPrice: '$199.00',
  250. planOnlyDisplayPrice: '',
  251. addOns: [],
  252. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  297. activeCoupons: [],
  298. accountEmail: 'fake@example.com',
  299. hasPastDueInvoice: false,
  300. displayPrice: '$1290.00',
  301. planOnlyDisplayPrice: '',
  302. addOns: [],
  303. addOnDisplayPricesWithoutAdditionalLicense: {},
  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. trialEndsAt: null,
  342. activeCoupons: [],
  343. accountEmail: 'fake@example.com',
  344. hasPastDueInvoice: false,
  345. displayPrice: '$2967.00',
  346. currentPlanDisplayPrice: '$2709.00',
  347. pendingAdditionalLicenses: 13,
  348. pendingTotalLicenses: 23,
  349. planOnlyDisplayPrice: '',
  350. addOns: [],
  351. addOnDisplayPricesWithoutAdditionalLicense: {},
  352. },
  353. pendingPlan: {
  354. planCode: 'group_collaborator_10_enterprise',
  355. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  356. hideFromUsers: true,
  357. price_in_cents: 129000,
  358. annual: true,
  359. groupPlan: true,
  360. membersLimit: 10,
  361. membersLimitAddOn: 'additional-license',
  362. },
  363. }
  364. export const trialSubscription: RecurlySubscription = {
  365. manager_ids: ['abc123'],
  366. member_ids: [],
  367. invited_emails: [],
  368. groupPlan: false,
  369. membersLimit: 0,
  370. _id: 'def456',
  371. admin_id: 'abc123',
  372. teamInvites: [],
  373. planCode: 'paid-personal_free_trial_7_days',
  374. recurlySubscription_id: 'ghi789',
  375. plan: {
  376. planCode: 'paid-personal_free_trial_7_days',
  377. name: 'Personal',
  378. price_in_cents: 1500,
  379. featureDescription: [],
  380. hideFromUsers: true,
  381. },
  382. recurly: {
  383. tax: 0,
  384. taxRate: 0,
  385. billingDetailsLink: '/user/subscription/recurly/billing-details',
  386. accountManagementLink: '/user/subscription/recurly/account-management',
  387. additionalLicenses: 0,
  388. totalLicenses: 0,
  389. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  390. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  391. currency: 'USD',
  392. state: 'active',
  393. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  394. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  395. activeCoupons: [],
  396. accountEmail: 'fake@example.com',
  397. hasPastDueInvoice: false,
  398. displayPrice: '$14.00',
  399. planOnlyDisplayPrice: '',
  400. addOns: [],
  401. addOnDisplayPricesWithoutAdditionalLicense: {},
  402. },
  403. }
  404. export const customSubscription: CustomSubscription = {
  405. manager_ids: ['abc123'],
  406. member_ids: [],
  407. invited_emails: [],
  408. groupPlan: false,
  409. membersLimit: 0,
  410. _id: 'def456',
  411. admin_id: 'abc123',
  412. teamInvites: [],
  413. planCode: 'collaborator-annual',
  414. recurlySubscription_id: 'ghi789',
  415. plan: {
  416. planCode: 'collaborator-annual',
  417. name: 'Standard (Collaborator) Annual',
  418. price_in_cents: 21900,
  419. annual: true,
  420. featureDescription: [],
  421. },
  422. customAccount: true,
  423. }
  424. export const trialCollaboratorSubscription: RecurlySubscription = {
  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_free_trial_7_days',
  434. recurlySubscription_id: 'ghi789',
  435. plan: {
  436. planCode: 'collaborator_free_trial_7_days',
  437. name: 'Standard (Collaborator)',
  438. price_in_cents: 2300,
  439. featureDescription: [],
  440. hideFromUsers: true,
  441. },
  442. recurly: {
  443. tax: 0,
  444. taxRate: 0,
  445. billingDetailsLink: '/user/subscription/recurly/billing-details',
  446. accountManagementLink: '/user/subscription/recurly/account-management',
  447. additionalLicenses: 0,
  448. totalLicenses: 0,
  449. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  450. nextPaymentDueDate: sevenDaysFromTodayFormatted,
  451. currency: 'USD',
  452. state: 'active',
  453. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  454. trialEndsAt: new Date(sevenDaysFromToday).toString(),
  455. activeCoupons: [],
  456. accountEmail: 'foo@example.com',
  457. hasPastDueInvoice: false,
  458. displayPrice: '$21.00',
  459. planOnlyDisplayPrice: '',
  460. addOns: [],
  461. addOnDisplayPricesWithoutAdditionalLicense: {},
  462. },
  463. }
  464. export const monthlyActiveCollaborator: RecurlySubscription = {
  465. manager_ids: ['abc123'],
  466. member_ids: [],
  467. invited_emails: [],
  468. groupPlan: false,
  469. membersLimit: 0,
  470. _id: 'def456',
  471. admin_id: 'abc123',
  472. teamInvites: [],
  473. planCode: 'collaborator',
  474. recurlySubscription_id: 'ghi789',
  475. plan: {
  476. planCode: 'collaborator',
  477. name: 'Standard (Collaborator)',
  478. price_in_cents: 212300900,
  479. featureDescription: [],
  480. },
  481. recurly: {
  482. tax: 0,
  483. taxRate: 0,
  484. billingDetailsLink: '/user/subscription/recurly/billing-details',
  485. accountManagementLink: '/user/subscription/recurly/account-management',
  486. additionalLicenses: 0,
  487. totalLicenses: 0,
  488. nextPaymentDueAt,
  489. nextPaymentDueDate,
  490. currency: 'USD',
  491. state: 'active',
  492. trialEndsAtFormatted: null,
  493. trialEndsAt: null,
  494. activeCoupons: [],
  495. accountEmail: 'foo@example.com',
  496. hasPastDueInvoice: false,
  497. displayPrice: '$21.00',
  498. planOnlyDisplayPrice: '',
  499. addOns: [],
  500. addOnDisplayPricesWithoutAdditionalLicense: {},
  501. },
  502. }