From 698da79d3fcae8e7c4a1b2fa34157cd7196f79ac Mon Sep 17 00:00:00 2001 From: Denys Karmazyn Date: Tue, 10 Dec 2024 17:15:35 +0100 Subject: [PATCH] feat(frontend): feature flag for the Swap feature (#3906) # Motivation A feature flag for the Swap feature. Note: `feat/swap` will be a base branch for this functionality until the whole feature is ready to go to staging. --- .env.example | 1 + .github/workflows/deploy-to-environment.yml | 2 ++ src/frontend/src/env/actions.env.ts | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 src/frontend/src/env/actions.env.ts diff --git a/.env.example b/.env.example index 7a3b65d627..63a97dac23 100644 --- a/.env.example +++ b/.env.example @@ -15,3 +15,4 @@ VITE_AUTH_DERIVATION_ORIGIN= VITE_ONRAMPER_API_KEY_DEV=pk_test_ VITE_ONRAMPER_API_KEY_PROD=pk_prod_ VITE_BTC_TO_CKBTC_EXCHANGE_ENABLED= +VITE_SWAP_ACTION_ENABLED= diff --git a/.github/workflows/deploy-to-environment.yml b/.github/workflows/deploy-to-environment.yml index 4aaffd0623..ba6e6b7b50 100644 --- a/.github/workflows/deploy-to-environment.yml +++ b/.github/workflows/deploy-to-environment.yml @@ -104,6 +104,7 @@ jobs: echo "VITE_POUH_ENABLED=${{ secrets.VITE_POUH_ENABLED_STAGING }}" >> $GITHUB_ENV echo "VITE_AUTH_DERIVATION_ORIGIN=${{ secrets.VITE_AUTH_DERIVATION_ORIGIN_STAGING }}" >> $GITHUB_ENV echo "VITE_BTC_TO_CKBTC_EXCHANGE_ENABLED=${{ secrets.VITE_BTC_TO_CKBTC_EXCHANGE_ENABLED_STAGING }}" >> $GITHUB_ENV + echo "VITE_SWAP_ACTION_ENABLED=${{ secrets.VITE_SWAP_ACTION_ENABLED_STAGING }}" >> $GITHUB_ENV echo "VITE_ONRAMPER_API_KEY_DEV=${{ secrets.VITE_ONRAMPER_API_KEY_DEV_STAGING }}" >> $GITHUB_ENV echo "VITE_ONRAMPER_API_KEY_PROD=${{ secrets.VITE_ONRAMPER_API_KEY_PROD_STAGING }}" >> $GITHUB_ENV if [[ "$NETWORK" == "staging" ]]; then @@ -135,6 +136,7 @@ jobs: echo "VITE_AUTH_ALTERNATIVE_ORIGINS=${{ secrets.VITE_AUTH_ALTERNATIVE_ORIGINS_BETA }}" >> $GITHUB_ENV echo "VITE_AUTH_DERIVATION_ORIGIN=${{ secrets.VITE_AUTH_DERIVATION_ORIGIN_BETA }}" >> $GITHUB_ENV echo "VITE_BTC_TO_CKBTC_EXCHANGE_ENABLED=${{ secrets.VITE_BTC_TO_CKBTC_EXCHANGE_ENABLED_BETA }}" >> $GITHUB_ENV + echo "VITE_SWAP_ACTION_ENABLED=${{ secrets.VITE_SWAP_ACTION_ENABLED_BETA }}" >> $GITHUB_ENV echo "VITE_ONRAMPER_API_KEY_DEV=${{ secrets.VITE_ONRAMPER_API_KEY_DEV_BETA }}" >> $GITHUB_ENV echo "VITE_ONRAMPER_API_KEY_PROD=${{ secrets.VITE_ONRAMPER_API_KEY_PROD_BETA }}" >> $GITHUB_ENV { diff --git a/src/frontend/src/env/actions.env.ts b/src/frontend/src/env/actions.env.ts new file mode 100644 index 0000000000..8628d9c780 --- /dev/null +++ b/src/frontend/src/env/actions.env.ts @@ -0,0 +1,3 @@ +// TODO: to be removed when the feature is fully implemented +export const SWAP_ACTION_ENABLED = + JSON.parse(import.meta.env.VITE_SWAP_ACTION_ENABLED ?? false) === true;