@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 +7 -0
- package/README.md +67 -60
- package/dist/client/Config.d.ts +8 -0
- package/dist/client/HttpClient.d.ts +13 -0
- package/dist/components/MainSDKFlow.d.ts +6 -0
- package/dist/components/steps/IdentityForm.d.ts +10 -0
- package/dist/components/steps/LivenessFlow.d.ts +13 -0
- package/dist/components/steps/LivenessPreCheck.d.ts +8 -0
- package/dist/components/steps/LoadingScreen.d.ts +6 -0
- package/dist/components/steps/SuccessConfirmation.d.ts +6 -0
- package/dist/components/steps/UploadingScreen.d.ts +6 -0
- package/dist/components/steps/WelcomeScreen.d.ts +8 -0
- package/dist/components/ui/Dropdown.d.ts +14 -0
- package/dist/components/ui/SessionTimeout.d.ts +4 -0
- package/dist/components/ui/toast/ToastContainer.d.ts +1 -0
- package/dist/components/ui/toast/index.d.ts +15 -0
- package/dist/index.d.ts +4 -34
- package/dist/index.js +84 -17
- package/dist/main.d.ts +13 -0
- package/dist/utils/constants.d.ts +8 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/livenessHelpers.d.ts +3 -0
- package/dist/utils/types.d.ts +76 -0
- package/dist/vite.svg +1 -0
- package/dist/web-sdk.css +1 -0
- package/package.json +26 -8
- package/dist/index.cjs +0 -17
- package/dist/index.d.cts +0 -34
- package/dist/loading-5HD36QXU.svg +0 -14
- package/dist/shield-checkmark-JBZCUXJC.png +0 -0
- package/dist/success-GHUHNWON.svg +0 -4
- package/dist/trash-KETR47RP.svg +0 -7
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
|
-
|
|
1
|
+
## @smartcomply/web-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The lightweight, secure, and performance-optimized Identity Verification SDK for Smartcomply.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Overview
|
|
6
|
+
The Smartcomply Web SDK provides a seamless identity verification experience. Built with performance in mind, it features:
|
|
6
7
|
|
|
7
|
-
-
|
|
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
|
-
|
|
10
|
+
- **Encapsulated Styles:** Powered by Shadow DOM to prevent style clashing with your website.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- **Privacy-First:** Automatic hardware cleanup ensures the camera turns off immediately after use.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- **Framework Agnostic:** Works with React, Vue, Angular, or Vanilla JavaScript.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
import
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
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,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,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,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 @@
|
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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';
|