-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#Wave-Control: Add NetSuite]: Added NetSuite
connect button and fixed copies
#44218
Changes from 28 commits
22f38a2
a50e94f
8584f97
0c1f040
221f0ef
c300257
5f3f526
2ecec42
4cd240d
4c72b52
ab7997e
4a4783f
6c84302
abac11b
432e443
de1919d
499d31f
c282904
14dfbdc
32d85e8
61578a4
2984b26
e10eb65
0f6e35f
db05635
4cfa704
8287fd5
0c17ae0
a600231
26fe29a
05c92d0
6a3037c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import type {ConnectionName} from '@src/types/onyx/Policy'; | ||
import ConfirmModal from './ConfirmModal'; | ||
|
||
type AccountingConnectionConfirmationModalProps = { | ||
integrationToConnect: ConnectionName; | ||
onConfirm: () => void; | ||
onCancel: () => void; | ||
}; | ||
|
||
function AccountingConnectionConfirmationModal({integrationToConnect, onCancel, onConfirm}: AccountingConnectionConfirmationModalProps) { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<ConfirmModal | ||
title={translate('workspace.accounting.connectTitle', integrationToConnect)} | ||
isVisible | ||
onConfirm={onConfirm} | ||
onCancel={onCancel} | ||
prompt={translate('workspace.accounting.connectPrompt', integrationToConnect)} | ||
confirmText={translate('workspace.accounting.setup')} | ||
cancelText={translate('common.cancel')} | ||
success | ||
/> | ||
); | ||
} | ||
|
||
AccountingConnectionConfirmationModal.displayName = 'AccountingConnectionConfirmationModal'; | ||
export default AccountingConnectionConfirmationModal; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, {useState} from 'react'; | ||
import AccountingConnectionConfirmationModal from '@components/AccountingConnectionConfirmationModal'; | ||
import Button from '@components/Button'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useNetwork from '@hooks/useNetwork'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import {removePolicyConnection} from '@libs/actions/connections'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import CONST from '@src/CONST'; | ||
import ROUTES from '@src/ROUTES'; | ||
import type {ConnectToNetSuiteButtonProps} from './types'; | ||
|
||
function ConnectToNetSuiteButton({policyID, shouldDisconnectIntegrationBeforeConnecting, integrationToDisconnect}: ConnectToNetSuiteButtonProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const {isOffline} = useNetwork(); | ||
|
||
const [isDisconnectModalOpen, setIsDisconnectModalOpen] = useState(false); | ||
|
||
return ( | ||
<> | ||
<Button | ||
onPress={() => { | ||
if (shouldDisconnectIntegrationBeforeConnecting && integrationToDisconnect) { | ||
setIsDisconnectModalOpen(true); | ||
return; | ||
} | ||
|
||
// TODO: Will be updated to new token input page | ||
Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_SUBSIDIARY_SELECTOR.getRoute(policyID)); | ||
}} | ||
text={translate('workspace.accounting.setup')} | ||
style={styles.justifyContentCenter} | ||
small | ||
isDisabled={isOffline} | ||
/> | ||
{shouldDisconnectIntegrationBeforeConnecting && isDisconnectModalOpen && integrationToDisconnect && ( | ||
<AccountingConnectionConfirmationModal | ||
onConfirm={() => { | ||
removePolicyConnection(policyID, integrationToDisconnect); | ||
|
||
// TODO: Will be updated to new token input page | ||
Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_SUBSIDIARY_SELECTOR.getRoute(policyID)); | ||
mananjadhav marked this conversation as resolved.
Show resolved
Hide resolved
|
||
setIsDisconnectModalOpen(false); | ||
}} | ||
integrationToConnect={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} | ||
onCancel={() => setIsDisconnectModalOpen(false)} | ||
/> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default ConnectToNetSuiteButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type {PolicyConnectionName} from '@src/types/onyx/Policy'; | ||
|
||
type ConnectToNetSuiteButtonProps = { | ||
policyID: string; | ||
shouldDisconnectIntegrationBeforeConnecting?: boolean; | ||
integrationToDisconnect?: PolicyConnectionName; | ||
}; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export type {ConnectToNetSuiteButtonProps}; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -2435,22 +2435,23 @@ export default { | |||||||
syncNow: 'Sync now', | ||||||||
disconnect: 'Disconnect', | ||||||||
disconnectTitle: (integration?: ConnectionName): string => { | ||||||||
switch (integration) { | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||||
return 'Disconnect QuickBooks Online'; | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||||
return 'Disconnect Xero'; | ||||||||
default: { | ||||||||
return 'Disconnect integration'; | ||||||||
} | ||||||||
} | ||||||||
const integrationName = integration && CONST.POLICY.CONNECTIONS.NAME_MAP[integration] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integration] : 'integration'; | ||||||||
return `Disconnect ${integrationName}`; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be simplified down to:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just be strict with the types for the function? disconnectPrompt: (currentIntegration: ConnectionName): string => `Are you sure you want to disconnect ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[currentIntegration] ?? 'integration'}?`}, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, let me check if it has any other usage. I can update. Give me a few mins. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was able to update it for
|
||||||||
}, | ||||||||
connectTitle: (integrationToConnect?: ConnectionName): string => { | ||||||||
const integrationName = | ||||||||
integrationToConnect && CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] : 'accounting integration'; | ||||||||
return `Connect ${integrationName}`; | ||||||||
}, | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Responded. #44218 (comment) |
||||||||
|
||||||||
syncError: (integration?: ConnectionName): string => { | ||||||||
switch (integration) { | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||||
return "Can't connect to QuickBooks Online."; | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||||
return "Can't connect to Xero."; | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.NETSUITE: | ||||||||
return "Can't connec to NetSuite"; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good eye!! |
||||||||
default: { | ||||||||
return "Can't connect to integration."; | ||||||||
} | ||||||||
|
@@ -2469,24 +2470,15 @@ export default { | |||||||
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE]: 'Not imported', | ||||||||
[CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: 'Imported as report fields', | ||||||||
}, | ||||||||
disconnectPrompt: (integrationToConnect?: ConnectionName, currentIntegration?: ConnectionName): string => { | ||||||||
switch (integrationToConnect) { | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||||
return 'Are you sure you want to disconnect Xero to set up QuickBooks Online?'; | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||||
return 'Are you sure you want to disconnect QuickBooks Online to set up Xero?'; | ||||||||
default: { | ||||||||
switch (currentIntegration) { | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||||
return 'Are you sure you want to disconnect QuickBooks Online?'; | ||||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||||
return 'Are you sure you want to disconnect Xero?'; | ||||||||
default: { | ||||||||
return 'Are you sure you want to disconnect this integration?'; | ||||||||
} | ||||||||
} | ||||||||
} | ||||||||
} | ||||||||
disconnectPrompt: (currentIntegration?: ConnectionName): string => { | ||||||||
const integrationName = | ||||||||
currentIntegration && CONST.POLICY.CONNECTIONS.NAME_MAP[currentIntegration] ? CONST.POLICY.CONNECTIONS.NAME_MAP[currentIntegration] : 'this integration'; | ||||||||
return `Are you sure you want to disconnect ${integrationName}?`; | ||||||||
}, | ||||||||
connectPrompt: (integrationToConnect?: ConnectionName): string => { | ||||||||
const integrationName = | ||||||||
integrationToConnect && CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] : 'this accounting integration'; | ||||||||
return `Are you sure you want to connect ${integrationName}? This will remove any existing acounting connections.`; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Responded #44218 (comment). |
||||||||
}, | ||||||||
enterCredentials: 'Enter your credentials', | ||||||||
connections: { | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2437,23 +2437,23 @@ export default { | |||||
other: 'Otras integraciones', | ||||||
syncNow: 'Sincronizar ahora', | ||||||
disconnect: 'Desconectar', | ||||||
disconnectTitle: (currentIntegration?: ConnectionName): string => { | ||||||
switch (currentIntegration) { | ||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||
return 'Desconectar QuickBooks Online'; | ||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||
return 'Desconectar Xero'; | ||||||
default: { | ||||||
return 'Desconectar integración'; | ||||||
} | ||||||
} | ||||||
disconnectTitle: (integration?: ConnectionName): string => { | ||||||
const integrationName = integration && CONST.POLICY.CONNECTIONS.NAME_MAP[integration] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integration] : 'integración'; | ||||||
return `Desconectar ${integrationName}`; | ||||||
}, | ||||||
connectTitle: (integrationToConnect?: ConnectionName): string => { | ||||||
const integrationName = | ||||||
integrationToConnect && CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] : 'accounting integration'; | ||||||
return `Conectar ${integrationName}`; | ||||||
}, | ||||||
syncError: (integration?: ConnectionName): string => { | ||||||
switch (integration) { | ||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||
return 'No se puede conectar a QuickBooks Online.'; | ||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||
return 'No se puede conectar a Xero'; | ||||||
case CONST.POLICY.CONNECTIONS.NAME.NETSUITE: | ||||||
return 'No se puede conectar a NetSuite'; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Let's also add the punctuation for the Xero copy above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added. |
||||||
default: { | ||||||
return 'No se ha podido conectar a la integración.'; | ||||||
} | ||||||
|
@@ -2472,24 +2472,14 @@ export default { | |||||
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE]: 'No importado', | ||||||
[CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: 'Importado como campos de informe', | ||||||
}, | ||||||
disconnectPrompt: (integrationToConnect?: ConnectionName, currentIntegration?: ConnectionName): string => { | ||||||
switch (integrationToConnect) { | ||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||
return '¿Estás seguro de que quieres desconectar Xero para configurar QuickBooks Online?'; | ||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||
return '¿Estás seguro de que quieres desconectar QuickBooks Online para configurar Xero?'; | ||||||
default: { | ||||||
switch (currentIntegration) { | ||||||
case CONST.POLICY.CONNECTIONS.NAME.QBO: | ||||||
return '¿Estás seguro de que quieres desconectar QuickBooks Online?'; | ||||||
case CONST.POLICY.CONNECTIONS.NAME.XERO: | ||||||
return '¿Estás seguro de que quieres desconectar Xero?'; | ||||||
default: { | ||||||
return '¿Estás seguro de que quieres desconectar integración?'; | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
disconnectPrompt: (currentIntegration?: ConnectionName): string => { | ||||||
const integrationName = currentIntegration && CONST.POLICY.CONNECTIONS.NAME_MAP[currentIntegration] ? CONST.POLICY.CONNECTIONS.NAME_MAP[currentIntegration] : 'integración'; | ||||||
return `¿Estás seguro de que quieres desconectar ${integrationName}?`; | ||||||
}, | ||||||
connectPrompt: (integrationToConnect?: ConnectionName): string => { | ||||||
const integrationName = | ||||||
integrationToConnect && CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] ? CONST.POLICY.CONNECTIONS.NAME_MAP[integrationToConnect] : 'esta integración contable'; | ||||||
return `¿Estás seguro de que quieres conectar a ${integrationName}? Esto eliminará cualquier conexión contable existente.`; | ||||||
}, | ||||||
enterCredentials: 'Ingresa tus credenciales', | ||||||
connections: { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will match the constant names we use in the API and is also more intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay updated.