-
-
Notifications
You must be signed in to change notification settings - Fork 413
/
Copy pathorder.tsx
780 lines (743 loc) · 29.2 KB
/
order.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
import React from 'react';
import { themeGet } from '@styled-system/theme-get';
import { isEmpty, orderBy, partition, round, toNumber } from 'lodash';
import type { GetServerSideProps } from 'next';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
import styled from 'styled-components';
import { getSSRQueryHelpers } from '../lib/apollo-client';
import { getCollectivePageMetadata } from '../lib/collective';
import dayjs from '../lib/dayjs';
import { API_V2_CONTEXT, gql } from '../lib/graphql/helpers';
import type { Account, AccountWithHost } from '../lib/graphql/types/v2/schema';
import useLoggedInUser from '../lib/hooks/useLoggedInUser';
import { usePrevious } from '../lib/hooks/usePrevious';
import { i18nPaymentMethodProviderType } from '../lib/i18n/payment-method-provider-type';
import { i18nTaxType } from '../lib/i18n/taxes';
import { getCollectivePageCanonicalURL } from '../lib/url-helpers';
import CollectiveNavbar from '../components/collective-navbar';
import { NAVBAR_CATEGORIES } from '../components/collective-navbar/constants';
import { accountNavbarFieldsFragment } from '../components/collective-navbar/fragments';
import Container from '../components/Container';
import { confirmContributionFieldsFragment } from '../components/contributions/ConfirmContributionForm';
import CreatePendingOrderModal from '../components/dashboard/sections/contributions/CreatePendingOrderModal';
import DateTime from '../components/DateTime';
import ErrorPage from '../components/ErrorPage';
import FormattedMoneyAmount from '../components/FormattedMoneyAmount';
import { Box, Flex, Grid } from '../components/Grid';
import HTMLContent from '../components/HTMLContent';
import PrivateInfoIcon from '../components/icons/PrivateInfoIcon';
import LinkCollective from '../components/LinkCollective';
import Loading from '../components/Loading';
import MessageBoxGraphqlError from '../components/MessageBoxGraphqlError';
import OrderStatusTag from '../components/orders/OrderStatusTag';
import ProcessOrderButtons, { hasProcessButtons } from '../components/orders/ProcessOrderButtons';
import Page from '../components/Page';
import PaymentMethodTypeWithIcon from '../components/PaymentMethodTypeWithIcon';
import StyledButton from '../components/StyledButton';
import StyledCard from '../components/StyledCard';
import StyledHr from '../components/StyledHr';
import StyledLink from '../components/StyledLink';
import StyledTag from '../components/StyledTag';
import StyledTooltip from '../components/StyledTooltip';
import Tags from '../components/Tags';
import { H1, H5, P, Span } from '../components/Text';
import { getDisplayedAmount } from '../components/transactions/TransactionItem';
import Custom404 from './404';
const orderPageQuery = gql`
query OrderPage($legacyId: Int!, $collectiveSlug: String!) {
order(order: { legacyId: $legacyId }) {
id
legacyId
status
description
tags
...ConfirmContributionFields
paymentMethod {
id
type
}
createdAt
processedAt
permissions {
id
canMarkAsExpired
canMarkAsPaid
canSetTags
canEdit
}
transactions {
id
legacyId
group
description
type
kind
createdAt
order {
id
}
amount {
valueInCents
currency
}
netAmount {
valueInCents
currency
}
taxAmount {
valueInCents
currency
}
taxInfo {
id
type
rate
}
paymentProcessorFee {
valueInCents
currency
}
fromAccount {
id
slug
type
name
imageUrl
isIncognito
... on Individual {
isGuest
}
}
account {
id
slug
type
name
imageUrl
}
}
}
account(slug: $collectiveSlug) {
id
legacyId
slug
name
type
isHost
imageUrl
backgroundImageUrl
isActive
description
settings
twitterHandle
currency
expensePolicy
supportedExpenseTypes
features {
id
...NavbarFields
MULTI_CURRENCY_EXPENSES
}
location {
id
address
country
}
stats {
id
balanceWithBlockedFunds {
valueInCents
currency
}
}
... on AccountWithParent {
parent {
id
slug
name
imageUrl
backgroundImageUrl
twitterHandle
}
}
... on AccountWithHost {
host {
id
name
slug
imageUrl
backgroundImageUrl
}
}
... on Organization {
host {
id
name
slug
imageUrl
backgroundImageUrl
}
}
}
}
${accountNavbarFieldsFragment}
${confirmContributionFieldsFragment}
`;
const contributionPageQueryHelper = getSSRQueryHelpers<{ legacyId: number; collectiveSlug: string }>({
query: orderPageQuery,
context: API_V2_CONTEXT,
fetchPolicy: 'network-only',
getVariablesFromContext: ({ query }) => ({
legacyId: toNumber(query.OrderId),
collectiveSlug: query.collectiveSlug as string,
}),
});
// next.js export
// ts-unused-exports:disable-next-line
export const getServerSideProps: GetServerSideProps = contributionPageQueryHelper.getServerSideProps;
const messages = defineMessages({
title: {
id: 'OrderPage.title',
defaultMessage: '{title} · Contribution #{id}',
},
});
const ButtonsContainer = styled(Flex).attrs({ 'data-cy': 'order-actions' })`
flex-wrap: wrap;
transition: opacity 0.05s;
justify-content: flex-end;
@media (max-width: 40em) {
justify-content: center;
}
& > *:last-child {
margin-right: 0;
}
`;
const OrderDetails = ({ children: [field, value] }: { children: [React.ReactNode, React.ReactNode] }) => (
<Box>
<P
fontWeight="500"
fontSize="11px"
lineHeight="12px"
textTransform="uppercase"
color="black.700"
letterSpacing="0.06em"
>
{field}
</P>
<Container fontSize="12px" color="black.700" lineHeight="18px" mt={1}>
{value}
</Container>
</Box>
);
const TransactionDetailsWrapper = styled(Flex)`
padding-bottom: 16px;
:not(:last-child) {
border-bottom: 1px dotted #e6e8eb;
margin-bottom: 24px;
}
`;
const TransactionDetails = ({
children: [title, value, fees, description],
...props
}: {
children: [React.ReactNode, React.ReactNode, React.ReactNode?, React.ReactNode?];
[key: string]: any;
}) => (
<TransactionDetailsWrapper
data-cy="transaction-details-wrapper"
{...props}
alignItems="center"
justifyContent="space-between"
>
<Box>
<Box fontWeight="400" fontSize="14px" lineHeight="20px" color="black.900">
{title}
</Box>
<Box fontWeight="400" fontSize="12px" lineHeight="18px" color="black.700">
{description}
</Box>
</Box>
<Box textAlign="end">
<Container fontWeight="700" fontSize="16px" lineHeight="24px" color="black.900">
{value}
</Container>
{fees && (
<Container fontWeight="400" fontSize="12px" lineHeight="18px" color="black.700">
{fees}
</Container>
)}
</Box>
</TransactionDetailsWrapper>
);
const SummaryHeader = styled(H1)`
> a {
color: inherit;
text-decoration: underline;
:hover {
color: ${themeGet('colors.black.600')};
}
}
`;
const OverdueTag = styled.span`
padding: 2px 6px;
background: ${themeGet('colors.yellow.300')};
color: ${themeGet('colors.yellow.900')};
border-radius: 4px;
`;
const getTransactionsToDisplay = (account, transactions) => {
if (!transactions?.length) {
return [];
}
const isTipTransaction = t => ['PLATFORM_TIP', 'PLATFORM_TIP_DEBT'].includes(t.kind);
const isOwnAccount = t => t.account.id === account.id;
const [tipTransactions, otherTransactions] = partition(transactions, isTipTransaction);
const accountTransactions = otherTransactions.filter(t => t.account.id === account.id);
let tipTransactionsToDisplay = tipTransactions.filter(isOwnAccount);
if (tipTransactionsToDisplay.length === 0 && tipTransactions.length > 0) {
tipTransactionsToDisplay = tipTransactions.filter(t => t.kind === 'PLATFORM_TIP' && t.type === 'DEBIT');
}
return [...accountTransactions, ...tipTransactionsToDisplay];
};
// next.js export
// ts-unused-exports:disable-next-line
export default function OrderPage(props) {
const { LoggedInUser } = useLoggedInUser();
const prevLoggedInUser = usePrevious(LoggedInUser);
const [showCreatePendingOrderModal, setShowCreatePendingOrderModal] = React.useState(false);
const queryResult = contributionPageQueryHelper.useQuery(props);
const variables = contributionPageQueryHelper.getVariablesFromPageProps(props);
const baseMetadata = getCollectivePageMetadata(queryResult.data?.account);
const data = queryResult.data;
const account = data?.account as Account & AccountWithHost;
const order = data?.order;
const error = queryResult.error;
const isPending = order?.status === 'PENDING';
const isOverdue =
isPending &&
order?.pendingContributionData?.expectedAt &&
dayjs().isAfter(dayjs(order?.pendingContributionData.expectedAt));
const intl = useIntl();
// Refetch when users logs in
React.useEffect(() => {
if (!prevLoggedInUser && LoggedInUser) {
queryResult.refetch();
}
}, [LoggedInUser, prevLoggedInUser]);
if (!order && error) {
return <ErrorPage loading={queryResult.loading} data={queryResult.data} error={error} />;
} else if (!queryResult.loading && (!order || order.toAccount?.slug !== variables.collectiveSlug)) {
return <Custom404 />;
}
const displayedTransactions = getTransactionsToDisplay(account, order?.transactions);
return (
<Page
collective={account}
canonicalURL={`${getCollectivePageCanonicalURL(account)}/contributions/${queryResult.variables.legacyId}`}
{...baseMetadata}
title={intl.formatMessage(messages.title, {
title: order?.description || 'Contribution',
id: queryResult.variables.legacyId,
})}
>
<CollectiveNavbar collective={account} isLoading={!account} selectedCategory={NAVBAR_CATEGORIES.BUDGET} />
<Flex justifyContent="center" data-cy="contribution-page-content">
{!order ? (
<div className="p-20">
<Loading />
</div>
) : (
<Flex
maxWidth="1200px"
py={[0, 5]}
px={[2, 3, 4]}
mt={2}
mb={5}
flexDirection={['column', null, null, 'row']}
justifyContent={'space-between'}
>
<Box flex="1 0" flexBasis={['initial', null, null, 'min(832px, 70%)']} width="100%" mr={[null, 2, 3, 4]}>
{error && <MessageBoxGraphqlError error={error} my={4} />}
<SummaryHeader fontWeight="700" fontSize="24px" lineHeight="32px">
<FormattedMessage
id="PendingContributionSummary"
defaultMessage="{status, select, PENDING {Pending Contribution} other {Contribution}} to {account}"
values={{
status: order.status,
account: (
<LinkCollective collective={order.toAccount} textDecoration="underline">
{order.toAccount.name}
</LinkCollective>
),
}}
/>
</SummaryHeader>
<StyledCard mt="24px" p={[16, 24, 32]}>
<Flex
flexDirection={['column-reverse', 'row']}
alignItems={['stretch', 'center']}
justifyContent="space-between"
data-cy="contribution-title"
mb={1}
>
<Box mr={[0, 2]}>
<h4 className="text-xl font-medium" data-cy="contribution-description">
{order.description}
</h4>
</Box>
<Box mb={[3, 0]} justifyContent={['space-between', 'flex-end']} alignItems="center">
<OrderStatusTag status={order.status} />
</Box>
</Flex>
<Flex>
<StyledTag
variant="rounded-left"
fontSize="10px"
fontWeight="500"
mr={1}
textTransform="uppercase"
closeButtonProps={undefined}
>
<FormattedMessage defaultMessage="Contribution" id="0LK5eg" /> #{order.legacyId}
</StyledTag>
<Tags order={order} canEdit={order.permissions.canSetTags} />
</Flex>
<Flex alignItems="center" mt={1}>
<P mt="5px" fontSize="12px" color="black.600">
<FormattedMessage
defaultMessage="From {contributor} to {account}"
id="nqRBcp"
values={{
contributor: <LinkCollective collective={order.fromAccount} />,
account: <LinkCollective collective={order.toAccount} />,
}}
/>
{' • '}
<DateTime
value={order.processedAt || order.createdAt}
dateStyle={undefined}
timeStyle={undefined}
/>
</P>
</Flex>
<Grid mt="24px" gridGap="20px 50px" gridTemplateColumns={['1fr', '1fr 1fr', `repeat(4, 1fr)`]}>
{order.pendingContributionData?.ponumber && (
<OrderDetails>
<StyledTooltip
content={
<FormattedMessage
defaultMessage="External reference code for this contribution. This is usually a reference number from the contributor accounting system."
id="LqD2Po"
/>
}
containerCursor="default"
>
<FormattedMessage id="Fields.PONumber" defaultMessage="PO Number" />
</StyledTooltip>
{`#${order.pendingContributionData.ponumber}`}
</OrderDetails>
)}
{order.pendingContributionData?.expectedAt && (
<OrderDetails>
<FormattedMessage defaultMessage="Expected" id="6srLb2" />
{isOverdue ? (
<OverdueTag>
<DateTime
value={order.pendingContributionData.expectedAt}
dateStyle={'medium'}
timeStyle={undefined}
/>
<Span textTransform="uppercase" fontWeight="bold" letterSpacing="0.06em">
<FormattedMessage defaultMessage="Overdue" id="M0vCGv" />
</Span>
</OverdueTag>
) : (
<DateTime
value={order.pendingContributionData.expectedAt}
dateStyle={'medium'}
timeStyle={undefined}
/>
)}
</OrderDetails>
)}
{order.paymentMethod ? (
<OrderDetails>
<FormattedMessage id="PaidWith" defaultMessage="Paid With" />
<PaymentMethodTypeWithIcon type={order.paymentMethod?.type} iconSize={16} />
</OrderDetails>
) : (
<OrderDetails>
<FormattedMessage id="paymentmethod.label" defaultMessage="Payment Method" />
{i18nPaymentMethodProviderType(
intl,
order.pendingContributionData?.paymentMethod || 'BANK_TRANSFER',
)}
</OrderDetails>
)}
{!isEmpty(order.pendingContributionData?.fromAccountInfo) && (
<OrderDetails>
<FormattedMessage id="Contact" defaultMessage="Contact" />
<span>
{order.pendingContributionData.fromAccountInfo.name}
{order.pendingContributionData.fromAccountInfo.email && (
<React.Fragment>
(
<StyledLink
href={`mailto:${order.pendingContributionData.fromAccountInfo.email}`}
openInNewTab
>
{order.pendingContributionData.fromAccountInfo.email}
</StyledLink>
)
</React.Fragment>
)}
</span>
</OrderDetails>
)}
</Grid>
<Box mt={4}>
<P fontWeight="700" fontSize="16px" lineHeight="24px" color="black.900">
{isPending ? (
<FormattedMessage defaultMessage="Contribution Details" id="tijsiA" />
) : (
<FormattedMessage defaultMessage="Related Transactions" id="Sz+Qhv" />
)}
</P>
</Box>
<Box mt={4}>
{isPending ? (
<React.Fragment>
<TransactionDetails>
<FormattedMessage defaultMessage="Expected Total Amount" id="PEp9t9" />
<FormattedMoneyAmount
currency={order.totalAmount.currency}
precision={2}
amount={order.totalAmount.valueInCents}
/>
<FormattedMessage defaultMessage="Payment Fees not Considered" id="ysc4k/" />
<FormattedMessage
id="contribution.createdAt"
defaultMessage="Created on {date}"
values={{
date: <DateTime value={order.createdAt} dateStyle={'medium'} timeStyle="short" />,
}}
/>
</TransactionDetails>
{Boolean(order.taxAmount?.valueInCents) && (
<TransactionDetails>
<FormattedMessage
defaultMessage="Expected {taxType} ({rate}%)"
id="U5Xeen"
values={{
taxType: i18nTaxType(intl, order.tax?.type || 'Tax', 'long'),
rate: order.tax?.rate * 100,
}}
/>
<FormattedMoneyAmount
currency={order.amount.currency}
precision={2}
amount={-order.taxAmount.valueInCents}
/>
</TransactionDetails>
)}
{Boolean(order.hostFeePercent) && (
<TransactionDetails>
<FormattedMessage defaultMessage="Expected Host Fees" id="+UwJxq" />
<FormattedMoneyAmount
currency={order.amount.currency}
precision={2}
amount={
(order.amount.valueInCents - (order.taxAmount?.valueInCents || 0)) *
(order.hostFeePercent / -100)
}
/>
<FormattedMessage
defaultMessage="Based on default host fees, can be changed at settling time"
id="b8rZxx"
/>
</TransactionDetails>
)}
{Boolean(order.platformTipAmount?.valueInCents) && (
<TransactionDetails>
<FormattedMessage defaultMessage="Expected Platform Tip" id="20RyRD" />
<FormattedMoneyAmount
currency={order.platformTipAmount.currency}
amount={-order.platformTipAmount.valueInCents}
/>
</TransactionDetails>
)}
</React.Fragment>
) : (
orderBy(displayedTransactions, ['legacyId'], ['desc']).map(transaction => {
const displayedAmount = getDisplayedAmount(transaction, account);
const displayPaymentFees =
transaction.type === 'CREDIT' &&
transaction.netAmount?.valueInCents !== displayedAmount.valueInCents &&
transaction.paymentProcessorFee?.valueInCents !== 0;
return (
<TransactionDetails key={transaction.id}>
<span>{transaction.description}</span>
<FormattedMoneyAmount
currency={displayedAmount.currency}
precision={2}
amount={displayedAmount.valueInCents}
/>
<div>
{Boolean(transaction.taxAmount?.valueInCents) && (
<Span display="block">
<FormattedMoneyAmount
currency={transaction.taxAmount.currency}
precision={2}
amount={transaction.taxAmount.valueInCents}
/>{' '}
({round(transaction.taxInfo.rate * 100, 2)}%{' '}
{i18nTaxType(intl, transaction.taxInfo.type, 'long')})
</Span>
)}
{displayPaymentFees && (
<Span display="block">
<FormattedMessage
defaultMessage="{value} (Payment Processor Fee)"
id="ijvoto"
values={{
value: (
<FormattedMoneyAmount
currency={transaction.paymentProcessorFee.currency}
amount={transaction.paymentProcessorFee.valueInCents}
/>
),
}}
/>
</Span>
)}
</div>
<span>
<FormattedMessage
defaultMessage="{type, select, CREDIT {Received by} DEBIT {Paid by} other {}} {account} on {date}"
id="XhoJIl"
values={{
type: transaction.type,
date: <DateTime value={transaction.createdAt} dateStyle={'short'} timeStyle="short" />,
account: <LinkCollective collective={transaction.account} />,
}}
/>
</span>
</TransactionDetails>
);
})
)}
</Box>
{hasProcessButtons(order?.permissions) && (
<Box mt="40px">
<StyledHr />
<Flex
justifyContent={['stretch', 'space-between']}
flexDirection={['column-reverse', 'row']}
mt="8px"
>
<ButtonsContainer flexDirection={['column', 'row']}>
{order.permissions.canEdit && (
<React.Fragment>
<StyledButton
data-cy="edit-order-button"
buttonSize="tiny"
minWidth="130px"
mx={2}
mt={2}
py="9px"
height="34px"
onClick={() => setShowCreatePendingOrderModal(true)}
>
<FormattedMessage id="contribution.edit" defaultMessage="Edit Contribution" />
</StyledButton>
{showCreatePendingOrderModal && (
<CreatePendingOrderModal
hostSlug={account.host.slug}
onClose={() => setShowCreatePendingOrderModal(false)}
onSuccess={() => queryResult.refetch()}
edit={order}
/>
)}{' '}
</React.Fragment>
)}
</ButtonsContainer>
<ButtonsContainer flexDirection={['column', 'row']}>
<ProcessOrderButtons
order={order}
permissions={order.permissions}
onSuccess={() => queryResult.refetch()}
/>
</ButtonsContainer>
</Flex>
</Box>
)}
</StyledCard>
{order?.memo && (
<Box mt={4}>
<P fontWeight="700" fontSize="16px" lineHeight="24px" color="black.900">
<FormattedMessage defaultMessage="Additional Details" id="DgTPfL" />
</P>
<Span fontSize="12px" color="black.700" fontWeight="bold">
<FormattedMessage id="Expense.PrivateNote" defaultMessage="Private note" />
<PrivateInfoIcon className="text-muted-foreground" size={12} />
</Span>
<HTMLContent color="black.700" mt={1} fontSize="13px" content={order.memo} />
</Box>
)}
</Box>
<Flex
minWidth="270px"
display={['none', 'block']}
justifyContent={['center', null, 'flex-start', 'flex-end']}
pt={[4, null, 80]}
>
{account.isActive && (
<Box px={2}>
<H5 mb={3} textTransform="capitalize">
<FormattedMessage
id="CollectiveBalance"
defaultMessage="{type, select, COLLECTIVE {Collective balance} EVENT {Event balance} ORGANIZATION {Organization balance} FUND {Fund balance} PROJECT {Project balance} other {Account balance}}"
values={{ type: account.type || '' }}
/>
</H5>
<Container
borderLeft="1px solid"
borderColor="black.300"
pl={3}
fontSize="20px"
color="black.500"
data-cy="collective-balance"
>
<Box>
<FormattedMoneyAmount
currency={account.stats.balanceWithBlockedFunds.currency}
amount={account.stats.balanceWithBlockedFunds.valueInCents}
amountClassName="text-foreground"
/>
{account.host && (
<P fontSize="11px" color="black.600" mt={2}>
<Span
fontSize="9px"
fontWeight="600"
textTransform="uppercase"
color="black.500"
letterSpacing="0.06em"
>
<FormattedMessage id="Fiscalhost" defaultMessage="Fiscal Host" />
</Span>
<br />
<LinkCollective collective={account.host} />
</P>
)}
</Box>
</Container>
</Box>
)}
</Flex>
</Flex>
)}
</Flex>
</Page>
);
}