Skip to content

Commit

Permalink
Merge branch 'main' into uu-header
Browse files Browse the repository at this point in the history
  • Loading branch information
PerOlavM committed Jan 4, 2024
2 parents aaf1198 + 6d477bd commit 9c1f7bb
Show file tree
Hide file tree
Showing 27 changed files with 247 additions and 211 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: '1.0.14'
bun-version: '1.0.21'
- name: Install dependencies
run: bun install --immutable
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/configure-pages@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: '1.0.15'
bun-version: '1.0.21'
- name: Install dependencies
run: bun install --immutable
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: '1.0.15'
bun-version: '1.0.21'
- name: Install dependencies
run: bun install --immutable
env:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ dist/
storybook-static/
.idea

packages/server/public/assets/
packages/server/public/~partytown/
packages/server/public/.vite/
packages/server/.env

# yarn 3
.pnp.*
.yarn/*
Expand Down
2 changes: 1 addition & 1 deletion .nais/vars/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
- name: CDN_URL
value: https://cdn.nav.no/personbruker/decorator-next/public
- name: ENONICXP_SERVICES
value: https://www.intern.dev.nav.no/_/service
value: https://www.nav.no/_/service
- name: XP_BASE_URL
value: https://www.intern.dev.nav.no
- name: AUTH_API_URL
Expand Down
2 changes: 1 addition & 1 deletion .nais/vars/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
- name: CDN_URL
value: https://cdn.nav.no/personbruker/decorator-next/public
- name: ENONICXP_SERVICES
value: https://www.nav.no/_/service
value: https://www.nav.no/_/service
- name: XP_BASE_URL
value: https://www.nav.no
- name: AUTH_API_URL
Expand Down
6 changes: 5 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"singleQuote": true
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"printWidth": 150
}
Binary file modified bun.lockb
Binary file not shown.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "bun run --cwd packages/shared test && bun run --cwd packages/client test && bun run --cwd packages/server test",
"dev": "concurrently \"bun run --cwd packages/client dev\" \"bun run --cwd packages/server dev\"",
"build": "bun run --cwd packages/client build && bun run --cwd packages/server build && bun run copy-assets",
"copy-assets": "cp -r packages/client/dist/assets packages/server/public/ && cp -r packages/client/dist/~partytown packages/server/public/ && cp -r packages/client/dist/.vite packages/server/public/",
"copy-assets": "cp -r packages/client/dist/assets packages/server/public/ && cp -r packages/client/dist/~partytown packages/server/public/",
"serve": "bun run --cwd packages/server serve",
"serve-dev": "concurrently \"bun run --cwd packages/server serve-local\" \"bun run --cwd packages/client build:watch\"",
"prepare": "husky install",
Expand All @@ -28,7 +28,7 @@
"@types/cookie": "^0.5.4",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
"bun-types": "^1.0.15",
"@types/bun": "^1.0.0",
"concurrently": "^8.2.0",
"eslint": "latest",
"husky": "^8.0.0",
Expand All @@ -40,12 +40,14 @@
"*.{js,ts,tsx,css,md}": "prettier --write"
},
"dependencies": {
"@grafana/faro-web-sdk": "^1.3.5",
"@storybook/addon-essentials": "^7.4.3",
"@storybook/blocks": "^7.4.3",
"@storybook/html": "^7.4.3",
"@storybook/html-vite": "^7.4.3",
"clsx": "^2.0.0",
"js-cookie": "^3.0.5",
"postcss-modules": "latest",
"storybook": "^7.4.3",
"ts-pattern": "^5.0.5",
"zod": "^3.22.4"
Expand Down
12 changes: 6 additions & 6 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"test:watch": "TZ=UTC vitest watch"
},
"dependencies": {
"@navikt/ds-tokens": "5.11.2",
"@navikt/ds-tokens": "5.12.2",
"decorator-shared": "workspace:*",
"lodash.debounce": "4.0.8",
"js-cookie": "3.0.5",
"amplitude-js": "^8.21.9"
},
"devDependencies": {
"@types/js-cookie": "3.0.6",
"@fullhuman/postcss-purgecss": "^5.0.0",
"@open-wc/testing": "^3.2.0",
"@types/lodash.debounce": "4.0.8",
"@fullhuman/postcss-purgecss": "5.0.0",
"@open-wc/testing": "4.0.0",
"@types/lodash.debounce": "4.0.9",
"autoprefixer": "^10.4.14",
"jsdom": "^23.0.0",
"postcss": "^8.4.27",
"postcss-prefix-selector": "^1.16.0",
"rollup-plugin-minify-html-literals-v3": "^1.3.3",
"vite": "5.0.2",
"vite": "5.0.10",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.34.5"
"vitest": "1.1.1"
}
}
28 changes: 28 additions & 0 deletions packages/client/src/client.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { AppState } from 'decorator-shared/types';
import { Faro } from '@grafana/faro-web-sdk';

declare global {
interface Window {
__DECORATOR_DATA__: AppState;
loginDebug: {
expireToken: (seconds: number) => void;
expireSession: (seconds: number) => void;
};
analyticsEvent: (props: AnalyticsEventArgs) => void;
logPageView: (params: Params, authState: Auth) => Promise<unknown>;
logAmplitudeEvent: (
eventName: string,
eventData: Record<string, any>,
origin?: string,
) => void;
startTaskAnalyticsSurvey: (state: AppState) => void;
// For task analytics, should have better types?
TA: any;
dataLayer: any;
vngageReady: () => void;
vngage: {
join: (queue: string, options: unknown) => void;
},
faro?: Faro
}
}
14 changes: 14 additions & 0 deletions packages/client/src/faro.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* This adds information about decorator parameters to the Grafana faro. To aid with debugging.
* */
export function addFaroMetaData() {
if (!window.faro) return;

window.faro.api.setSession({
attributes: {
...window.__DECORATOR_DATA__.env,
},
});

console.log('Faro: Adding metadata');
}
4 changes: 2 additions & 2 deletions packages/client/src/helpers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function fetchSession() {

return await sessionResponse.json();
} catch (error) {
throw new Error(`Error fetching auth: ${error}`);
console.log(`User is not logged in`);
}
}

Expand All @@ -41,7 +41,7 @@ export async function fethRenew() {

return await sessionResponse.json();
} catch (error) {
throw new Error(`Error fetching auth: ${error}`);
console.log(`User is not logged in`);
}
}

Expand Down
Loading

0 comments on commit 9c1f7bb

Please sign in to comment.