Skip to content

Commit

Permalink
Merge branch 'main' into stt
Browse files Browse the repository at this point in the history
  • Loading branch information
kycarr authored Feb 13, 2024
2 parents 13f400b + cd422cc commit 2ee10c8
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 30 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,3 @@ test-e2e-exec:
test-e2e-up:
$(TEST_E2E_DOCKER_COMPOSE) up -d

.PHONY: deploy
deploy:
cd client && \
export GATSBY_GRAPHQL_ENDPOINT=https://api.devmentorpal.org/graphql/graphql && \
export GATSBY_STAGE=dev && \
npm run build && \
aws s3 sync ./public/ s3://mentorpal-us-east-1-newdev-mentorpal-origin/chat && \
aws cloudfront create-invalidation --distribution-id E6VOL8BYUVNWS --paths "/chat*"
5 changes: 0 additions & 5 deletions cicd/deployspec-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ env:
GATSBY_STAGE: 'dev'
GATSBY_IS_SENTRY_ENABLED: false
parameter-store:
S3_DEPLOY_BUCKET_NEWDEV: "/mentorpal/newdev/s3-websites/NAME"
CDN_ID_NEWDEV: "/mentorpal/newdev/CLOUDFRONT_DISTRIBUTION_ID"
S3_DEPLOY_BUCKET_DEV: "/devmentorpal/s3-websites/NAME"
CDN_ID_DEV: "/devmentorpal/CLOUDFRONT_DISTRIBUTION_ID"

Expand All @@ -22,9 +20,6 @@ phases:
build:
commands:
- cd client && npm run build
- echo Deploying to $S3_DEPLOY_BUCKET_NEWDEV
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_NEWDEV/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID_NEWDEV --paths "/chat*"
- echo Deploying to $S3_DEPLOY_BUCKET_DEV
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_DEV/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID_DEV --paths "/chat*"
7 changes: 1 addition & 6 deletions cicd/deployspec-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ env:
variables:
GATSBY_GRAPHQL_ENDPOINT: 'https://api.mentorpal.org/graphql/graphql'
GATSBY_NPCEDITOR_ENDPOINT: 'https://api.mentorpal.org/npceditor'
GATSBY_STAGE: 'cf'
GATSBY_STAGE: 'prod'
GATSBY_IS_SENTRY_ENABLED: true
parameter-store:
S3_DEPLOY_BUCKET_CF: "/mentorpal/cf/s3-websites/NAME"
CDN_ID_CF: "/mentorpal/cf/CLOUDFRONT_DISTRIBUTION_ID"
S3_DEPLOY_BUCKET: "/mentorpal/s3-websites/NAME"
CDN_ID: "/mentorpal/CLOUDFRONT_DISTRIBUTION_ID"

Expand All @@ -22,9 +20,6 @@ phases:
build:
commands:
- cd client && npm run build
- echo Deploying to $S3_DEPLOY_BUCKET_CF
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_CF/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID_CF --paths "/chat*"
- echo Deploying to $S3_DEPLOY_BUCKET
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID --paths "/chat*"
7 changes: 1 addition & 6 deletions cicd/deployspec-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ env:
variables:
GATSBY_GRAPHQL_ENDPOINT: 'https://api.qamentorpal.org/graphql/graphql'
GATSBY_NPCEDITOR_ENDPOINT: 'https://api.qamentorpal.org/npceditor'
GATSBY_STAGE: 'v2'
GATSBY_STAGE: 'qa'
GATSBY_IS_SENTRY_ENABLED: true
parameter-store:
S3_DEPLOY_BUCKET_V2: "/mentorpal/v2/s3-websites/NAME"
CDN_ID_V2: "/mentorpal/v2/CLOUDFRONT_DISTRIBUTION_ID"
S3_DEPLOY_BUCKET_QA: "/qamentorpal/s3-websites/NAME"
CDN_ID_QA: "/qamentorpal/CLOUDFRONT_DISTRIBUTION_ID"

Expand All @@ -22,9 +20,6 @@ phases:
build:
commands:
- cd client && npm run build
- echo Deploying to $S3_DEPLOY_BUCKET_V2
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_V2/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID_V2 --paths "/chat*"
- echo Deploying to $S3_DEPLOY_BUCKET_QA
- aws s3 sync ./public s3://$S3_DEPLOY_BUCKET_QA/chat
- aws cloudfront create-invalidation --distribution-id $CDN_ID_QA --paths "/chat*"
2 changes: 1 addition & 1 deletion client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ clean:

.PHONY: develop
develop: .env.development node_modules/gatsby
npx gatsby develop -p 8000
npx gatsby develop -p 80

.PHONY: format
format:
Expand Down
8 changes: 6 additions & 2 deletions client/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Permission to use, copy, modify, and distribute this software and its documentat
The full terms of this copyright and license should always be found in the root directory of this software deliverable as "license.txt" and if these terms are not found with this software, please contact the USC Stevens Center for the full license.
*/
import axios, { AxiosResponse } from "axios";
import { LS_LEFT_HOME_PAGE } from "local-constants";
import {
Utterance,
Config,
Expand All @@ -21,6 +22,7 @@ import {
UtteranceGQL,
convertUtteranceGQL,
} from "types-gql";
import { getLocalStorage } from "utils";

export const GATSBY_GRAPHQL_ENDPOINT =
process.env.GATSBY_GRAPHQL_ENDPOINT || "/graphql";
Expand Down Expand Up @@ -170,12 +172,13 @@ export async function fetchMentor(
accessToken: string,
subjectId?: string
): Promise<MentorClientData> {
const leftHomePageData = getLocalStorage(LS_LEFT_HOME_PAGE);
const gqlRes = await axios.post<GraphQLResponse<MentorQueryDataGQL>>(
GATSBY_GRAPHQL_ENDPOINT,
{
query: `
query FetchMentor($mentor: ID!, $subject: ID) {
mentorClientData(mentor: $mentor, subject: $subject) {
query FetchMentor($mentor: ID!, $subject: ID, $leftHomePageData: String!) {
mentorClientData(mentor: $mentor, subject: $subject, leftHomePageData: $leftHomePageData) {
_id
name
title
Expand Down Expand Up @@ -218,6 +221,7 @@ export async function fetchMentor(
variables: {
mentor: mentorId,
subject: subjectId,
leftHomePageData: leftHomePageData,
},
},
{
Expand Down
1 change: 1 addition & 0 deletions client/src/local-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const LS_X_API_EMAIL_KEY = "xapiUserEmail";
// Other
export const REFERRER_KEY = "referrer";
export const EVENTS_KEY = "events";
export const LS_LEFT_HOME_PAGE = "leftHomePage";

// Survey Popup
export const TIMER_TEXT_KEY = "timertext";
Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,9 @@ function IndexPage(props: {
});
updateLocalStorageUserData(newUserData);
}

if (typeof window !== "undefined") {
console.log(document.referrer);
}
return (
<div>
<BaseDialog
Expand Down
2 changes: 1 addition & 1 deletion client/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function loadSentry(): void {
Sentry.init({
dsn: "https://[email protected]/6439056",
integrations: [new BrowserTracing()],
tracesSampleRate: process.env.GATSBY_STAGE == "cf" ? 0.2 : 0.0,
tracesSampleRate: process.env.GATSBY_STAGE == "prod" ? 0.2 : 0.0,
environment: process.env.GATSBY_STAGE,
});
}
Expand Down

0 comments on commit 2ee10c8

Please sign in to comment.