-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from AppQuality/develop
Release 2023-12-11
- Loading branch information
Showing
40 changed files
with
1,029 additions
and
622 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
REACT_APP_API_URL=https://dev.tryber.me/api | ||
REACT_APP_POST_JOTFORM=https://raeo20bhid.execute-api.eu-west-1.amazonaws.com/prod/jotform | ||
REACT_APP_GTM_ID= | ||
REACT_APP_GTM_ID=GTM-K55XC7S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
REACT_APP_API_URL=/api | ||
REACT_APP_POST_JOTFORM=https://raeo20bhid.execute-api.eu-west-1.amazonaws.com/prod/jotform | ||
REACT_APP_GTM_ID=GTM-TDTZDXJ | ||
REACT_APP_GTM_ID=GTM-K55XC7S |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "Run tests" | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
install: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "Install Node" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install dependencies | ||
run: | | ||
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > .npmrc | ||
yarn | ||
- name: "Run Test" | ||
run: yarn test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
window.react_env = { | ||
REACT_APP_ENV: "local", | ||
REACT_APP_ENVIRONMENT: "local", | ||
REACT_APP_VERSION: "local", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from "react"; | ||
import { useGetUsersMeQuery } from "src/services/tryberApi"; | ||
import TagManager from "react-gtm-module"; | ||
import * as Sentry from "@sentry/react"; | ||
|
||
export const PageTemplate = ({ children }: { children: React.ReactNode }) => { | ||
const { | ||
data: user, | ||
error, | ||
isLoading, | ||
} = useGetUsersMeQuery({ | ||
fields: "id,email,username,wp_user_id,role", | ||
}); | ||
if (isLoading) { | ||
return <div>Loading...</div>; | ||
} | ||
TagManager.dataLayer({ | ||
dataLayer: { | ||
event: "ApiLoaded", | ||
}, | ||
}); | ||
Sentry.setUser({ | ||
id: user?.id ?? 0, | ||
email: user?.email ?? "unknown", | ||
username: user?.username ?? "unknown", | ||
wp_user_id: user?.wp_user_id ?? 0, | ||
role: user?.role ?? "unknown", | ||
}); | ||
if (error) { | ||
if ("status" in error && error.status === 403) { | ||
return <div>You are not logged in. Please log in to continue.</div>; | ||
} else { | ||
if ("message" in error) alert(error.message); | ||
} | ||
return null; | ||
} | ||
return <>{children}</>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as Sentry from "@sentry/react"; | ||
import isStagingEnvironment from "./isStagingEnvironment"; | ||
import { RouterHistory } from "@sentry/react/types/reactrouter"; | ||
|
||
const SentryWrapper = ({ | ||
children, | ||
history, | ||
}: { | ||
children: React.ReactNode; | ||
history: RouterHistory; | ||
}) => { | ||
if (process.env.NODE_ENV !== "test") { | ||
Sentry.init({ | ||
dsn: "https://[email protected]/4506320026664960", | ||
integrations: [ | ||
new Sentry.BrowserTracing({ | ||
routingInstrumentation: Sentry.reactRouterV5Instrumentation(history), | ||
}), | ||
], | ||
environment: react_env.REACT_APP_ENVIRONMENT, | ||
// trace all staging and locale traces and 70% of production traces | ||
tracesSampleRate: isStagingEnvironment() ? 1.0 : 0.7, | ||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: [ | ||
"localhost", | ||
/^https:\/\/dev\.tryber\.me\/api/, | ||
/^https:\/\/tryber\.me\/api/, | ||
], | ||
release: react_env.REACT_APP_VERSION, | ||
// Capture Replay for 10% of all sessions, | ||
// plus for 100% of sessions with an error | ||
// do not capture for staging and locale | ||
replaysSessionSampleRate: isStagingEnvironment() ? 0.0 : 0.1, | ||
replaysOnErrorSampleRate: isStagingEnvironment() ? 0.0 : 1.0, | ||
}); | ||
} | ||
|
||
return <>{children}</>; | ||
}; | ||
|
||
export default SentryWrapper; |
Oops, something went wrong.