subscriptions.tsx 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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. features: {},
  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 pastDueExpiredSubscription: Subscription = {
  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. features: {},
  70. featureDescription: [],
  71. },
  72. recurly: {
  73. tax: 0,
  74. taxRate: 0,
  75. billingDetailsLink: '/user/subscription/recurly/billing-details',
  76. accountManagementLink: '/user/subscription/recurly/account-management',
  77. additionalLicenses: 0,
  78. totalLicenses: 0,
  79. nextPaymentDueAt,
  80. currency: 'USD',
  81. state: 'expired',
  82. trialEndsAtFormatted: null,
  83. trial_ends_at: null,
  84. activeCoupons: [],
  85. account: {
  86. has_canceled_subscription: { _: 'false', $: { type: 'boolean' } },
  87. has_past_due_invoice: { _: 'true', $: { type: 'boolean' } },
  88. },
  89. displayPrice: '$199.00',
  90. },
  91. }
  92. export const canceledSubscription: Subscription = {
  93. manager_ids: ['abc123'],
  94. member_ids: [],
  95. invited_emails: [],
  96. groupPlan: false,
  97. membersLimit: 0,
  98. _id: 'def456',
  99. admin_id: 'abc123',
  100. teamInvites: [],
  101. planCode: 'collaborator-annual',
  102. recurlySubscription_id: 'ghi789',
  103. plan: {
  104. planCode: 'collaborator-annual',
  105. name: 'Standard (Collaborator) Annual',
  106. price_in_cents: 21900,
  107. annual: true,
  108. features: {},
  109. featureDescription: [],
  110. },
  111. recurly: {
  112. tax: 0,
  113. taxRate: 0,
  114. billingDetailsLink: '/user/subscription/recurly/billing-details',
  115. accountManagementLink: '/user/subscription/recurly/account-management',
  116. additionalLicenses: 0,
  117. totalLicenses: 0,
  118. nextPaymentDueAt,
  119. currency: 'USD',
  120. state: 'canceled',
  121. trialEndsAtFormatted: null,
  122. trial_ends_at: null,
  123. activeCoupons: [],
  124. account: {
  125. has_canceled_subscription: { _: 'true', $: { type: 'boolean' } },
  126. has_past_due_invoice: { _: 'false', $: { type: 'boolean' } },
  127. },
  128. displayPrice: '$199.00',
  129. },
  130. }
  131. export const pendingSubscriptionChange: Subscription = {
  132. manager_ids: ['abc123'],
  133. member_ids: [],
  134. invited_emails: [],
  135. groupPlan: false,
  136. membersLimit: 0,
  137. _id: 'def456',
  138. admin_id: 'abc123',
  139. teamInvites: [],
  140. planCode: 'collaborator-annual',
  141. recurlySubscription_id: 'ghi789',
  142. plan: {
  143. planCode: 'collaborator-annual',
  144. name: 'Standard (Collaborator) Annual',
  145. price_in_cents: 21900,
  146. annual: true,
  147. features: {},
  148. featureDescription: [],
  149. },
  150. recurly: {
  151. tax: 0,
  152. taxRate: 0,
  153. billingDetailsLink: '/user/subscription/recurly/billing-details',
  154. accountManagementLink: '/user/subscription/recurly/account-management',
  155. additionalLicenses: 0,
  156. totalLicenses: 0,
  157. nextPaymentDueAt,
  158. currency: 'USD',
  159. state: 'active',
  160. trialEndsAtFormatted: null,
  161. trial_ends_at: null,
  162. activeCoupons: [],
  163. account: {
  164. has_canceled_subscription: { _: 'false', $: { type: 'boolean' } },
  165. has_past_due_invoice: { _: 'false', $: { type: 'boolean' } },
  166. },
  167. displayPrice: '$199.00',
  168. },
  169. pendingPlan: {
  170. planCode: 'professional-annual',
  171. name: 'Professional Annual',
  172. price_in_cents: 42900,
  173. annual: true,
  174. features: {},
  175. featureDescription: [],
  176. },
  177. }
  178. export const groupActiveSubscription: GroupSubscription = {
  179. manager_ids: ['abc123'],
  180. member_ids: ['abc123'],
  181. invited_emails: [],
  182. groupPlan: true,
  183. teamName: 'GAS',
  184. membersLimit: 10,
  185. _id: 'bcd567',
  186. admin_id: 'abc123',
  187. teamInvites: [],
  188. planCode: 'group_collaborator_10_enterprise',
  189. recurlySubscription_id: 'ghi789',
  190. plan: {
  191. planCode: 'group_collaborator_10_enterprise',
  192. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  193. hideFromUsers: true,
  194. price_in_cents: 129000,
  195. annual: true,
  196. features: {},
  197. groupPlan: true,
  198. membersLimit: 10,
  199. membersLimitAddOn: 'additional-license',
  200. },
  201. recurly: {
  202. tax: 0,
  203. taxRate: 0,
  204. billingDetailsLink: '/user/subscription/recurly/billing-details',
  205. accountManagementLink: '/user/subscription/recurly/account-management',
  206. additionalLicenses: 0,
  207. totalLicenses: 10,
  208. nextPaymentDueAt,
  209. currency: 'USD',
  210. state: 'active',
  211. trialEndsAtFormatted: null,
  212. trial_ends_at: null,
  213. activeCoupons: [],
  214. account: {
  215. has_canceled_subscription: { _: 'false', $: { type: 'boolean' } },
  216. has_past_due_invoice: { _: 'false', $: { type: 'boolean' } },
  217. },
  218. displayPrice: '$1290.00',
  219. },
  220. }
  221. export const groupActiveSubscriptionWithPendingLicenseChange: GroupSubscription =
  222. {
  223. manager_ids: ['abc123'],
  224. member_ids: ['abc123'],
  225. invited_emails: [],
  226. groupPlan: true,
  227. teamName: 'GASWPLC',
  228. membersLimit: 10,
  229. _id: 'def456',
  230. admin_id: 'abc123',
  231. teamInvites: [],
  232. planCode: 'group_collaborator_10_enterprise',
  233. recurlySubscription_id: 'ghi789',
  234. plan: {
  235. planCode: 'group_collaborator_10_enterprise',
  236. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  237. hideFromUsers: true,
  238. price_in_cents: 129000,
  239. annual: true,
  240. features: {},
  241. groupPlan: true,
  242. membersLimit: 10,
  243. membersLimitAddOn: 'additional-license',
  244. },
  245. recurly: {
  246. tax: 0,
  247. taxRate: 0,
  248. billingDetailsLink: '/user/subscription/recurly/billing-details',
  249. accountManagementLink: '/user/subscription/recurly/account-management',
  250. additionalLicenses: 11,
  251. totalLicenses: 21,
  252. nextPaymentDueAt,
  253. currency: 'USD',
  254. state: 'active',
  255. trialEndsAtFormatted: null,
  256. trial_ends_at: null,
  257. activeCoupons: [],
  258. account: {
  259. has_canceled_subscription: {
  260. _: 'false',
  261. $: {
  262. type: 'boolean',
  263. },
  264. },
  265. has_past_due_invoice: {
  266. _: 'false',
  267. $: {
  268. type: 'boolean',
  269. },
  270. },
  271. },
  272. displayPrice: '$2967.00',
  273. currentPlanDisplayPrice: '$2709.00',
  274. pendingAdditionalLicenses: 13,
  275. pendingTotalLicenses: 23,
  276. },
  277. pendingPlan: {
  278. planCode: 'group_collaborator_10_enterprise',
  279. name: 'Overleaf Standard (Collaborator) - Group Account (10 licenses) - Enterprise',
  280. hideFromUsers: true,
  281. price_in_cents: 129000,
  282. annual: true,
  283. features: {},
  284. groupPlan: true,
  285. membersLimit: 10,
  286. membersLimitAddOn: 'additional-license',
  287. },
  288. }
  289. export const trialSubscription: Subscription = {
  290. manager_ids: ['abc123'],
  291. member_ids: [],
  292. invited_emails: [],
  293. groupPlan: false,
  294. membersLimit: 0,
  295. _id: 'def456',
  296. admin_id: 'abc123',
  297. teamInvites: [],
  298. planCode: 'paid-personal_free_trial_7_days',
  299. recurlySubscription_id: 'ghi789',
  300. plan: {
  301. planCode: 'paid-personal_free_trial_7_days',
  302. name: 'Personal',
  303. price_in_cents: 1500,
  304. features: {},
  305. featureDescription: [],
  306. hideFromUsers: true,
  307. },
  308. recurly: {
  309. tax: 0,
  310. taxRate: 0,
  311. billingDetailsLink: '/user/subscription/recurly/billing-details',
  312. accountManagementLink: '/user/subscription/recurly/account-management',
  313. additionalLicenses: 0,
  314. totalLicenses: 0,
  315. nextPaymentDueAt: sevenDaysFromTodayFormatted,
  316. currency: 'USD',
  317. state: 'active',
  318. trialEndsAtFormatted: sevenDaysFromTodayFormatted,
  319. trial_ends_at: new Date(sevenDaysFromToday).toString(),
  320. activeCoupons: [],
  321. account: {
  322. has_canceled_subscription: {
  323. _: 'false',
  324. $: {
  325. type: 'boolean',
  326. },
  327. },
  328. has_past_due_invoice: {
  329. _: 'false',
  330. $: {
  331. type: 'boolean',
  332. },
  333. },
  334. },
  335. displayPrice: '$14.00',
  336. },
  337. }