From 93a3f83dbd0dbefa7e14585f767bec0b4c560a50 Mon Sep 17 00:00:00 2001 From: gourav Date: Mon, 17 Nov 2025 12:52:05 +0530 Subject: [PATCH 1/9] fix: ui-bugs-eidwallet --- .../src/routes/(auth)/onboarding/+page.svelte | 580 +++++++++--------- 1 file changed, 296 insertions(+), 284 deletions(-) diff --git a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte index cbbb7e2ab..0aadb288c 100644 --- a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte @@ -1,265 +1,276 @@
{ >

- @@ -365,69 +376,70 @@ onMount(async () => { placeholder="Enter verification code" />
- NextNext
{/if} - {:else} - {#if checkingHardware} -
-
- -

Checking device capabilities...

-
+ {:else if checkingHardware} +
+
+ +

Checking device capabilities...

- {:else if showHardwareError} -

- Hardware Security Not Available -

-

- Your phone doesn't support hardware crypto keys, which is a requirement for verified IDs. -

-

- Please use the pre-verification code option to create a demo account instead. -

-
- { - isPaneOpen = false; - handlePreVerified(); - }} - > - Use Pre-Verification Code - +
+ {:else if showHardwareError} +

+ Hardware Security Not Available +

+

+ Your phone doesn't support hardware crypto keys, which is a + requirement for verified IDs. +

+

+ Please use the pre-verification code option to create a demo account + instead. +

+
+ { + isPaneOpen = false; + handlePreVerified(); + }} + > + Use Pre-Verification Code + +
+ {:else if loading} +
+
+ +

Initializing security keys...

- {:else} - {#if loading} -
-
- -

Initializing security keys...

-
-
- {:else} -

- Your Digital Self begins with the Real You -

-

- In the Web 3.0 Data Space, identity is linked to reality. We begin - by verifying your real-world passport, which serves as the - foundation for issuing your secure ePassport. At the same time, we - generate your eName – a unique digital identifier – and create your - eVault to store and protect your personal data. -

-
- Next -
- {/if} - {/if} +
+ {:else} +

+ Your Digital Self begins with the Real You +

+

+ In the Web 3.0 Data Space, identity is linked to reality. We begin + by verifying your real-world passport, which serves as the + foundation for issuing your secure ePassport. At the same time, we + generate your eName – a unique digital identifier – and create your + eVault to store and protect your personal data. +

+
+ Next +
{/if} From e27f40b2d90f27ffab5581cd5b2b4ce6de87c588 Mon Sep 17 00:00:00 2001 From: gourav Date: Mon, 17 Nov 2025 13:00:24 +0530 Subject: [PATCH 2/9] fix: format and lint --- .../src/routes/(auth)/onboarding/+page.svelte | 457 +++++++++--------- 1 file changed, 223 insertions(+), 234 deletions(-) diff --git a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte index 0aadb288c..28bb4c63b 100644 --- a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte @@ -1,276 +1,265 @@
Date: Mon, 17 Nov 2025 13:50:49 +0530 Subject: [PATCH 3/9] fix: now cancel button does something --- .../src/lib/ui/Drawer/Drawer.svelte | 106 +++---- .../src/routes/(app)/settings/+page.svelte | 287 +++++++++--------- 2 files changed, 199 insertions(+), 194 deletions(-) diff --git a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte index fa1c6e4ea..7bf583cf4 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte +++ b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte @@ -1,65 +1,65 @@
-import { goto } from "$app/navigation"; -import { SettingsNavigationBtn } from "$lib/fragments"; -import type { GlobalState } from "$lib/global"; -import { runtime } from "$lib/global/runtime.svelte"; -import { ButtonAction, Drawer } from "$lib/ui"; -import { - Key01Icon, - LanguageSquareIcon, - Link02Icon, - PinCodeIcon, - Shield01Icon, -} from "@hugeicons/core-free-icons"; -import { getContext } from "svelte"; - -const getGlobalState = getContext<() => GlobalState>("globalState"); -const setGlobalState = - getContext<(value: GlobalState) => void>("setGlobalState"); -let globalState = getGlobalState(); - -let isDeleteConfirmationOpen = $state(false); -let isFinalConfirmationOpen = $state(false); - -// Hidden eVault profile retry functionality -let tapCount = $state(0); -let lastTapTime = $state(0); -let isRetrying = $state(false); -let retryMessage = $state(""); - -function showDeleteConfirmation() { - isDeleteConfirmationOpen = true; -} - -function confirmDelete() { - isDeleteConfirmationOpen = false; - isFinalConfirmationOpen = true; -} - -async function nukeWallet() { - const newGlobalState = await globalState.reset(); - setGlobalState(newGlobalState); - globalState = newGlobalState; - goto("/onboarding"); -} - -function cancelDelete() { - isDeleteConfirmationOpen = false; - isFinalConfirmationOpen = false; -} - -async function handleVersionTap() { - const now = Date.now(); - - // Reset counter if more than 3 seconds between taps - if (now - lastTapTime > 3000) { - tapCount = 0; + import { goto } from "$app/navigation"; + import { SettingsNavigationBtn } from "$lib/fragments"; + import type { GlobalState } from "$lib/global"; + import { runtime } from "$lib/global/runtime.svelte"; + import { ButtonAction, Drawer } from "$lib/ui"; + import { + Key01Icon, + LanguageSquareIcon, + Link02Icon, + PinCodeIcon, + Shield01Icon, + } from "@hugeicons/core-free-icons"; + import { getContext } from "svelte"; + + const getGlobalState = getContext<() => GlobalState>("globalState"); + const setGlobalState = + getContext<(value: GlobalState) => void>("setGlobalState"); + let globalState = getGlobalState(); + + let isDeleteConfirmationOpen = $state(false); + let isFinalConfirmationOpen = $state(false); + + // Hidden eVault profile retry functionality + let tapCount = $state(0); + let lastTapTime = $state(0); + let isRetrying = $state(false); + let retryMessage = $state(""); + + function showDeleteConfirmation() { + isDeleteConfirmationOpen = true; } - tapCount++; - lastTapTime = now; + function confirmDelete() { + isDeleteConfirmationOpen = false; + isFinalConfirmationOpen = true; + } + + async function nukeWallet() { + const newGlobalState = await globalState.reset(); + setGlobalState(newGlobalState); + globalState = newGlobalState; + goto("/onboarding"); + } - // Show tap count feedback (only visible to user) - if (tapCount >= 5) { - retryMessage = `Taps: ${tapCount}/10`; + function cancelDelete() { + isDeleteConfirmationOpen = false; + isFinalConfirmationOpen = false; } - // Trigger eVault profile retry after 10 taps - if (tapCount === 10) { - isRetrying = true; - retryMessage = "Retrying eVault profile setup..."; - - try { - await globalState.vaultController.retryProfileCreation(); - retryMessage = "✅ eVault profile setup completed successfully!"; - - // Reset after success - setTimeout(() => { - tapCount = 0; - retryMessage = ""; - isRetrying = false; - }, 3000); - } catch (error) { - console.error("Failed to retry eVault profile setup:", error); - retryMessage = - "❌ Failed to setup eVault profile. Check console for details."; - - // Reset after error - setTimeout(() => { - tapCount = 0; - retryMessage = ""; - isRetrying = false; - }, 5000); + async function handleVersionTap() { + const now = Date.now(); + + // Reset counter if more than 3 seconds between taps + if (now - lastTapTime > 3000) { + tapCount = 0; + } + + tapCount++; + lastTapTime = now; + + // Show tap count feedback (only visible to user) + if (tapCount >= 5) { + retryMessage = `Taps: ${tapCount}/10`; + } + + // Trigger eVault profile retry after 10 taps + if (tapCount === 10) { + isRetrying = true; + retryMessage = "Retrying eVault profile setup..."; + + try { + await globalState.vaultController.retryProfileCreation(); + retryMessage = + "✅ eVault profile setup completed successfully!"; + + // Reset after success + setTimeout(() => { + tapCount = 0; + retryMessage = ""; + isRetrying = false; + }, 3000); + } catch (error) { + console.error("Failed to retry eVault profile setup:", error); + retryMessage = + "❌ Failed to setup eVault profile. Check console for details."; + + // Reset after error + setTimeout(() => { + tapCount = 0; + retryMessage = ""; + isRetrying = false; + }, 5000); + } } } -} -$effect(() => { - runtime.header.title = "Settings"; -}); + $effect(() => { + runtime.header.title = "Settings"; + });
@@ -146,59 +147,63 @@ $effect(() => {
- -
-

- ⚠️ Delete Account Warning -

-

- Are you sure you want to delete your account? This action will: -

-
    -
  • • Permanently delete all your personal data
  • -
  • • Remove your ePassport and eVault access
  • -
  • • Delete your eName and all associated credentials
  • -
  • • Make your data inaccessible within 24 hours
  • -
  • • This action cannot be undone
  • -
-
- Cancel - Continue +{#if isDeleteConfirmationOpen} + +
+

+ ⚠️ Delete Account Warning +

+

+ Are you sure you want to delete your account? This action will: +

+
    +
  • • Permanently delete all your personal data
  • +
  • • Remove your ePassport and eVault access
  • +
  • • Delete your eName and all associated credentials
  • +
  • • Make your data inaccessible within 24 hours
  • +
  • • This action cannot be undone
  • +
+
+ Cancel + Continue +
-
- + +{/if} - -
-

- 🚨 Final Confirmation -

-

- This is your final warning. Once you confirm: -

-
-

- All your data will be permanently deleted and you will lose - access to your ePassport, eVault, and eName forever. +{#if isFinalConfirmationOpen} + +

+

+ 🚨 Final Confirmation +

+

+ This is your final warning. Once you confirm:

+
+

+ All your data will be permanently deleted and you will lose + access to your ePassport, eVault, and eName forever. +

+
+

+ Are you absolutely certain you want to proceed? +

+
+ Cancel + Delete +
-

- Are you absolutely certain you want to proceed? -

-
- Cancel - Delete -
-
- + +{/if} From f8988dc8ff7e2d23f9745d440054b15b3e02e9ff Mon Sep 17 00:00:00 2001 From: gourav Date: Mon, 17 Nov 2025 13:58:31 +0530 Subject: [PATCH 4/9] fix: demo name continue button --- .../src/lib/ui/Drawer/Drawer.svelte | 106 +++++----- .../src/routes/(app)/settings/+page.svelte | 181 +++++++++--------- .../src/routes/(auth)/onboarding/+page.svelte | 7 +- 3 files changed, 148 insertions(+), 146 deletions(-) diff --git a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte index 7bf583cf4..fa1c6e4ea 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte +++ b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte @@ -1,65 +1,65 @@
- import { goto } from "$app/navigation"; - import { SettingsNavigationBtn } from "$lib/fragments"; - import type { GlobalState } from "$lib/global"; - import { runtime } from "$lib/global/runtime.svelte"; - import { ButtonAction, Drawer } from "$lib/ui"; - import { - Key01Icon, - LanguageSquareIcon, - Link02Icon, - PinCodeIcon, - Shield01Icon, - } from "@hugeicons/core-free-icons"; - import { getContext } from "svelte"; - - const getGlobalState = getContext<() => GlobalState>("globalState"); - const setGlobalState = - getContext<(value: GlobalState) => void>("setGlobalState"); - let globalState = getGlobalState(); - - let isDeleteConfirmationOpen = $state(false); - let isFinalConfirmationOpen = $state(false); - - // Hidden eVault profile retry functionality - let tapCount = $state(0); - let lastTapTime = $state(0); - let isRetrying = $state(false); - let retryMessage = $state(""); - - function showDeleteConfirmation() { - isDeleteConfirmationOpen = true; +import { goto } from "$app/navigation"; +import { SettingsNavigationBtn } from "$lib/fragments"; +import type { GlobalState } from "$lib/global"; +import { runtime } from "$lib/global/runtime.svelte"; +import { ButtonAction, Drawer } from "$lib/ui"; +import { + Key01Icon, + LanguageSquareIcon, + Link02Icon, + PinCodeIcon, + Shield01Icon, +} from "@hugeicons/core-free-icons"; +import { getContext } from "svelte"; + +const getGlobalState = getContext<() => GlobalState>("globalState"); +const setGlobalState = + getContext<(value: GlobalState) => void>("setGlobalState"); +let globalState = getGlobalState(); + +let isDeleteConfirmationOpen = $state(false); +let isFinalConfirmationOpen = $state(false); + +// Hidden eVault profile retry functionality +let tapCount = $state(0); +let lastTapTime = $state(0); +let isRetrying = $state(false); +let retryMessage = $state(""); + +function showDeleteConfirmation() { + isDeleteConfirmationOpen = true; +} + +function confirmDelete() { + isDeleteConfirmationOpen = false; + isFinalConfirmationOpen = true; +} + +async function nukeWallet() { + const newGlobalState = await globalState.reset(); + setGlobalState(newGlobalState); + globalState = newGlobalState; + goto("/onboarding"); +} + +function cancelDelete() { + isDeleteConfirmationOpen = false; + isFinalConfirmationOpen = false; +} + +async function handleVersionTap() { + const now = Date.now(); + + // Reset counter if more than 3 seconds between taps + if (now - lastTapTime > 3000) { + tapCount = 0; } - function confirmDelete() { - isDeleteConfirmationOpen = false; - isFinalConfirmationOpen = true; - } - - async function nukeWallet() { - const newGlobalState = await globalState.reset(); - setGlobalState(newGlobalState); - globalState = newGlobalState; - goto("/onboarding"); - } + tapCount++; + lastTapTime = now; - function cancelDelete() { - isDeleteConfirmationOpen = false; - isFinalConfirmationOpen = false; + // Show tap count feedback (only visible to user) + if (tapCount >= 5) { + retryMessage = `Taps: ${tapCount}/10`; } - async function handleVersionTap() { - const now = Date.now(); - - // Reset counter if more than 3 seconds between taps - if (now - lastTapTime > 3000) { - tapCount = 0; - } - - tapCount++; - lastTapTime = now; - - // Show tap count feedback (only visible to user) - if (tapCount >= 5) { - retryMessage = `Taps: ${tapCount}/10`; - } - - // Trigger eVault profile retry after 10 taps - if (tapCount === 10) { - isRetrying = true; - retryMessage = "Retrying eVault profile setup..."; - - try { - await globalState.vaultController.retryProfileCreation(); - retryMessage = - "✅ eVault profile setup completed successfully!"; - - // Reset after success - setTimeout(() => { - tapCount = 0; - retryMessage = ""; - isRetrying = false; - }, 3000); - } catch (error) { - console.error("Failed to retry eVault profile setup:", error); - retryMessage = - "❌ Failed to setup eVault profile. Check console for details."; - - // Reset after error - setTimeout(() => { - tapCount = 0; - retryMessage = ""; - isRetrying = false; - }, 5000); - } + // Trigger eVault profile retry after 10 taps + if (tapCount === 10) { + isRetrying = true; + retryMessage = "Retrying eVault profile setup..."; + + try { + await globalState.vaultController.retryProfileCreation(); + retryMessage = "✅ eVault profile setup completed successfully!"; + + // Reset after success + setTimeout(() => { + tapCount = 0; + retryMessage = ""; + isRetrying = false; + }, 3000); + } catch (error) { + console.error("Failed to retry eVault profile setup:", error); + retryMessage = + "❌ Failed to setup eVault profile. Check console for details."; + + // Reset after error + setTimeout(() => { + tapCount = 0; + retryMessage = ""; + isRetrying = false; + }, 5000); } } +} - $effect(() => { - runtime.header.title = "Settings"; - }); +$effect(() => { + runtime.header.title = "Settings"; +});
diff --git a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte index 28bb4c63b..d2f784c95 100644 --- a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte @@ -349,8 +349,11 @@ onMount(async () => { placeholder="Enter your demo name for ePassport" />
- ContinueContinue
{:else} From 1e2298079551c106590c9497d5e487c1dff5f20d Mon Sep 17 00:00:00 2001 From: gourav Date: Mon, 17 Nov 2025 17:45:30 +0530 Subject: [PATCH 5/9] fix: format and lint --- platforms/blabsy/src/components/input/image-preview.tsx | 6 +++--- platforms/blabsy/src/lib/utils/image-utils.ts | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/platforms/blabsy/src/components/input/image-preview.tsx b/platforms/blabsy/src/components/input/image-preview.tsx index e35afc917..6ecf5c33a 100644 --- a/platforms/blabsy/src/components/input/image-preview.tsx +++ b/platforms/blabsy/src/components/input/image-preview.tsx @@ -67,9 +67,9 @@ export function ImagePreview({ type: img.type })) }); - + const processed = combineBase64Images(imagesPreview); - + console.log('[ImagePreview] Processed images:', { originalCount: imagesPreview?.length || 0, processedCount: processed.length, @@ -82,7 +82,7 @@ export function ImagePreview({ type: img.type })) }); - + return processed; }, [imagesPreview]); diff --git a/platforms/blabsy/src/lib/utils/image-utils.ts b/platforms/blabsy/src/lib/utils/image-utils.ts index 70128f6f2..7f4ab678a 100644 --- a/platforms/blabsy/src/lib/utils/image-utils.ts +++ b/platforms/blabsy/src/lib/utils/image-utils.ts @@ -42,7 +42,10 @@ export function combineBase64Images( } else { // Handle odd number of images (last item) if (dataPart) { - if (dataPart.src.startsWith('data:') && !dataPart.src.includes(',')) { + if ( + dataPart.src.startsWith('data:') && + !dataPart.src.includes(',') + ) { // Incomplete base64 image, skip it } else { result.push(dataPart); From 02d7e6510127b8e106dd89f134613d919af9ffde Mon Sep 17 00:00:00 2001 From: gourav Date: Wed, 19 Nov 2025 12:04:44 +0530 Subject: [PATCH 6/9] fix: pane close functinality --- infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte index fa1c6e4ea..57b97b458 100644 --- a/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte +++ b/infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte @@ -41,6 +41,12 @@ $effect(() => { buttonDestroy: false, showDraggable: dismissible, upperThanTop: true, + events: { + onBackdropTap: () => { + pane?.destroy(); + isPaneOpen = false; + }, + }, breaks: { bottom: { enabled: true, height: 250 }, }, From 1960362c4b1554a3c8d2bbe2409eb493e48fa083 Mon Sep 17 00:00:00 2001 From: gourav Date: Wed, 19 Nov 2025 12:40:06 +0530 Subject: [PATCH 7/9] fix: code rabbit suggestion --- .../eid-wallet/src/routes/(auth)/onboarding/+page.svelte | 9 --------- 1 file changed, 9 deletions(-) diff --git a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte index d2f784c95..2a4a39910 100644 --- a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte @@ -408,15 +408,6 @@ onMount(async () => { Use Pre-Verification Code
- {:else if loading} -
-
- -

Initializing security keys...

-
-
{:else}

Your Digital Self begins with the Real You From 92c6042015622d9eda40b8e82b11e37089fe1e41 Mon Sep 17 00:00:00 2001 From: gourav Date: Wed, 19 Nov 2025 13:03:54 +0530 Subject: [PATCH 8/9] fix: code rabbit suggestion --- .../src/routes/(auth)/onboarding/+page.svelte | 69 ++++++++++--------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte index 2a4a39910..5027dc51d 100644 --- a/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(auth)/onboarding/+page.svelte @@ -189,42 +189,45 @@ onMount(async () => { loading = true; error = null; - // Initialize key manager for pre-verification context - await initializeKeyManager(); - await ensureKeyForContext(); + try { + // Initialize key manager for pre-verification context + await initializeKeyManager(); + await ensureKeyForContext(); - const { - data: { token: registryEntropy }, - } = await axios.get( - new URL("/entropy", PUBLIC_REGISTRY_URL).toString(), - ); + const entropyRes = await axios.get( + new URL("/entropy", PUBLIC_REGISTRY_URL).toString(), + ); + const registryEntropy = entropyRes.data.token; + + const provisionRes = await axios.post( + new URL("/provision", PUBLIC_PROVISIONER_URL).toString(), + { + registryEntropy, + namespace: uuidv4(), + verificationId, + publicKey: await getApplicationPublicKey(), + }, + ); + + if (!provisionRes.data?.success) { + throw new Error("Invalid verification code"); + } - const { data } = await axios - .post(new URL("/provision", PUBLIC_PROVISIONER_URL).toString(), { - registryEntropy, - namespace: uuidv4(), - verificationId, - publicKey: await getApplicationPublicKey(), - }) - .catch(() => { - loading = false; - console.log("caught"); - preVerified = false; - verificationId = ""; - error = "Wrong pre-verification code"; - setTimeout(() => { - error = null; - }, 6_000); - return { data: null }; - }); - if (!data) return; - - // If verification is successful, show demo name input - if (data.success === true) { - loading = false; verificationSuccess = true; - uri = data.uri; - ename = data.w3id; + uri = provisionRes.data.uri; + ename = provisionRes.data.w3id; + } catch (err) { + console.error("Pre-verification failed:", err); + + preVerified = false; + verificationId = ""; + error = "Wrong pre-verification code"; + + setTimeout(() => { + error = null; + }, 6000); + } finally { + loading = false; } }; From 5c88c0c8fe7c12b3020e426c0de77f74085f92c9 Mon Sep 17 00:00:00 2001 From: gourav Date: Wed, 19 Nov 2025 13:17:17 +0530 Subject: [PATCH 9/9] fix: settings page memorty leak --- .../src/routes/(app)/settings/+page.svelte | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte b/infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte index 70a671c10..16811b1a9 100644 --- a/infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte +++ b/infrastructure/eid-wallet/src/routes/(app)/settings/+page.svelte @@ -12,6 +12,7 @@ import { Shield01Icon, } from "@hugeicons/core-free-icons"; import { getContext } from "svelte"; +import { onDestroy } from "svelte"; const getGlobalState = getContext<() => GlobalState>("globalState"); const setGlobalState = @@ -26,6 +27,7 @@ let tapCount = $state(0); let lastTapTime = $state(0); let isRetrying = $state(false); let retryMessage = $state(""); +let timeoutId: ReturnType | null = null; function showDeleteConfirmation() { isDeleteConfirmationOpen = true; @@ -48,10 +50,15 @@ function cancelDelete() { isFinalConfirmationOpen = false; } +// Cleanup on unmount +onDestroy(() => { + if (timeoutId) clearTimeout(timeoutId); +}); + async function handleVersionTap() { const now = Date.now(); - // Reset counter if more than 3 seconds between taps + // Reset if more than 3s between taps if (now - lastTapTime > 3000) { tapCount = 0; } @@ -59,12 +66,12 @@ async function handleVersionTap() { tapCount++; lastTapTime = now; - // Show tap count feedback (only visible to user) + // Show feedback after 5 taps if (tapCount >= 5) { retryMessage = `Taps: ${tapCount}/10`; } - // Trigger eVault profile retry after 10 taps + // Trigger hidden action at 10 taps if (tapCount === 10) { isRetrying = true; retryMessage = "Retrying eVault profile setup..."; @@ -73,8 +80,10 @@ async function handleVersionTap() { await globalState.vaultController.retryProfileCreation(); retryMessage = "✅ eVault profile setup completed successfully!"; - // Reset after success - setTimeout(() => { + // Clear previous timeout if exists + if (timeoutId) clearTimeout(timeoutId); + + timeoutId = setTimeout(() => { tapCount = 0; retryMessage = ""; isRetrying = false; @@ -84,8 +93,10 @@ async function handleVersionTap() { retryMessage = "❌ Failed to setup eVault profile. Check console for details."; - // Reset after error - setTimeout(() => { + // Clear previous timeout if exists + if (timeoutId) clearTimeout(timeoutId); + + timeoutId = setTimeout(() => { tapCount = 0; retryMessage = ""; isRetrying = false;