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
@@ -0,0 +1,57 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Hey Pharamcist API
5
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
+ *
7
+ * OpenAPI spec version: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by the swagger code generator program.
11
+ * https://github.com/swagger-api/swagger-codegen.git
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface TopCustomerDto
18
+ */
19
+ export interface TopCustomerDto {
20
+ _id?: string;
21
+ /**
22
+ *
23
+ * @type {string}
24
+ * @memberof TopCustomerDto
25
+ */
26
+ userId: string;
27
+ /**
28
+ *
29
+ * @type {string}
30
+ * @memberof TopCustomerDto
31
+ */
32
+ name: string;
33
+ /**
34
+ *
35
+ * @type {string}
36
+ * @memberof TopCustomerDto
37
+ */
38
+ email: string;
39
+ /**
40
+ *
41
+ * @type {number}
42
+ * @memberof TopCustomerDto
43
+ */
44
+ totalSpent: number;
45
+ /**
46
+ *
47
+ * @type {number}
48
+ * @memberof TopCustomerDto
49
+ */
50
+ orderCount: number;
51
+ /**
52
+ *
53
+ * @type {Date}
54
+ * @memberof TopCustomerDto
55
+ */
56
+ lastOrderDate?: Date;
57
+ }
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Hey Pharamcist API
5
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
+ *
7
+ * OpenAPI spec version: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by the swagger code generator program.
11
+ * https://github.com/swagger-api/swagger-codegen.git
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface TopDiscountDto
18
+ */
19
+ export interface TopDiscountDto {
20
+ _id?: string;
21
+ /**
22
+ *
23
+ * @type {string}
24
+ * @memberof TopDiscountDto
25
+ */
26
+ discountId: string;
27
+ /**
28
+ *
29
+ * @type {string}
30
+ * @memberof TopDiscountDto
31
+ */
32
+ name: string;
33
+ /**
34
+ *
35
+ * @type {string}
36
+ * @memberof TopDiscountDto
37
+ */
38
+ code?: string;
39
+ /**
40
+ *
41
+ * @type {number}
42
+ * @memberof TopDiscountDto
43
+ */
44
+ usageCount: number;
45
+ /**
46
+ *
47
+ * @type {number}
48
+ * @memberof TopDiscountDto
49
+ */
50
+ totalSavings: number;
51
+ }
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Hey Pharamcist API
5
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
+ *
7
+ * OpenAPI spec version: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by the swagger code generator program.
11
+ * https://github.com/swagger-api/swagger-codegen.git
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface TopProductDto
18
+ */
19
+ export interface TopProductDto {
20
+ _id?: string;
21
+ /**
22
+ *
23
+ * @type {string}
24
+ * @memberof TopProductDto
25
+ */
26
+ productId: string;
27
+ /**
28
+ *
29
+ * @type {string}
30
+ * @memberof TopProductDto
31
+ */
32
+ name: string;
33
+ /**
34
+ *
35
+ * @type {number}
36
+ * @memberof TopProductDto
37
+ */
38
+ totalSold: number;
39
+ /**
40
+ *
41
+ * @type {number}
42
+ * @memberof TopProductDto
43
+ */
44
+ revenue: number;
45
+ /**
46
+ *
47
+ * @type {string}
48
+ * @memberof TopProductDto
49
+ */
50
+ imageUrl?: string;
51
+ }
@@ -0,0 +1,27 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Hey Pharamcist API
5
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
+ *
7
+ * OpenAPI spec version: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by the swagger code generator program.
11
+ * https://github.com/swagger-api/swagger-codegen.git
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface UnreadCountDto
18
+ */
19
+ export interface UnreadCountDto {
20
+ _id?: string;
21
+ /**
22
+ * Number of unread notifications
23
+ * @type {number}
24
+ * @memberof UnreadCountDto
25
+ */
26
+ unreadCount: number;
27
+ }
@@ -67,6 +67,18 @@ export interface UpdateStoreDto {
67
67
  * @memberof UpdateStoreDto
68
68
  */
69
69
  stripeWebhookSecret?: string;
70
+ /**
71
+ *
72
+ * @type {string}
73
+ * @memberof UpdateStoreDto
74
+ */
75
+ stripeAccountId?: string;
76
+ /**
77
+ *
78
+ * @type {boolean}
79
+ * @memberof UpdateStoreDto
80
+ */
81
+ stripeOnboardingCompleted?: boolean;
70
82
  /**
71
83
  *
72
84
  * @type {string}
@@ -75,7 +75,7 @@ export function OrderReviewsScreen() {
75
75
  <p className="text-red-600 mb-4">{error.message}</p>
76
76
  <button
77
77
  onClick={() => router.back()}
78
- className="text-[#E67E50] hover:underline"
78
+ className="text-haccent-500 hover:underline"
79
79
  >
80
80
  Go Back
81
81
  </button>
@@ -179,7 +179,7 @@ export function OrderReviewsScreen() {
179
179
  return (
180
180
  <div
181
181
  key={`${variantId}-${index}`}
182
- className="bg-white rounded-lg border border-gray-200 p-4 cursor-pointer hover:border-[#E67E50] hover:shadow-md transition-all"
182
+ className="bg-white rounded-lg border border-gray-200 p-4 cursor-pointer hover:border-haccent-500 hover:shadow-md transition-all"
183
183
  onClick={() => {
184
184
  // Try to extract productId from various possible locations
185
185
  const possibleProductId =
@@ -218,7 +218,7 @@ export function OrderReviewsScreen() {
218
218
  <p className="text-sm text-gray-600">{variantData?.description || ''}</p>
219
219
  <p className="text-xs text-gray-500 mt-1">Quantity: {item.quantity}</p>
220
220
  </div>
221
- <div className="flex items-center gap-2 text-[#E67E50]">
221
+ <div className="flex items-center gap-2 text-haccent-500">
222
222
  <span className="text-sm font-medium">Review Now</span>
223
223
  </div>
224
224
  </div>
@@ -260,7 +260,7 @@ export function OrderReviewsScreen() {
260
260
  </p>
261
261
  <button
262
262
  onClick={() => router.push('/shop')}
263
- className="px-6 py-3 bg-[#E67E50] text-white rounded-lg hover:bg-[#d66f40] transition-colors"
263
+ className="px-6 py-3 bg-haccent-500 text-white rounded-lg hover:bg-[#d66f40] transition-colors"
264
264
  >
265
265
  Start Shopping
266
266
  </button>
@@ -270,7 +270,7 @@ export function OrderReviewsScreen() {
270
270
  {completedOrders.map((order) => (
271
271
  <div
272
272
  key={order.id || order._id}
273
- className="bg-white rounded-lg border border-gray-200 p-6 cursor-pointer hover:border-[#E67E50] hover:shadow-md transition-all"
273
+ className="bg-white rounded-lg border border-gray-200 p-6 cursor-pointer hover:border-haccent-500 hover:shadow-md transition-all"
274
274
  onClick={() => handleOrderClick(order)}
275
275
  >
276
276
  <div className="flex items-center justify-between">
@@ -293,7 +293,7 @@ export function OrderReviewsScreen() {
293
293
  )}
294
294
  </div>
295
295
  <div className="text-right">
296
- <div className="flex items-center gap-2 text-[#E67E50]">
296
+ <div className="flex items-center gap-2 text-haccent-500">
297
297
  <span className="text-sm font-medium">Review Products</span>
298
298
  </div>
299
299
  </div>
@@ -474,7 +474,7 @@ export function ProductDetailScreen({ productId }: ProductDetailScreenProps) {
474
474
  <Star
475
475
  key={i}
476
476
  className={`size-4 ${i < Math.floor(reviewStats.averageRating)
477
- ? 'text-[#E67E50] fill-[#E67E50]'
477
+ ? 'text-haccent-500 fill-haccent-500'
478
478
  : 'text-gray-300'
479
479
  }`}
480
480
  />
@@ -112,34 +112,30 @@ export default function SearchPage() {
112
112
  return;
113
113
  }
114
114
 
115
+ // Require at least 2 characters for search
116
+ if (sanitizedQuery.length < 2) {
117
+ setProducts([]);
118
+ setIsLoading(false);
119
+ setHasSearched(false);
120
+ return;
121
+ }
122
+
115
123
  try {
116
124
  setIsLoading(true);
117
125
  const api = new ProductsApi(AXIOS_CONFIG);
118
126
 
119
- // Search for products using getAllProducts
120
- let response = await api.getAllProducts(
121
- sanitizedQuery, // searchTerm
122
- undefined, // maxPrice
123
- undefined, // minPrice
124
- undefined, // brandFilter
125
- undefined, // availability
126
- 'relevance', // sort
127
- undefined, // subCategoryId
128
- undefined, // categoryId
129
- true, // isActive
130
- 20, // limit
131
- 1 // page
132
- );
133
-
134
- console.log('Search API Response:', {
127
+ // Use AI-powered smart search for typo tolerance and semantic matching
128
+ const response = await api.smartSearch(sanitizedQuery, 20);
129
+
130
+ console.log('Smart Search API Response:', {
135
131
  query: sanitizedQuery,
136
132
  status: response.status,
137
- dataLength: response.data?.data?.length,
138
- totalItems: response.data?.totalItems
133
+ productsCount: response.data?.products?.length,
134
+ scores: response.data?.scores
139
135
  });
140
136
 
141
- if (response.data?.data) {
142
- const transformedProducts = response.data.data.map((item: Product) => ({
137
+ if (response.data?.products) {
138
+ const transformedProducts = response.data.products.map((item: Product) => ({
143
139
  ...item,
144
140
  id: item._id || '',
145
141
  }));
@@ -155,7 +151,7 @@ export default function SearchPage() {
155
151
  }
156
152
  setHasSearched(true);
157
153
  } catch (error) {
158
- console.error('Error fetching search results:', error);
154
+ console.error('Error fetching smart search results:', error);
159
155
  if (error instanceof Error) {
160
156
  console.error('Error details:', error.message);
161
157
  }
@@ -151,68 +151,6 @@ export function ShopScreen({ initialFilters = {}, categoryName }: ShopScreenProp
151
151
  [categories]
152
152
  );
153
153
 
154
- const productInsights = useMemo(() => {
155
- if (!products.length) {
156
- return { newArrivals: 0, inStockCount: 0 };
157
- }
158
-
159
- const monthAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
160
- let newArrivals = 0;
161
- let inStockCount = 0;
162
-
163
- products.forEach((product) => {
164
- if (product.summary?.totalInventory > 0) inStockCount += 1;
165
- if (new Date(product.createdAt).getTime() >= monthAgo) newArrivals += 1;
166
- });
167
-
168
- return { newArrivals, inStockCount };
169
- }, [products]);
170
- const insightCards = useMemo(
171
- () => [
172
- {
173
- id: 'new',
174
- label: 'New arrivals',
175
- value: productInsights.newArrivals
176
- ? productInsights.newArrivals.toLocaleString()
177
- : isLoading
178
- ? '...'
179
- : '0',
180
- helper: filters.newArrivals ? 'Filter active: showing last 30 days' : 'Click to show last 30 days',
181
- icon: Sparkles,
182
- },
183
- {
184
- id: 'stock',
185
- label: 'Available now',
186
- value: productInsights.inStockCount
187
- ? productInsights.inStockCount.toLocaleString()
188
- : isLoading
189
- ? '...'
190
- : '0',
191
- helper: 'Ready to ship today',
192
- icon: ShieldCheck,
193
- },
194
- {
195
- id: 'catalogue',
196
- label: 'Total products',
197
- value:
198
- pagination.total || products.length
199
- ? (pagination.total || products.length).toLocaleString()
200
- : isLoading
201
- ? '...'
202
- : '0',
203
- helper: 'Across all categories',
204
- icon: TrendingUp,
205
- },
206
- ],
207
- [
208
- isLoading,
209
- pagination.total,
210
- productInsights.inStockCount,
211
- productInsights.newArrivals,
212
- products.length,
213
- filters.newArrivals,
214
- ]
215
- );
216
154
 
217
155
  const filteredProducts = useMemo(() => {
218
156
  if (isLoading) return products;