Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -18,7 +18,6 @@ import {
DefaultMemberIcon,
IconOutline,
LinkButton,
VerifiedMemberBadge,
} from '~/libs/ui'
import { EnvironmentConfig } from '~/config'
import { UserProfile } from '~/libs/core'
Expand Down Expand Up @@ -61,7 +60,6 @@ export interface HiringManagerViewProps {
completionUuid?: string
isPreview?: boolean
isModalView?: boolean
isMemberVerified?: boolean
isOwner?: boolean
userProfile?: UserProfile
userName?: string
Expand Down Expand Up @@ -182,11 +180,6 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
<div className={styles.memberInfo}>
<p className='body-large-bold'>{props.userName}</p>
<p className='body-large-medium'>{props.userProfile.handle}</p>
{
props.isMemberVerified ? (
<VerifiedMemberBadge />
) : undefined
}
</div>
</div>
<div className={styles.certTitle}>{props.certification.title}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {
Dispatch,
FC,
MutableRefObject,
SetStateAction,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from 'react'
import { useSearchParams } from 'react-router-dom'

import { LoadingSpinner } from '~/libs/ui'
import {
getVerificationStatusAsync,
UserProfile,
} from '~/libs/core'

Expand Down Expand Up @@ -51,20 +46,8 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
: props.enrollment?.userName
), [props.profile, props.enrollment])

const [isMemberVerified, setIsMemberVerified]: [boolean, Dispatch<SetStateAction<boolean>>]
= useState<boolean>(false)

const validationUrl: string = getTCACertificationValidationUrl(props.enrollment?.completionUuid as string)

useEffect(() => {
if (!props.enrollment?.userHandle) {
return
}

getVerificationStatusAsync(props.enrollment?.userHandle)
.then(verified => setIsMemberVerified(verified))
}, [props.enrollment])

useLayoutEffect(() => {
const el: HTMLElement = elRef.current
if (!el || !isModalView) {
Expand Down Expand Up @@ -99,7 +82,6 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
certification={props.certification}
completedAt={(props.enrollment.completedAt ?? undefined) as string}
completionUuid={props.enrollment.completionUuid ?? undefined}
isMemberVerified={isMemberVerified}
userProfile={props.profile}
userName={userName}
isOwner={isOwnProfile}
Expand Down
1 change: 0 additions & 1 deletion src/libs/core/lib/profile/profile-functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export {
getLoggedInAsync as profileGetLoggedInAsync,
getMemberStatsAsync,
getPublicAsync as profileGetPublicAsync,
getVerificationStatusAsync,
editNameAsync as profileEditNameAsync,
updatePrimaryMemberRoleAsync,
updateMemberEmailPreferencesAsync,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export {
get as profileStoreGet,
patchName as profileStorePatchName,
getMemberStats,
getVerification,
} from './profile-xhr.store'

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import { UserEmailPreferences } from '../../user-email-preference.model'
import { UserProfile } from '../../user-profile.model'
import { UserStats } from '../../user-stats.model'
import { UserTraits } from '../../user-traits.model'
import { UserVerify } from '../../user-verify.model'

import {
countryLookupURL,
memberEmailPreferencesURL,
memberModifyURL,
profile as profileUrl,
verify as verifyUrl,
} from './profile-endpoint.config'

export function get(handle: string): Promise<UserProfile> {
Expand All @@ -29,11 +27,6 @@ export function patchName(handle: string, request: EditNameRequest): Promise<Use
return xhrPutAsync<EditNameRequest, UserProfile>(profileUrl(handle), request)
}

// reads from looker where member verified status is stored
export function getVerification(): Promise<UserVerify[]> {
return xhrGetAsync<UserVerify[]>(verifyUrl())
}

export function getMemberStats(handle: string): Promise<UserStats | undefined> {
return xhrGetAsync<UserStats[]>(`${profileUrl(handle)}/stats`)
.then(stats => (!stats.length ? undefined : stats[0]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { UserEmailPreferences } from '../user-email-preference.model'
import { UserProfile } from '../user-profile.model'
import { UserStats } from '../user-stats.model'
import { UserTrait, UserTraits } from '../user-traits.model'
import { UserVerify } from '../user-verify.model'

import { profileFactoryCreate } from './profile-factory'
import { getMemberStats, getVerification, profileStoreGet, profileStorePatchName } from './profile-store'
import { getMemberStats, profileStoreGet, profileStorePatchName } from './profile-store'
import {
createMemberTraits,
deleteMemberTrait,
Expand Down Expand Up @@ -58,31 +57,6 @@ export async function editNameAsync(handle: string, profile: EditNameRequest): P
return profileStorePatchName(handle, profile)
}

export async function getVerificationStatusAsync(handle: string): Promise<boolean> {

// get verification statuses
// in DEV this looker API is mocked data response
const verfiedMembers: UserVerify[] = await getVerification()

// filter by member
return verfiedMembers.some(member => {
let isVerified: boolean = false
if (member['user.handle'] && member['user.handle'].toLowerCase() === handle.toLowerCase()) {
isVerified = true
}

// On DEV we have a mocked data response with silghtly different structure
if (
member['member_verification_dev.handle']
&& member['member_verification_dev.handle'].toLowerCase() === handle.toLowerCase()
) {
isVerified = true
}

return isVerified
})
}

export async function getMemberStatsAsync(handle: string): Promise<UserStats | undefined> {
return getMemberStats(handle)
}
Expand Down
Loading