Skip to content

Verification Web UI updates #649

Open
HarshithaK61 wants to merge 2 commits intoConcordium:mainfrom
HarshithaK61:feature/verification-web-ui
Open

Verification Web UI updates #649
HarshithaK61 wants to merge 2 commits intoConcordium:mainfrom
HarshithaK61:feature/verification-web-ui

Conversation

@HarshithaK61
Copy link

Purpose

This pull request sets up the initial project structure and configuration for the @concordium/verification-web-ui package. It introduces essential environment variables, project metadata, formatting and build tools, a custom PostCSS plugin, and key source files including a landing modal UI and WalletConnect integration examples.

Changes

Project Initialization and Configuration:

  • Added package.json with project metadata, build scripts, dependencies (including WalletConnect, Tailwind CSS, and others), and export definitions for publishing as a UI library.
  • Introduced environment variables in .env for WalletConnect and Concordium network configuration.
  • Added .prettierrc and .prettierignore to enforce consistent code formatting and ignore build artifacts.
  • Included a basic index.html as the app entry point.
  • Added a Netlify-style _redirects file to support client-side routing.

Build and Styling Tooling:

  • Implemented a custom PostCSS plugin (postcss-remove-empty-layers.js) to flatten Tailwind v4 @layer directives, ensuring compatibility for consumers not using Tailwind.
  • Updated postcss.config.ts to use Tailwind, Autoprefixer, and the custom plugin for CSS processing.

Source Code and Examples:

  • Added a comprehensive example integration file (walletconnect-integration.ts) demonstrating SDK-managed and merchant-provided WalletConnect flows, event handling, and usage in React/Vue.
  • Implemented a desktop landing modal component (landing.ts) with a carousel, animated transitions, and event-driven navigation for the verification flow.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

CLA acceptance

_Remove if not applicable.

By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0

- Implemented ConcordiumIDAppPopup for handling popups related to WalletConnect and account creation.
- Added session detection utilities for checking Concordium wallet connections.
- Introduced WalletConnect initialization and configuration utilities.
- Created Vue-specific entry point for Merchant SDK with configuration wrappers.
- Configured Tailwind CSS for styling.
- Established TypeScript configuration for building and type declaration generation.
- Set up Vite configuration for library mode with proper asset handling and external dependencies.
@HarshithaK61 HarshithaK61 requested a review from Vishwas1 February 9, 2026 14:13
const sdk = new ConcordiumVerificationWebUI({ network: 'testnet' }); // Set Concordium network here

try {
await sdk.initWalletConnect(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we still using this function?

I thought we decided to take the the wallet connect params in the constructor like this?

const sdk = new ConcordiumVerificationWebUI({
    network: "testnet", // Use "mainnet" for production
    projectId: "YOUR_WALLETCONNECT_PROJECT_ID",
    metadata: {
      name: "Merchant App",
      description: "Merchant connecting to Concordium IDApp",
      url: window.location.origin,
      icons: [`${window.location.origin}/favicon.ico`],
    },
});


---

## Complete Example (Vue 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably its not required to add this section in the readme since we already have /example folder in the project.

{
image: slide1,
alt: 'locked-graphic',
title: 'Anonymous Verification that keeps your data safe',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting to keep all messages / titles / texts in one file in some constant and refer from there in the app.

This way, tomorrow if we have add language support we can keep different files (like, en.ts - for english) for different langauge and refer those depending on what user choose in the UI

title: 'Common online verification exposes your data ',
reduceOpacity: true,
points: [
{ icon: 'exclamation', text: 'Personal data shared' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggesting to keep all messages / titles / texts in one file in some constant and refer from there in the app.

This way, tomorrow if we have add language support we can keep different files (like, en.ts - for english) for different langauge and refer those depending on what user choose in the UI

<p class="font-normal text-[12px] leading-[19px] tracking-[0px] font-inter" style="color: #0D0F11;">
${
state === 'loading'
? 'Approve in your ConcordiumID App'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here:

Suggesting to keep all messages / titles / texts in one file in some constant and refer from there in the app.

This way, tomorrow if we have add language support we can keep different files (like, en.ts - for english) for different langauge and refer those depending on what user choose in the UI

Also imagine they decides to change the name of the app, for example from ConcordiumID to something else. then we need to change in all pages. but if we keep in one file we just need to update one.

const walletConnectService = ServiceFactory.createWalletConnectService();
await walletConnectService.initialize();
const activeSessions = walletConnectService.getActiveSessions();
const activeSessionData = activeSessions[0]; // Get first active session
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to check the length of activeSessions array is > 0

detail: {
type: 'active_session',
data: {
message: 'Active WalletConnect session detected',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here - please keep these texts in common file.

// Helper function to create mobile steps
function createMobileStepHTML(): string {
const steps = [
{ count: '1', text: 'Open in your Concordium Wallet' },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here - please keep these texts in common file.

// Update button text for mobile
const walletBtnText = scanContainer.querySelector('#wallet-btn-text');
if (walletBtnText) {
walletBtnText.textContent = `Verify with ${selected.text}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here - please keep these texts in common file.

const footerTitle = scanContainer.querySelector('#footer-title');
if (footerTitle) {
if (selected.value === WALLET_TYPES.CONCORDIUM_ID) {
footerTitle.textContent = 'Download Concordium ID';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here - please keep these texts in common file.

'Active session detected, redirecting to returning user modal...'
);

// // Extract session details
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest deleting all commented code which are not used or required.

};

window.dispatchEvent(
new CustomEvent('concordium-merchant-sdk-event', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dispatch event should be @concordium/verification-web-ui-event as mentioned in the readme


// Emit error event
window.dispatchEvent(
new CustomEvent('concordium-merchant-sdk-event', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dispatch event should be @concordium/verification-web-ui-event as mentioned in the readme

message: 'User disconnected',
},

getDefaultMetadata: () => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I know the use of wallet connect metadata ? like arent' we supposed to take these wallet connect metadata from merchant or customer ?


// Emit active_session event to merchant with session data
window.dispatchEvent(
new CustomEvent('concordium-merchant-sdk-event', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use this event name @concordium/verification-web-ui-event ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the prettier config at the repository root instead of this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this used for? 🤔

{
"name": "@concordium/verification-web-ui",
"private": false,
"version": "1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do

Suggested change
"version": "1.0.0",
"version": "0.1.0",

instead and wait with 1.0.0 until we've had a chance to properly review.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not included in any build it seems? I think it would be good to:

  1. move this to be a separate project in the examples/ directory at the repository root.
  2. Include build steps and ensure this runs as part of CI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +16 to +28
export interface PresentationRequest {
challenge: string;
credentialSubject?: any;
[key: string]: any;
}

export interface PresentationResponse {
verifiablePresentation: any;
presentationContext: any;
proof: any;
type: any;
verifiableCredential: any;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types don't provide much value. I think we should consider integrating with the web-SDK as a peer dependency? Or is there any reason why we would not do this?

Also the types don't seem to align with actual the type definitions for the V1 verifiable presentations?

Comment on lines +47 to +48
"format": "prettier --write .",
"format:check": "prettier --check .",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"format": "prettier --write .",
"format:check": "prettier --check .",
"fmt": "prettier --write .",
"fmt-check": "prettier --check .",

to include this in CI

"link": "./setup-link.sh",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"lint": "tsc --noEmit",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should align with linting done for the other projects, i.e.

Suggested change
"lint": "tsc --noEmit",
"lint": "eslint . --cache --ext ts,tsx --report-unused-disable-directives --max-warnings 0",

Root repository has eslint setup to run for all projects, so that should be used for linting. See the web SDK project as a reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to run yarn at the repository root to update the yarn.lock file.

- Updated ConcordiumEventData interface to include 'repeat-verification' event.
- Introduced showErrorState method in ConcordiumVerificationWebUI for handling verification errors.
- Removed unnecessary console logs across various files to clean up the code.
- Added new SVG assets for modal graphics and section separators.
- Enhanced mobile deep link handling to include redirect to origin.
- Updated Vite configuration to externalize additional dependencies.
- Added new styles for landing and processing modals in desktop.css.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants