hey-pharmacist-ecommerce 1.0.4 → 1.0.6
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 +107 -1
- package/dist/index.d.mts +3636 -316
- package/dist/index.d.ts +3636 -316
- package/dist/index.js +6802 -3865
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6756 -3817
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -14
- package/src/components/AddressFormModal.tsx +171 -0
- package/src/components/CartItem.tsx +17 -12
- package/src/components/FilterChips.tsx +195 -0
- package/src/components/Header.tsx +121 -71
- package/src/components/OrderCard.tsx +18 -25
- package/src/components/ProductCard.tsx +209 -72
- package/src/components/ui/Button.tsx +13 -5
- package/src/components/ui/Card.tsx +46 -0
- package/src/hooks/useAddresses.ts +83 -0
- package/src/hooks/useOrders.ts +37 -19
- package/src/hooks/useProducts.ts +55 -63
- package/src/hooks/useWishlistProducts.ts +75 -0
- package/src/index.ts +3 -19
- package/src/lib/Apis/api.ts +1 -0
- package/src/lib/Apis/apis/cart-api.ts +3 -3
- package/src/lib/Apis/apis/inventory-api.ts +0 -108
- package/src/lib/Apis/apis/stores-api.ts +70 -0
- package/src/lib/Apis/apis/wishlist-api.ts +447 -0
- package/src/lib/Apis/models/cart-item-populated.ts +0 -1
- package/src/lib/Apis/models/create-single-variant-product-dto.ts +3 -10
- package/src/lib/Apis/models/create-variant-dto.ts +26 -33
- package/src/lib/Apis/models/extended-product-dto.ts +20 -24
- package/src/lib/Apis/models/index.ts +2 -1
- package/src/lib/Apis/models/order-time-line-dto.ts +49 -0
- package/src/lib/Apis/models/order.ts +3 -8
- package/src/lib/Apis/models/populated-order.ts +3 -8
- package/src/lib/Apis/models/product-variant.ts +29 -0
- package/src/lib/Apis/models/update-product-variant-dto.ts +16 -23
- package/src/lib/Apis/models/wishlist.ts +51 -0
- package/src/lib/Apis/wrapper.ts +18 -7
- package/src/lib/api-adapter/index.ts +0 -12
- package/src/lib/types/index.ts +16 -61
- package/src/lib/utils/colors.ts +7 -4
- package/src/lib/utils/format.ts +1 -1
- package/src/lib/validations/address.ts +14 -0
- package/src/providers/AuthProvider.tsx +61 -31
- package/src/providers/CartProvider.tsx +18 -28
- package/src/providers/EcommerceProvider.tsx +7 -0
- package/src/providers/FavoritesProvider.tsx +86 -0
- package/src/providers/ThemeProvider.tsx +16 -1
- package/src/providers/WishlistProvider.tsx +174 -0
- package/src/screens/AddressesScreen.tsx +484 -0
- package/src/screens/CartScreen.tsx +120 -84
- package/src/screens/CategoriesScreen.tsx +120 -0
- package/src/screens/CheckoutScreen.tsx +919 -241
- package/src/screens/CurrentOrdersScreen.tsx +125 -61
- package/src/screens/HomeScreen.tsx +209 -0
- package/src/screens/LoginScreen.tsx +133 -88
- package/src/screens/NewAddressScreen.tsx +187 -0
- package/src/screens/OrdersScreen.tsx +162 -50
- package/src/screens/ProductDetailScreen.tsx +641 -190
- package/src/screens/ProfileScreen.tsx +192 -116
- package/src/screens/RegisterScreen.tsx +193 -144
- package/src/screens/SearchResultsScreen.tsx +165 -0
- package/src/screens/ShopScreen.tsx +1110 -146
- package/src/screens/WishlistScreen.tsx +428 -0
- package/src/lib/Apis/models/inventory-paginated-response.ts +0 -75
- package/src/lib/api/auth.ts +0 -81
- package/src/lib/api/cart.ts +0 -42
- package/src/lib/api/orders.ts +0 -53
- package/src/lib/api/products.ts +0 -51
- package/src/lib/api-adapter/auth-adapter.ts +0 -196
- package/src/lib/api-adapter/cart-adapter.ts +0 -193
- package/src/lib/api-adapter/mappers.ts +0 -147
- package/src/lib/api-adapter/orders-adapter.ts +0 -195
- package/src/lib/api-adapter/products-adapter.ts +0 -194
package/README.md
CHANGED
|
@@ -97,6 +97,112 @@ The package uses CSS variables for theming. Your colors are automatically applie
|
|
|
97
97
|
- Next.js 14+
|
|
98
98
|
- react-hook-form 7+
|
|
99
99
|
|
|
100
|
+
## Local Development & Testing
|
|
101
|
+
|
|
102
|
+
### Testing Locally Before Publishing
|
|
103
|
+
|
|
104
|
+
You can test the package locally in your frontend project using npm link:
|
|
105
|
+
|
|
106
|
+
#### Step 1: Build and Link the Package
|
|
107
|
+
|
|
108
|
+
In this package directory:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Build the package
|
|
112
|
+
npm run build
|
|
113
|
+
|
|
114
|
+
# Create a global symlink
|
|
115
|
+
npm link
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For active development with auto-rebuild:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Watch mode - rebuilds on file changes
|
|
122
|
+
npm run build:watch
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### Step 2: Link in Your Frontend Project
|
|
126
|
+
|
|
127
|
+
In your frontend project directory:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Link to the local package
|
|
131
|
+
npm link hey-pharmacist-ecommerce
|
|
132
|
+
|
|
133
|
+
# Install peer dependencies if not already installed
|
|
134
|
+
npm install react react-dom next react-hook-form @hookform/resolvers
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Step 3: Use the Package
|
|
138
|
+
|
|
139
|
+
Now you can use the package in your frontend as if it were installed from npm:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
// app/ecommerce.config.ts
|
|
143
|
+
import { EcommerceConfig } from 'hey-pharmacist-ecommerce';
|
|
144
|
+
|
|
145
|
+
export const config: EcommerceConfig = {
|
|
146
|
+
storeId: '68e3b34ca07948e882f9418f',
|
|
147
|
+
storeName: 'Briarmill Pharmacy',
|
|
148
|
+
logo: '/logo.png',
|
|
149
|
+
colors: {
|
|
150
|
+
primary: '#EF821F',
|
|
151
|
+
secondary: '#8B5CF6',
|
|
152
|
+
accent: '#10B981',
|
|
153
|
+
},
|
|
154
|
+
apiBaseUrl: 'https://api.heypharmacist.com',
|
|
155
|
+
stripePublicKey: 'pk_test_...',
|
|
156
|
+
};
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
// app/layout.tsx
|
|
161
|
+
import { EcommerceProvider } from 'hey-pharmacist-ecommerce';
|
|
162
|
+
import { config } from './ecommerce.config';
|
|
163
|
+
|
|
164
|
+
export default function RootLayout({ children }) {
|
|
165
|
+
return (
|
|
166
|
+
<html lang="en">
|
|
167
|
+
<body>
|
|
168
|
+
<EcommerceProvider config={config}>
|
|
169
|
+
{children}
|
|
170
|
+
</EcommerceProvider>
|
|
171
|
+
</body>
|
|
172
|
+
</html>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Step 4: Test Your Changes
|
|
178
|
+
|
|
179
|
+
Make changes to the package source code, and:
|
|
180
|
+
- If using `npm run build:watch`, changes rebuild automatically
|
|
181
|
+
- If not, run `npm run build` after each change
|
|
182
|
+
- Refresh your frontend to see the changes
|
|
183
|
+
|
|
184
|
+
#### Step 5: Unlink When Done
|
|
185
|
+
|
|
186
|
+
When you're ready to use the published version:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# In your frontend project
|
|
190
|
+
npm unlink hey-pharmacist-ecommerce
|
|
191
|
+
npm install hey-pharmacist-ecommerce@latest
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Publishing to npm
|
|
195
|
+
|
|
196
|
+
When everything works as expected:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Update version (will auto-build before publish)
|
|
200
|
+
npm version patch # or minor, or major
|
|
201
|
+
|
|
202
|
+
# Publish to npm
|
|
203
|
+
npm publish
|
|
204
|
+
```
|
|
205
|
+
|
|
100
206
|
## License
|
|
101
207
|
|
|
102
|
-
MIT
|
|
208
|
+
MIT# hey-pharmacist-customer
|