merchi_sdk_js 0.0.60 → 0.0.61
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 +116 -0
- package/package.json +1 -1
- package/src/merchi.js +1 -1
package/README.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
# Merchi SDK JavaScript
|
2
|
+
|
3
|
+
A comprehensive JavaScript SDK for interacting with the Merchi platform API. This SDK provides a robust interface for managing products, orders, users, and other Merchi platform features.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm install merchi_sdk_js
|
9
|
+
# or
|
10
|
+
yarn add merchi_sdk_js
|
11
|
+
```
|
12
|
+
|
13
|
+
## Quick Start
|
14
|
+
|
15
|
+
```javascript
|
16
|
+
import { merchi } from 'merchi_sdk_js';
|
17
|
+
|
18
|
+
// Initialize the SDK with your backend and websocket URIs
|
19
|
+
const merchiClient = merchi('https://your-backend-uri.com', 'wss://your-websocket-uri.com');
|
20
|
+
|
21
|
+
// Example: Get current user
|
22
|
+
merchiClient.getCurrentUser(
|
23
|
+
(status, data) => {
|
24
|
+
console.log('User data:', data);
|
25
|
+
},
|
26
|
+
(error) => {
|
27
|
+
console.error('Error:', error);
|
28
|
+
}
|
29
|
+
);
|
30
|
+
```
|
31
|
+
|
32
|
+
## Features
|
33
|
+
|
34
|
+
- **Authentication & User Management**
|
35
|
+
- User session management
|
36
|
+
- Token-based authentication
|
37
|
+
- User profile management
|
38
|
+
|
39
|
+
- **Product Management**
|
40
|
+
- Create and manage products
|
41
|
+
- Handle product variations
|
42
|
+
- Manage inventory
|
43
|
+
|
44
|
+
- **Order Processing**
|
45
|
+
- Create and manage orders
|
46
|
+
- Handle quotes
|
47
|
+
- Process payments
|
48
|
+
- Manage shipments
|
49
|
+
|
50
|
+
- **Company & Domain Management**
|
51
|
+
- Company profile management
|
52
|
+
- Domain settings
|
53
|
+
- User roles and permissions
|
54
|
+
|
55
|
+
- **Real-time Updates**
|
56
|
+
- WebSocket integration for real-time notifications
|
57
|
+
- Subscription management for live updates
|
58
|
+
|
59
|
+
## API Reference
|
60
|
+
|
61
|
+
### Core Functions
|
62
|
+
|
63
|
+
- `merchi(backendUri, websocketUri)` - Initialize the SDK
|
64
|
+
- `getCurrentUser(success, error, embed)` - Get current user information
|
65
|
+
- `initSessionByToken(tokenStringForUser, success, error, embed)` - Initialize session with token
|
66
|
+
|
67
|
+
### Entity Management
|
68
|
+
|
69
|
+
The SDK provides comprehensive entity management for:
|
70
|
+
- Products
|
71
|
+
- Orders
|
72
|
+
- Users
|
73
|
+
- Companies
|
74
|
+
- Domains
|
75
|
+
- Shipments
|
76
|
+
- Payments
|
77
|
+
- And more...
|
78
|
+
|
79
|
+
## Dependencies
|
80
|
+
|
81
|
+
- axios: ^0.27.2
|
82
|
+
- browser-or-node: ^2.1.1
|
83
|
+
- form-data: ^4.0.0
|
84
|
+
- moment-timezone: ^0.5.33
|
85
|
+
- uuid: ^8.3.2
|
86
|
+
|
87
|
+
## Development
|
88
|
+
|
89
|
+
### Building
|
90
|
+
|
91
|
+
```bash
|
92
|
+
# Install dependencies
|
93
|
+
npm install
|
94
|
+
|
95
|
+
# Build the library
|
96
|
+
npm run build
|
97
|
+
```
|
98
|
+
|
99
|
+
### Testing
|
100
|
+
|
101
|
+
```bash
|
102
|
+
# Run tests
|
103
|
+
npm test
|
104
|
+
```
|
105
|
+
|
106
|
+
## License
|
107
|
+
|
108
|
+
This project is licensed under the GPL-3.0-only License - see the LICENSE file for details.
|
109
|
+
|
110
|
+
## Support
|
111
|
+
|
112
|
+
For support, please contact Merchi support or open an issue in the repository.
|
113
|
+
|
114
|
+
## Contributing
|
115
|
+
|
116
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
package/package.json
CHANGED
package/src/merchi.js
CHANGED
@@ -585,7 +585,7 @@ export function merchi(backendUri, websocketUri) {
|
|
585
585
|
|
586
586
|
function getJobQuote(job, success, error) {
|
587
587
|
var request = new Request(),
|
588
|
-
data = serialise(job, null, null, null, {excludeOld: false});
|
588
|
+
data = serialise(job, null, null, null, {excludeOld: false})[0];
|
589
589
|
request.resource('/specialised-order-estimate/');
|
590
590
|
request.method('POST');
|
591
591
|
request.data().merge(data);
|