Skip to content

Commit

Permalink
[EN-6393] feat(form-inscription): add mail ts
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulEntourage committed Oct 4, 2023
1 parent 4799970 commit 40e1fb8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/contacts/contacts.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const HeardAbout = {
SPORTS: 'sports',
VOLUNTEER: 'volunteer',
CONTACT: 'contact',
ORIENTATION: 'orientation',
OTHER: 'other',
} as const;

Expand Down Expand Up @@ -47,6 +48,10 @@ export const HeardAboutFilters: FilterConstant<HeardAboutValue>[] = [
label: 'Le bouche à oreille',
value: HeardAbout.CONTACT,
},
{
label: 'Par mon travailleur social/Pôle emploi',
value: HeardAbout.ORIENTATION,
},
{
label: 'Autre',
value: HeardAbout.OTHER,
Expand Down
5 changes: 5 additions & 0 deletions src/contacts/dto/inscription-candidate-form.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ export class InscriptionCandidateFormDto {
@ApiProperty()
@IsString()
workingRight: CandidateYesNoNSPPValue;

@ApiProperty()
@IsString()
@IsOptional()
tsPrescripteur: string;
}
6 changes: 6 additions & 0 deletions src/external-services/salesforce/salesforce.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ export class SalesforceService {
heardAbout,
diagnostic,
contactWithCoach,
tsPrescripteur,
}: CandidateAndWorkerLeadProps) {
const department = getDepartmentFromPostalCode(postalCode);

Expand Down Expand Up @@ -935,6 +936,7 @@ export class SalesforceService {
diagnostic,
zone,
associationSfId,
tsPrescripteur,
};

try {
Expand Down Expand Up @@ -968,10 +970,13 @@ export class SalesforceService {
location,
phone,
workingRight,
tsPrescripteur
}: CandidateInscriptionLeadProps) {
const department = getDepartmentFromPostalCode(location);
const zone = getZoneFromDepartment(department);

console.log(tsPrescripteur);

const leadToCreate = {
firstName,
lastName,
Expand All @@ -981,6 +986,7 @@ export class SalesforceService {
workingRight,
heardAbout,
zone,
tsPrescripteur,
autreSource: 'Formulaire_Sourcing_Page_Travailler',
} as const;
const leadId = (await this.createCandidateLead(leadToCreate)) as string;
Expand Down
5 changes: 5 additions & 0 deletions src/external-services/salesforce/salesforce.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export const LeadHeardAbout: { [K in HeardAboutValue]: string } = {
[HeardAbout.SOCIAL]: 'Autres réseaux (facebook, twitter, instagram...)',
[HeardAbout.SPORTS]: 'Un partenariat sportif',
[HeardAbout.VOLUNTEER]: 'Un site de bénévolat',
[HeardAbout.ORIENTATION]: 'Par mon travailleur social/Pôle emploi',
[HeardAbout.CONTACT]: 'Le bouche à oreille',
[HeardAbout.OTHER]: 'Autre',
} as const;
Expand Down Expand Up @@ -586,6 +587,7 @@ export interface CandidateLeadProps {
heardAbout?: string;
location?: string;
autreSource?: 'Formulaire_Sourcing_Page_Travailler';
tsPrescripteur: string;
}

export interface CoachLeadProps {
Expand Down Expand Up @@ -620,6 +622,7 @@ export interface CandidateInscriptionLeadProps {
location: string;
phone: string;
workingRight: CandidateYesNoNSPPValue;
tsPrescripteur: string;
}

export interface CandidateAndWorkerLeadProps {
Expand Down Expand Up @@ -654,6 +657,7 @@ export interface CandidateAndWorkerLeadProps {
heardAbout: HeardAboutValue;
diagnostic?: string;
contactWithCoach?: boolean;
tsPrescripteur?: string;
}

export interface CandidateSalesforceLead {
Expand Down Expand Up @@ -691,6 +695,7 @@ export interface CandidateSalesforceLead {
Antenne__c: string;
Source__c: 'Lead entrant';
Autre_source_LinkedOut__c: 'Formulaire_Sourcing_Page_Travailler';
TS_du_Candidat__c: string;
}

export interface WorkerSalesforceLead {
Expand Down
3 changes: 3 additions & 0 deletions src/external-services/salesforce/salesforce.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export function mapSalesforceLeadFields<T extends LeadRecordType>(
leadProps: LeadProp<T>,
recordType: AnyCantFix
): SalesforceLeads[T] {

const { firstName, lastName, email, phone, zone } = leadProps;

const commonFields = {
Expand Down Expand Up @@ -453,6 +454,7 @@ export function mapSalesforceLeadFields<T extends LeadRecordType>(
workerSfIdAsContact,
associationSfId,
autreSource,
tsPrescripteur,
} = leadProps;

const parsedAddress = parseAddress(address);
Expand All @@ -468,6 +470,7 @@ export function mapSalesforceLeadFields<T extends LeadRecordType>(
Genre__c: formatSalesforceValue<CandidateGender>(gender, LeadGender),
Date_de_naissance__c: birthDate,
Autre_source_LinkedOut__c: autreSource,
TS_du_Candidat__c: tsPrescripteur,
Accompagnement_social__c: formatSalesforceValue<CandidateHelpWithValue>(
helpWith,
LeadHelpWith
Expand Down

0 comments on commit 40e1fb8

Please sign in to comment.