@smartcomply/web-sdk 1.0.0 → 1.0.2

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/LICENSE.txt ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026 Smartcomply. All rights reserved.
2
+
3
+ This software and its source code are the proprietary information of Smartcomply.
4
+ Unauthorized copying, modification, distribution, or any other use of this software without the express written consent of Smartcomply is strictly prohibited.
5
+
6
+ The use of this SDK is governed by the Smartcomply Terms of Service provided
7
+ at https://adhere.smartcomply.com.
package/README.md CHANGED
@@ -1,73 +1,80 @@
1
- # React + TypeScript + Vite
1
+ ## @smartcomply/web-sdk
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ The lightweight, secure, and performance-optimized Identity Verification SDK for Smartcomply.
4
4
 
5
- Currently, two official plugins are available:
5
+ ### Overview
6
+ The Smartcomply Web SDK provides a seamless identity verification experience. Built with performance in mind, it features:
6
7
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
8
+ - **Ultra-Lightweight:** Only ~80kB gzipped.
9
9
 
10
- ## React Compiler
10
+ - **Encapsulated Styles:** Powered by Shadow DOM to prevent style clashing with your website.
11
11
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
12
+ - **Privacy-First:** Automatic hardware cleanup ensures the camera turns off immediately after use.
13
13
 
14
- ## Expanding the ESLint configuration
14
+ - **Framework Agnostic:** Works with React, Vue, Angular, or Vanilla JavaScript.
15
15
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
-
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
16
+ ### Installation
17
+ ```bash
18
+ npm install @smartcomply/web-sdk
19
+ ```
25
20
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
21
+ **or**
32
22
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
23
+ ```bash
24
+ yarn add @smartcomply/web-sdk
44
25
  ```
45
26
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
27
+ ### Usage
28
+ Integrating the SDK is straightforward. Initialize it with your configuration and launch it.
29
+
30
+ #### Basic Integration
31
+ ```JavaScript
32
+ import AdhereSDK from '@smartcomply/web-sdk';
33
+
34
+ const sdk = new AdhereSDK({
35
+ session: 'sessionId',
36
+ onSuccess: (data) => {
37
+ console.log('Verification successful:', data);
71
38
  },
72
- ])
39
+ onExpire: () => {
40
+ console.log('User cancelled verification');
41
+ },
42
+ onError: (error) => {
43
+ console.error('Verification error:', error);
44
+ }
45
+ });
46
+
47
+ // To open the SDK
48
+ sdk.launch();
73
49
  ```
50
+
51
+ ### Styling & Customization
52
+ The SDK uses a custom prefix (sc:) for its Tailwind-powered UI. Because it resides in a Shadow DOM, your global CSS will not affect the SDK, and the SDK's styles will not leak into your application.
53
+
54
+ ### Security & Privacy
55
+ - **Camera Permissions:** The SDK only requests camera access during the liveness detection phase.
56
+
57
+ - **Resource Management:** Hardware streams are automatically released upon session expiry or user exit.
58
+
59
+ - **Data Encryption:** All verification data is encrypted in transit.
60
+
61
+
62
+ ### License
63
+ Copyright © 2026 Smartcomply. All rights reserved.
64
+ This software and its source code are the proprietary information of Smartcomply.
65
+ Unauthorized copying, modification, distribution, or any other use of this software without the express written consent of Smartcomply is strictly prohibited.
66
+
67
+ The use of this SDK is governed by the Smartcomply Terms of Service provided at https://adhere.smartcomply.com.
68
+
69
+ ### Contributors
70
+
71
+ ##### This SDK is developed and maintained by the Smartcomply Engineering Team.
72
+
73
+ <a href="https://github.com/titoadeoye">
74
+ <img src="https://avatars.githubusercontent.com/titoadeoye?s=80"
75
+ alt="Tito Adeoye"
76
+ width="100"
77
+ style="border-radius:50%;" />
78
+ </a>
79
+
80
+ ---
@@ -0,0 +1,8 @@
1
+ export declare const BASE_URL: string;
2
+ export interface SDKConfig {
3
+ timeout?: number;
4
+ session: string;
5
+ onSuccess?: (data: any) => void;
6
+ onError?: (error: any) => void;
7
+ onExpire?: () => void;
8
+ }
@@ -0,0 +1,13 @@
1
+ import { SDKConfig } from './Config';
2
+ export declare class HttpClient {
3
+ private baseUrl;
4
+ private timeout;
5
+ private session;
6
+ private onError;
7
+ private destroy;
8
+ constructor(config: SDKConfig, destroy?: Function);
9
+ request<T>(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
10
+ post<T>(path: string, data: any, headers?: Record<string, string>): Promise<T>;
11
+ patch<T>(path: string, data: any, headers?: Record<string, string>): Promise<T>;
12
+ get<T>(path: string): Promise<T>;
13
+ }
@@ -0,0 +1,6 @@
1
+ import { default as SmartComply } from '../main';
2
+ type Props = {
3
+ sdkInstance: SmartComply;
4
+ };
5
+ declare const MainSDKFlow: ({ sdkInstance }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default MainSDKFlow;
@@ -0,0 +1,10 @@
1
+ import { SDK, TSDKTheme } from '../../utils/types';
2
+ type Props = {
3
+ config: SDK;
4
+ onSubmit: (identifier: string, identifier_type: string, country: string) => void;
5
+ selectedTheme: TSDKTheme;
6
+ handleIdUpdate: (file: File | undefined, cropped: File | undefined) => void;
7
+ idFile: File | undefined;
8
+ };
9
+ export default function IdentityForm({ config, selectedTheme, onSubmit, handleIdUpdate, idFile, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { SDKConfig } from '../../client/Config';
2
+ import { IDConfirmationFormPayload, SDK } from '../../utils/types';
3
+ interface Props {
4
+ sdkInstance: SDKConfig;
5
+ updateStep: (step: string) => void;
6
+ config: SDK;
7
+ idFile: File | undefined;
8
+ snapshotFile: File | undefined;
9
+ identityFormData: IDConfirmationFormPayload | undefined;
10
+ handleDetectionPass: () => void;
11
+ }
12
+ declare const LivenessFlow: ({ sdkInstance, updateStep, config, idFile, snapshotFile, identityFormData, handleDetectionPass }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ export default LivenessFlow;
@@ -0,0 +1,8 @@
1
+ import { SDK, TSDKTheme } from '../../utils/types';
2
+ type Props = {
3
+ config: SDK;
4
+ onStart: () => void;
5
+ selectedTheme: TSDKTheme;
6
+ };
7
+ export default function LivenessPreCheck({ selectedTheme, onStart }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import { TSDKTheme } from '../../utils/types';
2
+ type Props = {
3
+ selectedTheme: TSDKTheme;
4
+ };
5
+ export default function LoadingScreen({ selectedTheme }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ redirect_url?: string;
3
+ destroy: () => void;
4
+ };
5
+ export default function SuccessConfirmation({ redirect_url, destroy }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ onComplete: () => void;
3
+ canClose: boolean;
4
+ };
5
+ export default function UploadingScreen({ onComplete, canClose }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { SDK, TSDKTheme } from '../../utils/types';
2
+ type Props = {
3
+ config: SDK;
4
+ onNext: () => void;
5
+ selectedTheme: TSDKTheme;
6
+ };
7
+ export default function WelcomeScreen({ config, selectedTheme, onNext, }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { TSDKTheme } from '../../utils/types';
2
+ export interface DropdownOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ interface DropdownProps {
7
+ options: DropdownOption[];
8
+ value: string;
9
+ onChange: (value: string) => void;
10
+ selectedTheme: TSDKTheme;
11
+ placeholder?: string;
12
+ }
13
+ export default function Dropdown({ options, value, onChange, selectedTheme, placeholder, }: DropdownProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,4 @@
1
+ export default function SessionTimeout({ destroy, onExpire }: {
2
+ destroy: Function;
3
+ onExpire?: Function;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function ToastContainer(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ type ToastType = "success" | "error" | "loading";
2
+ export interface ToastItem {
3
+ id: string;
4
+ message: string;
5
+ type: ToastType;
6
+ }
7
+ type Listener = (toasts: ToastItem[]) => void;
8
+ export declare const toast: {
9
+ subscribe(listener: Listener): () => void;
10
+ success(message: string): void;
11
+ error(message: string): void;
12
+ loading(message: string): `${string}-${string}-${string}-${string}-${string}`;
13
+ dismiss(id?: string): void;
14
+ };
15
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,34 +1,4 @@
1
- interface SDKConfig {
2
- timeout?: number;
3
- session: string;
4
- onSuccess?: (data: any) => void;
5
- onError?: (error: any) => void;
6
- onExpire?: () => void;
7
- }
8
-
9
- declare class HttpClient {
10
- private baseUrl;
11
- private timeout;
12
- private session;
13
- private onError;
14
- private destroy;
15
- constructor(config: SDKConfig, destroy?: Function);
16
- request<T>(method: string, path: string, body?: unknown, headers?: Record<string, string>): Promise<T>;
17
- post<T>(path: string, data: any, headers?: Record<string, string>): Promise<T>;
18
- patch<T>(path: string, data: any, headers?: Record<string, string>): Promise<T>;
19
- get<T>(path: string): Promise<T>;
20
- }
21
-
22
- declare class SmartComply {
23
- private http;
24
- private config;
25
- private root;
26
- private containerId;
27
- constructor(config: SDKConfig);
28
- getConfig(): SDKConfig;
29
- getHttp(): HttpClient;
30
- launch(): void;
31
- destroy: () => void;
32
- }
33
-
34
- export { type SDKConfig, SmartComply, SmartComply as default };
1
+ import { default as SmartComply } from './main';
2
+ export default SmartComply;
3
+ export { SmartComply };
4
+ export type { SDKConfig } from './client/Config';