astra-sdk-web 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astra-sdk.cjs.js +74 -57
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.css +28 -0
- package/dist/astra-sdk.css.map +1 -1
- package/dist/astra-sdk.es.js +74 -57
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +74 -57
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.css +28 -0
- package/dist/components.css.map +1 -1
- package/dist/components.d.cts +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.es.js +74 -57
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KycFlow.tsx +8 -1
- package/src/pages/QRCodePage.tsx +19 -7
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export interface KycFlowProps {
|
|
|
10
10
|
deviceType?: string;
|
|
11
11
|
startAtQr?: boolean;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
mobileBaseUrl?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
type KycFlowView = 'qr' | 'mobileroute';
|
|
@@ -21,6 +22,7 @@ export const KycFlow: React.FC<KycFlowProps> = ({
|
|
|
21
22
|
deviceType,
|
|
22
23
|
startAtQr = true,
|
|
23
24
|
onClose,
|
|
25
|
+
mobileBaseUrl = 'https://astra-sdk-rebuild.vercel.app',
|
|
24
26
|
}) => {
|
|
25
27
|
const [currentView, setCurrentView] = useState<KycFlowView>(startAtQr ? 'qr' : 'mobileroute');
|
|
26
28
|
|
|
@@ -42,7 +44,12 @@ export const KycFlow: React.FC<KycFlowProps> = ({
|
|
|
42
44
|
deviceType={deviceType}
|
|
43
45
|
>
|
|
44
46
|
{currentView === 'qr' ? (
|
|
45
|
-
<QRCodePage
|
|
47
|
+
<QRCodePage
|
|
48
|
+
onClose={handleClose}
|
|
49
|
+
onNavigate={handleNavigate}
|
|
50
|
+
mobileBaseUrl={mobileBaseUrl}
|
|
51
|
+
sessionId={sessionId}
|
|
52
|
+
/>
|
|
46
53
|
) : (
|
|
47
54
|
<MobileRoute onClose={handleClose} onNavigate={handleNavigate} />
|
|
48
55
|
)}
|
package/src/pages/QRCodePage.tsx
CHANGED
|
@@ -5,23 +5,29 @@ import '../index.css';
|
|
|
5
5
|
interface QRCodePageProps {
|
|
6
6
|
onClose?: () => void;
|
|
7
7
|
onNavigate?: (view: 'qr' | 'mobileroute') => void;
|
|
8
|
+
mobileBaseUrl?: string;
|
|
9
|
+
sessionId?: string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
function QRCodePage({ onClose, onNavigate }: QRCodePageProps = {}) {
|
|
12
|
+
function QRCodePage({ onClose, onNavigate, mobileBaseUrl = 'https://astra-sdk-rebuild.vercel.app', sessionId }: QRCodePageProps = {}) {
|
|
11
13
|
const [qrUrl, setQrUrl] = useState<string>('');
|
|
12
14
|
const [copied, setCopied] = useState<boolean>(false);
|
|
13
15
|
|
|
14
16
|
useEffect(() => {
|
|
15
|
-
const currentUrl = window.location.origin;
|
|
16
|
-
|
|
17
17
|
// Get search params from current URL
|
|
18
18
|
const searchParams = new URLSearchParams(window.location.search);
|
|
19
|
+
|
|
20
|
+
// Add sessionId to query params if provided
|
|
21
|
+
if (sessionId) {
|
|
22
|
+
searchParams.set('sessionId', sessionId);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
const mobileRoute = '/mobileroute';
|
|
20
26
|
const queryString = searchParams.toString();
|
|
21
|
-
const fullUrl = `${
|
|
27
|
+
const fullUrl = `${mobileBaseUrl}${mobileRoute}${queryString ? `?${queryString}` : ''}`;
|
|
22
28
|
|
|
23
29
|
setQrUrl(fullUrl);
|
|
24
|
-
}, []);
|
|
30
|
+
}, [mobileBaseUrl, sessionId]);
|
|
25
31
|
|
|
26
32
|
const handleCopyUrl = async () => {
|
|
27
33
|
if (qrUrl) {
|
|
@@ -46,8 +52,14 @@ function QRCodePage({ onClose, onNavigate }: QRCodePageProps = {}) {
|
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
return (
|
|
49
|
-
<div className="fixed inset-0 flex items-center justify-center bg-black p-4 sm:p-6 md:p-8 z-[1000]">
|
|
50
|
-
|
|
55
|
+
<div className="fixed inset-0 flex items-center justify-center bg-gradient-to-br from-gray-900 via-gray-800 to-black p-4 sm:p-6 md:p-8 z-[1000]">
|
|
56
|
+
{/* Background pattern overlay */}
|
|
57
|
+
<div className="absolute inset-0 opacity-10" style={{
|
|
58
|
+
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
59
|
+
backgroundSize: '40px 40px'
|
|
60
|
+
}}></div>
|
|
61
|
+
|
|
62
|
+
<div className="relative bg-[rgba(20,20,20,0.95)] backdrop-blur-sm rounded-2xl p-5 sm:p-6 md:p-7 max-w-[450px] w-full h-[80vh] flex flex-col text-center shadow-[0_8px_32px_rgba(0,0,0,0.5)] border border-white/10">
|
|
51
63
|
<button
|
|
52
64
|
className="absolute top-5 right-5 bg-transparent border-none text-white cursor-pointer p-2 flex items-center justify-center rounded transition-colors hover:bg-white/10 active:bg-white/20"
|
|
53
65
|
onClick={handleClose}
|