hey-pharmacist-ecommerce 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.
Files changed (2) hide show
  1. package/README.md +47 -214
  2. package/package.json +8 -8
package/README.md CHANGED
@@ -1,71 +1,61 @@
1
- # Multi-Tenant E-commerce Package
1
+ # Hey Pharmacist E-commerce Package
2
2
 
3
- A reusable, customizable e-commerce package for Next.js with dynamic theming, built for multi-tenant applications.
3
+ A multi-tenant e-commerce package for Next.js applications with stunning design and full functionality.
4
4
 
5
5
  ## Features
6
6
 
7
- - 🎨 **Dynamic Theming** - Customize colors, logos, and store name per deployment
8
- - 🏪 **Multi-Tenant** - Automatic store ID injection in all API calls
9
- - 🛍️ **Complete E-commerce** - Products, cart, checkout, orders, user accounts
10
- - 💳 **Stripe Integration** - Secure checkout with Stripe payment links
11
- - 🔐 **Authentication** - JWT-based auth with token refresh
12
- - 📱 **Responsive Design** - Beautiful UI that works on all devices
13
- - ⚡ **Performance** - Built with Next.js 14, React 18, and Tailwind CSS
14
- - 🎭 **Animations** - Smooth transitions with Framer Motion
7
+ - 🛒 **Complete E-commerce Flow**: Shop, cart, checkout, orders
8
+ - 🎨 **Stunning Design**: Modern UI with smooth animations
9
+ - 🔐 **Authentication**: Login, register, profile management
10
+ - 💳 **Stripe Integration**: Secure payment processing
11
+ - 🏪 **Multi-tenant**: Single package, multiple stores
12
+ - 📱 **Responsive**: Works on all devices
13
+ - ⚡ **Fast**: Optimized for performance
15
14
 
16
15
  ## Installation
17
16
 
18
17
  ```bash
19
- npm install @hey-pharmacist/ecommerce
20
- ```
21
-
22
- ### Peer Dependencies
23
-
24
- Make sure you have these installed in your project:
25
-
26
- ```bash
27
- npm install react@^18.0.0 react-dom@^18.0.0 next@^14.0.0
18
+ npm install hey-pharmacist-ecommerce react-hook-form @hookform/resolvers
28
19
  ```
29
20
 
30
21
  ## Quick Start
31
22
 
32
- ### 1. Create Configuration
23
+ ### 1. Configure Your Store
33
24
 
34
- Create a configuration file for your store:
25
+ Create a config file for your store:
35
26
 
36
27
  ```typescript
37
28
  // ecommerce.config.ts
38
- import { EcommerceConfig } from '@hey-pharmacist/ecommerce';
39
-
40
- export const config: EcommerceConfig = {
41
- storeId: 'your-store-id',
42
- storeName: 'Your Store Name',
43
- logo: '/logo.png',
29
+ export const ecommerceConfig = {
30
+ storeId: "your-store-id",
31
+ storeName: "Your Store Name",
32
+ logo: "/path/to/logo.png",
44
33
  colors: {
45
- primary: '#3B82F6', // Blue
46
- secondary: '#8B5CF6', // Purple
47
- accent: '#10B981', // Green
34
+ primary: "#3B82F6",
35
+ secondary: "#1E40AF",
36
+ accent: "#F59E0B",
48
37
  },
49
- apiBaseUrl: 'https://api.yourbackend.com',
50
- stripePublicKey: 'pk_test_...',
38
+ apiBaseUrl: "https://your-api.com",
39
+ stripePublicKey: "pk_test_...",
51
40
  };
52
41
  ```
53
42
 
54
43
  ### 2. Wrap Your App
55
44
 
56
- In your root layout or `_app.tsx`:
57
-
58
- ```typescript
59
- // app/layout.tsx (App Router)
60
- import { EcommerceProvider } from '@hey-pharmacist/ecommerce';
61
- import { config } from './ecommerce.config';
62
- import '@hey-pharmacist/ecommerce/styles/globals.css';
45
+ ```tsx
46
+ // app/layout.tsx
47
+ import { EcommerceProvider } from 'hey-pharmacist-ecommerce';
48
+ import { ecommerceConfig } from './ecommerce.config';
63
49
 
64
- export default function RootLayout({ children }) {
50
+ export default function RootLayout({
51
+ children,
52
+ }: {
53
+ children: React.ReactNode;
54
+ }) {
65
55
  return (
66
56
  <html lang="en">
67
57
  <body>
68
- <EcommerceProvider config={config}>
58
+ <EcommerceProvider config={ecommerceConfig}>
69
59
  {children}
70
60
  </EcommerceProvider>
71
61
  </body>
@@ -74,11 +64,11 @@ export default function RootLayout({ children }) {
74
64
  }
75
65
  ```
76
66
 
77
- ### 3. Use Screens in Your Pages
67
+ ### 3. Use the Screens
78
68
 
79
- ```typescript
69
+ ```tsx
80
70
  // app/shop/page.tsx
81
- import { ShopScreen } from '@hey-pharmacist/ecommerce';
71
+ import { ShopScreen } from 'hey-pharmacist-ecommerce';
82
72
 
83
73
  export default function ShopPage() {
84
74
  return <ShopScreen />;
@@ -87,183 +77,26 @@ export default function ShopPage() {
87
77
 
88
78
  ## Available Screens
89
79
 
90
- All screens are ready-to-use React components:
91
-
92
- - `<ShopScreen />` - Product listing with filters and search
93
- - `<ProductDetailScreen productId={id} />` - Product details and add to cart
94
- - `<CartScreen />` - Shopping cart management
95
- - `<CheckoutScreen />` - Checkout form with Stripe integration
80
+ - `<ShopScreen />` - Product listing with filters
81
+ - `<ProductDetailScreen />` - Individual product page
82
+ - `<CartScreen />` - Shopping cart
83
+ - `<CheckoutScreen />` - Checkout flow
96
84
  - `<LoginScreen />` - User login
97
85
  - `<RegisterScreen />` - User registration
98
- - `<ProfileScreen />` - User profile management
86
+ - `<ProfileScreen />` - User profile
99
87
  - `<OrdersScreen />` - Order history
100
- - `<CurrentOrdersScreen />` - Active orders tracking
101
-
102
- ## Components
103
-
104
- Reusable components for custom pages:
105
-
106
- ```typescript
107
- import {
108
- Header,
109
- Footer,
110
- ProductCard,
111
- CartItem,
112
- OrderCard,
113
- Button,
114
- Input,
115
- Badge,
116
- Modal,
117
- } from '@hey-pharmacist/ecommerce';
118
- ```
119
-
120
- ## Hooks
121
-
122
- Custom hooks for data fetching:
123
-
124
- ```typescript
125
- import {
126
- useAuth,
127
- useCart,
128
- useProducts,
129
- useProduct,
130
- useFeaturedProducts,
131
- useCategories,
132
- useOrders,
133
- useCurrentOrders,
134
- } from '@hey-pharmacist/ecommerce';
135
-
136
- function MyComponent() {
137
- const { user, login, logout } = useAuth();
138
- const { cart, addToCart, removeFromCart } = useCart();
139
- const { products, isLoading } = useProducts();
140
-
141
- // ... your component logic
142
- }
143
- ```
144
-
145
- ## API Integration
146
-
147
- The package automatically handles:
148
- - Store ID injection in all requests
149
- - Authentication tokens
150
- - Token refresh
151
- - Error handling
152
-
153
- ### Expected Backend Endpoints
154
-
155
- Your backend should implement these endpoints:
156
-
157
- **Products**
158
- - `GET /products` - List products (with pagination, filters)
159
- - `GET /products/:id` - Get product details
160
- - `GET /products/featured` - Get featured products
161
- - `GET /categories` - List categories
162
-
163
- **Cart**
164
- - `GET /cart` - Get user's cart
165
- - `POST /cart/items` - Add item to cart
166
- - `PUT /cart/items/:productId` - Update item quantity
167
- - `DELETE /cart/items/:productId` - Remove item from cart
168
-
169
- **Orders**
170
- - `GET /orders` - List user's orders
171
- - `GET /orders/current` - Get active orders
172
- - `GET /orders/:id` - Get order details
173
- - `POST /orders` - Create new order (returns Stripe checkout URL)
174
-
175
- **Auth**
176
- - `POST /auth/register` - Register new user
177
- - `POST /auth/login` - Login user
178
- - `GET /auth/me` - Get current user
179
- - `PUT /auth/profile` - Update profile
180
- - `POST /auth/logout` - Logout
181
-
182
- All requests include:
183
- - Header: `X-Store-Id: your-store-id`
184
- - Header: `Authorization: Bearer <token>` (when authenticated)
88
+ - `<CurrentOrdersScreen />` - Active orders
185
89
 
186
- ## Styling
90
+ ## Customization
187
91
 
188
- The package uses Tailwind CSS with CSS variables for dynamic theming. Include the styles:
92
+ The package uses CSS variables for theming. Your colors are automatically applied throughout the interface.
189
93
 
190
- ```typescript
191
- import '@hey-pharmacist/ecommerce/styles/globals.css';
192
- ```
193
-
194
- ### Customize Tailwind
195
-
196
- Extend the default Tailwind config if needed:
197
-
198
- ```javascript
199
- // tailwind.config.js
200
- module.exports = {
201
- content: [
202
- './app/**/*.{js,ts,jsx,tsx}',
203
- './node_modules/@hey-pharmacist/ecommerce/**/*.{js,ts,jsx,tsx}',
204
- ],
205
- // ... your config
206
- };
207
- ```
208
-
209
- ## Example Routes
94
+ ## Requirements
210
95
 
211
- Here's a complete routing setup:
212
-
213
- ```
214
- /shop → <ShopScreen />
215
- /products/[id] → <ProductDetailScreen productId={id} />
216
- /cart → <CartScreen />
217
- /checkout → <CheckoutScreen />
218
- /login → <LoginScreen />
219
- /register → <RegisterScreen />
220
- /account → <ProfileScreen />
221
- /orders → <OrdersScreen />
222
- /orders/current → <CurrentOrdersScreen />
223
- ```
224
-
225
- ## TypeScript Support
226
-
227
- Full TypeScript support with exported types:
228
-
229
- ```typescript
230
- import type {
231
- EcommerceConfig,
232
- Product,
233
- Cart,
234
- Order,
235
- User,
236
- } from '@hey-pharmacist/ecommerce';
237
- ```
238
-
239
- ## Advanced Usage
240
-
241
- ### Custom API Client
242
-
243
- If you need to make custom API calls:
244
-
245
- ```typescript
246
- import { getApiClient } from '@hey-pharmacist/ecommerce';
247
-
248
- const apiClient = getApiClient();
249
- const response = await apiClient.get('/custom-endpoint');
250
- ```
251
-
252
- ### Direct API Access
253
-
254
- ```typescript
255
- import { productsApi, authApi, cartApi, ordersApi } from '@hey-pharmacist/ecommerce';
256
-
257
- // Use API methods directly
258
- const products = await productsApi.getProducts({ category: 'electronics' });
259
- const order = await ordersApi.getOrder('order-id');
260
- ```
96
+ - React 18+
97
+ - Next.js 14+
98
+ - react-hook-form 7+
261
99
 
262
100
  ## License
263
101
 
264
- MIT
265
-
266
- ## Support
267
-
268
- For issues and questions, please open an issue on GitHub.
269
-
102
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hey-pharmacist-ecommerce",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Multi-tenant e-commerce package for Next.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -16,13 +16,9 @@
16
16
  "type-check": "tsc --noEmit"
17
17
  },
18
18
  "dependencies": {
19
- "react": "^18.2.0",
20
- "react-dom": "^18.2.0",
21
- "next": "^14.0.0",
22
19
  "axios": "^1.6.0",
23
20
  "framer-motion": "^10.16.0",
24
21
  "lucide-react": "^0.294.0",
25
- "react-hook-form": "^7.48.0",
26
22
  "zod": "^3.22.0",
27
23
  "@hookform/resolvers": "^3.3.0",
28
24
  "sonner": "^1.2.0",
@@ -39,12 +35,17 @@
39
35
  "autoprefixer": "^10.4.0",
40
36
  "tsup": "^8.0.0",
41
37
  "eslint": "^8.0.0",
42
- "eslint-config-next": "^14.0.0"
38
+ "eslint-config-next": "^14.0.0",
39
+ "react": "^18.2.0",
40
+ "react-dom": "^18.2.0",
41
+ "next": "^14.0.0",
42
+ "react-hook-form": "^7.48.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^18.0.0",
46
46
  "react-dom": "^18.0.0",
47
- "next": "^14.0.0"
47
+ "next": "^14.0.0",
48
+ "react-hook-form": "^7.0.0"
48
49
  },
49
50
  "keywords": [
50
51
  "ecommerce",
@@ -67,4 +68,3 @@
67
68
  },
68
69
  "homepage": "https://github.com/yourusername/hey-pharmacist-customer#readme"
69
70
  }
70
-