@sbc-connect/nuxt-auth 0.6.1 → 0.7.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.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#135](https://github.com/bcgov/connect-nuxt/pull/135) [`31c8786`](https://github.com/bcgov/connect-nuxt/commit/31c87862eae861c21fd26d8b79325b38eca565cb) Thanks [@cameron-eyds](https://github.com/cameron-eyds)! - Updated Account Status Handling
8
+
9
+ - [#136](https://github.com/bcgov/connect-nuxt/pull/136) [`7e3a970`](https://github.com/bcgov/connect-nuxt/commit/7e3a9701ddd5304851c8d55c9fc940b2da656cbf) Thanks [@cameron-eyds](https://github.com/cameron-eyds)! - Misc typing and e2e test fixes
10
+
11
+ - [#137](https://github.com/bcgov/connect-nuxt/pull/137) [`9c10812`](https://github.com/bcgov/connect-nuxt/commit/9c10812d8ecde646eb185310376cabd3319a414d) Thanks [@deetz99](https://github.com/deetz99)! - Account creation form: fix padding
12
+
13
+ - [#133](https://github.com/bcgov/connect-nuxt/pull/133) [`644cb59`](https://github.com/bcgov/connect-nuxt/commit/644cb59f04d17e8ad5d480ad63d475359415ebcc) Thanks [@cameron-eyds](https://github.com/cameron-eyds)! - Session expiry logout url updates
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`9c10812`](https://github.com/bcgov/connect-nuxt/commit/9c10812d8ecde646eb185310376cabd3319a414d), [`7e3a970`](https://github.com/bcgov/connect-nuxt/commit/7e3a9701ddd5304851c8d55c9fc940b2da656cbf)]:
18
+ - @sbc-connect/nuxt-forms@0.6.0
19
+ - @sbc-connect/nuxt-base@0.7.0
20
+
21
+ ## 0.6.2
22
+
23
+ ### Patch Changes
24
+
25
+ - [#131](https://github.com/bcgov/connect-nuxt/pull/131) [`f649e93`](https://github.com/bcgov/connect-nuxt/commit/f649e930fcb08a4e363e2b6632cb337466f21150) Thanks [@kialj876](https://github.com/kialj876)! - Update useConnectAccountFlowRedirect to add accountid to the query and remove modal in idp-enforcement middleware
26
+
3
27
  ## 0.6.1
4
28
 
5
29
  ### Patch Changes
@@ -18,9 +18,9 @@ const validateName = useDebounceFn(async (accountName: string) => {
18
18
  try {
19
19
  const { refetch } = authApi.verifyAccountName(accountName)
20
20
  const { data } = await refetch()
21
- statusCode.value = data?.status
21
+ statusCode.value = data?.status ?? 500 // fallback as undefined is not considered an exception
22
22
  } catch (err: unknown) {
23
- statusCode.value = err?.response?.status || 500
23
+ statusCode.value = getErrorStatus(err) ?? 500
24
24
  } finally {
25
25
  isLoading.value = false
26
26
  }
@@ -57,10 +57,10 @@ provide('UInput-props-account-name-input', uInputProps)
57
57
 
58
58
  <template>
59
59
  <ConnectFormFieldWrapper
60
- class="pt-2 my-6"
61
60
  :label="$t('connect.page.createAccount.accountNameLabel')"
62
61
  orientation="horizontal"
63
62
  :error
63
+ padding-class="pt-6 pb-4 px-4 sm:pb-4 sm:pt-8 sm:px-8"
64
64
  >
65
65
  <ConnectFormInput
66
66
  v-model="accountFormState.accountName"
@@ -25,7 +25,10 @@ const formErrors = computed<{
25
25
  })
26
26
 
27
27
  async function validate(fieldName?: keyof AccountProfileSchema) {
28
- return formRef.value?.validate({ name: fieldName, silent: true })
28
+ return formRef.value?.validate({
29
+ name: fieldName as never,
30
+ silent: true
31
+ })
29
32
  }
30
33
 
31
34
  watch(() => statusCode.value, async () => {
@@ -42,11 +45,11 @@ watch(() => statusCode.value, async () => {
42
45
  label: $t('connect.label.accountInformation'),
43
46
  labelClass: 'font-bold md:ml-4',
44
47
  }"
48
+ ui-body="p-0 sm:p-0"
45
49
  >
46
50
  <UForm
47
51
  id="account-create-form"
48
52
  ref="account-create-form"
49
- class="p-8"
50
53
  no-validate
51
54
  :validate-on="['input', 'change']"
52
55
  :schema="accountProfileSchema"
@@ -58,6 +61,7 @@ watch(() => statusCode.value, async () => {
58
61
  <ConnectFormFieldWrapper
59
62
  :label="$t('connect.page.createAccount.yourNameLabel')"
60
63
  orientation="horizontal"
64
+ class="py-6 sm:py-8"
61
65
  >
62
66
  <p class="font-bold">
63
67
  {{ userFullName }}
@@ -67,7 +71,7 @@ watch(() => statusCode.value, async () => {
67
71
  </p>
68
72
  </ConnectFormFieldWrapper>
69
73
 
70
- <USeparator orientation="horizontal" class="my-8" />
74
+ <USeparator orientation="horizontal" />
71
75
 
72
76
  <!-- Account Name -->
73
77
  <ConnectAccountCreateName
@@ -77,10 +81,10 @@ watch(() => statusCode.value, async () => {
77
81
 
78
82
  <!-- Account Email -->
79
83
  <ConnectFormFieldWrapper
80
- class="my-6"
81
84
  :label="$t('connect.page.createAccount.emailLabel')"
82
85
  orientation="horizontal"
83
86
  :error="formErrors.emailAddress"
87
+ padding-class="py-1 px-4 sm:py-2 sm:px-8"
84
88
  >
85
89
  <ConnectFormInput
86
90
  v-model="accountFormState.emailAddress"
@@ -95,6 +99,7 @@ watch(() => statusCode.value, async () => {
95
99
  :label="$t('connect.page.createAccount.phoneLabel')"
96
100
  orientation="horizontal"
97
101
  :error="formErrors.phone"
102
+ padding-class="py-1 px-4 sm:py-2 sm:px-8"
98
103
  >
99
104
  <div class="flex flex-row gap-2">
100
105
  <!-- Disabling country code selection until Auth Model Supports individual property -->
@@ -123,10 +128,10 @@ watch(() => statusCode.value, async () => {
123
128
 
124
129
  <!-- Account Address -->
125
130
  <ConnectFieldset
126
- class="my-6"
127
131
  :label="$t('connect.page.createAccount.addressLabel')"
128
132
  orientation="horizontal"
129
133
  :error="formErrors.address"
134
+ padding-class="py-1 px-4 sm:pt-2 sm:pb-4 sm:px-8"
130
135
  >
131
136
  <ConnectFormAddress
132
137
  id="account-address"
@@ -9,8 +9,9 @@ export const useConnectAccountFlowRedirect = () => {
9
9
  const externalRedirectUrl = route.query.return as string | undefined
10
10
  const internalRedirectUrl = ac.redirect
11
11
  const query = { ...route.query }
12
+ query.accountid = String(currentAccount.id)
12
13
 
13
- const bypassAccounts = userAccounts.length === 1 && !query.populate
14
+ const bypassAccounts = userAccounts.length === 1 && !query.token
14
15
  const isNonStaffAccount = ![AccountType.STAFF, AccountType.SBC_STAFF].includes(currentAccount.accountType)
15
16
  const createOrSelectAccount = manageAccount && isNonStaffAccount && !bypassAccounts
16
17
 
@@ -29,7 +29,10 @@ export const useConnectAuth = () => {
29
29
  let redirectUri = redirect ?? window.location.href
30
30
 
31
31
  if (siteminderUrl) {
32
- redirectUri = `${siteminderUrl}?returl=${redirectUri.replace(/(https?:\/\/)|(\/)+/g, '$1$2')}&retnow=1`
32
+ const cleanedUri = redirectUri.replace(/(https?:\/\/)|(\/)+/g, '$1$2')
33
+ const queryString = window.location.search
34
+ const returlValue = queryString ? `${cleanedUri}${queryString}` : cleanedUri
35
+ redirectUri = `${siteminderUrl}?returl=${returlValue}&retnow=1`
33
36
  }
34
37
 
35
38
  resetPiniaStores()
@@ -85,15 +85,15 @@ export function useConnectHeaderOptions() {
85
85
  const isActive = accountStore.currentAccount.id === account.id
86
86
  options.push({
87
87
  label: account.label,
88
- onSelect: () => {
88
+ onSelect: async () => {
89
89
  if (!isActive && account.id) {
90
90
  if (route.meta.onAccountChange) {
91
91
  const allowAccountChange = route.meta.onAccountChange(accountStore.currentAccount, account)
92
92
  if (allowAccountChange) {
93
- accountStore.switchCurrentAccount(account.id)
93
+ await accountStore.switchCurrentAccount(account.id)
94
94
  }
95
95
  } else {
96
- accountStore.switchCurrentAccount(account.id)
96
+ await accountStore.switchCurrentAccount(account.id)
97
97
  }
98
98
  }
99
99
  },
@@ -14,16 +14,23 @@ export interface ConnectLogoutConfig {
14
14
  }
15
15
 
16
16
  export interface ConnectHeaderConfig {
17
- loginMenu: boolean
18
- createAccount: boolean
19
- notifications: boolean
20
- accountOptionsMenu: boolean
17
+ loginMenu?: boolean
18
+ createAccount?: boolean
19
+ notifications?: boolean
20
+ accountOptionsMenu?: boolean
21
+ localeSelect?: boolean
22
+ whatsNew?: boolean
23
+ }
24
+
25
+ export interface ConnectFooterConfig {
26
+ versions?: string[]
21
27
  }
22
28
 
23
29
  export interface ConnectConfig {
24
30
  login: ConnectLoginConfig
25
31
  logout: ConnectLogoutConfig
26
32
  header: ConnectHeaderConfig
33
+ footer?: ConnectFooterConfig
27
34
  }
28
35
 
29
36
  export interface ConnectPresetOverrides {
@@ -1 +1,3 @@
1
- export type ConnectAccountAddress = Pick<ConnectAddress, Exclude<keyof ConnectAddress, 'locationDescription'>>
1
+ export type ConnectAccountAddress = Pick<ConnectAddress, Exclude<keyof ConnectAddress, 'locationDescription'>> & {
2
+ deliveryInstructions?: string
3
+ }
@@ -11,7 +11,7 @@ export interface ConnectAccount {
11
11
 
12
12
  export interface ConnectCreateAccount {
13
13
  accessType: ConnectAccessType
14
- isBusinessAccount: boolean
14
+ isBusinessAccount?: boolean
15
15
  mailingAddress: ConnectAccountAddress
16
16
  name: string
17
17
  paymentInfo: {
@@ -6,7 +6,7 @@ export default defineNuxtRouteMiddleware(async (to) => {
6
6
  await accountStore.initAccountStore()
7
7
 
8
8
  if (to.query.accountid) {
9
- accountStore.switchCurrentAccount(parseInt(to.query.accountid as string))
9
+ await accountStore.switchCurrentAccount(parseInt(to.query.accountid as string))
10
10
  }
11
11
  }
12
12
  }
@@ -2,7 +2,7 @@ import { useConnectAuth } from '#auth/app/composables/useConnectAuth'
2
2
  import { withQuery } from 'ufo'
3
3
  import type { ConnectIdpHint } from '#imports'
4
4
  import { useAppConfig } from '#imports'
5
- import { ConnectModalInvalidIdp } from '#components'
5
+ // import { ConnectModalInvalidIdp } from '#components'
6
6
 
7
7
  export default defineNuxtRouteMiddleware(async (to) => {
8
8
  const localePath = useLocalePath()
@@ -15,13 +15,14 @@ export default defineNuxtRouteMiddleware(async (to) => {
15
15
  const allowedIdps = connectConfig?.login?.idps
16
16
 
17
17
  // Idp overlay
18
- const overlay = useOverlay()
19
- const modal = overlay.create(ConnectModalInvalidIdp)
18
+ // const overlay = useOverlay()
19
+ // const modal = overlay.create(ConnectModalInvalidIdp)
20
20
 
21
21
  /** Show Invalid IDP Modal and Logout on modal close */
22
22
  async function showInvalidIdpModal() {
23
23
  // Prompt user with invalid IDP modal
24
- await modal.open({ currentIdp: authUser.value?.loginSource })
24
+ // FUTURE: Fix this in #32610. Currently it doesn't work - loading overlay covers it.
25
+ // await modal.open({ currentIdp: authUser.value?.loginSource })
25
26
 
26
27
  // Logout and Preserve any query param
27
28
  const pathWithQuery = withQuery(localePath('/auth/login'), to.query)
@@ -23,8 +23,8 @@ useHead({
23
23
  title: pageTitle
24
24
  })
25
25
 
26
- function selectAndRedirect(id: number) {
27
- accountStore.switchCurrentAccount(id)
26
+ async function selectAndRedirect(id: number) {
27
+ await accountStore.switchCurrentAccount(id)
28
28
  finalRedirect(useRoute())
29
29
  }
30
30
 
@@ -66,8 +66,8 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
66
66
  mailingAddress: {
67
67
  city: accountFormState.address.city,
68
68
  country: accountFormState.address.country,
69
- region: accountFormState.address.region,
70
- postalCode: accountFormState.address.postalCode,
69
+ region: accountFormState.address.region ?? '',
70
+ postalCode: accountFormState.address.postalCode ?? '',
71
71
  street: accountFormState.address.street,
72
72
  streetAdditional: accountFormState.address.streetAdditional || '',
73
73
  deliveryInstructions: accountFormState.address.locationDescription || ''
@@ -91,7 +91,7 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
91
91
  // Refresh and switch to new account prior to redirect
92
92
  if (createResponse?.id) {
93
93
  await setAccountInfo()
94
- switchCurrentAccount(createResponse.id)
94
+ await switchCurrentAccount(createResponse.id)
95
95
  }
96
96
 
97
97
  // Update or create user contact and then redirect regardless of success or failure
@@ -148,10 +148,11 @@ export const useConnectAccountStore = defineStore('connect-auth-account-store',
148
148
  }
149
149
 
150
150
  /** Switch the current account to the given account ID if it exists in the user's account list */
151
- function switchCurrentAccount(accountId: number) {
151
+ async function switchCurrentAccount(accountId: number) {
152
152
  const account = userAccounts.value.find(account => account.id === accountId)
153
153
  if (account) {
154
154
  currentAccount.value = account
155
+ await checkAccountStatus()
155
156
  }
156
157
  }
157
158
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-auth",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.7.0",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -22,8 +22,8 @@
22
22
  "keycloak-js": "26.2.2",
23
23
  "pinia": "3.0.4",
24
24
  "pinia-plugin-persistedstate": "4.7.1",
25
- "@sbc-connect/nuxt-base": "0.6.1",
26
- "@sbc-connect/nuxt-forms": "0.5.0"
25
+ "@sbc-connect/nuxt-base": "0.7.0",
26
+ "@sbc-connect/nuxt-forms": "0.6.0"
27
27
  },
28
28
  "scripts": {
29
29
  "preinstall": "npx only-allow pnpm",