@longvansoftware/storefront-js-client
v3.8.6
Published
[](https://badge.fury.io/js/%40longvansoftware%2Fstorefront-js-client) [](http://www.typesc
Downloads
1,297
Readme
Longvan Storefront JavaScript Client SDK
A comprehensive TypeScript/JavaScript SDK for integrating with the Longvan e-commerce platform. This SDK provides easy-to-use interfaces for managing products, orders, users, payments, and other e-commerce functionalities.
🚀 Quick Start
npm install @longvansoftware/storefront-js-clientimport { SDK } from '@longvansoftware/storefront-js-client';
const sdk = new SDK('your-org-id', 'your-store-id', 'dev');
sdk.setToken('your-access-token');
// Ready to use!
const products = await sdk.product.getSimpleProducts({ currentPage: 1, maxResult: 10 });📚 Documentation
🎯 Getting Started
- Installation & Setup - Complete installation guide
- Quick Start Guide - Get running in 5 minutes
- Configuration - Environment and SDK configuration
- Authentication - Authentication setup and patterns
🔧 Core Services
- Authentication Service - User authentication and authorization
- Product Service - Product catalog management
- Order Service - Order lifecycle management
- User Service - Customer and user management
- Payment Service - Payment processing and invoicing
- CRM Service - Customer relationship management
🛠️ Extended Services
- Warehouse Service - Inventory management
- Computing Service - Cloud computing services
- Campaign Service - Marketing campaigns
- Image Service - Image and media management
- Upload Service - File upload handling
📖 Advanced Topics
- Error Handling - Robust error handling patterns
- TypeScript Support - Full TypeScript integration
- Testing - Testing your integration
- Performance - Optimization and best practices
💡 Examples & Patterns
- E-commerce Flow - Complete workflow examples
- Authentication Patterns - Auth implementation patterns
- Product Management - Product handling examples
- Order Processing - Order workflow examples
🔍 API Reference
- Complete API Reference - Full API documentation
- Type Definitions - TypeScript type definitions
- Interfaces - Interface specifications
🏗️ Architecture Overview
Longvan SDK
├── 🔐 Authentication Layer
├── 🛍️ Core E-commerce Services
│ ├── Product Management
│ ├── Order Processing
│ ├── User Management
│ └── Payment Processing
├── 🔧 Extended Services
│ ├── Warehouse & Inventory
│ ├── CRM & Customer Support
│ ├── Marketing & Campaigns
│ └── Media & File Management
└── 🚀 Infrastructure
├── GraphQL Client
├── REST API Client
├── Error Handling
└── TypeScript Support✨ Key Features
- 🎯 Type-Safe: Full TypeScript support with comprehensive type definitions
- 🔌 Multi-Protocol: Supports both GraphQL and REST APIs
- 🔐 Secure: Built-in authentication and token management
- ⚡ Performance: Optimized for speed with caching and batching
- 🛠️ Developer-Friendly: Intuitive API design with excellent IntelliSense
- 📱 Cross-Platform: Works in Node.js, browsers, and React Native
- 🧪 Well-Tested: Comprehensive test suite with high coverage
- 📖 Well-Documented: Extensive documentation with real-world examples
🚀 Installation
Using npm
npm install @longvansoftware/storefront-js-clientUsing yarn
yarn add @longvansoftware/storefront-js-clientUsing pnpm
pnpm add @longvansoftware/storefront-js-client⚡ Quick Example
import { SDK } from '@longvansoftware/storefront-js-client';
// Initialize SDK
const sdk = new SDK('your-org-id', 'your-store-id', 'dev');
// Authenticate user
const loginResponse = await sdk.auth.login({
username: '[email protected]',
password: 'password123'
});
sdk.setToken(loginResponse.accessToken);
// Browse products
const products = await sdk.product.getSimpleProducts({
keyword: 'laptop',
currentPage: 1,
maxResult: 20
});
// Create order
const order = await sdk.order.createOrder({
customer_id: loginResponse.partyId,
line_items: [{
product_id: products[0].id,
quantity: 1,
input_price: products[0].price
}]
}, 'web', false, loginResponse.partyId);
console.log('Order created:', order.id);
// Manage stores
const newStore = await sdk.store.createStore('FOX', 'My New Store');
const channels = await sdk.store.getStoreChannelByEmpId('emp-123');📦 TypeScript Support
Import types for full TypeScript support:
// Import specific types
import type {
Product,
ProductFilterOptions,
} from '@longvansoftware/storefront-js-client/dist/src/types/product';
import type {
StoreDTO,
CreateStoreRequest,
StoreConfiguration,
} from '@longvansoftware/storefront-js-client/dist/src/types/store';
import type {
LoginRequest,
LoginResponse,
} from '@longvansoftware/storefront-js-client/dist/src/types/auth';
// Use with full type safety
const products: Product[] = await sdk.product.getSimpleProducts({
keyword: 'laptop',
currentPage: 1,
maxResult: 10
});
const stores: StoreDTO[] = await sdk.store.getStoreChannelByEmpId('emp-123');🌟 What's New in v2.9.0
- ✨ Enhanced TypeScript support with stricter types
- 🚀 Improved error handling and debugging capabilities
- 🔧 New utility services for better platform integration
- ⚡ Performance optimizations and caching improvements
- 🔒 Updated dependencies and security enhancements
- 📖 Comprehensive documentation with real-world examples
🤝 Community & Support
- 📖 Documentation: Complete Documentation
- 🐛 Issues: GitLab Issues
- 💬 Discussions: GitLab Discussions
- 📧 Support: Contact the Longvan development team
🚀 Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- 🔧 Setting up the development environment
- 📝 Code style and conventions
- 🧪 Running tests and quality checks
- 📤 Submitting pull requests
📄 License
This project is licensed under the ISC License - see the LICENSE file for details.
Ready to get started?
Need help? Open an issue on GitLab or check our documentation.
