Skip to content

Commit d03b35a

Browse files
Merge pull request #446 from topcoder-platform/TCA-832_release
TCA-832 2.4 TCA Survey Release - 2022-12-14 -> master
2 parents 380e6ff + a3251b9 commit d03b35a

File tree

16 files changed

+186
-56
lines changed

16 files changed

+186
-56
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install_dependency: &install_dependency
2828
install_deploysuite: &install_deploysuite
2929
name: Installation of install_deploysuite.
3030
command: |
31-
git clone --branch v1.4.12 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
31+
git clone --branch v1.4.13 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
3232
cp ./../buildscript/master_deploy.sh .
3333
cp ./../buildscript/buildenv.sh .
3434
cp ./../buildscript/awsconfiguration.sh .
@@ -184,7 +184,7 @@ jobs:
184184
environment:
185185
DEPLOY_ENV: "PROD"
186186
LOGICAL_ENV: "prod"
187-
ENABLE_CACHE: false
187+
ENABLE_CACHE: true
188188
APPNAME: "platform-ui-mvp"
189189
steps: *deploy_steps
190190

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"@datadog/browser-logs": "^4.21.2",
2525
"@heroicons/react": "^1.0.6",
26+
"@sprig-technologies/sprig-browser": "^2.20.1",
2627
"@stripe/react-stripe-js": "1.13.0",
2728
"@stripe/stripe-js": "1.41.0",
2829
"apexcharts": "^3.36.0",

public/index.html

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22
<html lang="en">
33

44
<head>
5-
<meta charset="utf-8" />
6-
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1" />
8-
<meta name="theme-color" content="#000000" />
9-
<meta name="description"
10-
content="Topcoder is home to the world’s largest community of designers, developers, and data scientists. Allowing you the freedom to start and execute faster." />
11-
<link rel="preconnect" href="https://fonts.googleapis.com" />
12-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
13-
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Barlow+Condensed:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" />
14-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Barlow+Condensed:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" />
15-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo_512x512.png" />
16-
<link rel="stylesheet" href="%PUBLIC_URL%/global.css">
17-
<!--
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="%PUBLIC_URL%/favicon.png" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta name="description"
10+
content="Topcoder is home to the world’s largest community of designers, developers, and data scientists. Allowing you the freedom to start and execute faster." />
11+
<link rel="preconnect" href="https://fonts.googleapis.com" />
12+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
13+
<link rel="preload" as="style"
14+
href="https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Barlow+Condensed:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" />
15+
<link rel="stylesheet"
16+
href="https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Barlow+Condensed:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,600;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" />
17+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo_512x512.png" />
18+
<link rel="stylesheet" href="%PUBLIC_URL%/global.css">
19+
<!--
1820
manifest.json provides metadata used when your web app is installed on a
1921
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
2022
-->
21-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
22-
<!--
23+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
24+
<!--
2325
Notice the use of %PUBLIC_URL% in the tags above.
2426
It will be replaced with the URL of the `public` folder during the build.
2527
Only files inside the `public` folder can be referenced from the HTML.
@@ -28,13 +30,13 @@
2830
work correctly both with client-side routing and a non-root public URL.
2931
Learn how to configure a non-root public URL by running `npm run build`.
3032
-->
31-
<title>Topcoder Top Technology Talent On-Demand</title>
33+
<title>Topcoder Top Technology Talent On-Demand</title>
3234
</head>
3335

3436
<body>
35-
<noscript>You need to enable JavaScript to run this app.</noscript>
36-
<div id="root" data-id="root"></div>
37-
<!--
37+
<noscript>You need to enable JavaScript to run this app.</noscript>
38+
<div id="root" data-id="root"></div>
39+
<!--
3840
This HTML file is a template.
3941
If you open it directly in the browser, you will see an empty page.
4042

src-ts/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { routeContext, RouteContextData } from './lib'
77

88
const App: FC<{}> = () => {
99

10-
const [ready, setReady]: [boolean, Dispatch<SetStateAction<boolean>>] = useState(false)
10+
const [ready, setReady]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
1111
const { allRoutes, getRouteElement }: RouteContextData = useContext(routeContext)
1212

1313
const routeElements: Array<ReactElement> = allRoutes
@@ -19,9 +19,9 @@ const App: FC<{}> = () => {
1919

2020
useEffect(() => {
2121
if (ready) {
22-
document.getElementById('root')?.classList.add('app-ready');
22+
document.getElementById('root')?.classList.add('app-ready')
2323
}
24-
}, [ready]);
24+
}, [ready])
2525

2626
return (
2727
<>

src-ts/config/environments/environment.default.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export const EnvironmentConfigDefault: EnvironmentConfigModel = {
2020
SERVICE: 'platform-ui',
2121
},
2222
REAUTH_OFFSET: 55,
23+
SPRIG: {
24+
ENVIRONMENT_ID: 'bUcousVQ0-yF',
25+
},
2326
// TODO: Move stripe creds to .env file
2427
STRIPE: {
2528
ADMIN_TOKEN:

src-ts/config/environments/environment.prod.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export const EnvironmentConfigProd: EnvironmentConfigModel = {
1818
},
1919
DISABLED_TOOLS: [],
2020
ENV: 'prod',
21+
SPRIG: {
22+
ENVIRONMENT_ID: 'a-IZBZ6-r7bU',
23+
},
2124
// TODO: Move stripe creds to .env file
2225
STRIPE: {
2326
ADMIN_TOKEN:

src-ts/lib/functions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export * from './error-functions'
1010
export * from './file-functions'
1111
export * from './logging-functions'
1212
export * from './text-format-functions'
13+
export * from './survey-functions'
1314
export * from './user-functions'
1415
export * from './xhr-functions'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { triggerForUser as surveyTriggerForUser } from './survey.functions'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { sprig, SprigAPI } from '@sprig-technologies/sprig-browser'
2+
3+
import { EnvironmentConfig } from '../../../config'
4+
5+
const Sprig: SprigAPI = sprig.configure({
6+
environmentId: EnvironmentConfig.SPRIG.ENVIRONMENT_ID,
7+
})
8+
9+
export function triggerForUser(surveyName: string, userId?: number): void {
10+
11+
if (!userId) {
12+
Sprig.track(surveyName)
13+
return
14+
}
15+
16+
Sprig.identifyAndTrack({
17+
anonymousId: '',
18+
eventName: surveyName,
19+
metadata: undefined,
20+
userId: `${userId}`,
21+
})
22+
}

src-ts/lib/global-config.model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export interface GlobalConfig {
1616
SERVICE: string
1717
}
1818
REAUTH_OFFSET: number
19+
SPRIG: {
20+
ENVIRONMENT_ID: string
21+
}
1922
STRIPE: {
2023
ADMIN_TOKEN: string
2124
API_KEY: string

src-ts/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export {
1818
logError,
1919
logInfo,
2020
logInitialize,
21+
surveyTriggerForUser,
2122
textFormatDateLocaleShortString,
2223
textFormatGetSafeString,
2324
textFormatMoneyLocaleString,

src-ts/tools/learn/course-details/CourseDetailsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const CourseDetailsPage: FC<{}> = () => {
4848
const {
4949
certificationProgress: progress,
5050
ready: progressReady,
51+
setCertificateProgress,
5152
}: UserCertificationProgressProviderData = useGetUserCertificationProgress(
5253
profile?.userId,
5354
routeParams.provider,
@@ -214,6 +215,7 @@ const CourseDetailsPage: FC<{}> = () => {
214215
progress={progress}
215216
progressReady={progressReady}
216217
profile={profile}
218+
setCertificateProgress={setCertificateProgress}
217219
/>
218220
</div>
219221
</div>

src-ts/tools/learn/course-details/course-curriculum/CourseCurriculum.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface CourseCurriculumProps {
3131
profile?: UserProfile
3232
progress?: LearnUserCertificationProgress
3333
progressReady?: boolean
34+
setCertificateProgress: (d: LearnUserCertificationProgress) => void
3435
}
3536

3637
const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProps) => {
@@ -108,7 +109,7 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp
108109
}
109110

110111
if (!props.progress?.id) {
111-
await userCertificationProgressStartAsync(
112+
const progress: LearnUserCertificationProgress = await userCertificationProgressStartAsync(
112113
props.profile.userId,
113114
props.course.certificationId,
114115
props.course.id,
@@ -117,6 +118,9 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp
117118
module: props.course.modules[0].meta.dashedName,
118119
},
119120
)
121+
122+
// update progress with data returned from calling the start progress endpoint
123+
props.setCertificateProgress(progress)
120124
} else {
121125
await userCertificationProgressUpdateAsync(
122126
props.progress.id,

0 commit comments

Comments
 (0)