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.
Files changed (63) hide show
  1. package/dist/index.d.mts +2341 -888
  2. package/dist/index.d.ts +2341 -888
  3. package/dist/index.js +539 -393
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +538 -393
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/AccountReviewsTab.tsx +4 -4
  9. package/src/components/Header.tsx +1 -1
  10. package/src/components/OrderCard.tsx +1 -1
  11. package/src/components/ProductCard.tsx +1 -1
  12. package/src/components/RatingDistribution.tsx +2 -2
  13. package/src/components/ReviewForm.tsx +3 -3
  14. package/src/components/ReviewPromptBanner.tsx +4 -4
  15. package/src/components/ReviewsList.tsx +9 -11
  16. package/src/components/StarRating.tsx +3 -3
  17. package/src/hooks/useProducts.ts +0 -1
  18. package/src/hooks/useSmartSearch.ts +68 -0
  19. package/src/lib/Apis/api.ts +1 -0
  20. package/src/lib/Apis/apis/analytics-api.ts +809 -0
  21. package/src/lib/Apis/apis/notifications-api.ts +8 -6
  22. package/src/lib/Apis/apis/products-api.ts +390 -15
  23. package/src/lib/Apis/apis/stores-api.ts +26 -149
  24. package/src/lib/Apis/apis/web-hooks-api.ts +8 -17
  25. package/src/lib/Apis/models/analytics-period-dto.ts +45 -0
  26. package/src/lib/Apis/models/appointment-overview-dto.ts +71 -0
  27. package/src/lib/Apis/models/{api-key-info-dto.ts → category-sales-dto.ts} +24 -22
  28. package/src/lib/Apis/models/create-store-dto.ts +12 -0
  29. package/src/lib/Apis/models/customer-overview-dto.ts +96 -0
  30. package/src/lib/Apis/models/customer-segment-dto.ts +39 -0
  31. package/src/lib/Apis/models/dashboard-overview-dto.ts +70 -0
  32. package/src/lib/Apis/models/discount-overview-dto.ts +71 -0
  33. package/src/lib/Apis/models/index.ts +29 -3
  34. package/src/lib/Apis/models/inline-response200.ts +34 -0
  35. package/src/lib/Apis/models/{store-api-keys-response-dto.ts → inline-response2001.ts} +14 -9
  36. package/src/lib/Apis/models/inventory-alert-dto.ts +67 -0
  37. package/src/lib/Apis/models/notification-dto.ts +107 -0
  38. package/src/lib/Apis/models/notifications-paginated-response-dto.ts +58 -0
  39. package/src/lib/Apis/models/order-overview-dto.ts +89 -0
  40. package/src/lib/Apis/models/{update-api-keys-dto.ts → order-status-count-dto.ts} +13 -13
  41. package/src/lib/Apis/models/payout-history-item-dto.ts +45 -0
  42. package/src/lib/Apis/models/popular-time-slot-dto.ts +39 -0
  43. package/src/lib/Apis/models/product-overview-dto.ts +90 -0
  44. package/src/lib/Apis/models/product.ts +6 -0
  45. package/src/lib/Apis/models/products-aidraft-body.ts +27 -0
  46. package/src/lib/Apis/models/products-processimage-body.ts +27 -0
  47. package/src/lib/Apis/models/rating-distribution-dto.ts +39 -0
  48. package/src/lib/Apis/models/recent-review-dto.ts +63 -0
  49. package/src/lib/Apis/models/review-overview-dto.ts +65 -0
  50. package/src/lib/Apis/models/store-balance-dto.ts +39 -0
  51. package/src/lib/Apis/models/store-entity.ts +12 -0
  52. package/src/lib/Apis/models/store-finance-overview-dto.ts +35 -0
  53. package/src/lib/Apis/models/store.ts +12 -0
  54. package/src/lib/Apis/models/time-series-point-dto.ts +33 -0
  55. package/src/lib/Apis/models/top-customer-dto.ts +57 -0
  56. package/src/lib/Apis/models/top-discount-dto.ts +51 -0
  57. package/src/lib/Apis/models/top-product-dto.ts +51 -0
  58. package/src/lib/Apis/models/unread-count-dto.ts +27 -0
  59. package/src/lib/Apis/models/update-store-dto.ts +12 -0
  60. package/src/screens/OrderReviewsScreen.tsx +6 -6
  61. package/src/screens/ProductDetailScreen.tsx +1 -1
  62. package/src/screens/SearchResultsScreen.tsx +17 -21
  63. 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.43",
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-[#E67E50] hover:underline text-sm"
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-[#E67E50]/10 flex items-center justify-center mx-auto mb-4">
48
- <Star className="size-8 text-[#E67E50]" />
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-[#E67E50] text-white rounded-lg font-medium hover:bg-[#d66f40] transition-colors"
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-hsecondary truncate">
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-[#E67E50] bg-white hover:bg-[#E67E50]/5 text-[#E67E50] px-4 py-2 text-sm transition-colors"
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-[#E67E50] text-white rounded-full px-2 py-0.5 flex items-center gap-1">
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-[#E67E50] text-[#E67E50]" />
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-[#E67E50] transition-all duration-300"
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-[#E67E50] focus:border-transparent"
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-[#E67E50] focus:border-transparent resize-none"
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-[#E67E50] 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"
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-[#E67E50]/10 to-[#E67E50]/5 border border-[#E67E50]/20 rounded-lg p-4 mb-4">
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-[#E67E50]/20 flex items-center justify-center">
62
- <Star className="size-5 text-[#E67E50]" />
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-[#E67E50] text-white text-sm font-medium rounded-lg hover:bg-[#d66f40] transition-colors"
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
- filterRating === 'all'
84
- ? 'bg-[#E67E50] text-white'
85
- : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
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
- filterRating === rating
96
- ? 'bg-[#E67E50] text-white'
97
- : 'bg-gray-100 text-gray-700 hover:bg-gray-200'
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-[#E67E50] focus:border-transparent"
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-[#E67E50] text-[#E67E50]`} />
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-[#E67E50] text-[#E67E50]' : 'text-gray-300'}
83
- ${interactive && hoverRating > 0 && index < hoverRating ? 'fill-[#E67E50] text-[#E67E50]' : ''}
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
  )}
@@ -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
+ }
@@ -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';