The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { isDefined } from 'twenty-shared/utils';
export const getReconnectedStepIds = ({
nextStepIds,
oldTargetId,
newTargetId,
}: {
nextStepIds: string[] | null | undefined;
oldTargetId: string;
newTargetId: string;
}): string[] | undefined => {
if (
!isDefined(nextStepIds) ||
!nextStepIds.includes(oldTargetId) ||
nextStepIds.includes(newTargetId)
) {
return undefined;
}
return nextStepIds.map((stepId) =>
stepId === oldTargetId ? newTargetId : stepId,
);
};