subscriptions.tsx 8.9 KB

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