diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 104477952..1e80ccd23 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -48,10 +48,9 @@ jobs: env: # Build-time envs used in next.config.js NET: 'sepolia' - INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} - ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} + INFURA_API_KEY: ${{ secrets.DEV_INFURA_API_KEY }} + ALCHEMY_API_KEY: ${{ secrets.DEV_ALCHEMY_API_KEY }} GA4_TAG_ID: ${{ secrets.GA4_TAG_ID }} - WOGAA_ENV: ${{ secrets.WOGAA_ENV }} TRUSTED_TLDS: ${{ secrets.TRUSTED_TLDS }} - name: Upload build artifact (Dev) @@ -74,8 +73,8 @@ jobs: - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.AWS_REGION }} - name: Select target bucket diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index c1ed9632b..79af7966a 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -51,7 +51,6 @@ jobs: INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }} ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }} GA4_TAG_ID: ${{ secrets.GA4_TAG_ID }} - WOGAA_ENV: ${{ secrets.WOGAA_ENV }} TRUSTED_TLDS: ${{ secrets.TRUSTED_TLDS }} - name: Upload build artifact diff --git a/next.config.js b/next.config.js index 6373afbfe..f1e47ec7f 100644 --- a/next.config.js +++ b/next.config.js @@ -22,7 +22,6 @@ const nextConfig = { ALCHEMY_API_KEY: process.env.ALCHEMY_API_KEY, // The default/free key should not be used in production as they are rate-limited by the service provider TRUSTED_TLDS: process.env.TRUSTED_TLDS || "gov.sg,edu.sg", GA4_TAG_ID: process.env.GA4_TAG_ID || "G-JP12T2F01V", - WOGAA_ENV: process.env.WOGAA_ENV || "production", }, // Variables passed to both server and client publicRuntimeConfig: { diff --git a/pages/index.tsx b/pages/index.tsx index f5d68ca94..c308c0840 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -2,7 +2,6 @@ import { ParsedUrlQuery } from "querystring"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; import { connect } from "react-redux"; -import { Wogaa } from "../src/components/Analytics/wogaa"; import { Wrapper, Main } from "../src/components/Layout/Body"; import { FooterBar } from "../src/components/Layout/FooterBar"; import { NavigationBar } from "../src/components/Layout/NavigationBar"; @@ -38,8 +37,7 @@ const HomePage: React.FunctionComponent = (props) => { }, [props, urlParams]); return ( - - {urlParams ? : null} +
diff --git a/src/components/Analytics/wogaa.tsx b/src/components/Analytics/wogaa.tsx deleted file mode 100644 index 02cb09856..000000000 --- a/src/components/Analytics/wogaa.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import Script from "next/script"; -import React from "react"; -import { WOGAA_TRANSACTIONAL_SERVICE } from "../../config"; - -declare global { - interface Window { - wogaaCustom: { - startTransactionalService: ( - trackingId: (typeof WOGAA_TRANSACTIONAL_SERVICE)[keyof typeof WOGAA_TRANSACTIONAL_SERVICE], - uniqueTransactionId?: string - ) => void; - completeTransactionalService: ( - trackingId: (typeof WOGAA_TRANSACTIONAL_SERVICE)[keyof typeof WOGAA_TRANSACTIONAL_SERVICE], - uniqueTransactionId?: string - ) => void; - }; - } -} - -const MAX_CALL_QUEUE_LENGTH = 20; -// calls to Wogaa can happen before the Wogaa script is loaded -// this queue will hold the calls until the Wogaa script is loaded -const wogaaCallQueue: ( - | { - name: "startTransactionalService"; - args: Parameters; - } - | { - name: "completeTransactionalService"; - args: Parameters; - } -)[] = []; -export const startTransactionalService: typeof window.wogaaCustom.startTransactionalService = (...args) => { - if (typeof window !== undefined && window.wogaaCustom) { - window.wogaaCustom.startTransactionalService(...args); - } else { - console.warn( - "window.wogaaCustom is not defined", - "Ensure Wogaa script is properly installed/imported", - "Pushed call to queue" - ); - // just in case wogaa script is never loaded, we dont want to keep storing calls indefinitely - if (wogaaCallQueue.length <= MAX_CALL_QUEUE_LENGTH) { - wogaaCallQueue.push({ name: "startTransactionalService", args }); - } - } -}; - -export const completeTransactionalService: typeof window.wogaaCustom.completeTransactionalService = (...args) => { - if (typeof window !== undefined && window.wogaaCustom) { - window.wogaaCustom.completeTransactionalService(...args); - } else { - console.warn( - "window.wogaaCustom is not defined", - "Ensure Wogaa script is properly installed/imported", - "Pushed call to queue" - ); - // just in case wogaa script is never loaded, we dont want to keep storing calls indefinitely - if (wogaaCallQueue.length <= MAX_CALL_QUEUE_LENGTH) { - wogaaCallQueue.push({ name: "completeTransactionalService", args }); - } - } -}; - -export const Wogaa = () => ( -