Skip to content

Commit

Permalink
misc: better copy handling for Hubspot selected object type (#1816)
Browse files Browse the repository at this point in the history
ansmonjol authored Oct 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f07edaf commit 5743682
Showing 2 changed files with 59 additions and 31 deletions.
88 changes: 57 additions & 31 deletions src/components/customers/addDrawer/ExternalAppsAccordion.tsx
Original file line number Diff line number Diff line change
@@ -60,6 +60,20 @@ import Stripe from '~/public/images/stripe.svg'
import Xero from '~/public/images/xero.svg'
import { MenuPopper, theme } from '~/styles'

const hubspotExternalIdTypeCopyMap: Record<
HubspotTargetedObjectsEnum,
Record<'label' | 'placeholder', string>
> = {
[HubspotTargetedObjectsEnum.Companies]: {
label: 'text_1729602057769exfgebgaj4g',
placeholder: 'text_1729602057769w37ljj318sn',
},
[HubspotTargetedObjectsEnum.Contacts]: {
label: 'text_1729067791880uwec7af9cpq',
placeholder: 'text_1729067791880y0th6mtz2av',
},
}

gql`
fragment CustomerForExternalAppsAccordion on Customer {
id
@@ -1269,40 +1283,52 @@ export const ExternalAppsAccordion = ({ formikProps, isEdition }: TExternalAppsA
formikProps={formikProps}
/>

<TextInputField
label={translate('text_1729067791880uwec7af9cpq')}
placeholder={translate('text_1729067791880y0th6mtz2av')}
name={`${hubspotIntegrationpointerInIntegrationCustomer}.externalCustomerId`}
disabled={
!!selectedHubspotIntegration?.syncWithProvider ||
hadInitialHubspotIntegrationCustomer
}
formikProps={formikProps}
/>
{!!!!selectedHubspotIntegration.targetedObject && (
<>
<TextInputField
label={translate(
hubspotExternalIdTypeCopyMap[selectedHubspotIntegration.targetedObject][
'label'
],
)}
placeholder={translate(
hubspotExternalIdTypeCopyMap[selectedHubspotIntegration.targetedObject][
'placeholder'
],
)}
name={`${hubspotIntegrationpointerInIntegrationCustomer}.externalCustomerId`}
disabled={
!!selectedHubspotIntegration?.syncWithProvider ||
hadInitialHubspotIntegrationCustomer
}
formikProps={formikProps}
/>

<Checkbox
name={`${hubspotIntegrationpointerInIntegrationCustomer}.syncWithProvider`}
disabled={hadInitialHubspotIntegrationCustomer}
value={!!selectedHubspotIntegration?.syncWithProvider}
label={translate('text_66423cad72bbad009f2f569e', {
connectionName: selectedHubspotIntegrationSettings?.name,
})}
onChange={(_, checked) => {
const newHubspotIntegrationObject = {
...selectedHubspotIntegration,
syncWithProvider: checked,
}
<Checkbox
name={`${hubspotIntegrationpointerInIntegrationCustomer}.syncWithProvider`}
disabled={hadInitialHubspotIntegrationCustomer}
value={!!selectedHubspotIntegration?.syncWithProvider}
label={translate('text_66423cad72bbad009f2f569e', {
connectionName: selectedHubspotIntegrationSettings?.name,
})}
onChange={(_, checked) => {
const newHubspotIntegrationObject = {
...selectedHubspotIntegration,
syncWithProvider: checked,
}

if (!isEdition && checked) {
newHubspotIntegrationObject.externalCustomerId = ''
}
if (!isEdition && checked) {
newHubspotIntegrationObject.externalCustomerId = ''
}

formikProps.setFieldValue(
`${hubspotIntegrationpointerInIntegrationCustomer}`,
newHubspotIntegrationObject,
)
}}
/>
formikProps.setFieldValue(
`${hubspotIntegrationpointerInIntegrationCustomer}`,
newHubspotIntegrationObject,
)
}}
/>
</>
)}
</>
)}

2 changes: 2 additions & 0 deletions translations/base.json
Original file line number Diff line number Diff line change
@@ -2515,6 +2515,8 @@
"text_17290677918809xyyuizjvtk": "Targeted HubSpot object",
"text_1729067791880uwec7af9cpq": "HubSpot Contact ID",
"text_1729067791880y0th6mtz2av": "Type a HubSpot Contact ID",
"text_1729602057769exfgebgaj4g": "HubSpot Company ID",
"text_1729602057769w37ljj318sn": "Type a HubSpot Company ID",
"text_1729067791880abj1lzd7dn9": "This customer will be created to HubSpot after editing in Lago",
"text_17285747264958mqbtws3em8": "Dunning",
"text_1728574726495473mszb2j27": "Automatic payment retries and targeted emails to settle customers’ overdue balances.",

0 comments on commit 5743682

Please sign in to comment.