@sbc-connect/nuxt-auth 0.13.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @sbc-connect/nuxt-auth
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#180](https://github.com/bcgov/connect-nuxt/pull/180) [`4e25088`](https://github.com/bcgov/connect-nuxt/commit/4e250886da973eda99044ff1c34383604b05d718) Thanks [@deetz99](https://github.com/deetz99)! - Force type resolutions via nuxt config prepare:types hook.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`4e25088`](https://github.com/bcgov/connect-nuxt/commit/4e250886da973eda99044ff1c34383604b05d718)]:
12
+ - @sbc-connect/nuxt-base@0.12.0
13
+ - @sbc-connect/nuxt-forms@0.7.7
14
+
15
+ ## 0.14.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#178](https://github.com/bcgov/connect-nuxt/pull/178) [`3c8d9bf`](https://github.com/bcgov/connect-nuxt/commit/3c8d9bfdf9147d6fd6ce0dadc4b47f043feb4f4b) Thanks [@deetz99](https://github.com/deetz99)! - Fix type augmentation resolution
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`3c8d9bf`](https://github.com/bcgov/connect-nuxt/commit/3c8d9bfdf9147d6fd6ce0dadc4b47f043feb4f4b)]:
24
+ - @sbc-connect/nuxt-base@0.11.0
25
+ - @sbc-connect/nuxt-forms@0.7.6
26
+
3
27
  ## 0.13.1
4
28
 
5
29
  ### Patch Changes
package/app/app.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectIdpHint } from '#auth/app/enums/connect-idp-hint'
1
+ import { ConnectIdpHint } from './enums/connect-idp-hint'
2
2
  import type { AppConfigInput } from 'nuxt/schema'
3
3
 
4
4
  export default defineAppConfig({
@@ -8,12 +8,14 @@ const {
8
8
  username?: string
9
9
  theme?: 'header' | 'dropdown'
10
10
  }>()
11
+
12
+ const { locale } = useI18n()
11
13
  </script>
12
14
 
13
15
  <template>
14
16
  <div class="flex items-center gap-1">
15
17
  <UAvatar
16
- :text="username[0] ? username[0].toLocaleUpperCase($i18n.locale) : 'U'"
18
+ :text="username[0] ? username[0].toLocaleUpperCase(locale) : 'U'"
17
19
  size="md"
18
20
  class="text-inverted self-start sm:self-center"
19
21
  :ui="{ root: 'bg-blue-300 rounded-none text-lg', fallback: 'text-inverted font-bold' }"
@@ -1,5 +1,4 @@
1
- import { useAppConfig } from '#imports'
2
-
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  export const useConnectAppConfig = () => {
4
3
  /**
5
4
  * Merge preset overrides (from app.config.connectOverrides) into the provided baseConfig.
@@ -7,10 +6,10 @@ export const useConnectAppConfig = () => {
7
6
  */
8
7
  function mergeAppConfigOverrides(
9
8
  baseConfig: ConnectConfig,
10
- presetName: ConnectPresetType
9
+ presetName: string
11
10
  ): ConnectConfig {
12
11
  const appConfig = useAppConfig()
13
- const overrides = appConfig.connectOverrides?.[presetName] ?? null
12
+ const overrides = (appConfig.connectOverrides as Record<string, any>)?.[presetName] ?? null
14
13
 
15
14
  return {
16
15
  ...baseConfig,
@@ -1,10 +1,12 @@
1
1
  export default defineNuxtRouteMiddleware((to) => {
2
- const appConfig = useAppConfig()
3
- const { mergeAppConfigOverrides } = useConnectAppConfig()
2
+ if (to.query.preset) {
3
+ const appConfig = useAppConfig()
4
+ const { mergeAppConfigOverrides } = useConnectAppConfig()
4
5
 
5
- // Build and assign app.config presets
6
- appConfig.connect = mergeAppConfigOverrides(
7
- appConfig.connect as ConnectConfig,
8
- to.query.preset as ConnectPresetType
9
- )
6
+ // Build and assign app.config presets
7
+ appConfig.connect = mergeAppConfigOverrides(
8
+ appConfig.connect as ConnectConfig,
9
+ to.query.preset as string
10
+ )
11
+ }
10
12
  })
@@ -5,3 +5,5 @@ declare module '#app' {
5
5
  'connect:auth:refresh': (payload: { token: string | undefined }) => HookResult
6
6
  }
7
7
  }
8
+
9
+ export {}
@@ -0,0 +1,11 @@
1
+ import type { $Fetch } from 'ofetch'
2
+ import type Keycloak from 'keycloak-js'
3
+
4
+ declare module '#app' {
5
+ interface NuxtApp {
6
+ $authApi: $Fetch
7
+ $connectAuth: Keycloak
8
+ }
9
+ }
10
+
11
+ export {}
package/nuxt.config.ts CHANGED
@@ -88,5 +88,20 @@ export default defineNuxtConfig({
88
88
  'keycloak-js'
89
89
  ]
90
90
  }
91
+ },
92
+
93
+ // Nuxt 4 tsconfig `references` context workaround for type augmentation
94
+ // Forces type augmentations into the correct context
95
+ // https://nuxt.com/docs/4.x/guide/modules/recipes-advanced#extend-typescript-config
96
+ // Can also force sharedReferences, nodeReferences - and nitro references using the 'nitro:prepare:types' hook
97
+ hooks: {
98
+ 'prepare:types': ({ references }) => {
99
+ references.push(
100
+ { path: resolve('./app/types/auth-app-config.d.ts') },
101
+ { path: resolve('./app/types/auth-nuxt-hooks.d.ts') },
102
+ { path: resolve('./app/types/auth-page-meta.d.ts') },
103
+ { path: resolve('./app/types/auth-plugins.d.ts') }
104
+ )
105
+ }
91
106
  }
92
107
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-auth",
3
3
  "type": "module",
4
- "version": "0.13.1",
4
+ "version": "0.15.0",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -11,8 +11,8 @@
11
11
  "nuxt": "4.4.6",
12
12
  "typescript": "6.0.3",
13
13
  "vue-tsc": "3.3.1",
14
- "@sbc-connect/eslint-config": "0.0.8",
15
14
  "@sbc-connect/playwright-config": "0.2.0",
15
+ "@sbc-connect/eslint-config": "0.0.8",
16
16
  "@sbc-connect/vitest-config": "0.2.0"
17
17
  },
18
18
  "dependencies": {
@@ -22,8 +22,8 @@
22
22
  "keycloak-js": "26.2.4",
23
23
  "pinia": "3.0.4",
24
24
  "pinia-plugin-persistedstate": "4.7.1",
25
- "@sbc-connect/nuxt-base": "0.10.0",
26
- "@sbc-connect/nuxt-forms": "0.7.5"
25
+ "@sbc-connect/nuxt-base": "0.12.0",
26
+ "@sbc-connect/nuxt-forms": "0.7.7"
27
27
  },
28
28
  "scripts": {
29
29
  "preinstall": "npx only-allow pnpm",
@@ -1,4 +0,0 @@
1
- export enum ConnectPresetType {
2
- DEFAULT = 'default',
3
- BCSC_USER = 'bcscUser'
4
- }