Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (
)
}
const { triggers: triggersCollection } = this.props
const accounts = this.getAllAccounts()
const triggers = triggersCollection.data
if (
accounts.length === 0 ||
flag('balance.no-account') ||
flag('balance.account-loading')
) {
let konnectorInfos = triggers
.map(x => x.attributes)
.filter(isBankTrigger)
.map(t => ({
konnector: get(t, 'message.konnector'),
account: get(t, 'message.account'),
status: get(t, 'current_state.status')
}))
if (flag('balance.account-loading')) {
// eslint-disable-next-line no-console
console.log('konnectorInfos', konnectorInfos)
if (konnectorInfos.length === 0) {
virtualReimbursements: group => {
const balance = getGroupBalance(group)
if (flag('demo') || flag('balance.reimbursements-top-position')) {
// Must be first if we have reimbursements waiting
return balance > 0 ? -1 : 2
} else {
return 2
}
}
}
const setFlagsFromSettings = settings => {
// The flag is needed to use local model when getting a transaction category ID
flag('local-model-override', settings.community.localModelOverride.enabled)
flag(
'late-health-reimbursement-limit',
settings.notifications.lateHealthReimbursement.value
)
}
const root = document.querySelector('[role=application]')
const data = root.dataset
lang =
__TARGET__ === 'mobile' && navigator && navigator.language
? navigator.language.slice(0, 2)
: data.cozyLocale || 'en'
setupD3Locale(lang)
history = setupHistory()
client = await getClient(persistedState)
store = configureStore(client, persistedState)
client.registerPlugin(CleanupStoreClientPlugin, { store })
client.registerPlugin(PinPlugin)
client.registerPlugin(flag.plugin)
client.registerPlugin(StartupChecksPlugin, {
launchTriggers: [
{
slug: 'banks',
name: 'autogroups',
type: '@event',
policy: 'never-executed'
}
],
// Delay startup checks to lessen the load at page startup
delay: 5000
})
client.setStore(store)
/** Reset flags, keeping only those set to a truthy value */
const garbageCollectFlags = () => {
const trueFlags = flag
.list()
.map(name => [name, flag(name)])
.filter(x => x[1])
flag.reset()
for (const [flagName, flagValue] of trueFlags) {
flag(flagName, flagValue)
}
}
garbageCollectFlags()
if (__DEVELOPMENT__ && flag('switcher') === null) {
flag('switcher', true)
}
const demoFqdns = [
'stephaniedurand.cozy.rocks',
'isabelledurand.cozy.rocks',
'genevievedurand.cozy.rocks',
'isabelledurand.mycozy.cloud'
]
const locationMatchesFqdn = (location, fqdn) => {
const splitted = fqdn.split('.')
const slug = splitted[0]
const domain = splitted.slice(1).join('.')
const rx = new RegExp(slug + '.*' + domain.replace('.', '\\.'))
return rx.exec(location)
it('should contain a others expenses virtual account', () => {
flag.mockReturnValue(true)
const virtualAccounts = buildVirtualAccounts(mockTransactions)
const othersExpenseAccount = virtualAccounts.find(
a => a._id === 'others_reimbursements'
)
expect(othersExpenseAccount).toBeDefined()
})
transactions
}) => {
const { t } = useI18n()
const titlePaddedClass = isMobile ? 'u-p-0' : 'u-pb-0'
const subtitle = subtitleParams
? t('BalanceHistory.checked_accounts', subtitleParams)
: t('BalanceHistory.all_accounts')
return (
<header>
{isMobile && (
{t('Balance.title')}
)}
{flag('banks.search') ? : null}
{accounts && (
)}
</header>
export const TransactionPageErrors = props => {
const errors = getTransactionPageErrors(props)
const count = errors.length
const Wrapper = count > 1 ? Carrousel : React.Fragment
const wrapperProps =
count > 1
? {
className: 'u-bg-chablis'
}
: null
if (flag('demo')) {
return null
}
return (
{errors.map((error, i) => {
const Component = TransactionPageErrors.errorTypeToComponent[error.type]
if (!Component) {
throw new Error(`No component available for error ${error.type}`)
}
return (
isExtraLarge,
showCategoryChoice,
filteringOnAccount,
onRef,
showRecurrence
} = this.props
const categoryId = getCategoryId(transaction)
const categoryName = getCategoryName(categoryId)
const categoryTitle = t(`Data.subcategories.${categoryName}`)
const account = transaction.account.data
const recurrence = transaction.recurrence
? transaction.recurrence.data
: null
const trRest = flag('show-transactions-ids') ? { id: transaction._id } : {}
const applicationDate = getApplicationDate(transaction)
return (
<img title="{categoryTitle}">
{!filteringOnAccount && }
export const getGroupLabel = (group, t) => {
if (group.virtual) {
return (
t(`Data.accountTypes.${group.label}`, { _: 'other' }) +
(flag('debug-groups') ? ' (virtual)' : '')
)
} else if (isAutoGroup(group) && !isFormerAutoGroup(group)) {
return (
t(`Data.accountTypes.${group.accountType}`) +
(flag('debug-groups') ? ' (auto)' : '')
)
} else {
return group.label
}
}