Add payment result view default state. Set up build env (#328)

This commit is contained in:
Ildar Galeev 2024-07-24 20:37:17 +07:00 committed by GitHub
parent 17cb74690a
commit 0bfc635965
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 28 deletions

View File

@ -20,12 +20,10 @@ jobs:
uses: ./.github/actions/init uses: ./.github/actions/init
- name: Build - name: Build
run: npm run build run: npm run build
- name: Set checkout version env:
uses: jossef/action-set-json-field@v2 SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with: SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
file: ./dist/v1/env.json SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
field: version
value: ${{ github.sha }}
- name: Deploy image - name: Deploy image
uses: valitydev/action-deploy-docker@v2 uses: valitydev/action-deploy-docker@v2
with: with:
@ -61,12 +59,3 @@ jobs:
directory: 'dist' directory: 'dist'
gitHubToken: ${{ secrets.GITHUB_TOKEN }} gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main 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'

View File

@ -35,8 +35,6 @@ creditCardType.addCard({
const initSentry = async (dsn: string) => { const initSentry = async (dsn: string) => {
const { init, BrowserTracing } = await import('@sentry/react'); const { init, BrowserTracing } = await import('@sentry/react');
const { CaptureConsole } = await import('@sentry/integrations'); const { CaptureConsole } = await import('@sentry/integrations');
const fetchEnv = withRetry(fetchConfig<{ version: string }>);
const env = await fetchEnv('./env.json');
init({ init({
environment: 'production', environment: 'production',
dsn, dsn,
@ -47,7 +45,6 @@ const initSentry = async (dsn: string) => {
}), }),
], ],
tracesSampleRate: 0.1, tracesSampleRate: 0.1,
release: env.version,
}); });
}; };

View File

@ -80,5 +80,15 @@ export const getResultInfo = (condition: PaymentCondition): ResultInfo => {
label: 'form.header.final.pending.label', label: 'form.header.final.pending.label',
description: 'form.header.final.pending.description', 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,
};
} }
}; };

View File

@ -1,3 +0,0 @@
{
"version": ""
}

View File

@ -27,10 +27,6 @@ export default defineConfig({
src: 'src/appConfig.json', src: 'src/appConfig.json',
dest: './', dest: './',
}, },
{
src: 'src/env.json',
dest: './',
},
{ {
src: 'src/assets/*', src: 'src/assets/*',
dest: './assets', dest: './assets',
@ -39,10 +35,10 @@ export default defineConfig({
}), }),
visualizer(), visualizer(),
sentryVitePlugin({ sentryVitePlugin({
org: 'empayredev', org: process.env.SENTRY_ORG,
project: 'checkout', project: process.env.SENTRY_PROJECT,
telemetry: false,
authToken: process.env.SENTRY_AUTH_TOKEN, authToken: process.env.SENTRY_AUTH_TOKEN,
telemetry: false,
}), }),
], ],
server: { server: {