Skip to content

Commit f2408ec

Browse files
committed
API Products, Products
1 parent fe7f75f commit f2408ec

27 files changed

Lines changed: 550 additions & 93 deletions

File tree

src/hooks.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { oauth2ProviderManager } from "$lib/oauth/providerManager";
1111
import { SessionOAuthHelper } from "$lib/oauth/sessionHelper";
1212
import { resourceDocsCache } from "$lib/stores/resourceDocsCache";
1313

14+
declare const process: { env: Record<string, string | undefined>; argv: string[] };
15+
1416
// Constants
1517
const DEFAULT_PORT = 3003;
1618

src/lib/components/OpeyChat.svelte

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -541,39 +541,22 @@
541541
{#if options.displayConnectionPips}
542542
<div class="flex flex-col items-center">
543543
<!-- Connection Pip with Tooltip -->
544-
<Tooltip
545-
classes="z-10"
546-
positioning={{ placement: 'top' }}
547-
contentBase="card bg-primary-200-800 text-xs p-1"
548-
arrowBackground="var(--color-primary-200-800)"
549-
arrow
550-
>
551-
<!-- Added z-10 for higher stacking -->
552-
{#snippet trigger()}
544+
<Tooltip positioning={{ placement: 'top' }}>
545+
<Tooltip.Trigger>
553546
<div class="badge-icon {connectionPipColor} h-3 w-3">
554547
<ShieldUserIcon size={12} />
555548
</div>
556-
{/snippet}
557-
{#snippet content()}Opey Connection Status: {connectionStatusString}{/snippet}
549+
</Tooltip.Trigger>
550+
<Tooltip.Content>Opey Connection Status: {connectionStatusString}</Tooltip.Content>
558551
</Tooltip>
559552
<!-- Authentication Pip with Tooltip -->
560-
<Tooltip
561-
classes="z-10"
562-
open={authPipOpenState}
563-
contentBase="card bg-primary-200-800 text-xs p-1"
564-
arrowBackground="var(--color-primary-200-800)"
565-
onclick={() => {
566-
authPipOpenState = !authPipOpenState;
567-
}}
568-
arrow
569-
>
570-
<!-- Added z-10 for higher stacking -->
571-
{#snippet trigger()}
553+
<Tooltip open={authPipOpenState}>
554+
<Tooltip.Trigger>
572555
<div class="badge-icon {authPipColor} h-3 w-3">
573556
<ShieldUserIcon size={12} />
574557
</div>
575-
{/snippet}
576-
{#snippet content()}
558+
</Tooltip.Trigger>
559+
<Tooltip.Content>
577560
{#if session.status === 'loading'}
578561
Authenticating...
579562
{:else if session.status === 'error'}
@@ -590,7 +573,7 @@
590573
{:else}
591574
Not Authenticated
592575
{/if}
593-
{/snippet}
576+
</Tooltip.Content>
594577
</Tooltip>
595578
<!-- {#if !session.isAuthenticated}
596579
<button class="btn btn-sm btn-primary" onclick={upgradeSession} disabled={session.status === 'loading'}>

src/lib/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { env } from "$env/dynamic/public";
22
import { browser } from "$app/environment";
33

4+
declare const process: { env: Record<string, string | undefined>; argv: string[] };
5+
46
// Application configuration interface
57
export interface AppConfiguration {
68
obp: {
@@ -197,8 +199,7 @@ export const configHelpers = {
197199
},
198200
};
199201

200-
// Export types for external use
201-
export type { AppConfiguration };
202+
// AppConfiguration is already exported at its definition above
202203

203204
// Constants for common use
204205
export const OBP_HOST = config.obp.host;

src/lib/config/navigation.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
Package,
2929
CircleHelp,
3030
Rocket,
31+
Banknote,
3132
} from "@lucide/svelte";
3233
import { env } from "$env/dynamic/public";
3334

@@ -365,6 +366,11 @@ export function getActiveDynamicEndpointsMenuItem(pathname: string) {
365366
function buildProductsItems(): NavigationItem[] {
366367
const items: NavigationItem[] = [
367368
{ href: "/products", label: "API Products", iconComponent: Package },
369+
{
370+
href: "/products/financial",
371+
label: "Financial Products",
372+
iconComponent: Banknote,
373+
},
368374
{
369375
href: "/products/collections",
370376
label: "Product Collections",
@@ -384,7 +390,10 @@ export function getActiveProductsMenuItem(pathname: string) {
384390
if (item.external) {
385391
return false;
386392
}
387-
return pathname.startsWith(item.href);
393+
if (item.href === "/products" && pathname === "/products") {
394+
return true;
395+
}
396+
return pathname.startsWith(item.href) && item.href !== "/products";
388397
});
389398

390399
return found || productsItems[0];

src/lib/oauth/client.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { jwtDecode } from "jwt-decode";
99

1010
export class OAuth2ClientWithConfig extends OAuth2Client {
1111
OIDCConfig?: OpenIdConnectConfiguration;
12+
private _redirectURI: string;
13+
private _clientSecret: string;
1214

1315
constructor(clientId: string, clientSecret: string, redirectUri: string) {
1416
super(clientId, clientSecret, redirectUri);
15-
16-
// get the OIDC configuration from the well-known URL if provided
17+
this._redirectURI = redirectUri;
18+
this._clientSecret = clientSecret;
1719
}
1820

1921
async initOIDCConfig(OIDCConfigUrl: string): Promise<void> {
@@ -94,11 +96,11 @@ export class OAuth2ClientWithConfig extends OAuth2Client {
9496
const body = new URLSearchParams();
9597
body.set("grant_type", "authorization_code");
9698
body.set("code", code);
97-
body.set("redirect_uri", this.redirectURI);
99+
body.set("redirect_uri", this._redirectURI);
98100
body.set("client_id", this.clientId);
99101

100-
if (this.clientSecret) {
101-
body.set("client_secret", this.clientSecret);
102+
if (this._clientSecret) {
103+
body.set("client_secret", this._clientSecret);
102104
}
103105

104106
if (codeVerifier) {

src/lib/oauth/providerFactory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class KeyCloakStrategy implements OAuth2ProviderStrategy {
3030

3131
async initialize(config: WellKnownUri): Promise<OAuth2ClientWithConfig> {
3232
const client = new OAuth2ClientWithConfig(
33-
env.KEYCLOAK_OAUTH_CLIENT_ID,
34-
env.KEYCLOAK_OAUTH_CLIENT_SECRET,
35-
env.APP_CALLBACK_URL,
33+
env.KEYCLOAK_OAUTH_CLIENT_ID || "",
34+
env.KEYCLOAK_OAUTH_CLIENT_SECRET || "",
35+
env.APP_CALLBACK_URL || "",
3636
);
3737

3838
await client.initOIDCConfig(config.url);

src/lib/oauth/providerManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class OAuth2ProviderManager {
2626
ready: false,
2727
providers: [],
2828
};
29-
private retryIntervalId: NodeJS.Timeout | null = null;
29+
private retryIntervalId: ReturnType<typeof setInterval> | null = null;
3030
private retryIntervalMs: number = 30000; // Retry every 30 seconds
31-
private refreshIntervalId: NodeJS.Timeout | null = null;
31+
private refreshIntervalId: ReturnType<typeof setInterval> | null = null;
3232
private refreshIntervalMs: number = 60000; // Refresh provider status every 60 seconds
3333
private definedProviders: string[] = [];
3434

src/lib/opey/services/OBPIntegrationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,5 @@ export class DefaultOBPIntegrationService implements OBPIntegrationService {
134134
}
135135

136136
export const obpIntegrationService = new DefaultOBPIntegrationService(
137-
env.OPEY_CONSUMER_ID,
137+
env.OPEY_CONSUMER_ID || "",
138138
);

src/routes/(protected)/account-access/system-views/[view_id]/edit/+page.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@
8383
if (grantAccessViews.trim()) {
8484
requestBody.can_grant_access_to_views = grantAccessViews
8585
.split(",")
86-
.map((v) => v.trim())
87-
.filter((v) => v);
86+
.map((v: string) => v.trim())
87+
.filter((v: string) => v);
8888
}
8989
9090
if (revokeAccessViews.trim()) {
9191
requestBody.can_revoke_access_to_views = revokeAccessViews
9292
.split(",")
93-
.map((v) => v.trim())
94-
.filter((v) => v);
93+
.map((v: string) => v.trim())
94+
.filter((v: string) => v);
9595
}
9696
9797
const response = await fetch(`/api/system-views/${data.view?.view_id}`, {

src/routes/(protected)/consumers/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
let { data } = $props();
55
const consumers = data.consumers;
6-
const errorMessage = data.errorMessage;
6+
const errorMessage = data.error;
77
const userEntitlements = data.userEntitlements || [];
88
const requiredRoles = data.requiredRoles || [];
99

0 commit comments

Comments
 (0)