2828<script setup lang="ts">
2929import { ref , inject , watchEffect , onMounted , onUnmounted , computed } from ' vue'
3030import { useRoute , useRouter } from ' vue-router'
31- import { OBP_API_DEFAULT_RESOURCE_DOC_VERSION , getCurrentUser } from ' ../obp'
31+ import { OBP_API_DEFAULT_RESOURCE_DOC_VERSION , getCurrentUser , getOBPBanks } from ' ../obp'
3232import { getOBPAPIVersions } from ' ../obp/api-version'
3333import {
3434 LOGO_URL as logoSource ,
@@ -60,8 +60,20 @@ const combinedMessageDocs = computed(() => {
6060 return [... regularDocs , ... jsonSchemaDocs ]
6161})
6262
63- // Debug menu items
64- const debugMenuItems = ref ([' /debug/providers-status' , ' /debug/oidc' ])
63+ // Help menu items (includes debug pages)
64+ const helpMenuItems = ref ([' /help' , ' /debug/providers-status' , ' /debug/oidc' ])
65+
66+ // Banks state
67+ const banks = ref <Array <{ id: string ; short_name: string ; full_name: string }>>([])
68+ const bankItems = computed (() => banks .value .map (b => b .short_name || b .id ))
69+ const selectedBankId = ref (localStorage .getItem (' obp-selected-bank-id' ) || ' ' )
70+ const banksDropdownLabel = computed (() => {
71+ if (selectedBankId .value ) {
72+ const bank = banks .value .find (b => b .id === selectedBankId .value )
73+ return bank ? (bank .short_name || bank .id ) : ' Banks'
74+ }
75+ return ' Banks'
76+ })
6577
6678// Split versions into main and other
6779const mainVersions = [' BGv1.3' , ' OBPv5.1.0' , ' OBPv6.0.0' , ' UKv3.1' , ' dynamic-endpoints' , ' dynamic-entities' , ' OBPdynamic-endpoint' , ' OBPdynamic-entity' ]
@@ -227,6 +239,9 @@ const handleMore = (command: string, source?: string) => {
227239 // Regular message docs (connector names contain underscores)
228240 console .log (' Navigating to message docs:' , command )
229241 router .push ({ name: ' message-docs' , params: { id: command } })
242+ } else if (command === ' /help' ) {
243+ console .log (' Navigating to help page' )
244+ router .push (' /help' )
230245 } else if (command .startsWith (' /debug/' )) {
231246 console .log (' Navigating to debug page:' , command )
232247 router .push (command )
@@ -238,7 +253,24 @@ const handleMore = (command: string, source?: string) => {
238253 }
239254}
240255
256+ const handleBankSelect = (shortName : string ) => {
257+ const bank = banks .value .find (b => (b .short_name || b .id ) === shortName )
258+ if (bank ) {
259+ selectedBankId .value = bank .id
260+ localStorage .setItem (' obp-selected-bank-id' , bank .id )
261+ }
262+ }
263+
241264onMounted (async () => {
265+ // Fetch banks
266+ getOBPBanks ().then ((data ) => {
267+ if (data && data .banks && Array .isArray (data .banks )) {
268+ banks .value = data .banks
269+ }
270+ }).catch ((error ) => {
271+ console .error (' Failed to fetch banks:' , error )
272+ })
273+
242274 // Fetch available providers
243275 await fetchAvailableProviders ()
244276
@@ -292,9 +324,24 @@ const getCurrentPath = () => {
292324 <RouterLink class =" router-link" id =" header-nav-glossary" to =" /glossary" >{{
293325 $t('header.glossary')
294326 }}</RouterLink >
295- <RouterLink class =" router-link" id =" header-nav-help" to =" /help" >{{
296- $t('header.help')
297- }}</RouterLink >
327+ <SvelteDropdown
328+ class =" menu-right"
329+ id =" header-nav-help"
330+ label =" Help"
331+ :items =" helpMenuItems"
332+ :hover-color =" headerLinksHoverColor"
333+ :background-color =" headerLinksBackgroundColor"
334+ @select =" handleMore"
335+ />
336+ <SvelteDropdown
337+ class =" menu-right"
338+ id =" header-nav-banks"
339+ :label =" banksDropdownLabel"
340+ :items =" bankItems"
341+ :hover-color =" headerLinksHoverColor"
342+ :background-color =" headerLinksBackgroundColor"
343+ @select =" handleBankSelect"
344+ />
298345 <a v-if =" showObpApiManagerButton && hasObpApiManagerHost" v-bind:href =" obpApiManagerHost" class =" router-link" id =" header-nav-api-manager" >
299346 {{ $t('header.api_manager') }}
300347 </a >
@@ -316,15 +363,6 @@ const getCurrentPath = () => {
316363 :background-color =" headerLinksBackgroundColor"
317364 @select =" handleMore"
318365 />
319- <SvelteDropdown
320- class =" menu-right"
321- id =" header-nav-debug"
322- label =" Debug"
323- :items =" debugMenuItems"
324- :hover-color =" headerLinksHoverColor"
325- :background-color =" headerLinksBackgroundColor"
326- @select =" handleMore"
327- />
328366 <!-- <span class="el-dropdown-link">
329367 <RouterLink class="router-link" id="header-nav-spaces" to="/spaces">{{
330368 $t('header.spaces')
@@ -529,7 +567,8 @@ button.login-button-disabled {
529567/* Custom dropdown containers */
530568#header-nav-versions ,
531569#header-nav-message-docs ,
532- #header-nav-debug {
570+ #header-nav-help ,
571+ #header-nav-banks {
533572 display : inline-block ;
534573 vertical-align : middle ;
535574}
0 commit comments