Skip to content

Commit

Permalink
Amplitude utvide sidevisning (#2133)
Browse files Browse the repository at this point in the history
* Legger til pageType (innholdstype) til decoratorParams
* nav-dekoratoren-moduler v3.1.3

---------

Co-authored-by: Tale Prestmo <[email protected]>
  • Loading branch information
PerOlavM and talepre authored Dec 19, 2024
1 parent 683c45d commit d31976e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
27 changes: 17 additions & 10 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 @@ -42,7 +42,7 @@
"@navikt/ds-css": "7.3.1",
"@navikt/ds-react": "7.3.1",
"@navikt/ds-tokens": "7.3.1",
"@navikt/nav-dekoratoren-moduler": "3.1.1",
"@navikt/nav-dekoratoren-moduler": "3.1.3",
"@navikt/nav-office-reception-info": "1.1.2",
"@reduxjs/toolkit": "2.3.0",
"csp-header": "5.2.1",
Expand Down
7 changes: 3 additions & 4 deletions src/utils/decorator-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DecoratorParams } from '@navikt/nav-dekoratoren-moduler';
import { Language } from 'translations';
import { ContentProps, ContentType } from 'types/content-props/_content-common';
import { ContentProps, ContentType, innholdsTypeMap } from 'types/content-props/_content-common';
import { LanguageProps } from 'types/language';
import { Audience, getAudience } from 'types/component-props/_mixins';
import { stripXpPathPrefix } from './urls';
Expand Down Expand Up @@ -76,20 +76,19 @@ export const getDecoratorParams = (content: ContentProps): DecoratorParams => {
}

const { _path, breadcrumbs, language, data, editorView } = content;

const audience = data?.audience ? getAudience(data.audience) : undefined;

const rolePathSegment = _path.split('/')[2];
const context = audience ? audienceToRoleContext[audience] : pathToRoleContext[rolePathSegment];
const decoratorLanguage = getDecoratorLangFromXpLang(language);
const feedbackEnabled = data?.feedbackToggle;
const chatbotDisabled =
data?.chatbotToggle === false || editorView === 'edit' || editorView === 'inline';

const pageType = innholdsTypeMap[content.type];
return {
...defaultParams,
...(context && { context }),
...(decoratorLanguage && { language: decoratorLanguage }),
pageType,
breadcrumbs:
breadcrumbs?.map((crumb) => ({
...crumb,
Expand Down

0 comments on commit d31976e

Please sign in to comment.