Skip to content
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

feat(tp): unsubscribe from marketing emails on TP #986

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ export class TpJobseekerProfilePatchInput extends PartialType(
'topSkills',
'willingToRelocate',
'immigrationStatus',
'isSubscribedToTPMarketingEmails',
] as const)
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ const formLanguages = Object.entries(LANGUAGES).map(([value, label]) => ({
value,
label,
}))
console.log(formLanguages)

const formLanguageProficiencyLevels = languageProficiencyLevels.map(
({ id, label }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const LoggedIn = ({ children, hideNavigation }: Props) => {
return undefined
}
})()
console.log('logging current user as type', userType)

if ((window as any).hj) {
;(window as any).hj(
'identify',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ export function JobseekerProfileForJobseekerEyes() {
queryClient.invalidateQueries()
}

const onSubscribeToMarketingEmailsChange = async () => {
await mutation.mutateAsync({
input: {
isSubscribedToTPMarketingEmails:
!profile?.isSubscribedToTPMarketingEmails,
},
})
queryClient.invalidateQueries()
}

/**
* Job Fair Boolean Field(s)
* Uncomment & Rename (joins{Location}{Year}{Season}JobFair) the next method when there's an upcoming Job Fair
Expand Down Expand Up @@ -130,6 +140,12 @@ export function JobseekerProfileForJobseekerEyes() {
>
Hide my profile from companies
</Checkbox>
<Checkbox
checked={profile?.isSubscribedToTPMarketingEmails}
customOnChange={onSubscribeToMarketingEmailsChange}
>
Subscribe to marketing emails
</Checkbox>
</Columns.Column>
</Columns>
</LoggedIn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class TpJobseekerDirectoryEntryEntityProps implements EntityProps {
willingToRelocate: boolean
@Field((type) => ImmigrationStatus)
immigrationStatus?: ImmigrationStatus
isSubscribedToTPMarketingEmails: boolean

@Field((type) => [TpJobseekerProfileExperienceRecordEntityProps])
experience?: Array<TpJobseekerProfileExperienceRecordEntityProps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export class TpJobseekerDirectoryEntryMapper
jobseekerProfileRecord.Immigration_Status__c as unknown as
| ImmigrationStatus
| undefined
props.isSubscribedToTPMarketingEmails =
jobseekerProfileRecord.Subscribed_to_TP_Marketing_Emails__c

props.updatedAt = jobseekerProfileRecord.LastModifiedDate
props.createdAt = jobseekerProfileRecord.CreatedDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class TpJobseekerDirectoryEntryRecord extends Record<TpJobseekerDirectory
'Federal_State__c',
'Willing_to_Relocate__c',
'Immigration_Status__c',
'Subscribed_to_TP_Marketing_Emails__c',
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class JobseekerProfileItem {
Federal_State__c?: PicklistValue
Willing_to_Relocate__c: boolean
Immigration_Status__c?: PicklistValue
Subscribed_to_TP_Marketing_Emails__c: boolean
}

class JobseekerLanguageItemsWrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class TpJobseekerProfileEntityProps implements EntityProps {
willingToRelocate: boolean
@Field((type) => ImmigrationStatus)
immigrationStatus?: ImmigrationStatus
isSubscribedToTPMarketingEmails: boolean

@Field(() => ID)
userId: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class TpJobseekerProfileMapper
props.immigrationStatus = raw.props.Immigration_Status__c as unknown as
| ImmigrationStatus
| undefined
props.isSubscribedToTPMarketingEmails =
raw.props.Subscribed_to_TP_Marketing_Emails__c

props.userId = raw.props.Contact__c

Expand Down Expand Up @@ -90,6 +92,8 @@ export class TpJobseekerProfileMapper
*/
// props.Joins_Munich_24_Summer_Job_Fair__c = source.props.joinsMunich24SummerJobFair
props.Is_Visible_to_Companies__c = source.props.isProfileVisibleToCompanies
props.Subscribed_to_TP_Marketing_Emails__c =
source.props.isSubscribedToTPMarketingEmails
props.Federal_State__c = source.props.federalState
props.Willing_to_Relocate__c = source.props.willingToRelocate
props.Immigration_Status__c = source.props.immigrationStatus as unknown as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class TpJobseekerProfileRecord extends Record<TpJobseekerProfileRecordPro
'Federal_State__c',
'Willing_to_Relocate__c',
'Immigration_Status__c',
'Subscribed_to_TP_Marketing_Emails__c',
'Contact__c',
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class TpJobseekerProfileRecordProps implements RecordProps {
Federal_State__c?: PicklistValue
Willing_to_Relocate__c: boolean
Immigration_Status__c?: PicklistValue
Subscribed_to_TP_Marketing_Emails__c: boolean
Contact__c: string

public static create(rawProps: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type TpJobseekerDirectoryEntriesFindAllVisibleQueryVariables = Types.Exac
}>;


export type TpJobseekerDirectoryEntriesFindAllVisibleQuery = { __typename?: 'Query', tpJobseekerDirectoryEntriesVisible: Array<{ __typename?: 'TpJobseekerDirectoryEntry', aboutYourself?: string | null, federalState?: Types.FederalState | null, firstName: string, fullName: string, genderPronouns?: string | null, githubUrl?: string | null, id: string, ifAvailabilityIsDate_date?: any | null, availability?: Types.TpAvailabilityOption | null, isProfileVisibleToCompanies: boolean, lastName: string, linkedInUrl?: string | null, location?: string | null, loopbackUserId: string, personalWebsite?: string | null, postalMailingAddress?: string | null, profileAvatarImageS3Key?: string | null, rediLocation?: string | null, behanceUrl?: string | null, stackOverflowUrl?: string | null, state: Types.JobseekerProfileStatus, telephoneNumber?: string | null, topSkills?: Array<Types.TpTechnicalSkill> | null, twitterUrl?: string | null, updatedAt: any, userId: string, willingToRelocate: boolean, createdAt: any, desiredEmploymentType?: Array<Types.TpEmploymentType> | null, desiredPositions?: Array<Types.TpDesiredPosition> | null, dribbbleUrl?: string | null, email: string, immigrationStatus?: Types.ImmigrationStatus | null, experience?: Array<{ __typename?: 'TpJobseekerProfileExperienceRecord', city?: string | null, sortIndex: number, company?: string | null, country?: string | null, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, startDateMonth?: number | null, startDateYear?: number | null, title?: string | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null, workingLanguages?: Array<{ __typename?: 'TpJobseekerProfileLanguageRecord', id: string, userId: string, language: Types.Language, proficiencyLevelId: Types.LanguageProficiencyLevel }> | null, education?: Array<{ __typename?: 'TpJobseekerProfileEducationRecord', certificationType?: Types.TpEducationCertificationType | null, title?: string | null, sortIndex: number, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, institutionCity?: string | null, institutionCountry?: string | null, institutionName?: string | null, startDateMonth?: number | null, startDateYear?: number | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null }> };
export type TpJobseekerDirectoryEntriesFindAllVisibleQuery = { __typename?: 'Query', tpJobseekerDirectoryEntriesVisible: Array<{ __typename?: 'TpJobseekerDirectoryEntry', aboutYourself?: string | null, federalState?: Types.FederalState | null, firstName: string, fullName: string, genderPronouns?: string | null, githubUrl?: string | null, id: string, ifAvailabilityIsDate_date?: any | null, availability?: Types.TpAvailabilityOption | null, isProfileVisibleToCompanies: boolean, isSubscribedToTPMarketingEmails: boolean, lastName: string, linkedInUrl?: string | null, location?: string | null, loopbackUserId: string, personalWebsite?: string | null, postalMailingAddress?: string | null, profileAvatarImageS3Key?: string | null, rediLocation?: string | null, behanceUrl?: string | null, stackOverflowUrl?: string | null, state: Types.JobseekerProfileStatus, telephoneNumber?: string | null, topSkills?: Array<Types.TpTechnicalSkill> | null, twitterUrl?: string | null, updatedAt: any, userId: string, willingToRelocate: boolean, createdAt: any, desiredEmploymentType?: Array<Types.TpEmploymentType> | null, desiredPositions?: Array<Types.TpDesiredPosition> | null, dribbbleUrl?: string | null, email: string, immigrationStatus?: Types.ImmigrationStatus | null, experience?: Array<{ __typename?: 'TpJobseekerProfileExperienceRecord', city?: string | null, sortIndex: number, company?: string | null, country?: string | null, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, startDateMonth?: number | null, startDateYear?: number | null, title?: string | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null, workingLanguages?: Array<{ __typename?: 'TpJobseekerProfileLanguageRecord', id: string, userId: string, language: Types.Language, proficiencyLevelId: Types.LanguageProficiencyLevel }> | null, education?: Array<{ __typename?: 'TpJobseekerProfileEducationRecord', certificationType?: Types.TpEducationCertificationType | null, title?: string | null, sortIndex: number, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, institutionCity?: string | null, institutionCountry?: string | null, institutionName?: string | null, startDateMonth?: number | null, startDateYear?: number | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null }> };


export const TpJobseekerDirectoryEntriesFindAllVisibleDocument = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type TpJobseekerDirectoryEntriesFindOneVisibleQueryVariables = Types.Exac
}>;


export type TpJobseekerDirectoryEntriesFindOneVisibleQuery = { __typename?: 'Query', tpJobseekerDirectoryEntryVisible: { __typename?: 'TpJobseekerDirectoryEntry', aboutYourself?: string | null, federalState?: Types.FederalState | null, firstName: string, fullName: string, genderPronouns?: string | null, githubUrl?: string | null, id: string, ifAvailabilityIsDate_date?: any | null, availability?: Types.TpAvailabilityOption | null, isProfileVisibleToCompanies: boolean, lastName: string, linkedInUrl?: string | null, location?: string | null, loopbackUserId: string, personalWebsite?: string | null, postalMailingAddress?: string | null, profileAvatarImageS3Key?: string | null, rediLocation?: string | null, behanceUrl?: string | null, stackOverflowUrl?: string | null, state: Types.JobseekerProfileStatus, telephoneNumber?: string | null, topSkills?: Array<Types.TpTechnicalSkill> | null, twitterUrl?: string | null, updatedAt: any, userId: string, willingToRelocate: boolean, createdAt: any, desiredEmploymentType?: Array<Types.TpEmploymentType> | null, desiredPositions?: Array<Types.TpDesiredPosition> | null, dribbbleUrl?: string | null, email: string, immigrationStatus?: Types.ImmigrationStatus | null, experience?: Array<{ __typename?: 'TpJobseekerProfileExperienceRecord', city?: string | null, sortIndex: number, company?: string | null, country?: string | null, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, startDateMonth?: number | null, startDateYear?: number | null, title?: string | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null, workingLanguages?: Array<{ __typename?: 'TpJobseekerProfileLanguageRecord', id: string, userId: string, language: Types.Language, proficiencyLevelId: Types.LanguageProficiencyLevel }> | null, education?: Array<{ __typename?: 'TpJobseekerProfileEducationRecord', certificationType?: Types.TpEducationCertificationType | null, title?: string | null, sortIndex: number, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, institutionCity?: string | null, institutionCountry?: string | null, institutionName?: string | null, startDateMonth?: number | null, startDateYear?: number | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null } };
export type TpJobseekerDirectoryEntriesFindOneVisibleQuery = { __typename?: 'Query', tpJobseekerDirectoryEntryVisible: { __typename?: 'TpJobseekerDirectoryEntry', aboutYourself?: string | null, federalState?: Types.FederalState | null, firstName: string, fullName: string, genderPronouns?: string | null, githubUrl?: string | null, id: string, ifAvailabilityIsDate_date?: any | null, availability?: Types.TpAvailabilityOption | null, isProfileVisibleToCompanies: boolean, isSubscribedToTPMarketingEmails: boolean, lastName: string, linkedInUrl?: string | null, location?: string | null, loopbackUserId: string, personalWebsite?: string | null, postalMailingAddress?: string | null, profileAvatarImageS3Key?: string | null, rediLocation?: string | null, behanceUrl?: string | null, stackOverflowUrl?: string | null, state: Types.JobseekerProfileStatus, telephoneNumber?: string | null, topSkills?: Array<Types.TpTechnicalSkill> | null, twitterUrl?: string | null, updatedAt: any, userId: string, willingToRelocate: boolean, createdAt: any, desiredEmploymentType?: Array<Types.TpEmploymentType> | null, desiredPositions?: Array<Types.TpDesiredPosition> | null, dribbbleUrl?: string | null, email: string, immigrationStatus?: Types.ImmigrationStatus | null, experience?: Array<{ __typename?: 'TpJobseekerProfileExperienceRecord', city?: string | null, sortIndex: number, company?: string | null, country?: string | null, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, startDateMonth?: number | null, startDateYear?: number | null, title?: string | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null, workingLanguages?: Array<{ __typename?: 'TpJobseekerProfileLanguageRecord', id: string, userId: string, language: Types.Language, proficiencyLevelId: Types.LanguageProficiencyLevel }> | null, education?: Array<{ __typename?: 'TpJobseekerProfileEducationRecord', certificationType?: Types.TpEducationCertificationType | null, title?: string | null, sortIndex: number, current?: boolean | null, description?: string | null, endDateMonth?: number | null, endDateYear?: number | null, institutionCity?: string | null, institutionCountry?: string | null, institutionName?: string | null, startDateMonth?: number | null, startDateYear?: number | null, createdAt: any, id: string, tpJobseekerProfileId: string, updatedAt: any, userId: string }> | null } };


export const TpJobseekerDirectoryEntriesFindOneVisibleDocument = `
Expand Down
Loading
Loading