@dtect/security-sdk-js 0.0.6 → 0.0.7

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.
Files changed (2) hide show
  1. package/README.md +39 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,17 +6,13 @@ Security API Javascript SDK by dtect.
6
6
  <details>
7
7
  <summary>Table of Contents</summary>
8
8
  <ol>
9
- <li>
10
- <a href="#about-the-project">About The Project</a>
11
- </li>
12
9
  <li>
13
10
  <a href="#getting-started">Getting Started</a>
14
11
  <ul>
15
- <li><a href="#prerequisites">Prerequisites</a></li>
16
12
  <li><a href="#installation">Installation</a></li>
17
13
  </ul>
18
14
  </li>
19
- <li>
15
+ <li>
20
16
  <a href="#implementation">Implementation</a>
21
17
  </li>
22
18
  <li>
@@ -24,17 +20,10 @@ Security API Javascript SDK by dtect.
24
20
  </li>
25
21
  <li><a href="#license">License</a></li>
26
22
  <li><a href="#contact">Contact</a></li>
23
+
27
24
  </ol>
28
25
  </details>
29
26
 
30
- <!-- ABOUT THE PROJECT -->
31
-
32
- ## About The Project
33
-
34
- Security API SDK
35
-
36
- <p align="right">(<a href="#readme-top">back to top</a>)</p>
37
-
38
27
  <!-- GETTING STARTED -->
39
28
 
40
29
  ## Getting Started
@@ -42,9 +31,9 @@ Security API SDK
42
31
  The dtect Security API helps you gather valuable insights about your visitors, enhancing the quality of your survey data.
43
32
  This library is responsible for collecting data about the visitor's browser and behavior, send everything to our API and return a Security Result or a Security Token.
44
33
 
45
- ### Prerequisites
34
+ _Please refer to [our official documentation](https://docs.dtect.io) to learn more about the dtect Security API_
46
35
 
47
- Get required Public Keys at [https://dtect.security.dashboard.com](https://dtect.security.dashboard.com)
36
+ _**If you want to use our API, please [contact us](https://dtect.io/contact)**_
48
37
 
49
38
  ### Installation
50
39
 
@@ -68,10 +57,12 @@ or CDN
68
57
 
69
58
  ## NPM Implementation
70
59
 
60
+ _Read full documentation about implementation on [our official docs](https://docs.dtect.io/frontend/introduction)_
61
+
71
62
  ### 1. Start initialize security sdk by calling init function.
72
63
 
73
- - Set `clientId` from your [dtect dashboard](https://dtect.security.dashboard.com/keys)
74
- - Set `apiKey` from your [dtect dashboard](https://dtect.security.dashboard.com/keys)
64
+ - Set your public client id as `clientId`
65
+ - Set your public api key as `apiKey`
75
66
 
76
67
  ```jsx
77
68
  import dtect from "@dtect/security-sdk-js";
@@ -123,7 +114,9 @@ dtect
123
114
 
124
115
  ```html
125
116
  <script>
126
- const dtectPromise = import(`cdnurl`).then((dtect) =>
117
+ const dtectPromise = import(
118
+ "https://unpkg.com/@dtect/security-sdk-js@latest/dist/index.mjs"
119
+ ).then((dtect) =>
127
120
  dtect.init({
128
121
  clientId: "your-public-client-id-from-dashboard", // required
129
122
  apiKey: "your-public-api-key-from-dashboard", // required
@@ -152,6 +145,8 @@ dtect
152
145
 
153
146
  ## Errors
154
147
 
148
+ _Read full documentation about errors on [our official docs](https://docs.dtect.io/errors)_
149
+
155
150
  Access the list of error enums from `SecurityAPIError`
156
151
 
157
152
  ### init()
@@ -174,6 +169,10 @@ You will see these errors on console
174
169
  | `FAILED_TO_GET_SECURITY_TOKEN` | Failed to Generate Security Token | An error occurred while generating the Security Token. |
175
170
  | `FAILED_TO_GET_SECURITY_RESULT` | Failed to Retrieve Security Result | An error occurred while retrieving the Security Result. |
176
171
 
172
+ |
173
+
174
+ #### NPM implementation with errors
175
+
177
176
  ```jsx
178
177
  import dtect, { SecurityAPIError } from "@dtect/security-sdk-js";
179
178
 
@@ -191,11 +190,31 @@ dtect
191
190
  });
192
191
  ```
193
192
 
193
+ #### CDN implementation with errors
194
+
195
+ ```jsx
196
+ <script>
197
+ dtectPromise.then((dtect) =>
198
+ dtect
199
+ .getSecurityResult({
200
+ projectId: "your-project-id-for-deduplication", // required
201
+ })
202
+ .then((securityResult) => console.log(securityResult))
203
+ .catch((error) => {
204
+ switch(error.message) {
205
+ case dtect.SecurityAPIError.FAILED_TO_GET_SECURITY_RESULT:
206
+ // log internally
207
+ }
208
+ })
209
+ );
210
+ </script>
211
+ ```
212
+
194
213
  <!-- LICENSE -->
195
214
 
196
- ## License
215
+ <!-- ## License
197
216
 
198
- <p align="right">(<a href="#readme-top">back to top</a>)</p>
217
+ <p align="right">(<a href="#readme-top">back to top</a>)</p> -->
199
218
 
200
219
  <!-- CONTACT -->
201
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtect/security-sdk-js",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",