Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main from staging (July 26th, 2024) #708

Merged
merged 6 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine3.20 AS base
FROM node:20.16.0-alpine3.20 AS base
WORKDIR /base
COPY package*.json ./
RUN npm ci && npm cache clean --force
Expand All @@ -9,6 +9,8 @@ FROM base AS build
# Build envs
ARG HOSTALIAS_CERT
ENV HOSTALIAS_CERT=$HOSTALIAS_CERT
ARG HOSTALIAS_ROOT_CERT
ENV HOSTALIAS_ROOT_CERT=$HOSTALIAS_ROOT_CERT
ARG LOGGING_LEVEL=info
ENV LOGGING_LEVEL=$LOGGING_LEVEL
ARG AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/graphql/execute.json/decd-endc/
Expand All @@ -26,9 +28,21 @@ ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./

RUN mkdir -p /usr/local/share/ca-certificates/ && echo ${HOSTALIAS_CERT} | sed 's/\\n/\n/g' | xargs > /usr/local/share/ca-certificates/env.crt && chmod 644 /usr/local/share/ca-certificates/env.crt && npm run build

FROM node:20-alpine3.20 AS production
RUN mkdir -p /usr/local/share/ca-certificates/ && \
echo ${HOSTALIAS_CERT} | \
sed 's/\\n/\n/g' | \
xargs > \
/usr/local/share/ca-certificates/env.crt && \
chmod 644 /usr/local/share/ca-certificates/env.crt && \
mkdir -p /etc/ssl/certs/ && \
echo ${HOSTALIAS_ROOT_CERT} | \
sed 's/\\n/\n/g' | \
xargs > \
/etc/ssl/certs/root.crt && \
chmod 644 /etc/ssl/certs/root.crt && \
npm run build

FROM node:20.16.0-alpine3.20 AS production
ENV NODE_ENV=production

ARG user=nodeuser
Expand All @@ -51,9 +65,13 @@ RUN addgroup \

WORKDIR ${home}

COPY --from=build /etc/ssl/certs/root.crt /etc/ssl/certs/root.crt
COPY --from=build --chown=${user}:${group} /usr/local/share/ca-certificates/env.crt ${MSCA_NG_CERT_LOCATION}

RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* && update-ca-certificates
RUN apk update && \
apk add ca-certificates && \
rm -rf /var/cache/apk/* && \
update-ca-certificates

USER ${user}

Expand Down
66 changes: 25 additions & 41 deletions components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useRouter } from 'next/router'
import throttle from 'lodash.throttle'
import IdleTimeout from './IdleTimeout'
import { signOut } from 'next-auth/react'
import getConfig from 'next/config'

export default function Layout(props) {
const t = props.locale === 'en' ? en : fr
Expand Down Expand Up @@ -144,48 +145,31 @@ export default function Layout(props) {
<main id="mainContent" className="sch-container grid gap-[30px]">
{props.children}
</main>

<IdleTimeout locale={props.locale} refPageAA={props.refPageAA} />

{process.env.ENVIRONMENT === 'production' ? (
<Footer
lang={!props.locale ? 'en' : props.locale}
brandLinks={[
{
href: t.footerTermsAndConditionURL,
id: 'linkTC',
text: t.footerTermsAndCondition,
},
{
href: t.footerPrivacyURL,
id: 'linkPR',
text: t.footerPrivacy,
},
]}
contactLink={contactLink}
btnLink="#top"
id="page-footer"
/>
) : (
<Footer
lang={!props.locale ? 'en' : props.locale}
brandLinks={[
{
href: t.footerTermsAndConditionDevURL,
id: 'linkTC',
text: t.footerTermsAndCondition,
},
{
href: t.footerPrivacyDevURL,
id: 'linkPR',
text: t.footerPrivacy,
},
]}
contactLink={contactLink}
btnLink="#top"
id="page-footer"
/>
)}
<Footer
lang={!props.locale ? 'en' : props.locale}
brandLinks={[
{
href:
getConfig()?.publicRuntimeConfig.ENVIRONMENT === 'production'
? t.footerTermsAndConditionURL
: t.footerTermsAndConditionDevURL,
id: 'linkTC',
text: t.footerTermsAndCondition,
},
{
href:
getConfig()?.publicRuntimeConfig.ENVIRONMENT === 'production'
? t.footerPrivacyURL
: t.footerPrivacyDevURL,
id: 'linkPR',
text: t.footerPrivacy,
},
]}
contactLink={contactLink}
btnLink="#top"
id="page-footer"
/>
</>
)
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/ContactUs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Validate Contact Us Landing page', () => {
cy.get('[data-cy = "contact-task-list"]')
.find('a')
.should('be.visible')
.and('have.length', '3')
.and('have.length', '4')
.and('not.have.length', 0)
.and('not.have.attr', 'href', '#undefined')
})
Expand Down
21 changes: 21 additions & 0 deletions graphql/mappers/contact-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export async function getContactUsContent() {
const eiContactFragment = findFragmentByScId(response, 'ei-contact-us')
const oasContactFragment = findFragmentByScId(response, 'oas-contact-us')
const cppContactFragment = findFragmentByScId(response, 'cpp-contact-us')
const sinContactFragment = findFragmentByScId(response, 'sin-contact-us')

const mappedSecurity = {
en: {
Expand Down Expand Up @@ -144,6 +145,16 @@ export async function getContactUsContent() {
: '',
schBetaPopup: oasContactFragment?.schBetaPopUp,
},
{
linkId: sinContactFragment?.scId,
linkTitle: sinContactFragment?.scLinkTextEn,
linkAssistiveTitle: sinContactFragment?.scLinkTextAssistiveEn,
linkDestination: sinContactFragment?.scDestinationURLEn,
linkDescription: sinContactFragment?.scDescriptionEn?.json
? sinContactFragment.scDescriptionEn.json[0].content[0].value
: '',
schBetaPopup: sinContactFragment?.schBetaPopUp,
},
],
},
fr: {
Expand Down Expand Up @@ -190,6 +201,16 @@ export async function getContactUsContent() {
: '',
schBetaPopup: oasContactFragment?.schBetaPopUp,
},
{
linkId: sinContactFragment?.scId,
linkTitle: sinContactFragment?.scLinkTextFr,
linkAssistiveTitle: sinContactFragment?.scLinkTextAssistiveFr,
linkDestination: sinContactFragment?.scDestinationURLFr,
linkDescription: sinContactFragment?.scDescriptionFr?.json
? sinContactFragment.scDescriptionFr.json[0].content[0].value
: '',
schBetaPopup: sinContactFragment?.schBetaPopUp,
},
],
},
}
Expand Down
Loading
Loading