@attabot/product-app 1.0.0
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 +132 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Product App
|
|
2
|
+
|
|
3
|
+
A React component library for managing and displaying products with API integration. This package provides a complete product management interface with filtering, search, and product details functionality.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install product-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
Make sure you have React and React DOM installed in your project:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install react react-dom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Basic Usage
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
import React from 'react';
|
|
25
|
+
import ProductApp from 'product-app';
|
|
26
|
+
import 'product-app/style.css';
|
|
27
|
+
|
|
28
|
+
function App() {
|
|
29
|
+
return (
|
|
30
|
+
<ProductApp
|
|
31
|
+
apiUrl={import.meta.env.VITE_API_URL} // or process.env.VITE_API_URL
|
|
32
|
+
authToken="YOUR_BEARER_TOKEN" // optional
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default App;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With Base Path
|
|
41
|
+
|
|
42
|
+
If you need to mount the app at a specific base path:
|
|
43
|
+
|
|
44
|
+
```jsx
|
|
45
|
+
import React from 'react';
|
|
46
|
+
import ProductApp from 'product-app';
|
|
47
|
+
import 'product-app/style.css';
|
|
48
|
+
|
|
49
|
+
function App() {
|
|
50
|
+
return (
|
|
51
|
+
<ProductApp
|
|
52
|
+
apiUrl="https://your-api-url.com/api"
|
|
53
|
+
basePath="/products"
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default App;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Props
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Required | Default | Description |
|
|
64
|
+
|------|------|----------|---------|-------------|
|
|
65
|
+
| `apiUrl` | `string` | Yes | `import.meta.env.VITE_API_URL` or `process.env.VITE_API_URL` if provided | The base API URL for all API calls |
|
|
66
|
+
| `authToken` | `string` | No | - | Optional bearer token to pre-seed auth |
|
|
67
|
+
| `basePath` | `string` | No | `'/'` | Base path for routing |
|
|
68
|
+
| `theme` | `object` | No | - | Theme configuration (coming soon) |
|
|
69
|
+
|
|
70
|
+
## API Requirements
|
|
71
|
+
|
|
72
|
+
The package expects your API to have the following endpoint:
|
|
73
|
+
|
|
74
|
+
- `GET /products` - Returns a list of products
|
|
75
|
+
|
|
76
|
+
### Expected Product Data Structure
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"id": 1,
|
|
81
|
+
"name": "Product Name",
|
|
82
|
+
"category": "Category Name",
|
|
83
|
+
"price": 100,
|
|
84
|
+
"originalPrice": 120,
|
|
85
|
+
"stock": 50,
|
|
86
|
+
"maxStock": 100,
|
|
87
|
+
"status": "Active",
|
|
88
|
+
"image": "image-url",
|
|
89
|
+
"offer": "Special offer text",
|
|
90
|
+
"sku": "SKU: 123456"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Authentication
|
|
95
|
+
|
|
96
|
+
The package uses cookies for authentication:
|
|
97
|
+
- `token` - Access token (Bearer token)
|
|
98
|
+
- `refreshToken` - Refresh token for token renewal
|
|
99
|
+
|
|
100
|
+
Make sure your API supports token refresh at:
|
|
101
|
+
- `POST /api/v1/auth/refresh`
|
|
102
|
+
|
|
103
|
+
## Features
|
|
104
|
+
|
|
105
|
+
- ✅ Product listing with grid view
|
|
106
|
+
- ✅ Product filtering by category and status
|
|
107
|
+
- ✅ Search functionality
|
|
108
|
+
- ✅ Product details page
|
|
109
|
+
- ✅ Bulk selection
|
|
110
|
+
- ✅ Redux state management
|
|
111
|
+
- ✅ Token refresh handling
|
|
112
|
+
- ✅ Responsive design
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Install dependencies
|
|
118
|
+
npm install
|
|
119
|
+
|
|
120
|
+
# Run development server
|
|
121
|
+
npm run dev
|
|
122
|
+
|
|
123
|
+
# Build for production
|
|
124
|
+
npm run build
|
|
125
|
+
|
|
126
|
+
# Preview production build
|
|
127
|
+
npm run preview
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@attabot/product-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A React component library for managing and displaying products with API integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/product-app.umd.js",
|
|
7
|
+
"module": "./dist/product-app.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/product-app.js",
|
|
13
|
+
"require": "./dist/product-app.umd.js"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./dist/style.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "vite build",
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"preview": "vite preview"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"react",
|
|
29
|
+
"product",
|
|
30
|
+
"component",
|
|
31
|
+
"library",
|
|
32
|
+
"redux",
|
|
33
|
+
"mui"
|
|
34
|
+
],
|
|
35
|
+
"author": "",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@emotion/react": "^11.14.0",
|
|
43
|
+
"@emotion/styled": "^11.14.1",
|
|
44
|
+
"@heroicons/react": "^2.2.0",
|
|
45
|
+
"@mui/material": "^7.3.6",
|
|
46
|
+
"@reduxjs/toolkit": "^2.11.1",
|
|
47
|
+
"axios": "^1.13.2",
|
|
48
|
+
"js-cookie": "^3.0.5",
|
|
49
|
+
"lucide-react": "^0.556.0",
|
|
50
|
+
"react-feather": "^2.0.10",
|
|
51
|
+
"react-icons": "^5.5.0",
|
|
52
|
+
"react-redux": "^9.2.0",
|
|
53
|
+
"react-router-dom": "^6.30.2",
|
|
54
|
+
"redux-persist": "^6.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint/js": "^9.39.1",
|
|
58
|
+
"@types/react": "^19.2.5",
|
|
59
|
+
"@types/react-dom": "^19.2.3",
|
|
60
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
61
|
+
"eslint": "^9.39.1",
|
|
62
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
63
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
64
|
+
"globals": "^16.5.0",
|
|
65
|
+
"vite": "^7.2.4",
|
|
66
|
+
"vite-plugin-dts": "^4.3.0"
|
|
67
|
+
}
|
|
68
|
+
}
|