Skip to content

Commit

Permalink
feat(netsuite) allow to map items
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmonjol committed May 3, 2024
1 parent 83681ff commit 533245e
Show file tree
Hide file tree
Showing 13 changed files with 2,483 additions and 212 deletions.
46 changes: 44 additions & 2 deletions ditto/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"text_661ff6e56ef7e1b7c542b251": "Type your NetSuite Client Secret",
"text_661ff6e56ef7e1b7c542b25b": "Custom endpoint in NetSuite",
"text_661ff6e56ef7e1b7c542b267": "This endpoint URL synchronizes and retrieves data with NetSuite.",
"text_661ff6e56ef7e1b7c542b271": "Custom script endpoint",
"text_661ff6e56ef7e1b7c542b271": "Custom script endpoint (optional)",
"text_661ff6e56ef7e1b7c542b27d": "Type the custom script endpoint URL",
"text_661ff6e56ef7e1b7c542b286": "Select the NetSuite object for data synchronization",
"text_661ff6e56ef7e1b7c542b28e": "You’ll be able to edit this setting later.",
Expand All @@ -321,7 +321,7 @@
"text_661ff6e56ef7e1b7c542b232": "Connection details",
"text_661ff6e56ef7e1b7c542b2a0": "NetSuite custom endpoint URL",
"text_661ff6e56ef7e1b7c542b2b4": "Synchronized data",
"text_661ff6e56ef7e1b7c542b2c4": "NetSuite integration successfully connected",
"text_661ff6e56ef7e1b7c542b2c4": "NetSuite integration successfully connected. Items can take few seconds to be fetched",
"text_661ff6e56ef7e1b7c542b2cc": "NetSuite integration successfully edited",
"text_661ff6e56ef7e1b7c542b1d0": "Edit connection to {{name}}",
"text_661ff6e56ef7e1b7c542b1da": "Edit information linked to this NetSuite connection.",
Expand All @@ -331,6 +331,48 @@
"text_661ff6e56ef7e1b7c542b1f6": "Premium add-ons are available upon request. Please contact Lago to unlock this new feature.",
"text_661ff6e56ef7e1b7c542b220": "Request access to premium NetSuite add-on",
"text_661ff6e56ef7e1b7c542b238": "Hello, I would like to access your NetSuite add-on. \nPlease let me know if you need more info!",
"text_6630e3210c13c500cd398e95": "Items from",
"text_6630e3210c13c500cd398e96": "Fallback items",
"text_6630e3210c13c500cd398e97": "Mapped to",
"text_6630e3210c13c500cd398e98": "Fallback item",
"text_6630e3210c13c500cd398e99": "For all items not defined",
"text_6630e3210c13c500cd398e9a": "Undefined",
"text_6630e3210c13c500cd398e9b": "Items linked to coupons",
"text_6630e3210c13c500cd398e9e": "For all coupons",
"text_6630e3210c13c500cd398ea0": "Items linked to plans",
"text_6630e3210c13c500cd398ea2": "Subscription fees",
"text_6630e3210c13c500cd398ea3": "For all plans",
"text_6630e3210c13c500cd398ea5": "Plan’s minimum commitments",
"text_6630e3210c13c500cd398ea8": "Items linked to taxes",
"text_6630e3210c13c500cd398eab": "For all taxes",
"text_6630e3210c13c500cd398ead": "Items linked to wallets",
"text_6630e3210c13c500cd398eb0": "For all wallets",
"text_6630e51df0a194013daea61f": "Define a fallback item",
"text_6630e51df0a194013daea620": "This item serves as a fallback in case your mapping is incorrect, ensuring that your actions to NetSuite do not fail.",
"text_6630e51df0a194013daea621": "NetSuite item",
"text_6630e51df0a194013daea622": "Search and select an item",
"text_6630e51df0a194013daea624": "Map item",
"text_6630e52a04d25adb0300f034": "(account: {{accountCode}})",
"text_6630e560a830417bd3b119fb": "Map your taxes with a NetSuite tax item",
"text_6630e560a830417bd3b119fc": "To link Lago taxes with NetSuite, please choose the corresponding tax item in your NetSuite account.",
"text_6630e57386f8a700a3318cc8": "Map your coupons with a NetSuite item",
"text_6630e57386f8a700a3318cc9": "To link Lago coupons with NetSuite, please choose the corresponding coupon item in your NetSuite account.",
"text_6630e5923500e7015f1905b9": "Map {{addOnName}} with a NetSuite item",
"text_6630e5923500e7015f1905bd": "To link this add-on with NetSuite, please choose the corresponding add-on item in your NetSuite account.",
"text_6630e5923500e7015f19063e": "Lago item mapping successfully deleted",
"text_6630e5923500e7015f190641": "Lago item mapping successfully updated",
"text_6630e5923500e7015f190643": "Lago item successfully mapped",
"text_6630e5923500e7015f1905dd": "Map the plan’s subscription fee with a NetSuite item",
"text_6630e5923500e7015f1905e7": "To link Lago subscription fees with NetSuite, please choose the corresponding subscription item in your NetSuite account.",
"text_6630e5923500e7015f1905bf": "Map {{billableMetricName}} with a NetSuite item",
"text_6630e5923500e7015f1905c3": "To link this billable metric with NetSuite, please choose the corresponding billable metric item in your NetSuite account.",
"text_6630e5923500e7015f1905d8": "Map the plan’s minimum commitments fee with a NetSuite item",
"text_6630e5923500e7015f1905dc": "To link Lago minimum commitment fees with NetSuite, please choose the corresponding minimum commitment item in your NetSuite account.",
"text_6630e5923500e7015f19061e": "Map the prepaid credits fee with a NetSuite item",
"text_6630e5923500e7015f190624": "To link Lago prepaid credits with NetSuite, please choose the corresponding prepaid credits item in your NetSuite account.",
"text_6630ea71a6c2ef00bc63006f": "Add-ons items",
"text_6630ea71a6c2ef00bc63006e": "Billable metrics items",
"text_6630ec823adac97d3bf0fb4b": "Items fetching can take time.",
"text_62f50d3cc15266f3bd1d83ce": "Infos copied to clipboard",
"text_62f50d26c989ab0319688498": "Environment information",
"text_62f50d26c989ab031968849a": "Use and share this information if you’re <a rel=\"external\" target=\"_blank\" href=\"https://github.com/getlago/lago-front/issues/new?labels=%F0%9F%90%9E+bug&template=bug.md&title=%5BBUG%5D\">reporting a bug to Lago</a>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const DeleteNetsuiteIntegrationDialog = forwardRef<DeleteNetsuiteIntegrat
update(cache) {
cache.evict({ id: `NetsuiteProvider:${netsuiteProvider?.id}` })
},
refetchQueries: ['getNetsuiteIntegrationsList'],
})

useImperativeHandle(ref, () => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import styled from 'styled-components'

import { Typography } from '~/components/designSystem'
import { useInternationalization } from '~/hooks/core/useInternationalization'
import { HEADER_TABLE_HEIGHT, theme } from '~/styles'

type TNetsuiteIntegrationItemHeaderProps = {
columnName: string
}

const NetsuiteIntegrationItemHeader = ({ columnName }: TNetsuiteIntegrationItemHeaderProps) => {
const { translate } = useInternationalization()

return (
<ItemHeader>
<Typography variant="bodyHl" color="grey500">
{columnName}
</Typography>
<Typography variant="bodyHl" color="grey500">
{translate('text_6630e3210c13c500cd398e97')}
</Typography>
</ItemHeader>
)
}

export default NetsuiteIntegrationItemHeader

const ItemHeader = styled.div`
height: ${HEADER_TABLE_HEIGHT}px;
padding: 0 ${theme.spacing(12)};
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: ${theme.shadows[7]};
background-color: ${theme.palette.grey[100]};
`
127 changes: 127 additions & 0 deletions src/components/settings/integrations/NetsuiteIntegrationItemLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { Stack } from '@mui/material'
import styled from 'styled-components'

import { Avatar, Icon, IconName, Skeleton, Typography } from '~/components/designSystem'
import { useInternationalization } from '~/hooks/core/useInternationalization'
import { NAV_HEIGHT, theme } from '~/styles'

const STATUS_SIZE = 12

type TNetsuiteIntegrationItemLineProps = {
description: string
icon: IconName
label: string
loading: boolean
mappingInfos?: {
id: string
name: string
}
onMappingClick?: () => void
}

const NetsuiteIntegrationItemLine = ({
description,
icon,
label,
loading,
mappingInfos,
onMappingClick,
}: TNetsuiteIntegrationItemLineProps) => {
const { translate } = useInternationalization()

if (loading) {
return (
<SkeletonWrapper>
<Stack direction="row" alignItems="center" gap={3} sx={{ flex: 1 }}>
<Skeleton variant="connectorAvatar" size="big" />
<Stack sx={{ flex: 1 }}>
<Skeleton variant="text" width={180} height={12} marginBottom={10} />
<Skeleton variant="text" width={80} height={12} />
</Stack>
</Stack>

<Skeleton variant="text" width={200} height={26} />
</SkeletonWrapper>
)
}

return (
<ItemLine onClick={onMappingClick}>
<Stack direction="row" alignItems="center" gap={3}>
<Avatar size="big" variant="connector">
<Icon name={icon} color="dark" />
</Avatar>

<Stack>
<Typography variant="bodyHl" color="grey700">
{label}
</Typography>
<Typography variant="caption" color="grey600">
{description}
</Typography>
</Stack>
</Stack>

<StatusContainer>
<svg height={STATUS_SIZE} width={STATUS_SIZE}>
<circle
cx="6"
cy="6"
r="6"
fill={!!mappingInfos ? theme.palette.success[600] : theme.palette.error[600]}
/>
</svg>

<Typography variant="captionHl" color="grey700">
{!!mappingInfos
? `${mappingInfos.name} (${mappingInfos.id})`
: translate('text_6630e3210c13c500cd398e9a')}
</Typography>
</StatusContainer>
</ItemLine>
)
}

export default NetsuiteIntegrationItemLine

const ItemLine = styled.div`
min-height: ${NAV_HEIGHT}px;
padding: ${theme.spacing(3)} ${theme.spacing(12)};
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: ${theme.shadows[7]};
cursor: pointer;
&:hover {
background-color: ${theme.palette.grey[100]};
}
`

const SkeletonWrapper = styled.div`
height: ${NAV_HEIGHT}px;
padding: ${theme.spacing(3)} ${theme.spacing(12)};
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: ${theme.shadows[7]};
`

const StatusContainer = styled.div`
display: flex;
align-items: center;
background-color: ${theme.palette.grey[100]};
padding: ${theme.spacing(1)} ${theme.spacing(2)};
box-sizing: border-box;
border-radius: ${theme.shape.borderRadius}px;
min-height: ${theme.spacing(8)};
gap: ${theme.spacing(2)};
outline: 1px solid ${theme.palette.grey[300]};
outline-offset: -1px;
svg {
flex-shrink: 0;
}
`
13 changes: 0 additions & 13 deletions src/components/settings/integrations/NetsuiteIntegrationItems.tsx

This file was deleted.

Loading

0 comments on commit 533245e

Please sign in to comment.