@busha/ramp-web-sdk 0.1.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 ADDED
@@ -0,0 +1,244 @@
1
+ # @busha/ramp-web-sdk
2
+
3
+ Official Busha Ramp Web SDK for integrating cryptocurrency on-ramp functionality into web applications.
4
+
5
+ [![npm version](https://badge.fury.io/js/%40busha%2Framp-web-sdk.svg)](https://badge.fury.io/js/%40busha%2Framp-web-sdk)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## 🚀 Features
9
+
10
+ - **Easy Integration**: Simple API for adding crypto on-ramp to your web app
11
+ - **TypeScript Support**: Full TypeScript definitions included
12
+ - **Framework Agnostic**: Works with React, Vue, Angular, or vanilla JavaScript
13
+ - **Customizable**: Flexible configuration options
14
+ - **Secure**: Built with security best practices
15
+
16
+ ## 📦 Installation
17
+
18
+ ### NPM/Yarn
19
+
20
+ ```bash
21
+ # Using npm
22
+ npm install @busha/ramp-web-sdk
23
+
24
+ # Using yarn
25
+ yarn add @busha/ramp-web-sdk
26
+ ```
27
+
28
+ ### CDN
29
+
30
+ ```html
31
+ <script src="https://cdn.jsdelivr.net/npm/@busha/ramp-web-sdk/dist/index.umd.js"></script>
32
+ ```
33
+
34
+ ## 📦 Build Formats
35
+
36
+ The SDK is available in multiple formats:
37
+
38
+ - **ES Module** (`dist/index.es.js`): For modern bundlers and ES modules
39
+ - **UMD** (`dist/index.umd.js`): For CDN usage and older environments
40
+
41
+ The package.json exports are configured to automatically use the appropriate format based on your build environment.
42
+
43
+ ## 🛠️ Usage
44
+
45
+ ### Basic Usage
46
+
47
+ ```javascript
48
+ import { BushaRampWidget } from '@busha/ramp-web-sdk';
49
+
50
+ const ramp = new BushaRampWidget({
51
+ publicKey: 'your_public_key_here',
52
+ side: 'buy', // 'buy' or 'sell'
53
+ onSuccess: (transaction) => {
54
+ console.log('Transaction successful:', transaction);
55
+ },
56
+ onClose: () => {
57
+ console.log('Widget closed');
58
+ },
59
+ });
60
+
61
+ // Show the widget
62
+ ramp.show();
63
+ ```
64
+
65
+ ### React Component
66
+
67
+ ```jsx
68
+ import React from 'react';
69
+ import { BushaRampWidget } from '@busha/ramp-web-sdk';
70
+
71
+ function App() {
72
+ const handleShowWidget = () => {
73
+ const ramp = new BushaRampWidget({
74
+ publicKey: 'your_public_key_here',
75
+ side: 'buy',
76
+ onSuccess: (transaction) => {
77
+ console.log('Success:', transaction);
78
+ },
79
+ onClose: () => {
80
+ console.log('Widget closed');
81
+ },
82
+ });
83
+ ramp.show();
84
+ };
85
+
86
+ return (
87
+ <div>
88
+ <h1>My Crypto App</h1>
89
+ <button onClick={handleShowWidget}>
90
+ Buy Crypto
91
+ </button>
92
+ </div>
93
+ );
94
+ }
95
+ ```
96
+
97
+ ### CDN Usage
98
+
99
+ ```html
100
+ <!DOCTYPE html>
101
+ <html>
102
+ <head>
103
+ <title>Crypto App</title>
104
+ </head>
105
+ <body>
106
+ <button id="buyCrypto">Buy Crypto</button>
107
+
108
+ <script src="https://cdn.jsdelivr.net/npm/@busha/ramp-web-sdk/dist/index.umd.js"></script>
109
+ <script>
110
+ const { BushaRampWidget } = window.BushaRampWeb;
111
+
112
+ const ramp = new BushaRampWidget({
113
+ publicKey: 'your_public_key_here',
114
+ side: 'buy',
115
+ onSuccess: (transaction) => {
116
+ console.log('Success:', transaction);
117
+ },
118
+ onClose: () => {
119
+ console.log('Widget closed');
120
+ },
121
+ });
122
+
123
+ document.getElementById('buyCrypto').addEventListener('click', () => {
124
+ ramp.show();
125
+ });
126
+ </script>
127
+ </body>
128
+ </html>
129
+ ```
130
+
131
+ ## ⚙️ Configuration
132
+
133
+ ### BushaRampWidget Options
134
+
135
+ | Option | Type | Required | Description |
136
+ |--------|------|----------|-------------|
137
+ | `publicKey` | `string` | ✅ | Your Busha public key |
138
+ | `side` | `'buy' \| 'sell'` | ✅ | Transaction type |
139
+ | `onSuccess` | `function` | ❌ | Callback when transaction succeeds |
140
+ | `onClose` | `function` | ❌ | Callback when widget closes |
141
+ | `onError` | `function` | ❌ | Callback when an error occurs |
142
+ | `amount` | `number` | ❌ | Pre-filled amount |
143
+ | `currency` | `string` | ❌ | Default currency (e.g., 'USD') |
144
+ | `cryptoCurrency` | `string` | ❌ | Default crypto currency (e.g., 'BTC') |
145
+
146
+ ### Methods
147
+
148
+ | Method | Description |
149
+ |--------|-------------|
150
+ | `show()` | Display the widget |
151
+ | `close()` | Close the widget and trigger onClose callback |
152
+
153
+ ## 🔧 Development
154
+
155
+ ### Prerequisites
156
+
157
+ - Node.js 18+
158
+ - Yarn or npm
159
+
160
+ ### Setup
161
+
162
+ ```bash
163
+ # Clone the repository
164
+ git clone https://github.com/busha-labs/busha-ramp-web-sdk.git
165
+ cd busha-ramp-web-sdk
166
+
167
+ # Install dependencies
168
+ yarn install
169
+
170
+ # Start development server
171
+ yarn dev
172
+
173
+ # Run tests
174
+ yarn test
175
+
176
+ # Build for production
177
+ yarn build
178
+ ```
179
+
180
+ ### Testing
181
+
182
+ ```bash
183
+ # Run tests
184
+ yarn test
185
+
186
+ # Run tests in watch mode
187
+ yarn test:watch
188
+
189
+ # Run tests with UI
190
+ yarn test:ui
191
+ ```
192
+
193
+ ## 🚀 Releasing
194
+
195
+ ### Automated Release
196
+
197
+ ```bash
198
+ # Patch release (bug fixes)
199
+ ./scripts/release.sh patch
200
+
201
+ # Minor release (new features)
202
+ ./scripts/release.sh minor
203
+
204
+ # Major release (breaking changes)
205
+ ./scripts/release.sh major
206
+ ```
207
+
208
+ ### Manual Release
209
+
210
+ ```bash
211
+ # Update version in package.json
212
+ # Create and push tag
213
+ git tag v1.0.0
214
+ git push origin v1.0.0
215
+ ```
216
+
217
+ The GitHub Actions workflow will automatically:
218
+ 1. Run tests
219
+ 2. Build the package
220
+ 3. Publish to npm
221
+
222
+ ## 📄 License
223
+
224
+ MIT License - see [LICENSE](LICENSE) file for details.
225
+
226
+ ## 🤝 Contributing
227
+
228
+ 1. Fork the repository
229
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
230
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
231
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
232
+ 5. Open a Pull Request
233
+
234
+ ## 📞 Support
235
+
236
+ - **Documentation**: [https://docs.busha.co](https://docs.busha.co)
237
+ - **Issues**: [GitHub Issues](https://github.com/busha-labs/busha-ramp-web-sdk/issues)
238
+ - **Email**: support@busha.co
239
+
240
+ ## 🔗 Links
241
+
242
+ - [Busha Website](https://busha.co)
243
+ - [API Documentation](https://docs.busha.co)
244
+ - [npm Package](https://www.npmjs.com/package/@busha/ramp-web-sdk)
Binary file