From 3a2b08a4b153ef6440aaacbf1fc97624e2fc1476 Mon Sep 17 00:00:00 2001 From: Alessandra Vertrees Date: Tue, 26 Nov 2024 10:22:21 -0500 Subject: [PATCH 1/3] cleanup variables after reverse proxy launch --- .env.example | 7 ++----- CHANGELOG.md | 3 +++ ENVIRONMENTVARS.md | 1 - README.md | 5 ----- .../homePageMainContent/homePageMainContent.tsx | 6 +++--- app/src/components/lane/lane.test.tsx | 11 +++++------ app/src/components/lane/lane.tsx | 3 +-- app/src/components/navMenu/mobileNavMenu.test.tsx | 7 +++---- app/src/components/navMenu/navMenu.test.tsx | 12 +++--------- .../components/pages/divisionPage/divisionPage.tsx | 3 +-- app/src/components/search/search.test.tsx | 5 ++--- app/src/components/search/search.tsx | 2 -- app/src/config/constants.ts | 1 - app/src/data/dcNavLinks.ts | 6 ++---- app/src/utils/utils.ts | 6 +----- appConfig.ts | 10 ---------- next.config.js | 4 ++-- 17 files changed, 28 insertions(+), 64 deletions(-) diff --git a/.env.example b/.env.example index e7e8553b..c86e779d 100644 --- a/.env.example +++ b/.env.example @@ -1,16 +1,13 @@ APP_ENV=development # or qa or production -#IIIF -IIIF_URL=https://iiif.nypl.org - # Repo api API_URL=https://api.repo.nypl.org # must be https AUTH_TOKEN= # Get credentials from a parameter store or a teammate! API_DEBUG=true # Optional, controls verbosity of api related log output API_CACHE=false # Optional, controls whether or not api responses are cached -# Old DC url -DC_URL='' # OR https://qa-digitalcollections.nypl.org OR https://digitalcollections.nypl.org +# Base DC url +# DC_URL='' # Feedback form CLIENT_ID= # Available in parameter store diff --git a/CHANGELOG.md b/CHANGELOG.md index ceb2dea8..fc005e49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## Removed +- removed unneccessary variables post reverse proxy launch + ## [0.2.3] 2024-11-21 ### Updated diff --git a/ENVIRONMENTVARS.md b/ENVIRONMENTVARS.md index 13eb8e77..ffabde5b 100644 --- a/ENVIRONMENTVARS.md +++ b/ENVIRONMENTVARS.md @@ -22,7 +22,6 @@ These environment variables control how certain elements on the page render and | Variable | Type | Value Example | Description | | ---------------------------- | ------ | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `APP_ENV` | string | "development" | App environment key used to determine various environment-specific app settings. | -| `DC_URL` | string | "" or "https://qa-digitalcollections.nypl.org" or https://digitalcollections.nypl.org | The base URL of the DC url, either points locally or externally to legacy DC. | | `API_URL` | string | "https://api.repo.nypl.org" or "https://qa.api.repo.nypl.org" | base url for Repo API calls. | | `AUTH_TOKEN` | string | "" | Auth token for Repo API. | | `ADOBE_EMBED_URL` | string | "" | Url endpoint used for Adobe Analytics event tracking. | diff --git a/README.md b/README.md index f2b93465..c28ed969 100644 --- a/README.md +++ b/README.md @@ -79,11 +79,6 @@ Example: ``` const appConfig = { environment: process.env.APP_ENV || "development", - DC_URL: { - development: "https://qa-digitalcollections.nypl.org", - qa: "https://qa-digitalcollections.nypl.org", - production: "https://digitalcollections.nypl.org", - }, adobeEmbedUrl: { development: "https://assets.adobedtm.com/1a9376472d37/8519dfce636d/launch-bf8436264b01-development.min.js", diff --git a/app/src/components/homePageMainContent/homePageMainContent.tsx b/app/src/components/homePageMainContent/homePageMainContent.tsx index 9d29c2d8..e2eedb39 100644 --- a/app/src/components/homePageMainContent/homePageMainContent.tsx +++ b/app/src/components/homePageMainContent/homePageMainContent.tsx @@ -1,7 +1,7 @@ import React from "react"; import FeaturedContentComponent from "../featuredContent/featuredContent"; import { useEffect, useState } from "react"; -import { DC_URL } from "@/src/config/constants"; +// import { DC_URL } from "@/src/config/constants"; import { Lane as DCLane } from "../lane/lane"; import LaneDataType from "@/src/types/Lane"; import LaneLoading from "../lane/laneLoading"; @@ -28,7 +28,7 @@ const HomePageMainContent = ({ @@ -37,7 +37,7 @@ const HomePageMainContent = ({ diff --git a/app/src/components/lane/lane.test.tsx b/app/src/components/lane/lane.test.tsx index 73ad5d27..c47a3bb3 100644 --- a/app/src/components/lane/lane.test.tsx +++ b/app/src/components/lane/lane.test.tsx @@ -1,6 +1,5 @@ import { fireEvent, render, screen, within } from "@testing-library/react"; import { mockCollectionLanes } from "__tests__/__mocks__/data/mockCollectionLanes"; -import { DC_URL } from "@/src/config/constants"; import { Lane as DCLane } from "./lane"; describe("Lanes component renders with expected collection props", () => { @@ -10,7 +9,7 @@ describe("Lanes component renders with expected collection props", () => { {mockCollectionLanes.lanesWithNumItems.map((lane, key) => ( { {mockCollectionLanes.lanesWithNumItems.map((lane, key) => ( { {mockCollectionLanes.lanesWithNumItems.map((lane, key) => ( { {mockCollectionLanes.lanesWithNumItems.map((lane, key) => ( { {mockCollectionLanes.lanesWithNumItems.map((lane, key) => ( { it("renders mobile nav menu component", () => { @@ -26,15 +25,15 @@ describe("Mobile nav menu component", () => { fireEvent.click(screen.getByLabelText("Open Navigation")); expect(screen.getByLabelText("Items")).toHaveAttribute( "href", - `${DC_URL}/search/index?utf8=%E2%9C%93&keywords=` + `/search/index?utf8=%E2%9C%93&keywords=` ); expect(screen.getByLabelText("Divisions")).toHaveAttribute( "href", - `${DC_URL}/divisions` + `/divisions` ); expect(screen.getByLabelText("Collections")).toHaveAttribute( "href", - `${DC_URL}/collections` + `/collections` ); expect(screen.getByLabelText("About")).toHaveAttribute("href", `/about`); }); diff --git a/app/src/components/navMenu/navMenu.test.tsx b/app/src/components/navMenu/navMenu.test.tsx index 0cb06db6..01b16b06 100644 --- a/app/src/components/navMenu/navMenu.test.tsx +++ b/app/src/components/navMenu/navMenu.test.tsx @@ -1,10 +1,7 @@ import React from "react"; import { render, screen } from "@testing-library/react"; import "@testing-library/jest-dom"; -import appConfig from "../../../../appConfig"; import NavMenu from "./navMenu"; -import { ENV_KEY } from "../../types/EnvironmentType"; -import { DC_URL } from "../../config/constants"; describe("Nav menu component", () => { it("renders nav menu component", () => { @@ -19,15 +16,12 @@ describe("Nav menu component", () => { const { getByLabelText } = render(); expect(getByLabelText("Items")).toHaveAttribute( "href", - `${DC_URL}/search/index?utf8=%E2%9C%93&keywords=` - ); - expect(getByLabelText("Divisions")).toHaveAttribute( - "href", - `${DC_URL}/divisions` + `/search/index?utf8=%E2%9C%93&keywords=` ); + expect(getByLabelText("Divisions")).toHaveAttribute("href", `/divisions`); expect(getByLabelText("Collections")).toHaveAttribute( "href", - `${DC_URL}/collections` + `/collections` ); expect(getByLabelText("About")).toHaveAttribute("href", "/about"); }); diff --git a/app/src/components/pages/divisionPage/divisionPage.tsx b/app/src/components/pages/divisionPage/divisionPage.tsx index 17497727..41a64d20 100644 --- a/app/src/components/pages/divisionPage/divisionPage.tsx +++ b/app/src/components/pages/divisionPage/divisionPage.tsx @@ -21,7 +21,6 @@ import { createAdobeAnalyticsPageName, displayResults, } from "../../../utils/utils"; -import { DC_URL } from "@/src/config/constants"; import { Lane as DCLane } from "../../lane/lane"; import LaneLoading from "../../lane/laneLoading"; @@ -103,7 +102,7 @@ export default function DivisionPage({ data }: any) { {isLoaded ? ( ) : ( diff --git a/app/src/components/search/search.test.tsx b/app/src/components/search/search.test.tsx index 758e4470..cbc3fc07 100644 --- a/app/src/components/search/search.test.tsx +++ b/app/src/components/search/search.test.tsx @@ -3,7 +3,6 @@ import { render, fireEvent, screen } from "@testing-library/react"; import "@testing-library/jest-dom"; import Search from "./search"; import { useRouter } from "next/navigation"; -import { DC_URL } from "../../config/constants"; jest.mock("next/navigation", () => ({ useRouter: jest.fn(), @@ -27,7 +26,7 @@ describe("Search component", () => { }); fireEvent.submit(getByLabelText("Search Digital Collections")); expect(mockRouter.push).toHaveBeenCalledWith( - `${DC_URL}/search/index?keywords=test%20word` + `/search/index?keywords=test%20word` ); }); @@ -45,7 +44,7 @@ describe("Search component", () => { fireEvent.submit(screen.getByLabelText("Search Digital Collections")); expect(mockRouter.push).toHaveBeenCalledWith( - `${DC_URL}/search/index?utf8=✓&filters%5Brights%5D=pd&keywords=test%20words` + `/search/index?utf8=✓&filters%5Brights%5D=pd&keywords=test%20words` ); }); }); diff --git a/app/src/components/search/search.tsx b/app/src/components/search/search.tsx index e68eefd5..2cf92410 100644 --- a/app/src/components/search/search.tsx +++ b/app/src/components/search/search.tsx @@ -5,7 +5,6 @@ import { Box, SearchBar } from "@nypl/design-system-react-components"; import { useRouter } from "next/navigation"; import PublicDomainFilter from "../publicDomainFilter/publicDomainFilter"; import { headerBreakpoints } from "../../utils/breakpoints"; -import { DC_URL } from "../../config/constants"; const Search = () => { const router = useRouter(); @@ -15,7 +14,6 @@ const Search = () => { const handleSubmit = (event) => { event.preventDefault(); const searchUrl = - DC_URL + `/search/index?` + (publicDomainOnly ? `utf8=✓&filters%5Brights%5D=pd&` : ``) + `keywords=${encodeURIComponent(keywords)}`; diff --git a/app/src/config/constants.ts b/app/src/config/constants.ts index 17e903c5..cb767a58 100644 --- a/app/src/config/constants.ts +++ b/app/src/config/constants.ts @@ -3,7 +3,6 @@ import appConfig from "../../../appConfig"; export const BASE_URL = "/"; export const SITE_NAME = "NYPL Digital Collections"; -export const DC_URL = appConfig.DC_URL[appConfig.environment as ENV_KEY]; // String used to namespace Digital Collection events in Adobe Analytics export const ADOBE_ANALYTICS_SITE_SECTION = "Digital Collections"; diff --git a/app/src/data/dcNavLinks.ts b/app/src/data/dcNavLinks.ts index d7dda40c..b484a413 100644 --- a/app/src/data/dcNavLinks.ts +++ b/app/src/data/dcNavLinks.ts @@ -1,12 +1,10 @@ -import { DC_URL } from "../config/constants"; - export const dcNavLinks = [ { - href: `${DC_URL}/search/index?utf8=%E2%9C%93&keywords=`, + href: `/search/index?utf8=%E2%9C%93&keywords=`, text: "Items", }, { - href: `${DC_URL}/collections`, + href: `/collections`, text: "Collections", }, { diff --git a/app/src/utils/utils.ts b/app/src/utils/utils.ts index b7be976c..a246ba1e 100644 --- a/app/src/utils/utils.ts +++ b/app/src/utils/utils.ts @@ -2,8 +2,6 @@ import { ADOBE_ANALYTICS_SITE_SECTION, ADOBE_ANALYTICS_DC_PREFIX, } from "../config/constants"; -import { ENV_KEY } from "../types/EnvironmentType"; -import appConfig from "../../../appConfig"; import CollectionDataType from "@/src/types/CollectionDataType"; import ItemDataType from "@/src/types/ItemDataType"; @@ -23,9 +21,7 @@ export const imageURL = ( size = "!1600,1600", rotation = "0" ) => { - return `${ - appConfig.IIIF_URL[appConfig.environment as ENV_KEY] - }/iiif/2/${imageId}/${region}/${size}/${rotation}/default.jpg`; + return `https://iiif.nypl.org/iiif/2/${imageId}/${region}/${size}/${rotation}/default.jpg`; }; export function addCommas(number: string) { diff --git a/appConfig.ts b/appConfig.ts index b744dec5..cd25eef4 100644 --- a/appConfig.ts +++ b/appConfig.ts @@ -1,15 +1,5 @@ const appConfig = { environment: process.env.APP_ENV || "development", - DC_URL: { - development: "", - qa: "", - production: "", - }, - IIIF_URL: { - development: "https://iiif.nypl.org", - qa: "https://iiif.nypl.org", - production: "https://iiif.nypl.org", - }, adobeEmbedUrl: { development: "https://assets.adobedtm.com/1a9376472d37/8519dfce636d/launch-bf8436264b01-development.min.js", diff --git a/next.config.js b/next.config.js index 98db66b9..5ae65bd4 100644 --- a/next.config.js +++ b/next.config.js @@ -12,8 +12,8 @@ const nextConfig = { }, reactStrictMode: false, env: { - DC_URL: process.env.DC_URL, - IIIF_URL: process.env.IIIF_URL, + // DC_URL: process.env.DC_URL, + // IIIF_URL: process.env.IIIF_URL, ADOBE_EMBED_URL: process.env.ADOBE_EMBED_URL, APP_ENV: process.env.APP_ENV, NEW_RELIC_LICENSE_KEY: process.env.NEW_RELIC_LICENSE_KEY, From 6da42d6e1cdac1c4d751bfbeb4b55b3a16c75337 Mon Sep 17 00:00:00 2001 From: Alessandra Vertrees Date: Tue, 26 Nov 2024 10:28:35 -0500 Subject: [PATCH 2/3] woopsies --- .../homePageMainContent.tsx | 1 - .../pages/divisionsPage/divisionsPage.tsx | 1 - app/src/utils/api.ts | 3 +-- next.config.js | 2 -- public/CHANGELOG.md | 20 +++++++++---------- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/src/components/homePageMainContent/homePageMainContent.tsx b/app/src/components/homePageMainContent/homePageMainContent.tsx index e2eedb39..10497385 100644 --- a/app/src/components/homePageMainContent/homePageMainContent.tsx +++ b/app/src/components/homePageMainContent/homePageMainContent.tsx @@ -1,7 +1,6 @@ import React from "react"; import FeaturedContentComponent from "../featuredContent/featuredContent"; import { useEffect, useState } from "react"; -// import { DC_URL } from "@/src/config/constants"; import { Lane as DCLane } from "../lane/lane"; import LaneDataType from "@/src/types/Lane"; import LaneLoading from "../lane/laneLoading"; diff --git a/app/src/components/pages/divisionsPage/divisionsPage.tsx b/app/src/components/pages/divisionsPage/divisionsPage.tsx index 494c6be0..b18cb2f6 100644 --- a/app/src/components/pages/divisionsPage/divisionsPage.tsx +++ b/app/src/components/pages/divisionsPage/divisionsPage.tsx @@ -7,7 +7,6 @@ import { } from "@nypl/design-system-react-components"; import PageLayout from "../../pageLayout/pageLayout"; import React, { useEffect, useState } from "react"; -import { DC_URL } from "@/src/config/constants"; import { Lane as DCLane } from "../../lane/lane"; import LaneLoading from "../../lane/laneLoading"; import LaneDataType from "@/src/types/Lane"; diff --git a/app/src/utils/api.ts b/app/src/utils/api.ts index 3d91eb7d..458e9226 100644 --- a/app/src/utils/api.ts +++ b/app/src/utils/api.ts @@ -5,7 +5,6 @@ import { imageURL, addCommas } from "../utils/utils"; import appConfig from "../../../appConfig"; import defaultFeaturedItems from "../data/defaultFeaturedItemData"; import { CARDS_PER_PAGE } from "../config/constants"; -import { DC_URL } from "../config/constants"; export const getHomePageData = async () => { const randomNumber = Math.floor(Math.random() * 2); @@ -53,7 +52,7 @@ export const getFeaturedItemData = async () => { ), uuid: featuredImageData.uuid, title: featuredImageData.title, - href: `${DC_URL}/items/${featuredImageData.uuid}`, + href: `/items/${featuredImageData.uuid}`, }; const newResponse = { featuredItem: featuredItemObject, diff --git a/next.config.js b/next.config.js index 5ae65bd4..97d343c3 100644 --- a/next.config.js +++ b/next.config.js @@ -12,8 +12,6 @@ const nextConfig = { }, reactStrictMode: false, env: { - // DC_URL: process.env.DC_URL, - // IIIF_URL: process.env.IIIF_URL, ADOBE_EMBED_URL: process.env.ADOBE_EMBED_URL, APP_ENV: process.env.APP_ENV, NEW_RELIC_LICENSE_KEY: process.env.NEW_RELIC_LICENSE_KEY, diff --git a/public/CHANGELOG.md b/public/CHANGELOG.md index 94e5b174..fc005e49 100644 --- a/public/CHANGELOG.md +++ b/public/CHANGELOG.md @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased + +## Removed +- removed unneccessary variables post reverse proxy launch + +## [0.2.3] 2024-11-21 + +### Updated + +- Update timeout on API request to 14 seconds + ## [0.2.2] 2024-11-20 ### Updated @@ -44,16 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - merged into 0.1.19 -## [0.1.19] 2024-11-18 - -## Updated - -- Updated collection card urls to use uuid -- Moved `/divisions` and `/divisions/[slug]` from behind middleware, now accessible -- Updated item card urls to use uuid -- Updated collection card urls to use legacy url -- Updated prod ECS cluster name to `new-digitalcollections-prod` - ## [0.1.17] 2024-11-14 ### Updated From b072411accaa1e566d037335be3008cb1fdeb302 Mon Sep 17 00:00:00 2001 From: Alessandra Vertrees Date: Tue, 3 Dec 2024 09:50:56 -0500 Subject: [PATCH 3/3] public changelog --- public/CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/public/CHANGELOG.md b/public/CHANGELOG.md index 12636a99..8f137c03 100644 --- a/public/CHANGELOG.md +++ b/public/CHANGELOG.md @@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Removed - - removed unneccessary variables post reverse proxy launch - Removed new relic files from frontend (DR-3311) @@ -16,12 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added tests for API helpers (DR-3271) - ### Updated - Update thumbnail logic so thumbnails are never restricted (DR-3293) - ## [0.2.4] 2024-11-26 ### Updated