Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/testing-library/reac…
Browse files Browse the repository at this point in the history
…t-15.0.7
  • Loading branch information
celinetendam authored Oct 31, 2024
2 parents cdfbf12 + 161b5bd commit dff9c40
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ NEXT_PUBLIC_API_MOCKING=enabled
SERVERSIDE_LOGIN=disabled
NEXT_PUBLIC_TELEMETRY_URL=http://localhost:12347/collect

NEXT_PUBLIC_SANITY_DATASET=development

INNSYN_API=https://dp-innsyn.intern.dev.nav.no
IDPORTEN_REDIRECT_URI=http://localhost:3000/api/auth/callback
Expand All @@ -12,3 +13,5 @@ AMPLITUDE_API_KEY=

SOKNADSDIALOG_URL=https://arbeid.intern.dev.nav.no/dagpenger/dialog
NEXT_PUBLIC_LOCALHOST=true

APP_ENV=localhost
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
Expand Down
2 changes: 2 additions & 0 deletions .nais/nais.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ spec:
value: {{uxsignalsMode}}
- name: APP_ENV
value: {{appEnv}}
- name: NEXT_PUBLIC_SANITY_DATASET
value: {{sanity_dataset}}
ingresses:
{{#each ingresses as |url|}}
- {{url}}
Expand Down
3 changes: 2 additions & 1 deletion .nais/vars-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ soknadsdialog:
ingress: https://arbeid.intern.dev.nav.no/dagpenger/dialog
uxsignalsEnabled: enabled
uxsignalsMode: demo
appEnv: dev
appEnv: dev
sanity_dataset: development
3 changes: 2 additions & 1 deletion .nais/vars-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ soknadsdialog:
ingress: https://www.nav.no/dagpenger/dialog
uxsignalsEnabled: enabled
uxsignalsMode: production
appEnv: production
appEnv: production
sanity_dataset: production
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"react-dom": "^18.3.1",
"swr": "^2.2.5",
"unleash-client": "^5.6.1",
"uuid": "^9.0.1"
"uuid": "^10.0.0"
},
"devDependencies": {
"@axe-core/react": "^4.9.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/UxSignalsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function UxSignalsWidget({ enabled, mode }: IProps) {
src="https://uxsignals-frontend.uxsignals.app.iterate.no/embed.js"
/>
<div
data-uxsignals-embed={`panel-${uxSignalId}`}
data-uxsignals-embed={uxSignalId}
data-uxsignals-mode={mode}
style={{ maxWidth: 630 }}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/context/sanity-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function useSanity() {
return context?.settings?.find((setting) => setting.settingId === settingId)?.settingValue;
}

function getRichText(slug: string): TypedObject | TypedObject[] | undefined {
function getRichText(textId: string): TypedObject | TypedObject[] | undefined {
const richText = context?.richTexts?.find((richText) => {
return richText.slug === slug;
return richText.textId === textId;
});

return richText?.body;
Expand Down
26 changes: 26 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { innenfor12Uker } from "../util/soknadDato.util";
import { PaabegyntSoknad, hentPaabegynteSoknader } from "./api/paabegynteSoknader";
import { Søknad, hentSoknader } from "./api/soknader";
import { UxSignalsWidget } from "../components/UxSignalsWidget";
import { useRouter } from "next/router";
import { useEffect } from "react";

interface Props {
fullforteSoknader: Søknad[] | null;
Expand All @@ -24,6 +26,7 @@ interface Props {

interface IEnv {
soknadsdialogIngress: string;
appEnv;
uxSignals: {
enabled: boolean;
mode: string;
Expand Down Expand Up @@ -81,6 +84,7 @@ export async function getServerSideProps(
paabegynteSoknader,
env: {
soknadsdialogIngress: process.env.SOKNADSDIALOG_URL,
appEnv: process.env.APP_ENV,
uxSignals: {
enabled: process.env.UXSIGNALS_ENABLED === "enabled",
mode: process.env.UXSIGNALS_MODE === "demo" ? "demo" : "",
Expand All @@ -92,6 +96,28 @@ export async function getServerSideProps(

export default function Status({ fullforteSoknader, paabegynteSoknader, env }: Props) {
const { getAppText } = useSanity();
const router = useRouter();

useEffect(() => {
// Task analytic Spørreundersøkelse for gammel og ny vedtaksbrev
const nyBrev = env.appEnv === "production" ? "03409" : "03400";
const gammelBrev = env.appEnv === "production" ? "03408" : "03400";

setTimeout(() => {
//@ts-ignore Ukjent TA type
if (router.query && typeof window.TA === "function") {
if (router.query.brev === "ny") {
//@ts-ignore Ukjent TA type
window.TA("start", nyBrev);
}

if (router.query.brev === "gammel") {
//@ts-ignore Ukjent TA type
window.TA("start", gammelBrev);
}
}
}, 2000);
});

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/sanity/sanity-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createClient } from "@sanity/client";

export const innsynSanityClient = createClient({
projectId: "rt6o382n",
dataset: "production",
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET || "production",
apiVersion: "2021-06-21",
useCdn: process.env.NODE_ENV === "production",
});
30 changes: 15 additions & 15 deletions src/sanity/sanity-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const settingFields = `{
settingValue,
}`;

const infoTextsFields = `{
"slug": slug.current,
const richTextsFields = `{
textId,
body
}`;

Expand All @@ -20,25 +20,25 @@ const linkFields = `{
linkDescription
}`;

export const appTextsGroq = `* [_type=="mineDagpengerAppText" && __i18n_lang==$baseLang]{
...coalesce(* [_id==^._id + "__i18n_" + $lang][0]${appTextFields}, ${appTextFields})
}`;
export const appTextsGroq = `* [_type=="mineDagpengerAppText" && language==$baseLang]{
...coalesce(* [textId==^.textId && language==$lang][0]${appTextFields}, ${appTextFields})
}`;

const infoTextsGroq = `* [_type=="mineDagpengerRichText" && __i18n_lang==$baseLang]{
...coalesce(* [_id==^._id + "__i18n_" + $lang][0]${infoTextsFields}, ${infoTextsFields})
}`;
const richTextsGroq = `* [_type=="mineDagpengerRichText" && language==$baseLang]{
...coalesce(* [textId==^.textId && language==$lang][0]${richTextsFields}, ${richTextsFields})
}`;

const linksGroq = `* [_type=="mineDagpengerLink" && __i18n_lang==$baseLang]{
...coalesce(* [_id==^._id + "__i18n_" + $lang][0]${linkFields}, ${linkFields})
}`;
const linksGroq = `* [_type=="mineDagpengerLink" && language==$baseLang]{
...coalesce(* [linkId==^.linkId && language==$lang][0]${linkFields}, ${linkFields})
}`;

const settingsGroq = `* [_type=="mineDagpengerSetting" && __i18n_lang==$baseLang]{
...coalesce(* [_id==^._id + "__i18n_" + $lang][0]${settingFields}, ${settingFields})
}`;
const settingsGroq = `* [_type=="mineDagpengerSetting" && language==$baseLang]{
...coalesce(* [settingId==^.settingId && language==$lang][0]${settingFields}, ${settingFields})
}`;

export const allTextsQuery = `{
"appTexts": ${appTextsGroq},
"richTexts": ${infoTextsGroq},
"richTexts": ${richTextsGroq},
"links": ${linksGroq},
"settings": ${settingsGroq}
}`;
2 changes: 1 addition & 1 deletion src/types/sanity.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface ISanitySetting {
}

export interface ISanityRichText {
slug: string;
textId: string;
body: TypedObject | TypedObject[];
}

Expand Down

0 comments on commit dff9c40

Please sign in to comment.