@dtect/security-sdk-react 0.0.8 → 0.0.10
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/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/types/error.ts +1 -0
- package/src/types/response.ts +8 -0
package/dist/index.d.mts
CHANGED
|
@@ -21,6 +21,14 @@ interface ISecurityResultResponse {
|
|
|
21
21
|
isAutomationDetected: boolean;
|
|
22
22
|
isUntrustedBrowserOrOS: boolean;
|
|
23
23
|
isBlockedIP: boolean;
|
|
24
|
+
isVpnDetected: boolean;
|
|
25
|
+
isDeviceTampered: boolean;
|
|
26
|
+
isVirtualMachine: boolean;
|
|
27
|
+
isDevToolsOpened: boolean;
|
|
28
|
+
isPrivacySettingsEnabled: boolean;
|
|
29
|
+
isTorDetected: boolean;
|
|
30
|
+
isHighActivityDevice: boolean;
|
|
31
|
+
isIncognito: boolean;
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
interface ISecurityTokenResponse {
|
|
@@ -49,6 +57,7 @@ declare const SecurityAPIError: {
|
|
|
49
57
|
INTERNAL_SERVER_ERROR: "Internal Server Error during API Request";
|
|
50
58
|
MISSING_CREDENTIALS: "Missing Public Client ID or Public API Key";
|
|
51
59
|
MAINTENANCE_MODE: "API Under Maintenance";
|
|
60
|
+
RATE_LIMIT_REACHED: "Too many requests. Rate limit exceeded";
|
|
52
61
|
};
|
|
53
62
|
|
|
54
63
|
export { SecurityAPIError, SecurityAPIProvider, useSecurityApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,14 @@ interface ISecurityResultResponse {
|
|
|
21
21
|
isAutomationDetected: boolean;
|
|
22
22
|
isUntrustedBrowserOrOS: boolean;
|
|
23
23
|
isBlockedIP: boolean;
|
|
24
|
+
isVpnDetected: boolean;
|
|
25
|
+
isDeviceTampered: boolean;
|
|
26
|
+
isVirtualMachine: boolean;
|
|
27
|
+
isDevToolsOpened: boolean;
|
|
28
|
+
isPrivacySettingsEnabled: boolean;
|
|
29
|
+
isTorDetected: boolean;
|
|
30
|
+
isHighActivityDevice: boolean;
|
|
31
|
+
isIncognito: boolean;
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
interface ISecurityTokenResponse {
|
|
@@ -49,6 +57,7 @@ declare const SecurityAPIError: {
|
|
|
49
57
|
INTERNAL_SERVER_ERROR: "Internal Server Error during API Request";
|
|
50
58
|
MISSING_CREDENTIALS: "Missing Public Client ID or Public API Key";
|
|
51
59
|
MAINTENANCE_MODE: "API Under Maintenance";
|
|
60
|
+
RATE_LIMIT_REACHED: "Too many requests. Rate limit exceeded";
|
|
52
61
|
};
|
|
53
62
|
|
|
54
63
|
export { SecurityAPIError, SecurityAPIProvider, useSecurityApi };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var k=Object.create;var u=Object.defineProperty;var
|
|
2
|
+
"use strict";var k=Object.create;var u=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var v=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},a=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!L.call(r,o)&&o!==t&&u(r,o,{get:()=>e[o],enumerable:!(n=D(e,o))||n.enumerable});return r};var y=(r,e,t)=>(t=r!=null?k(O(r)):{},a(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),w=r=>a(u({},"__esModule",{value:!0}),r);var F={};v(F,{SecurityAPIError:()=>K,SecurityAPIProvider:()=>x,useSecurityApi:()=>U});module.exports=w(F);var E=require("react");var M={UNAUTHORIZED:"Unauthorized"},p={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},T={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},R={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},C={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},l={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},c={...M,...p,...T,...R,...C,...l},m={...p,...T,...R,...C,...l};var S=y(require("@dtect/security-sdk-js")),_=require("react/jsx-runtime"),f=(0,E.createContext)({}),P=({children:r})=>{let e=async({projectId:n,visitorId:o,securitySettings:s,metaData:I})=>{try{return await S.default.getSecurityResult({projectId:n,visitorId:o,securitySettings:s,metaData:I})}catch(i){throw i instanceof Error?new Error(i.message):new Error(c.FAILED_TO_GET_SECURITY_RESULT)}},t=async({projectId:n,visitorId:o,securitySettings:s,metaData:I})=>{try{return await S.default.getSecurityToken({projectId:n,visitorId:o,securitySettings:s,metaData:I})}catch(i){throw i instanceof Error?new Error(i.message):new Error(c.FAILED_TO_GET_SECURITY_TOKEN)}};return(0,_.jsx)(f.Provider,{value:{getSecurityResult:e,getSecurityToken:t},children:r})},A=()=>(0,E.useContext)(f);var d=require("react"),h=y(require("@dtect/security-sdk-js"));var g=require("react/jsx-runtime"),G=({clientId:r,apiKey:e,children:t,endpoint:n})=>{let o=async()=>{try{await h.default.init({apiKey:e,clientId:r,endpoint:n})}catch(s){if(s instanceof Error){console.error(s.message);return}console.error(c.SDK_INIT_ERROR)}};if((0,d.useEffect)(()=>{r&&e&&o()},[]),!r||!e)throw new Error(c.MISSING_CREDENTIALS);return(0,g.jsx)(P,{children:t})},x=G;var U=()=>{let{getSecurityResult:r,getSecurityToken:e}=A();return{getSecurityResult:r,getSecurityToken:e}},K=m;0&&(module.exports={SecurityAPIError,SecurityAPIProvider,useSecurityApi});
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext as f,useContext as P}from"react";var m={UNAUTHORIZED:"Unauthorized"},E={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance"},I={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},S={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},a={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},y={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},n={...m,...E,...I,...S,...a,...y},p={...E,...I,...S,...a,...y};import
|
|
2
|
+
import{createContext as f,useContext as P}from"react";var m={UNAUTHORIZED:"Unauthorized"},E={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key",MAINTENANCE_MODE:"API Under Maintenance",RATE_LIMIT_REACHED:"Too many requests. Rate limit exceeded"},I={SDK_INIT_ERROR:"Internal Server Error during SDK Initialization",DUPLICATE_INITIALIZATION:"Multiple SDK Initializations Detected",NOT_INITIALIZED:"SDK Not Initialized"},S={INVALID_CREDENTIALS:"Invalid Public Client ID or Public API Key"},a={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},y={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},n={...m,...E,...I,...S,...a,...y},p={...E,...I,...S,...a,...y};import T from"@dtect/security-sdk-js";import{jsx as A}from"react/jsx-runtime";var R=f({}),C=({children:r})=>{let e=async({projectId:i,visitorId:s,securitySettings:o,metaData:u})=>{try{return await T.getSecurityResult({projectId:i,visitorId:s,securitySettings:o,metaData:u})}catch(t){throw t instanceof Error?new Error(t.message):new Error(n.FAILED_TO_GET_SECURITY_RESULT)}},c=async({projectId:i,visitorId:s,securitySettings:o,metaData:u})=>{try{return await T.getSecurityToken({projectId:i,visitorId:s,securitySettings:o,metaData:u})}catch(t){throw t instanceof Error?new Error(t.message):new Error(n.FAILED_TO_GET_SECURITY_TOKEN)}};return A(R.Provider,{value:{getSecurityResult:e,getSecurityToken:c},children:r})},l=()=>P(R);import{useEffect as _}from"react";import d from"@dtect/security-sdk-js";import{jsx as g}from"react/jsx-runtime";var h=({clientId:r,apiKey:e,children:c,endpoint:i})=>{let s=async()=>{try{await d.init({apiKey:e,clientId:r,endpoint:i})}catch(o){if(o instanceof Error){console.error(o.message);return}console.error(n.SDK_INIT_ERROR)}};if(_(()=>{r&&e&&s()},[]),!r||!e)throw new Error(n.MISSING_CREDENTIALS);return g(C,{children:c})},x=h;var er=()=>{let{getSecurityResult:r,getSecurityToken:e}=l();return{getSecurityResult:r,getSecurityToken:e}},tr=p;export{tr as SecurityAPIError,x as SecurityAPIProvider,er as useSecurityApi};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtect/security-sdk-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"ts:check": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dtect/security-sdk-js": "^0.0.
|
|
13
|
+
"@dtect/security-sdk-js": "^0.0.10",
|
|
14
14
|
"@tanstack/react-query": "^5.64.1",
|
|
15
15
|
"react": "^19.0.0",
|
|
16
16
|
"react-dom": "^19.0.0"
|
package/src/types/error.ts
CHANGED
|
@@ -7,6 +7,7 @@ const GeneralError = {
|
|
|
7
7
|
INTERNAL_SERVER_ERROR: "Internal Server Error during API Request",
|
|
8
8
|
MISSING_CREDENTIALS: "Missing Public Client ID or Public API Key",
|
|
9
9
|
MAINTENANCE_MODE: "API Under Maintenance",
|
|
10
|
+
RATE_LIMIT_REACHED: "Too many requests. Rate limit exceeded"
|
|
10
11
|
} as const;
|
|
11
12
|
|
|
12
13
|
const InitError = {
|
package/src/types/response.ts
CHANGED
|
@@ -9,6 +9,14 @@ export interface ISecurityResultResponse {
|
|
|
9
9
|
isAutomationDetected: boolean;
|
|
10
10
|
isUntrustedBrowserOrOS: boolean;
|
|
11
11
|
isBlockedIP: boolean;
|
|
12
|
+
isVpnDetected: boolean;
|
|
13
|
+
isDeviceTampered: boolean;
|
|
14
|
+
isVirtualMachine: boolean;
|
|
15
|
+
isDevToolsOpened: boolean;
|
|
16
|
+
isPrivacySettingsEnabled: boolean;
|
|
17
|
+
isTorDetected: boolean;
|
|
18
|
+
isHighActivityDevice: boolean;
|
|
19
|
+
isIncognito: boolean;
|
|
12
20
|
}
|
|
13
21
|
}
|
|
14
22
|
|