Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
d02ee469
Commit
d02ee469
authored
Nov 01, 2025
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the seon provider changes
parent
0fde51fe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
17 deletions
+24
-17
SeonProvider.tsx
src/app/SeonProvider.tsx
+24
-17
No files found.
src/app/SeonProvider.tsx
View file @
d02ee469
"use client"
;
"use client"
;
import
React
,
{
createContext
,
useContext
,
useEffect
,
useState
}
from
"react"
;
import
React
,
{
createContext
,
useContext
,
useEffect
,
useState
}
from
"react"
;
import
seon
from
"@seontechnologies/seon-javascript-sdk"
;
type
SeonContextType
=
{
type
SeonContextType
=
{
deviceId
?:
string
;
deviceId
?:
string
;
loading
:
boolean
;
loading
:
boolean
;
sessionData
?:
any
;
// For storing additional session information if available
sessionData
?:
any
;
};
};
const
SeonContext
=
createContext
<
SeonContextType
>
({
const
SeonContext
=
createContext
<
SeonContextType
>
({
deviceId
:
undefined
,
deviceId
:
undefined
,
loading
:
true
,
loading
:
true
,
sessionData
:
undefined
sessionData
:
undefined
,
});
});
export
const
useSeon
=
()
=>
useContext
(
SeonContext
);
export
const
useSeon
=
()
=>
useContext
(
SeonContext
);
...
@@ -21,7 +20,16 @@ export const SeonProvider: React.FC<{ children: React.ReactNode }> = ({ children
...
@@ -21,7 +20,16 @@ export const SeonProvider: React.FC<{ children: React.ReactNode }> = ({ children
const
[
loading
,
setLoading
]
=
useState
(
true
);
const
[
loading
,
setLoading
]
=
useState
(
true
);
useEffect
(()
=>
{
useEffect
(()
=>
{
// Initialize the SDK on page load
let
seon
:
any
;
const
initSeon
=
async
()
=>
{
if
(
typeof
window
===
"undefined"
)
return
;
// safeguard
try
{
// Dynamically import so it only runs in browser
const
seonModule
=
await
import
(
"@seontechnologies/seon-javascript-sdk"
);
seon
=
seonModule
.
default
||
seonModule
;
seon
.
init
({
seon
.
init
({
behavioralDataCollection
:
{
behavioralDataCollection
:
{
targets
:
'input[type="text"], .behavior'
,
targets
:
'input[type="text"], .behavior'
,
...
@@ -29,25 +37,24 @@ export const SeonProvider: React.FC<{ children: React.ReactNode }> = ({ children
...
@@ -29,25 +37,24 @@ export const SeonProvider: React.FC<{ children: React.ReactNode }> = ({ children
},
},
});
});
// Collect fingerprint session
const
session
=
await
seon
.
getSession
();
seon
.
getSession
()
.
then
((
session
:
string
)
=>
{
// session holds the encrypted fingerprint as a base64 encoded string
// This is what you send to your backend for fraud detection
console
.
log
(
"Device fingerprint session:"
,
session
);
console
.
log
(
"Device fingerprint session:"
,
session
);
setDeviceId
(
session
);
setDeviceId
(
session
);
setLoading
(
false
);
}
catch
(
err
)
{
})
.
catch
((
err
:
any
)
=>
{
console
.
error
(
"SEON init error:"
,
err
);
console
.
error
(
"SEON init error:"
,
err
);
}
finally
{
setLoading
(
false
);
setLoading
(
false
);
});
}
};
initSeon
();
// Cleanup: disable behavioral tracking when component unmounts
return
()
=>
{
return
()
=>
{
seon
.
init
({
if
(
seon
)
{
behavioralDataCollection
:
{
targets
:
""
},
// disables tracking
try
{
});
seon
.
init
({
behavioralDataCollection
:
{
targets
:
""
}
});
}
catch
{
}
}
};
};
},
[]);
},
[]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment