@yuno-payments/sdk-web 1.2.2-beta.0 → 1.2.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/README.md +59 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,73 @@
|
|
|
1
1
|
# SDK Web
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package provides a wrapper to easily load and use the Yuno SDK in your web applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```bash
|
|
8
8
|
npm install @yuno-payments/sdk-web
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Basic Usage
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
14
|
import { loadScript } from '@yuno-payments/sdk-web'
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
// Load the SDK with default settings (production environment)
|
|
16
17
|
const yuno = await loadScript()
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
// Initialize with your public API key
|
|
20
|
+
yuno.initialize('your-public-api-key')
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Advanced Usage
|
|
24
|
+
|
|
25
|
+
The `loadScript` function accepts optional configuration props, primarily for testing and development purposes:
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import { loadScript } from '@yuno-payments/sdk-web'
|
|
29
|
+
|
|
30
|
+
// Load SDK from a specific environment
|
|
31
|
+
const yuno = await loadScript({
|
|
32
|
+
env: 'sandbox' // Options: 'dev', 'staging', 'sandbox', 'prod'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Load a specific SDK version
|
|
36
|
+
const yuno = await loadScript({
|
|
37
|
+
version: 'v1.2' // Custom version (defaults to latest version)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Combine both options for testing
|
|
41
|
+
const yuno = await loadScript({
|
|
42
|
+
env: 'dev',
|
|
43
|
+
version: 'v1.3'
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
yuno.initialize('your-public-api-key')
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Configuration Options
|
|
50
|
+
|
|
51
|
+
| Option | Type | Default | Description |
|
|
52
|
+
|--------|------|---------|-------------|
|
|
53
|
+
| `env` | `'dev' \| 'staging' \| 'sandbox' \| 'prod'` | `'prod'` | Environment to load the SDK from. Use different environments for testing. |
|
|
54
|
+
| `version` | `string` | `'v1.2'` | SDK version to load. Useful for testing with specific versions. |
|
|
55
|
+
|
|
56
|
+
## Environment URLs
|
|
57
|
+
|
|
58
|
+
The SDK will be loaded from different URLs based on the environment:
|
|
59
|
+
|
|
60
|
+
- **dev**: `https://sdk-web.dev.y.uno/v1.2/main.js`
|
|
61
|
+
- **staging**: `https://sdk-web.staging.y.uno/v1.2/main.js`
|
|
62
|
+
- **sandbox**: `https://sdk-web.sandbox.y.uno/v1.2/main.js`
|
|
63
|
+
- **prod**: `https://sdk-web.y.uno/v1.2/main.js` (default)
|
|
64
|
+
|
|
65
|
+
## TypeScript Support
|
|
66
|
+
|
|
67
|
+
This package includes TypeScript definitions. The `loadScript` function returns a Promise that resolves to the Yuno SDK instance with full type support.
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { loadScript, LoadScript } from '@yuno-payments/sdk-web'
|
|
19
71
|
|
|
72
|
+
const yuno: Yuno = await loadScript({ env: 'sandbox' })
|
|
20
73
|
```
|