@connect-xyz/auth-js 1.58.4 → 1.59.1
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/README.md +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,14 +23,14 @@ You can import the script in your index file and use the Auth class provided by
|
|
|
23
23
|
```html
|
|
24
24
|
<script
|
|
25
25
|
type="module"
|
|
26
|
-
src="https://sdk.connect.xyz/auth-
|
|
26
|
+
src="https://sdk.connect.xyz/auth-web/index.js"
|
|
27
27
|
></script>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Or you can directly import in your javascript code.
|
|
31
31
|
|
|
32
32
|
```javascript
|
|
33
|
-
import { Auth } from 'https://sdk.connect.xyz/auth-
|
|
33
|
+
import { Auth } from 'https://sdk.connect.xyz/auth-web/index.js';
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Getting Started
|
|
@@ -46,7 +46,7 @@ import { Auth } from '@connect-xyz/auth-js';
|
|
|
46
46
|
### 1.1 Or import via CDN
|
|
47
47
|
|
|
48
48
|
```javascript
|
|
49
|
-
import { Auth } from 'https://sdk.connect.xyz/auth-
|
|
49
|
+
import { Auth } from 'https://sdk.connect.xyz/auth-web/index.js';
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
### 2. Initialize the Auth module into Your App
|
|
@@ -57,8 +57,8 @@ const auth = new Auth({
|
|
|
57
57
|
jwt: 'your-jwt-token',
|
|
58
58
|
env: 'production', // or 'sandbox'
|
|
59
59
|
theme: 'auto', // 'auto' (default), 'light', or 'dark'
|
|
60
|
-
onError: ({
|
|
61
|
-
console.error('Auth error:',
|
|
60
|
+
onError: ({ errorCode, reason }) => {
|
|
61
|
+
console.error('Auth error:', errorCode, 'Reason:', reason);
|
|
62
62
|
},
|
|
63
63
|
onClose: () => {
|
|
64
64
|
console.log('Auth widget closed');
|
|
@@ -96,16 +96,16 @@ auth.destroy();
|
|
|
96
96
|
### 2.1 Using Typescript (optional)
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
|
-
import { Auth, AuthConfig
|
|
99
|
+
import { Auth, AuthConfig } from '@connect-xyz/auth-js';
|
|
100
100
|
|
|
101
101
|
const config: AuthConfig = {
|
|
102
102
|
jwt: 'your-jwt-token',
|
|
103
103
|
env: 'sandbox',
|
|
104
104
|
theme: 'dark', // 'auto' (default), 'light', or 'dark'
|
|
105
|
-
onError: ({
|
|
105
|
+
onError: ({ errorCode, reason }) => {
|
|
106
106
|
// Handle error with type safety
|
|
107
107
|
},
|
|
108
|
-
onDeposit: ({ data }
|
|
108
|
+
onDeposit: ({ data }) => {
|
|
109
109
|
// Handle deposit with type safety
|
|
110
110
|
},
|
|
111
111
|
};
|