@dtect/security-sdk-react 0.0.3 → 0.0.5

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.
@@ -9,12 +9,12 @@
9
9
  CLI Cleaning output folder
10
10
  CJS Build start
11
11
  ESM Build start
12
- CJS dist/index.js 2.67 KB
13
- CJS ⚡️ Build success in 9ms
14
12
  ESM dist/index.mjs 1.98 KB
15
- ESM ⚡️ Build success in 9ms
13
+ ESM ⚡️ Build success in 10ms
14
+ CJS dist/index.js 2.59 KB
15
+ CJS ⚡️ Build success in 12ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 627ms
17
+ DTS ⚡️ Build success in 639ms
18
18
  DTS dist/index.d.ts 1.55 KB
19
19
  DTS dist/index.d.mts 1.55 KB
20
20
  ✨ Done in 1.14s.
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 D=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var L=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!v.call(r,o)&&o!==t&&u(r,o,{get:()=>e[o],enumerable:!(n=D(e,o))||n.enumerable});return r};var a=(r,e,t)=>(t=r!=null?k(O(r)):{},y(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),w=r=>y(u({},"__esModule",{value:!0}),r);var F={};L(F,{SecurityAPIError:()=>M,SecurityAPIProvider:()=>x,useSecurityApi:()=>U});module.exports=w(F);var I=require("react");var G={UNAUTHORIZED:"Unauthorized"},p={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key"},C={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"},T={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},l={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},c={...G,...p,...C,...R,...T,...l},m={...p,...C,...R,...T,...l};var S=a(require("@dtect/security-sdk-js")),A=require("react/jsx-runtime"),f=(0,I.createContext)({}),P=({children:r})=>{let e=async({projectId:n,visitorId:o,securitySettings:s,metaData:E})=>{try{return await S.default.getSecurityResult({projectId:n,visitorId:o,securitySettings:s,metaData:E})}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:E})=>{try{return await S.default.getSecurityToken({projectId:n,visitorId:o,securitySettings:s,metaData:E})}catch(i){throw i instanceof Error?new Error(i.message):new Error(c.FAILED_TO_GET_SECURITY_TOKEN)}};return(0,A.jsx)(f.Provider,{value:{getSecurityResult:e,getSecurityToken:t},children:r})},h=()=>(0,I.useContext)(f);var _=require("react"),d=a(require("@dtect/security-sdk-js"));var g=require("react/jsx-runtime"),K=({clientId:r,apiKey:e,children:t,endpoint:n})=>{let o=async()=>{try{await d.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,_.useEffect)(()=>{r&&e&&o()},[]),!r||!e)throw new Error(c.MISSING_CREDENTIALS);return(0,g.jsx)(P,{children:t})},x=K;var U=()=>{let{getSecurityResult:r,getSecurityToken:e}=h();return{getSecurityResult:r,getSecurityToken:e}},M=m;0&&(module.exports={SecurityAPIError,SecurityAPIProvider,useSecurityApi});
2
+ "use strict";var k=Object.create;var u=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var L=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},y=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N(e))!v.call(r,o)&&o!==t&&u(r,o,{get:()=>e[o],enumerable:!(n=D(e,o))||n.enumerable});return r};var a=(r,e,t)=>(t=r!=null?k(O(r)):{},y(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),w=r=>y(u({},"__esModule",{value:!0}),r);var F={};L(F,{SecurityAPIError:()=>M,SecurityAPIProvider:()=>x,useSecurityApi:()=>U});module.exports=w(F);var I=require("react");var G={UNAUTHORIZED:"Unauthorized"},p={INTERNAL_SERVER_ERROR:"Internal Server Error during API Request",MISSING_CREDENTIALS:"Missing Public Client ID or Public API Key"},C={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"},T={FAILED_TO_GET_SECURITY_RESULT:"Failed to Retrieve Security Result"},l={FAILED_TO_GET_SECURITY_TOKEN:" Failed to Generate Security Token"},c={...G,...p,...C,...R,...T,...l},m={...p,...C,...R,...T,...l};var S=a(require("@dtect/security-sdk-js")),A=require("react/jsx-runtime"),f=(0,I.createContext)({}),P=({children:r})=>{let e=async({projectId:n,visitorId:o,securitySettings:s,metaData:E})=>{try{return await S.default.getSecurityResult({projectId:n,visitorId:o,securitySettings:s,metaData:E})}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:E})=>{try{return await S.default.getSecurityToken({projectId:n,visitorId:o,securitySettings:s,metaData:E})}catch(i){throw i instanceof Error?new Error(i.message):new Error(c.FAILED_TO_GET_SECURITY_TOKEN)}};return(0,A.jsx)(f.Provider,{value:{getSecurityResult:e,getSecurityToken:t},children:r})},h=()=>(0,I.useContext)(f);var _=require("react"),d=a(require("@dtect/security-sdk-js"));var g=require("react/jsx-runtime"),K=({clientId:r,apiKey:e,children:t,endpoint:n})=>{let o=async()=>{try{await d.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,_.useEffect)(()=>{r&&e&&o()},[]),!r||!e)throw new Error(c.MISSING_CREDENTIALS);return(0,g.jsx)(P,{children:t})},x=K;var U=()=>{let{getSecurityResult:r,getSecurityToken:e}=h();return{getSecurityResult:r,getSecurityToken:e}},M=m;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtect/security-sdk-react",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "ts:check": "tsc --noEmit"
10
10
  },
11
11
  "dependencies": {
12
- "@dtect/security-sdk-js": "*",
12
+ "@dtect/security-sdk-js": "^0.0.5",
13
13
  "@tanstack/react-query": "^5.64.1",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0"
package/tsconfig.json CHANGED
@@ -15,5 +15,6 @@
15
15
  "strict": true,
16
16
  "skipLibCheck": true
17
17
  },
18
- "include": ["src"]
18
+ "include": ["src"],
19
+ "exclude": ["node_modules"]
19
20
  }
package/tsup.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineConfig } from "tsup";
1
+ import { defineConfig } from 'tsup'
2
2
 
3
3
  export default defineConfig({
4
4
  entry: ["src/index.ts", "src/**/*.ts", "src/**/*.tsx"],
@@ -6,13 +6,14 @@ export default defineConfig({
6
6
  external: ["react", "react-dom", "react/jsx-runtime"],
7
7
  sourcemap: false,
8
8
  clean: true,
9
- minify: true,
10
- dts: true,
11
- tsconfig: "tsconfig.json",
9
+ minify: true,
10
+ dts: true,
11
+ tsconfig: "tsconfig.json",
12
12
  banner: {
13
- js: `"use client";`,
13
+ js: `"use client";`
14
14
  },
15
15
  outDir: "dist",
16
16
  format: ["cjs", "esm"],
17
17
  minifyIdentifiers: true,
18
- });
18
+ platform: "browser"
19
+ })