Skip to content

Commit 1fe17d2

Browse files
authored
Remove scheme from burger menu (#220)
* Remove scheme from burger menu * Remove scheme from burger menu * Label update * Label update
1 parent 52de73d commit 1fe17d2

File tree

11 files changed

+21
-150
lines changed

11 files changed

+21
-150
lines changed

src/app/core/constants/general.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { Profile, RequestUriMethod } from "../models/TransactionInitializationRe
22

33
export const ACTIVE_TRANSACTION = 'ACTIVE_TRANSACTION';
44
export const SCHEME = 'scheme';
5-
export const DEFAULT_SCHEME = 'haip-vp://';
65
export const ISSUER_CHAIN = 'ISSUER_CHAIN';
76

87
export const DefaultRequestUriMethod: RequestUriMethod = 'get';
9-
export const DefaultProfile: Profile = 'openid4vp';
8+
export const DefaultProfile: Profile = 'haip';

src/app/core/layout/wallet-layout/wallet-layout-header/wallet-layout-header.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<a id="inspectLogs" mat-menu-item (click)="inspectLogs()"
99
>Inspect transaction logs</a
1010
>
11-
<a id="customScheme" mat-menu-item (click)="changeCustomScheme()"
12-
>Change default scheme</a
13-
>
1411
<a id="issuerChain" mat-menu-item (click)="changeIssuerChain()"
1512
>Configure issuer chain</a
1613
>

src/app/core/layout/wallet-layout/wallet-layout-header/wallet-layout-header.component.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { MatMenuModule } from "@angular/material/menu";
66
import { MatToolbarModule } from '@angular/material/toolbar';
77
import { OpenLogsComponent } from "@shared/elements/open-logs/open-logs.component";
88
import { MatDialog, MatDialogModule } from "@angular/material/dialog";
9-
import {InputSchemeComponent} from "@shared/elements/input-scheme/input-scheme.component";
109
import { IssuerChainComponent } from '@app/shared/elements/trusted-issuer/issuer-chain.component';
1110

1211
@Component({
@@ -40,16 +39,6 @@ export class WalletLayoutHeaderComponent {
4039
});
4140
}
4241

43-
changeCustomScheme () {
44-
this.dialog.open(InputSchemeComponent, {
45-
data: {
46-
transactionId: '',
47-
label: 'Inspect transaction logs',
48-
isInspectLogs: true
49-
},
50-
});
51-
}
52-
5342
changeIssuerChain () {
5443
this.dialog.open(IssuerChainComponent, {
5544
data: {

src/app/core/models/TransactionInitializationRequest.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import { DCQL } from './dcql/DCQL';
22

33
export type RequestUriMethod = 'get' | 'post';
44
export type Profile = 'haip' | 'openid4vp';
5+
export type ProfileOptions = {
6+
endpoint: string;
7+
}
8+
export const profileOptions: Record<Profile, ProfileOptions> = {
9+
haip: {
10+
endpoint: 'haip-vp://',
11+
},
12+
openid4vp: {
13+
endpoint: 'openid4vp://',
14+
},
15+
};
516

617
export type TransactionInitializationRequest = {
718
nonce: string;

src/app/features/presentation-request-preparation/components/presentation-options/presentation-options.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
(valueChange)="profileChange.emit($event)"
2222
aria-label="Presentation Profile"
2323
>
24+
<mat-button-toggle value="haip">HAIP</mat-button-toggle>
2425
<mat-button-toggle value="openid4vp">OpenID4VP</mat-button-toggle>
25-
<mat-button-toggle value="haip">HAIP</mat-button-toggle>
2626
</mat-button-toggle-group>
2727
</div>
2828
</div>
@@ -48,14 +48,14 @@
4848

4949
<div class="request-options-row">
5050
<div class="request-options-label">
51-
<span>Authorization URI Scheme</span>
51+
<span>Authorization Endpoint</span>
5252
<p class="request-options-helper">
53-
Specify a custom URI for the authorization request
53+
Specify an endpoint URI for the authorization request
5454
</p>
5555
</div>
5656
<div class="request-options-control">
5757
<mat-form-field appearance="outline" class="config-option-field">
58-
<mat-label>Authorization URI Scheme</mat-label>
58+
<mat-label>Authorization Endpoint</mat-label>
5959
<input
6060
matInput
6161
placeholder="scheme://"

src/app/features/presentation-request-preparation/home/home.component.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
import { AttributeSelectionComponent } from '@features/presentation-request-preparation/components/attribute-selection/attribute-selection.component';
2525
import {
2626
Profile,
27+
profileOptions,
2728
RequestUriMethod,
2829
TransactionInitializationRequest,
2930
} from '@core/models/TransactionInitializationRequest';
@@ -38,11 +39,9 @@ import { DCQLService } from '@app/core/services/dcql-service';
3839
import { Subject } from 'rxjs';
3940
import { SessionStorageService } from '@app/core/services/session-storage.service';
4041
import {
41-
DEFAULT_SCHEME,
4242
DefaultProfile,
4343
DefaultRequestUriMethod,
4444
ISSUER_CHAIN,
45-
SCHEME,
4645
} from '@app/core/constants/general';
4746
import { SUPPORTED_ATTESTATIONS } from '@app/core/constants/attestation-definitions';
4847
import { PresentationOptionsComponent } from '../components/presentation-options/presentation-options.component';
@@ -87,7 +86,7 @@ export class HomeComponent implements OnDestroy {
8786
nonNullable: true,
8887
});
8988
authorizationSchemeControl = new FormControl<string>(
90-
this.getStoredAuthorizationScheme(),
89+
profileOptions[DefaultProfile].endpoint,
9190
{ nonNullable: true }
9291
);
9392
presentationProfileControl = new FormControl<Profile>(DefaultProfile, {
@@ -103,7 +102,7 @@ export class HomeComponent implements OnDestroy {
103102
selectedAttributes: { [id: string]: string[] } | null = {};
104103
selectedRequestUriMethod: RequestUriMethod = DefaultRequestUriMethod;
105104
selectedProfile: Profile = DefaultProfile;
106-
authorizationRequestUri: string = DEFAULT_SCHEME;
105+
authorizationRequestUri: string = profileOptions[DefaultProfile].endpoint;
107106

108107
initializationRequest: TransactionInitializationRequest | null = null;
109108

@@ -167,6 +166,8 @@ export class HomeComponent implements OnDestroy {
167166

168167
handleProfileChangedEvent($event: string) {
169168
this.selectedProfile = $event as Profile;
169+
this.authorizationSchemeControl.setValue(profileOptions[this.selectedProfile].endpoint);
170+
this.authorizationRequestUri = profileOptions[this.selectedProfile].endpoint;
170171
if (this.selectedAttestations && this.selectedAttributes) {
171172
this.initializationRequest = this.prepareInitializationRequest(
172173
this.selectedAttestations,
@@ -257,12 +258,4 @@ export class HomeComponent implements OnDestroy {
257258
canProceed() {
258259
return this.initializationRequest !== null;
259260
}
260-
261-
private getStoredAuthorizationScheme(): string {
262-
if (typeof window === 'undefined' || !window.localStorage) {
263-
return DEFAULT_SCHEME;
264-
}
265-
266-
return window.localStorage.getItem(SCHEME) ?? DEFAULT_SCHEME;
267-
}
268261
}

src/app/shared/elements/input-scheme/error-state-matcher.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/app/shared/elements/input-scheme/input-scheme.component.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/app/shared/elements/input-scheme/input-scheme.component.scss

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/app/shared/elements/input-scheme/input-scheme.component.spec.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)