Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ workflows:
- dev
- justin_fixes
- talent_search_fixes
- PROD-4398_integrate-userflow-remove-sprig

- deployQa:
context: org-global
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.26",
"turndown": "^4.0.2",
"typescript": "^4.8.4",
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9e62ddc61d",
"universal-navigation": "https://github.com/topcoder-platform/universal-navigation#9fc50d938be7182",
"uuid": "^9.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/accounts/src/config/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SPRIG_CES_SURVEY_ID = 'onAccountSettingsUpdate'
export const CES_SURVEY_ID = '3e704fe0-dff4-4af4-abee-383ed162729e'
2 changes: 1 addition & 1 deletion src/apps/accounts/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './accounts-swr'
export * from './components'
export * from './assets'
export * from './sprig-survey'
export * from './userflow-survey'
8 changes: 0 additions & 8 deletions src/apps/accounts/src/lib/sprig-survey.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/apps/accounts/src/lib/userflow-survey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { TcUniNavFn } from 'universal-navigation'

import { CES_SURVEY_ID } from '../config'

declare let tcUniNav: TcUniNavFn

export function triggerSurvey(): void {
tcUniNav('triggerFlow', CES_SURVEY_ID, {})
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Dispatch, FC, SetStateAction, useState } from 'react'

import { BaseModal, Button, Collapsible } from '~/libs/ui'
import { authUrlLogout, updatePrimaryMemberRoleAsync, UserProfile } from '~/libs/core'
import { triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { triggerSurvey } from '~/apps/accounts/src/lib'

import styles from './AccountRole.module.scss'

Expand Down Expand Up @@ -36,7 +36,7 @@ const AccountRole: FC<AccountRoleProps> = (props: AccountRoleProps) => {
.then(() => {
setMemberRole(newRole)
setIsRoleChangeConfirmed(true)
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.finally(() => {
setIsUpdating(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
useCountryLookup,
UserProfile,
} from '~/libs/core'
import { triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { triggerSurvey } from '~/apps/accounts/src/lib'

import styles from './MemberAddress.module.scss'

Expand Down Expand Up @@ -88,7 +88,7 @@ const MemberAddress: FC<MemberAddressProps> = (props: MemberAddressProps) => {
.then(() => {
toast.success('Your account has been updated.', { position: toast.POSITION.BOTTOM_RIGHT })
setFormErrors({})
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Something went wrong. Please try again.', { position: toast.POSITION.BOTTOM_RIGHT })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { KeyedMutator } from 'swr'
import { noop } from 'lodash'

import { Button, Collapsible, FormToggleSwitch, IconSolid, Tooltip } from '~/libs/ui'
import { diceIdLogo, MFAImage, SettingSection, triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { diceIdLogo, MFAImage, SettingSection, triggerSurvey } from '~/apps/accounts/src/lib'
import { MemberMFAStatus, updateMemberMFAStatusAsync, useMemberMFAStatus, UserProfile } from '~/libs/core'

import { DiceSetupModal } from './dice-setup-modal'
Expand Down Expand Up @@ -39,7 +39,7 @@ const Security: FC<SecurityProps> = (props: SecurityProps) => {
.then(() => {
setMFAEnabled(!mfaEnabled)
toast.success('Your Multi Factor Authentication (MFA) status was updated.')
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Something went wrong. Please try again later.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
UserTrait,
UserTraits,
} from '~/libs/core'
import { SettingSection, triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { SettingSection, triggerSurvey } from '~/apps/accounts/src/lib'

import { UserAndPassFromConfig } from './user-and-pass.form.config'
import styles from './UserAndPassword.module.scss'
Expand Down Expand Up @@ -82,7 +82,7 @@ const UserAndPassword: FC<UserAndPasswordProps> = (props: UserAndPasswordProps)
setUserConsent(!userConsent)
mutateTraits()
toast.success('User consent updated successfully.')
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Failed to update user consent.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MemberEmailPreferenceAPI, updateMemberEmailPreferencesAsync, useMemberE
import { Button, FormToggleSwitch, LoadingSpinner } from '~/libs/ui'
import { EnvironmentConfig } from '~/config'

import { EmailIcon, ForumIcon, SettingSection, triggerSprigSurvey } from '../../../lib'
import { EmailIcon, ForumIcon, SettingSection, triggerSurvey } from '../../../lib'

import { newsletters, programs, subscribeLink, unsubscribeLink } from './preferences.config'
import styles from './PreferencesTab.module.scss'
Expand Down Expand Up @@ -43,7 +43,7 @@ const PreferencesTab: FC<PreferencesTabProps> = (props: PreferencesTabProps) =>
.then(() => {
toast.success('Your email preferences ware updated.')
mutateEmailPreferencesData()
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Something went wrong. Please try again later.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toast } from 'react-toastify'

import { updateOrCreateMemberTraitsAsync, useMemberTraits, UserProfile, UserTraits } from '~/libs/core'
import { Button, Collapsible, FormToggleSwitch } from '~/libs/ui'
import { triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { triggerSurvey } from '~/apps/accounts/src/lib'

import { communitiesConfig } from './communities-config'
import styles from './Communities.module.scss'
Expand Down Expand Up @@ -49,7 +49,7 @@ const Communities: FC<CommunitiesProps> = (props: CommunitiesProps) => {
setMemberCommunities(updatedCommunities)
mutateTraits()
toast.success('Communities updated successfully.')
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Failed to update user Communities.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DesignTrackIcon,
DevelopmentTrackIcon,
SettingSection,
triggerSprigSurvey,
triggerSurvey,
} from '~/apps/accounts/src/lib'

import styles from './Tracks.module.scss'
Expand Down Expand Up @@ -54,7 +54,7 @@ const Tracks: FC<TracksProps> = (props: TracksProps) => {
} as any,
})
toast.success('Your profile has been updated.')
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Failed to update your profile.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
SettingSection,
SmartphoneIcon,
TabletIcon,
triggerSprigSurvey,
triggerSurvey,
WearableIcon,
} from '~/apps/accounts/src/lib'

Expand Down Expand Up @@ -172,7 +172,7 @@ const Devices: FC<DevicesProps> = (props: DevicesProps) => {
.then(() => {
toast.success('Device deleted successfully')
setDeviceTypesData(updatedDeviceTypesData)
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error deleting Device')
Expand Down Expand Up @@ -278,7 +278,7 @@ const Devices: FC<DevicesProps> = (props: DevicesProps) => {
...updatedDeviceTypesData || [],
deviceUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error updating Device')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
OtherServiceProviderIcon,
SettingSection,
TelevisionServiceProviderIcon,
triggerSprigSurvey,
triggerSurvey,
} from '~/apps/accounts/src/lib'

import { serviceProviderTypes } from './service-provider-types.config'
Expand Down Expand Up @@ -151,7 +151,7 @@ const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps)
...updatedServiceProviderTypesData || [],
serviceProviderTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error updating Service Provider')
Expand Down Expand Up @@ -180,7 +180,7 @@ const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps)
...serviceProviderTypesData || [],
serviceProviderTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error adding new Service Provider')
Expand Down Expand Up @@ -220,7 +220,7 @@ const ServiceProvider: FC<ServiceProviderProps> = (props: ServiceProviderProps)
.then(() => {
toast.success('Service Provider deleted successfully')
setServiceProviderTypesData(updatedServiceProviderTypesData)
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error deleting Service Provider')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames'

import { updateMemberTraitsAsync, updateOrCreateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
import { Button, Collapsible, ConfirmModal, IconOutline, InputSelect, InputText } from '~/libs/ui'
import { SettingSection, SoftwareIcon, triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { SettingSection, SoftwareIcon, triggerSurvey } from '~/apps/accounts/src/lib'

import { softwareTypes } from './software-types.config'
import styles from './Software.module.scss'
Expand Down Expand Up @@ -139,7 +139,7 @@ const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
...updatedSoftwareTypesData || [],
softwareTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error updating software')
Expand Down Expand Up @@ -168,7 +168,7 @@ const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
...softwareTypesData || [],
softwareTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error adding new software')
Expand Down Expand Up @@ -208,7 +208,7 @@ const Software: FC<SoftwareProps> = (props: SoftwareProps) => {
.then(() => {
toast.success('Software deleted successfully')
setSoftwareTypesData(updatedSoftwareTypesData)
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error deleting software')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames'

import { updateMemberTraitsAsync, updateOrCreateMemberTraitsAsync, UserProfile, UserTrait } from '~/libs/core'
import { Button, Collapsible, ConfirmModal, IconOutline, InputText } from '~/libs/ui'
import { SettingSection, SubscriptionsIcon, triggerSprigSurvey } from '~/apps/accounts/src/lib'
import { SettingSection, SubscriptionsIcon, triggerSurvey } from '~/apps/accounts/src/lib'

import styles from './Subscriptions.module.scss'

Expand Down Expand Up @@ -124,7 +124,7 @@ const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
...updatedSubscriptionsTypesData || [],
softwareTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error updating subscription')
Expand Down Expand Up @@ -153,7 +153,7 @@ const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
...subscriptionsTypesData || [],
softwareTypeUpdate,
])
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error adding new subscription')
Expand Down Expand Up @@ -193,7 +193,7 @@ const Subscriptions: FC<SubscriptionsProps> = (props: SubscriptionsProps) => {
.then(() => {
toast.success('Subscription deleted successfully')
setSubscriptionsTypesData(updatedSubscriptionsTypesData)
triggerSprigSurvey(props.profile)
triggerSurvey()
})
.catch(() => {
toast.error('Error deleting subscription')
Expand Down
45 changes: 1 addition & 44 deletions src/apps/learn/src/free-code-camp/FreeCodeCamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ import {
ProfileContextData,
UserRole,
} from '~/libs/core'
import { sprigTriggerForUser, textFormatGetSafeString } from '~/libs/shared'
import { textFormatGetSafeString } from '~/libs/shared'

import {
CoursesProviderData,
LearnLesson,
LearnModule,
LearnModuleProgress,
LearnModuleStatus,
LearnUserCertificationProgress,
LessonProviderData,
PageTitle,
Expand Down Expand Up @@ -275,19 +274,13 @@ const FreeCodeCamp: FC<{}> = () => {
return
}

// get the current module as it exists before it's completed
const currentModule: LearnModuleProgress | undefined = getModuleFromProgress(certificateProgress)
const certWasInProgress: boolean = currentModule?.moduleStatus !== LearnModuleStatus.completed

userCertificationProgressUpdateAsync(
certificateProgress.id,
UserCertificationUpdateProgressActions.completeLesson,
currentLesson,
)
.then((progress: LearnUserCertificationProgress) => {
setCertificateProgress(progress)
handleSurvey(certWasInProgress, progress)

})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, 30), [
Expand All @@ -296,42 +289,6 @@ const FreeCodeCamp: FC<{}> = () => {
moduleParam,
])

function getModuleFromProgress(certProgress: LearnUserCertificationProgress):
LearnModuleProgress | undefined {

return certProgress.moduleProgresses.find(m => m.module === moduleParam)
}

function handleSurvey(certWasInProgress: boolean, progress: LearnUserCertificationProgress): void {

// if the current module wasn't in progress, there's nothing to do
if (!certWasInProgress) {
return
}

// if the updated module isn't completed now, there's nothing to do
const moduleResult: LearnModuleProgress | undefined = getModuleFromProgress(progress)
if (moduleResult?.moduleStatus !== LearnModuleStatus.completed) {
return
}

// if there are any other modules that have been completed, there's nothing to do
if (progress.moduleProgresses
.some(m => m.module !== moduleParam && m.moduleStatus === LearnModuleStatus.completed)
) {
return
}

// This is the last lesson to be completed in the first module completed,
// so it's time to trigger the survey

// NOTE: We have to add a delay, otherwise the survey closes when the user
// is automatically redirected to the next lesson.
setTimeout(() => {
sprigTriggerForUser('TCA First Module Completed', profile?.userId)
}, 1000)
}

/**
* Handle the navigation away from the last step of the course in the FCC frame
* @returns
Expand Down
3 changes: 0 additions & 3 deletions src/apps/platform/src/components/app-header/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ const AppHeader: FC<{}> = () => {
navElementId,
{
handleNavigation: navigationHandler,
integrations: {
sprig: 'disable',
},
onReady() { setReady(true) },
showSalesCta: routeNavConfigs?.showSalesCta,
signIn() { window.location.href = authUrlLogin() },
Expand Down
Loading