hey-pharmacist-ecommerce 1.1.43 → 1.1.44
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/dist/index.d.mts +2341 -888
- package/dist/index.d.ts +2341 -888
- package/dist/index.js +539 -393
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +538 -393
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/AccountReviewsTab.tsx +4 -4
- package/src/components/Header.tsx +1 -1
- package/src/components/OrderCard.tsx +1 -1
- package/src/components/ProductCard.tsx +1 -1
- package/src/components/RatingDistribution.tsx +2 -2
- package/src/components/ReviewForm.tsx +3 -3
- package/src/components/ReviewPromptBanner.tsx +4 -4
- package/src/components/ReviewsList.tsx +9 -11
- package/src/components/StarRating.tsx +3 -3
- package/src/hooks/useProducts.ts +0 -1
- package/src/hooks/useSmartSearch.ts +68 -0
- package/src/lib/Apis/api.ts +1 -0
- package/src/lib/Apis/apis/analytics-api.ts +809 -0
- package/src/lib/Apis/apis/notifications-api.ts +8 -6
- package/src/lib/Apis/apis/products-api.ts +390 -15
- package/src/lib/Apis/apis/stores-api.ts +26 -149
- package/src/lib/Apis/apis/web-hooks-api.ts +8 -17
- package/src/lib/Apis/models/analytics-period-dto.ts +45 -0
- package/src/lib/Apis/models/appointment-overview-dto.ts +71 -0
- package/src/lib/Apis/models/{api-key-info-dto.ts → category-sales-dto.ts} +24 -22
- package/src/lib/Apis/models/create-store-dto.ts +12 -0
- package/src/lib/Apis/models/customer-overview-dto.ts +96 -0
- package/src/lib/Apis/models/customer-segment-dto.ts +39 -0
- package/src/lib/Apis/models/dashboard-overview-dto.ts +70 -0
- package/src/lib/Apis/models/discount-overview-dto.ts +71 -0
- package/src/lib/Apis/models/index.ts +29 -3
- package/src/lib/Apis/models/inline-response200.ts +34 -0
- package/src/lib/Apis/models/{store-api-keys-response-dto.ts → inline-response2001.ts} +14 -9
- package/src/lib/Apis/models/inventory-alert-dto.ts +67 -0
- package/src/lib/Apis/models/notification-dto.ts +107 -0
- package/src/lib/Apis/models/notifications-paginated-response-dto.ts +58 -0
- package/src/lib/Apis/models/order-overview-dto.ts +89 -0
- package/src/lib/Apis/models/{update-api-keys-dto.ts → order-status-count-dto.ts} +13 -13
- package/src/lib/Apis/models/payout-history-item-dto.ts +45 -0
- package/src/lib/Apis/models/popular-time-slot-dto.ts +39 -0
- package/src/lib/Apis/models/product-overview-dto.ts +90 -0
- package/src/lib/Apis/models/product.ts +6 -0
- package/src/lib/Apis/models/products-aidraft-body.ts +27 -0
- package/src/lib/Apis/models/products-processimage-body.ts +27 -0
- package/src/lib/Apis/models/rating-distribution-dto.ts +39 -0
- package/src/lib/Apis/models/recent-review-dto.ts +63 -0
- package/src/lib/Apis/models/review-overview-dto.ts +65 -0
- package/src/lib/Apis/models/store-balance-dto.ts +39 -0
- package/src/lib/Apis/models/store-entity.ts +12 -0
- package/src/lib/Apis/models/store-finance-overview-dto.ts +35 -0
- package/src/lib/Apis/models/store.ts +12 -0
- package/src/lib/Apis/models/time-series-point-dto.ts +33 -0
- package/src/lib/Apis/models/top-customer-dto.ts +57 -0
- package/src/lib/Apis/models/top-discount-dto.ts +51 -0
- package/src/lib/Apis/models/top-product-dto.ts +51 -0
- package/src/lib/Apis/models/unread-count-dto.ts +27 -0
- package/src/lib/Apis/models/update-store-dto.ts +12 -0
- package/src/screens/OrderReviewsScreen.tsx +6 -6
- package/src/screens/ProductDetailScreen.tsx +1 -1
- package/src/screens/SearchResultsScreen.tsx +17 -21
- package/src/screens/ShopScreen.tsx +0 -62
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hey-pharmacist-ecommerce",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.44",
|
|
4
4
|
"description": "Production-ready, multi-tenant e‑commerce UI + API adapter for Next.js with auth, carts, checkout, orders, theming, and pharmacist-focused UX.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@ export function AccountReviewsTab() {
|
|
|
31
31
|
<p className="text-red-600 mb-4">Failed to load reviews</p>
|
|
32
32
|
<button
|
|
33
33
|
onClick={() => window.location.reload()}
|
|
34
|
-
className="text-
|
|
34
|
+
className="text-haccent-500 hover:underline text-sm"
|
|
35
35
|
>
|
|
36
36
|
Try again
|
|
37
37
|
</button>
|
|
@@ -44,8 +44,8 @@ export function AccountReviewsTab() {
|
|
|
44
44
|
return (
|
|
45
45
|
<div className="p-6">
|
|
46
46
|
<div className="text-center py-12">
|
|
47
|
-
<div className="size-16 rounded-full bg-
|
|
48
|
-
<Star className="size-8 text-
|
|
47
|
+
<div className="size-16 rounded-full bg-haccent-500/10 flex items-center justify-center mx-auto mb-4">
|
|
48
|
+
<Star className="size-8 text-haccent-500" />
|
|
49
49
|
</div>
|
|
50
50
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">
|
|
51
51
|
No reviews yet
|
|
@@ -55,7 +55,7 @@ export function AccountReviewsTab() {
|
|
|
55
55
|
</p>
|
|
56
56
|
<button
|
|
57
57
|
onClick={() => router.push(buildPath('/reviews'))}
|
|
58
|
-
className="inline-flex items-center gap-2 px-6 py-3 bg-
|
|
58
|
+
className="inline-flex items-center gap-2 px-6 py-3 bg-haccent-500 text-white rounded-lg font-medium hover:bg-[#d66f40] transition-colors"
|
|
59
59
|
>
|
|
60
60
|
<Star className="size-4" />
|
|
61
61
|
Write Your First Review
|
|
@@ -176,7 +176,7 @@ export function Header() {
|
|
|
176
176
|
<div className="absolute right-0 top-full mt-2 w-56 rounded-lg border border-slate-200 bg-white shadow-lg z-20">
|
|
177
177
|
<div className="p-2">
|
|
178
178
|
<div className="px-3 py-2 border-b border-slate-200 mb-1">
|
|
179
|
-
<p className="text-sm font-medium text-
|
|
179
|
+
<p className="text-sm font-medium text-hprimary-900 truncate">
|
|
180
180
|
{user?.firstname} {user?.lastname}
|
|
181
181
|
</p>
|
|
182
182
|
<p className="text-xs text-slate-500 truncate">{user?.email}</p>
|
|
@@ -179,7 +179,7 @@ export function OrderCard({ order, onDelete }: OrderCardProps) {
|
|
|
179
179
|
{isCompletedOrder && (
|
|
180
180
|
<button
|
|
181
181
|
onClick={handleReviewClick}
|
|
182
|
-
className="inline-flex items-center gap-2 rounded-lg border border-
|
|
182
|
+
className="inline-flex items-center gap-2 rounded-lg border border-haccent-500 bg-white hover:bg-haccent-500/5 text-haccent-500 px-4 py-2 text-sm transition-colors"
|
|
183
183
|
onPointerDown={(e) => e.stopPropagation()}
|
|
184
184
|
>
|
|
185
185
|
<Star className="w-4 h-4" />
|
|
@@ -232,7 +232,7 @@ export function ProductCard({
|
|
|
232
232
|
{/* ALL Status Badges */}
|
|
233
233
|
<div className="flex items-center gap-1 mb-2 flex-wrap">
|
|
234
234
|
{displayIsDiscounted && (
|
|
235
|
-
<span className="bg-
|
|
235
|
+
<span className="bg-haccent-500 text-white rounded-full px-2 py-0.5 flex items-center gap-1">
|
|
236
236
|
<span className="font-bold text-[8px] uppercase">-{displayDiscountAmount}%</span>
|
|
237
237
|
</span>
|
|
238
238
|
)}
|
|
@@ -55,12 +55,12 @@ export function RatingDistribution({ reviews, averageRating }: RatingDistributio
|
|
|
55
55
|
<div key={rating} className="flex items-center gap-3">
|
|
56
56
|
<div className="flex items-center gap-1 w-16">
|
|
57
57
|
<span className="text-sm font-medium text-gray-700">{rating}</span>
|
|
58
|
-
<Star className="size-3 fill-
|
|
58
|
+
<Star className="size-3 fill-haccent-500 text-haccent-500" />
|
|
59
59
|
</div>
|
|
60
60
|
|
|
61
61
|
<div className="flex-1 h-2 bg-gray-200 rounded-full overflow-hidden">
|
|
62
62
|
<div
|
|
63
|
-
className="h-full bg-
|
|
63
|
+
className="h-full bg-haccent-500 transition-all duration-300"
|
|
64
64
|
style={{ width: `${percentage}%` }}
|
|
65
65
|
/>
|
|
66
66
|
</div>
|
|
@@ -148,7 +148,7 @@ export function ReviewForm({
|
|
|
148
148
|
<select
|
|
149
149
|
id="reviewType"
|
|
150
150
|
{...register('reviewType')}
|
|
151
|
-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-
|
|
151
|
+
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-haccent-500 focus:border-transparent"
|
|
152
152
|
>
|
|
153
153
|
<option value="Product Review">Product Review</option>
|
|
154
154
|
<option value="Quality Review">Quality Review</option>
|
|
@@ -169,7 +169,7 @@ export function ReviewForm({
|
|
|
169
169
|
{...register('review')}
|
|
170
170
|
rows={5}
|
|
171
171
|
placeholder="Share your experience with this product..."
|
|
172
|
-
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-
|
|
172
|
+
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-haccent-500 focus:border-transparent resize-none"
|
|
173
173
|
/>
|
|
174
174
|
{errors.review && (
|
|
175
175
|
<p className="text-red-500 text-xs mt-1">{errors.review.message}</p>
|
|
@@ -180,7 +180,7 @@ export function ReviewForm({
|
|
|
180
180
|
<button
|
|
181
181
|
type="submit"
|
|
182
182
|
disabled={isLoading}
|
|
183
|
-
className="flex-1 bg-
|
|
183
|
+
className="flex-1 bg-haccent-500 text-white py-3 px-6 rounded-lg font-medium hover:bg-[#d66f40] transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"
|
|
184
184
|
>
|
|
185
185
|
{isLoading ? (
|
|
186
186
|
<>
|
|
@@ -55,11 +55,11 @@ export function ReviewPromptBanner({
|
|
|
55
55
|
if (!isVisible) return null;
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
|
-
<div className="bg-gradient-to-r from-
|
|
58
|
+
<div className="bg-gradient-to-r from-haccent-500/10 to-haccent-500/5 border border-haccent-500/20 rounded-lg p-4 mb-4">
|
|
59
59
|
<div className="flex items-start gap-4">
|
|
60
60
|
<div className="flex-shrink-0">
|
|
61
|
-
<div className="size-10 rounded-full bg-
|
|
62
|
-
<Star className="size-5 text-
|
|
61
|
+
<div className="size-10 rounded-full bg-haccent-500/20 flex items-center justify-center">
|
|
62
|
+
<Star className="size-5 text-haccent-500" />
|
|
63
63
|
</div>
|
|
64
64
|
</div>
|
|
65
65
|
|
|
@@ -86,7 +86,7 @@ export function ReviewPromptBanner({
|
|
|
86
86
|
|
|
87
87
|
<button
|
|
88
88
|
onClick={handleReviewClick}
|
|
89
|
-
className="mt-3 inline-flex items-center gap-2 px-4 py-2 bg-
|
|
89
|
+
className="mt-3 inline-flex items-center gap-2 px-4 py-2 bg-haccent-500 text-white text-sm font-medium rounded-lg hover:bg-[#d66f40] transition-colors"
|
|
90
90
|
>
|
|
91
91
|
<Star className="size-4" />
|
|
92
92
|
Write a Review
|
|
@@ -79,11 +79,10 @@ export function ReviewsList({ reviews, isLoading }: ReviewsListProps) {
|
|
|
79
79
|
<div className="flex items-center gap-2">
|
|
80
80
|
<button
|
|
81
81
|
onClick={() => setFilterRating('all')}
|
|
82
|
-
className={`px-3 py-1 text-sm rounded-full transition-colors ${
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}`}
|
|
82
|
+
className={`px-3 py-1 text-sm rounded-full transition-colors ${filterRating === 'all'
|
|
83
|
+
? 'bg-haccent-500 text-white'
|
|
84
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
|
|
85
|
+
}`}
|
|
87
86
|
>
|
|
88
87
|
All
|
|
89
88
|
</button>
|
|
@@ -91,11 +90,10 @@ export function ReviewsList({ reviews, isLoading }: ReviewsListProps) {
|
|
|
91
90
|
<button
|
|
92
91
|
key={rating}
|
|
93
92
|
onClick={() => setFilterRating(rating as FilterOption)}
|
|
94
|
-
className={`flex items-center gap-1 px-3 py-1 text-sm rounded-full transition-colors ${
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}`}
|
|
93
|
+
className={`flex items-center gap-1 px-3 py-1 text-sm rounded-full transition-colors ${filterRating === rating
|
|
94
|
+
? 'bg-haccent-500 text-white'
|
|
95
|
+
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
|
|
96
|
+
}`}
|
|
99
97
|
>
|
|
100
98
|
{rating}
|
|
101
99
|
<Star className="size-3 fill-current" />
|
|
@@ -109,7 +107,7 @@ export function ReviewsList({ reviews, isLoading }: ReviewsListProps) {
|
|
|
109
107
|
<select
|
|
110
108
|
value={sortBy}
|
|
111
109
|
onChange={(e) => setSortBy(e.target.value as SortOption)}
|
|
112
|
-
className="px-3 py-1 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-
|
|
110
|
+
className="px-3 py-1 text-sm border border-gray-300 rounded-lg focus:ring-2 focus:ring-haccent-500 focus:border-transparent"
|
|
113
111
|
>
|
|
114
112
|
<option value="recent">Most Recent</option>
|
|
115
113
|
<option value="oldest">Oldest First</option>
|
|
@@ -72,15 +72,15 @@ export function StarRating({
|
|
|
72
72
|
<div className="relative">
|
|
73
73
|
<Star className={`${sizeClasses[size]} text-gray-300`} />
|
|
74
74
|
<div className="absolute inset-0 overflow-hidden" style={{ width: '50%' }}>
|
|
75
|
-
<Star className={`${sizeClasses[size]} fill-
|
|
75
|
+
<Star className={`${sizeClasses[size]} fill-haccent-500 text-haccent-500`} />
|
|
76
76
|
</div>
|
|
77
77
|
</div>
|
|
78
78
|
) : (
|
|
79
79
|
<Star
|
|
80
80
|
className={`
|
|
81
81
|
${sizeClasses[size]}
|
|
82
|
-
${isFilled ? 'fill-
|
|
83
|
-
${interactive && hoverRating > 0 && index < hoverRating ? 'fill-
|
|
82
|
+
${isFilled ? 'fill-haccent-500 text-haccent-500' : 'text-gray-300'}
|
|
83
|
+
${interactive && hoverRating > 0 && index < hoverRating ? 'fill-haccent-500 text-haccent-500' : ''}
|
|
84
84
|
`}
|
|
85
85
|
/>
|
|
86
86
|
)}
|
package/src/hooks/useProducts.ts
CHANGED
|
@@ -24,7 +24,6 @@ export function useProducts(filters?: ProductFilters, page: number = 1, limit: n
|
|
|
24
24
|
],
|
|
25
25
|
queryFn: async () => {
|
|
26
26
|
const response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
|
|
27
|
-
filters?.search ?? "", // searchTerm
|
|
28
27
|
filters?.maxPrice, // maxPrice
|
|
29
28
|
filters?.minPrice, // minPrice
|
|
30
29
|
undefined, // brandFilter
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { ProductsApi, Product } from '@/lib/Apis';
|
|
6
|
+
import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
|
|
7
|
+
|
|
8
|
+
interface SmartSearchResult {
|
|
9
|
+
products: Product[];
|
|
10
|
+
scores: number[];
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AI-powered smart search hook with typo tolerance and semantic understanding.
|
|
17
|
+
*
|
|
18
|
+
* @param query - Natural language search query (e.g., "headache medicine", "tilenol")
|
|
19
|
+
* @param limit - Maximum number of results (default: 20)
|
|
20
|
+
* @param debounceMs - Debounce delay in milliseconds (default: 300)
|
|
21
|
+
*/
|
|
22
|
+
export function useSmartSearch(
|
|
23
|
+
query: string,
|
|
24
|
+
limit: number = 20,
|
|
25
|
+
debounceMs: number = 300
|
|
26
|
+
): SmartSearchResult {
|
|
27
|
+
const [debouncedQuery, setDebouncedQuery] = useState(query);
|
|
28
|
+
|
|
29
|
+
// Debounce the search query
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!query.trim()) {
|
|
32
|
+
setDebouncedQuery('');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const timer = setTimeout(() => {
|
|
37
|
+
setDebouncedQuery(query.trim());
|
|
38
|
+
}, debounceMs);
|
|
39
|
+
|
|
40
|
+
return () => clearTimeout(timer);
|
|
41
|
+
}, [query, debounceMs]);
|
|
42
|
+
|
|
43
|
+
const { data, isLoading, error } = useQuery({
|
|
44
|
+
queryKey: ['smartSearch', debouncedQuery, limit],
|
|
45
|
+
queryFn: async () => {
|
|
46
|
+
if (!debouncedQuery) {
|
|
47
|
+
return { products: [], scores: [] };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
51
|
+
const response = await api.smartSearch(debouncedQuery, limit);
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
products: response.data.products || [],
|
|
55
|
+
scores: response.data.scores || [],
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
enabled: debouncedQuery.length >= 2, // Only search with 2+ characters
|
|
59
|
+
staleTime: 1000 * 60 * 5, // Cache for 5 minutes
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
products: data?.products || [],
|
|
64
|
+
scores: data?.scores || [],
|
|
65
|
+
loading: isLoading,
|
|
66
|
+
error: error as Error | null,
|
|
67
|
+
};
|
|
68
|
+
}
|
package/src/lib/Apis/api.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* https://github.com/swagger-api/swagger-codegen.git
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/export * from './apis/addresses-api';
|
|
14
|
+
export * from './apis/analytics-api';
|
|
14
15
|
export * from './apis/auth-api';
|
|
15
16
|
export * from './apis/blogs-api';
|
|
16
17
|
export * from './apis/cart-api';
|