diff --git a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalContentWrapper.jsx b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalContentWrapper.jsx index 5f3c1c5d6c..a4d52846df 100644 --- a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalContentWrapper.jsx +++ b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalContentWrapper.jsx @@ -9,7 +9,13 @@ import TriggerError from './TriggerError' const AccountModalContentWrapper = ({ children }) => { const { isMobile } = useBreakpoints() - const { trigger, account, konnector } = useOutletContext() + const { + konnector, + account, + trigger, + intentsApi, + innerAccountModalOverrides + } = useOutletContext() return ( @@ -21,10 +27,17 @@ const AccountModalContentWrapper = ({ children }) => { konnector={konnector} account={account} trigger={trigger} + intentsApi={intentsApi} /> {React.Children.map(children, child => React.isValidElement(child) - ? React.cloneElement(child, { flow, trigger, account }) + ? React.cloneElement(child, { + flow, + account, + trigger, + intentsApi, + innerAccountModalOverrides + }) : null )} diff --git a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalWithoutTabs.jsx b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalWithoutTabs.jsx index 0e8f81684c..36cf5c7358 100644 --- a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalWithoutTabs.jsx +++ b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/AccountModalWithoutTabs.jsx @@ -11,11 +11,17 @@ import { withMountPointProps } from '../MountPointContext' import { getMatchingTrigger } from './helpers' import AccountModalHeader from './AccountModalHeader' import Error from './Error' +import { + innerAccountModalOverridesProptype, + intentsApiProptype +} from '../../helpers/proptypes' const AccountModalWithoutTabs = ({ accountsAndTriggers, konnector, - accountId + accountId, + intentsApi, + innerAccountModalOverrides }) => { const matchingTrigger = getMatchingTrigger(accountsAndTriggers, accountId) const matchingAccountId = matchingTrigger ? accountId : undefined @@ -57,7 +63,15 @@ const AccountModalWithoutTabs = ({ )} {!isError && !isLoading && ( - + )} ) @@ -74,7 +88,9 @@ AccountModalWithoutTabs.propTypes = { trigger: PropTypes.object.isRequired }) ).isRequired, - accountId: PropTypes.string.isRequired + accountId: PropTypes.string.isRequired, + intentsApi: intentsApiProptype, + innerAccountModalOverrides: innerAccountModalOverridesProptype } export default withMountPointProps(AccountModalWithoutTabs) diff --git a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalContentWrapper.jsx b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalContentWrapper.jsx index 719360c74f..3ee9a3d94a 100644 --- a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalContentWrapper.jsx +++ b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalContentWrapper.jsx @@ -1,16 +1,23 @@ import React from 'react' +import PropTypes from 'prop-types' import DialogContent from '@material-ui/core/DialogContent' import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints' import FlowProvider from '../../FlowProvider' import TriggerError from '../TriggerError' +import { + innerAccountModalOverridesProptype, + intentsApiProptype +} from '../../../helpers/proptypes' const AccountModalContentWrapper = ({ children, trigger, account, - konnector + konnector, + intentsApi, + innerAccountModalOverrides }) => { const { isMobile } = useBreakpoints() @@ -24,10 +31,17 @@ const AccountModalContentWrapper = ({ konnector={konnector} account={account} trigger={trigger} + intentsApi={intentsApi} /> {React.Children.map(children, child => React.isValidElement(child) - ? React.cloneElement(child, { flow, trigger, account }) + ? React.cloneElement(child, { + flow, + account, + trigger, + intentsApi, + innerAccountModalOverrides + }) : null )} @@ -37,4 +51,12 @@ const AccountModalContentWrapper = ({ ) } +AccountModalContentWrapper.propTypes = { + konnector: PropTypes.object.isRequired, + trigger: PropTypes.object.isRequired, + account: PropTypes.object.isRequired, + intentsApi: intentsApiProptype, + innerAccountModalOverrides: innerAccountModalOverridesProptype +} + export default AccountModalContentWrapper diff --git a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalWithoutTabs.jsx b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalWithoutTabs.jsx index 8783a4c0d0..a0996731dc 100644 --- a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalWithoutTabs.jsx +++ b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/FovV4Router/AccountModalWithoutTabs.jsx @@ -10,11 +10,17 @@ import { withMountPointProps } from '../../MountPointContext' import { getMatchingTrigger } from '../helpers' import AccountModalHeader from '../AccountModalHeader' import Error from '../Error' +import { + innerAccountModalOverridesProptype, + intentsApiProptype +} from '../../../helpers/proptypes' const AccountModalWithoutTabs = ({ accountsAndTriggers, konnector, accountId, + intentsApi, + innerAccountModalOverrides, children }) => { const matchingTrigger = getMatchingTrigger(accountsAndTriggers, accountId) @@ -63,7 +69,9 @@ const AccountModalWithoutTabs = ({ ? React.cloneElement(child, { trigger: matchingTrigger, account, - konnector + konnector, + intentsApi, + innerAccountModalOverrides }) : null )} @@ -82,7 +90,9 @@ AccountModalWithoutTabs.propTypes = { trigger: PropTypes.object.isRequired }) ).isRequired, - accountId: PropTypes.string.isRequired + accountId: PropTypes.string.isRequired, + intentsApi: intentsApiProptype, + innerAccountModalOverrides: innerAccountModalOverridesProptype } export default withMountPointProps(AccountModalWithoutTabs) diff --git a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/OpenOAuthWindowButton.jsx b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/OpenOAuthWindowButton.jsx index 1e50d03a4d..d8034440db 100644 --- a/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/OpenOAuthWindowButton.jsx +++ b/packages/cozy-harvest-lib/src/components/AccountModalWithoutTabs/OpenOAuthWindowButton.jsx @@ -5,13 +5,16 @@ import flag from 'cozy-flags' import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' import { Button } from 'cozy-ui/transpiled/react/Button' +import { useWebviewIntent } from 'cozy-intent' import useOAuthExtraParams from '../hooks/useOAuthExtraParams' import { OAUTH_SERVICE_OK, openOAuthWindow } from '../OAuthService' +import { intentsApiProptype } from '../../helpers/proptypes' -const OpenOAuthWindowButton = ({ flow, account, konnector }) => { +const OpenOAuthWindowButton = ({ flow, account, konnector, intentsApi }) => { const { t } = useI18n() const client = useClient() + const webviewIntent = useWebviewIntent() const { extraParams } = useOAuthExtraParams({ account, @@ -26,6 +29,8 @@ const OpenOAuthWindowButton = ({ flow, account, konnector }) => { konnector, account, extraParams, + intentsApi, + webviewIntent, reconnect: true }) @@ -35,7 +40,7 @@ const OpenOAuthWindowButton = ({ flow, account, konnector }) => { ) { flow.expectTriggerLaunch() } - }, [account, client, extraParams, flow, konnector]) + }, [account, client, extraParams, flow, konnector, webviewIntent, intentsApi]) return (