@oobit/react-native-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 +22 -0
- package/README.md +26 -25
- package/package.json +21 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Oobit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oobit/react-native-sdk
|
|
2
2
|
|
|
3
|
-
A React Native
|
|
3
|
+
A React Native SDK that enables wallet apps to integrate Oobit's crypto payment services. Let your users pay with cryptocurrency through Oobit's secure payment infrastructure.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@oobit/react-native-sdk)
|
|
6
|
+
[](https://github.com/oobit-tech/react-native-SDK/blob/main/LICENSE)
|
|
4
7
|
|
|
5
8
|
## Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
8
|
-
npm install @
|
|
11
|
+
npm install @oobit/react-native-sdk
|
|
9
12
|
# or
|
|
10
|
-
yarn add @
|
|
13
|
+
yarn add @oobit/react-native-sdk
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
### Peer Dependencies
|
|
17
|
+
|
|
18
|
+
Make sure you have these installed:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install react-native-webview expo-linking
|
|
22
|
+
# or
|
|
23
|
+
yarn add react-native-webview expo-linking
|
|
16
24
|
```
|
|
17
25
|
|
|
18
26
|
## Quick Start
|
|
19
27
|
|
|
20
28
|
```typescript
|
|
21
|
-
import { WidgetSDK } from '@sdk';
|
|
29
|
+
import { WidgetSDK } from '@oobit/react-native-sdk';
|
|
22
30
|
import { View, Alert } from 'react-native';
|
|
23
31
|
|
|
24
32
|
function MyApp() {
|
|
@@ -191,7 +199,7 @@ Called when the user requests to close the widget (via a close button in the wid
|
|
|
191
199
|
```typescript
|
|
192
200
|
import React, { useState } from 'react';
|
|
193
201
|
import { View, Button, StyleSheet, Alert, ActivityIndicator } from 'react-native';
|
|
194
|
-
import { WidgetSDK } from '@sdk';
|
|
202
|
+
import { WidgetSDK } from '@oobit/react-native-sdk';
|
|
195
203
|
|
|
196
204
|
export default function CardIssuanceScreen() {
|
|
197
205
|
const [showWidget, setShowWidget] = useState(false);
|
|
@@ -280,7 +288,7 @@ const styles = StyleSheet.create({
|
|
|
280
288
|
The SDK is fully typed. Import types as needed:
|
|
281
289
|
|
|
282
290
|
```typescript
|
|
283
|
-
import type { WidgetSDKConfig } from '@sdk';
|
|
291
|
+
import type { WidgetSDKConfig } from '@oobit/react-native-sdk';
|
|
284
292
|
|
|
285
293
|
const config: WidgetSDKConfig = {
|
|
286
294
|
apiKey: 'your-key',
|
|
@@ -297,7 +305,7 @@ const config: WidgetSDKConfig = {
|
|
|
297
305
|
For advanced use cases where you need to handle messages directly:
|
|
298
306
|
|
|
299
307
|
```typescript
|
|
300
|
-
import { MessageTypes } from '@sdk';
|
|
308
|
+
import { MessageTypes } from '@oobit/react-native-sdk';
|
|
301
309
|
|
|
302
310
|
// Use constants instead of strings
|
|
303
311
|
if (message.type === MessageTypes.CARD_CREATED) {
|
|
@@ -347,7 +355,7 @@ window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
|
347
355
|
You can also manually open the wallet from your React Native app:
|
|
348
356
|
|
|
349
357
|
```typescript
|
|
350
|
-
import { openNativeWallet, isWalletAvailable } from '@sdk';
|
|
358
|
+
import { openNativeWallet, isWalletAvailable } from '@oobit/react-native-sdk';
|
|
351
359
|
|
|
352
360
|
// Check if wallet is available
|
|
353
361
|
const available = await isWalletAvailable();
|
|
@@ -377,7 +385,7 @@ You can programmatically trigger back navigation using a ref:
|
|
|
377
385
|
|
|
378
386
|
```typescript
|
|
379
387
|
import { useRef } from 'react';
|
|
380
|
-
import { WidgetSDK, WidgetSDKRef } from '@sdk';
|
|
388
|
+
import { WidgetSDK, WidgetSDKRef } from '@oobit/react-native-sdk';
|
|
381
389
|
|
|
382
390
|
function MyScreen() {
|
|
383
391
|
const widgetRef = useRef<WidgetSDKRef>(null);
|
|
@@ -444,19 +452,19 @@ window.addEventListener('message', (event) => {
|
|
|
444
452
|
{
|
|
445
453
|
"react": ">=18.0.0",
|
|
446
454
|
"react-native": ">=0.70.0",
|
|
447
|
-
"react-native-webview": ">=13.0.0"
|
|
455
|
+
"react-native-webview": ">=13.0.0",
|
|
456
|
+
"expo-linking": ">=6.0.0"
|
|
448
457
|
}
|
|
449
458
|
```
|
|
450
459
|
|
|
451
460
|
### Optional Dependencies
|
|
452
461
|
|
|
453
|
-
For full wallet integration:
|
|
462
|
+
For full wallet integration on Android:
|
|
454
463
|
- `expo-intent-launcher` - Android wallet integration
|
|
455
|
-
- `expo-linking` - Deep link handling
|
|
456
464
|
|
|
457
465
|
Install with:
|
|
458
466
|
```bash
|
|
459
|
-
expo install expo-intent-launcher
|
|
467
|
+
expo install expo-intent-launcher
|
|
460
468
|
```
|
|
461
469
|
|
|
462
470
|
## Common Use Cases
|
|
@@ -556,13 +564,6 @@ const [isWidgetReady, setIsWidgetReady] = useState(false);
|
|
|
556
564
|
**iOS:** Ensure Apple Wallet app is installed (may require real device)
|
|
557
565
|
**Android:** Ensure Google Play Services is configured on the device/emulator
|
|
558
566
|
|
|
559
|
-
## Support
|
|
560
|
-
|
|
561
|
-
For integration help:
|
|
562
|
-
- [Architecture Docs](../SDK_ARCHITECTURE.md)
|
|
563
|
-
- [Quick Start Guide](../SDK_QUICKSTART.md)
|
|
564
|
-
- [Web Widget Integration](../WIDGET_INTEGRATION.md)
|
|
565
|
-
|
|
566
567
|
## License
|
|
567
568
|
|
|
568
|
-
MIT
|
|
569
|
+
MIT © [Oobit](https://oobit.com)
|
package/package.json
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oobit/react-native-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "React Native
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "React Native SDK for integrating Oobit crypto payments into wallet apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
8
17
|
"react-native": "dist/index.js",
|
|
9
18
|
"source": "src/index.ts",
|
|
10
19
|
"keywords": [
|
|
11
20
|
"react-native",
|
|
12
21
|
"expo",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
22
|
+
"crypto",
|
|
23
|
+
"payments",
|
|
15
24
|
"wallet",
|
|
25
|
+
"oobit",
|
|
26
|
+
"cryptocurrency",
|
|
27
|
+
"bitcoin",
|
|
28
|
+
"ethereum",
|
|
16
29
|
"sdk"
|
|
17
30
|
],
|
|
18
31
|
"author": "Oobit",
|
|
19
|
-
"license": "
|
|
32
|
+
"license": "MIT",
|
|
20
33
|
"private": false,
|
|
21
34
|
"publishConfig": {
|
|
22
35
|
"access": "public"
|
|
23
36
|
},
|
|
24
37
|
"repository": {
|
|
25
38
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/oobit-tech/react-native-SDK.git"
|
|
39
|
+
"url": "git+https://github.com/oobit-tech/react-native-SDK.git"
|
|
27
40
|
},
|
|
28
41
|
"peerDependencies": {
|
|
29
42
|
"expo-linking": ">=6.0.0",
|
|
@@ -51,7 +64,8 @@
|
|
|
51
64
|
"files": [
|
|
52
65
|
"dist",
|
|
53
66
|
"src",
|
|
54
|
-
"README.md"
|
|
67
|
+
"README.md",
|
|
68
|
+
"LICENSE"
|
|
55
69
|
],
|
|
56
70
|
"scripts": {
|
|
57
71
|
"build": "tsc",
|