Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed public/videos/tutorials/Connect Wallet.mp4
Binary file not shown.
35 changes: 0 additions & 35 deletions src/app/api/share/route.ts

This file was deleted.

43 changes: 0 additions & 43 deletions src/app/api/tutorials/route.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/dashboard/tutorials/page.tsx

This file was deleted.

39 changes: 26 additions & 13 deletions src/components/modules/credentials/hooks/useCredentialVerify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
import { useNetwork } from '@/providers/network.provider';
import { useWalletContext } from '@/providers/wallet.provider';
import { useActaApiKey } from '@/components/modules/vault/hooks/use-acta-api-key';
import { actaFetchJson } from '@/lib/actaApi';
import { actaFetchJson, getActaApiBaseUrl } from '@/lib/actaApi';

type VerifyResult = {
vc_id: string;
Expand Down Expand Up @@ -45,14 +45,17 @@ export function useCredentialVerify(vcId: string) {
setShareLoading(false);
return;
}

let decoded = '';
try {
let b64 = '';
try {
b64 = decodeURIComponent(raw);
} catch {
b64 = raw;
}
b64 = b64.replace(/\s+/g, '');
decoded = decodeURIComponent(raw);
} catch {
decoded = raw;
}

// 1) Try inline Base64 decoding
try {
let b64 = decoded.replace(/\s+/g, '');
b64 = b64.replace(/-/g, '+').replace(/_/g, '/');
const pad = b64.length % 4;
if (pad) b64 = b64 + '='.repeat(4 - pad);
Expand All @@ -61,24 +64,34 @@ export function useCredentialVerify(vcId: string) {
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
const json = new TextDecoder().decode(bytes);
const obj = JSON.parse(json) as unknown;
setShareParam(obj);
setShareLoading(false);
return;
if (
obj &&
typeof obj === 'object' &&
'revealedFields' in (obj as Record<string, unknown>)
) {
setShareParam(obj);
setShareLoading(false);
return;
}
} catch {}

// 2) Treat as short ID β€” fetch from persistent API
try {
const resp = await fetch(`/api/share?key=${encodeURIComponent(raw)}`);
const apiBase = getActaApiBaseUrl(network);
const resp = await fetch(`${apiBase}/share/${encodeURIComponent(decoded)}`);
if (resp.ok) {
const obj = (await resp.json()) as unknown;
setShareParam(obj);
setShareLoading(false);
return;
}
} catch {}

setShareParam(null);
setShareLoading(false);
};
read();
}, []);
}, [network]);

useEffect(() => {
const run = async () => {
Expand Down
23 changes: 15 additions & 8 deletions src/components/modules/credentials/hooks/useShareCredential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import { useEffect, useMemo, useState } from 'react';
import type { Credential } from '@/@types/credentials';
import { useNetwork } from '@/providers/network.provider';
import { getActaApiBaseUrl } from '@/lib/actaApi';

export function useShareCredential(credential: Credential | null) {
const { network } = useNetwork();
const fields = useMemo(() => {
const isPresent = (value: unknown) =>
value !== undefined && value !== null && String(value) !== '';
Expand Down Expand Up @@ -92,6 +95,7 @@ export function useShareCredential(credential: Credential | null) {

const [shareParam, setShareParam] = useState<string>('');
useEffect(() => {
let cancelled = false;
(async () => {
try {
const payload: Record<string, unknown> = { revealedFields };
Expand All @@ -100,36 +104,39 @@ export function useShareCredential(credential: Credential | null) {

const json = JSON.stringify(payload);

// Prefer short share keys via /api/share so links stay compact (e.g. for X).
try {
const resp = await fetch('/api/share', {
const apiBase = getActaApiBaseUrl(network);
const resp = await fetch(`${apiBase}/share`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
headers: { 'Content-Type': 'application/json' },
body: json,
});
if (resp.ok) {
const data = (await resp.json()) as { id?: string } | null;
const id = data && typeof data.id === 'string' ? data.id : null;
if (id) {
if (id && !cancelled) {
setShareParam(encodeURIComponent(id));
return;
}
}
} catch {
// fall through to inline encoding if share API is unavailable
// API unavailable β€” fall through to inline Base64
}

// Fallback: inline, URL-safe base64 payload.
if (cancelled) return;
const bytes = new TextEncoder().encode(json);
let binary = '';
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
const b64 = btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
setShareParam(encodeURIComponent(b64));
} catch {
setShareParam('');
if (!cancelled) setShareParam('');
}
})();
}, [revealedFields, credential]);
return () => {
cancelled = true;
};
}, [revealedFields, credential, network]);

const onToggle = (key: string) => {
setSelected((prev) => ({ ...prev, [key]: !prev[key] }));
Expand Down
17 changes: 1 addition & 16 deletions src/components/modules/dashboard/ui/GuidedTour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
FilePlus,
Share2,
KeyRound,
Book,
} from 'lucide-react';
import Image from 'next/image';
import Link from 'next/link';
Expand Down Expand Up @@ -107,10 +106,7 @@ function buildSteps(onClose: () => void): TourStep[] {
'Use the sidebar on the left to switch between pages. The header at the top lets you toggle between Testnet and Mainnet.',
content: (
<div className="space-y-3 mt-2">
<StepBullet
bold="Sidebar"
text="access Home, Issue, Authorize, Vault, API Keys, and Tutorials."
/>
<StepBullet bold="Sidebar" text="access Home, Issue, Authorize, Vault, and API Keys." />
<StepBullet
bold="Settings"
text="click your profile icon at the bottom of the sidebar to connect your wallet."
Expand Down Expand Up @@ -200,17 +196,6 @@ function buildSteps(onClose: () => void): TourStep[] {
</div>
),
},
{
icon: <Book className="w-7 h-7 text-[#edeed1]" />,
title: 'Tutorials & Resources',
description:
'Watch step-by-step video tutorials to learn how each feature works. Track your progress as you complete them.',
content: (
<div className="mt-2">
<StepAction label="Go to Tutorials" href="/dashboard/tutorials" />
</div>
),
},
];
}

Expand Down
121 changes: 0 additions & 121 deletions src/components/modules/tutorial/hooks/useTutorials.ts

This file was deleted.

Loading