From 0bfc635965e27608bd11c3150ca2e2b5d42e8c4d Mon Sep 17 00:00:00 2001 From: Ildar Galeev Date: Wed, 24 Jul 2024 20:37:17 +0700 Subject: [PATCH] Add payment result view default state. Set up build env (#328) --- .github/workflows/master.yaml | 19 ++++--------------- src/common/init/initialize.ts | 3 --- .../PaymentResultView/utils/getResultInfo.ts | 10 ++++++++++ src/env.json | 3 --- vite.config.app.ts | 10 +++------- 5 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 src/env.json diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index bd1f439c..75906bee 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -20,12 +20,10 @@ jobs: uses: ./.github/actions/init - name: Build run: npm run build - - name: Set checkout version - uses: jossef/action-set-json-field@v2 - with: - file: ./dist/v1/env.json - field: version - value: ${{ github.sha }} + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} - name: Deploy image uses: valitydev/action-deploy-docker@v2 with: @@ -61,12 +59,3 @@ jobs: directory: 'dist' gitHubToken: ${{ secrets.GITHUB_TOKEN }} branch: main - - name: Create Sentry release - uses: getsentry/action-release@v1 - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG }} - SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} - with: - environment: 'production' - sourcemaps: './dist' diff --git a/src/common/init/initialize.ts b/src/common/init/initialize.ts index 83e66575..e73f1270 100644 --- a/src/common/init/initialize.ts +++ b/src/common/init/initialize.ts @@ -35,8 +35,6 @@ creditCardType.addCard({ const initSentry = async (dsn: string) => { const { init, BrowserTracing } = await import('@sentry/react'); const { CaptureConsole } = await import('@sentry/integrations'); - const fetchEnv = withRetry(fetchConfig<{ version: string }>); - const env = await fetchEnv('./env.json'); init({ environment: 'production', dsn, @@ -47,7 +45,6 @@ const initSentry = async (dsn: string) => { }), ], tracesSampleRate: 0.1, - release: env.version, }); }; diff --git a/src/components/ViewContainer/PaymentResultView/utils/getResultInfo.ts b/src/components/ViewContainer/PaymentResultView/utils/getResultInfo.ts index 7b3ee1f0..c523a894 100644 --- a/src/components/ViewContainer/PaymentResultView/utils/getResultInfo.ts +++ b/src/components/ViewContainer/PaymentResultView/utils/getResultInfo.ts @@ -80,5 +80,15 @@ export const getResultInfo = (condition: PaymentCondition): ResultInfo => { label: 'form.header.final.pending.label', description: 'form.header.final.pending.description', }; + default: + const errDescription = `Unexpected Payment condition: ${condition.name}`; + console.error(errDescription, JSON.stringify(condition)); + return { + iconName: 'WarningIcon', + color: 'red.500', + label: 'form.header.final.error.label', + description: errDescription, + hasActions: false, + }; } }; diff --git a/src/env.json b/src/env.json deleted file mode 100644 index 4fdc6069..00000000 --- a/src/env.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "" -} diff --git a/vite.config.app.ts b/vite.config.app.ts index f898cb31..98ff25ec 100644 --- a/vite.config.app.ts +++ b/vite.config.app.ts @@ -27,10 +27,6 @@ export default defineConfig({ src: 'src/appConfig.json', dest: './', }, - { - src: 'src/env.json', - dest: './', - }, { src: 'src/assets/*', dest: './assets', @@ -39,10 +35,10 @@ export default defineConfig({ }), visualizer(), sentryVitePlugin({ - org: 'empayredev', - project: 'checkout', - telemetry: false, + org: process.env.SENTRY_ORG, + project: process.env.SENTRY_PROJECT, authToken: process.env.SENTRY_AUTH_TOKEN, + telemetry: false, }), ], server: {