diff --git a/src/core/constants/appConfig.ts b/src/core/constants/appConfig.ts index 5385439e..b045910f 100644 --- a/src/core/constants/appConfig.ts +++ b/src/core/constants/appConfig.ts @@ -62,7 +62,7 @@ const appConfig = { CF_TEMPLATE: getEnv("VITE_AWS_CF_TEMPLATE"), APPLE_APP_STORE_LINK: getEnv("VITE_APPLE_APP_STORE_LINK"), GOOGLE_PLAY_STORE_LINK: getEnv("VITE_GOOGLE_PLAY_STORE_LINK"), - COUNTRY_EVALUATION_URL: import.meta.env.DEV ? "/doNotDelete.txt" : "assets/doNotDelete.txt", + COUNTRY_EVALUATION_URL: "/doNotDelete.txt", APP_VERSION: getEnv("VITE_APP_VERSION"), NL_BASE_URL: getEnv("VITE_NL_BASE_URL"), NL_API_KEY: getEnv("VITE_NL_API_KEY"), diff --git a/src/utils/analyticsUtils.ts b/src/utils/analyticsUtils.ts index 5554b680..76f3e18b 100644 --- a/src/utils/analyticsUtils.ts +++ b/src/utils/analyticsUtils.ts @@ -1,3 +1,6 @@ +/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */ +/* SPDX-License-Identifier: MIT-0 */ + import { Event, GetEndpointCommand, diff --git a/src/utils/countryUtil.ts b/src/utils/countryUtil.ts index 415e2b35..8ed2e781 100644 --- a/src/utils/countryUtil.ts +++ b/src/utils/countryUtil.ts @@ -1,8 +1,12 @@ +/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */ +/* SPDX-License-Identifier: MIT-0 */ + import { appConfig } from "@demo/core/constants"; import sleep from "./sleep"; let failCount = 0; +let countryCode = ""; const { ENV: { COUNTRY_EVALUATION_URL } @@ -10,8 +14,13 @@ const { export const getCountryCode: () => Promise = async () => { try { + if (countryCode) { + return countryCode === "Unknown" ? undefined : countryCode; + } + const response = await fetch(COUNTRY_EVALUATION_URL); const country = response.headers.get("x-country"); + countryCode = country || "Unknown"; failCount = 0; @@ -22,7 +31,7 @@ export const getCountryCode: () => Promise = async () => { } } catch (error) { failCount++; - console.log("error: ", error); + console.error("error: ", error); // try three times before failing if (failCount === 3) {