hey-pharmacist-ecommerce 1.1.42 → 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/README.md +70 -8
- package/dist/index.d.mts +2550 -3081
- package/dist/index.d.ts +2550 -3081
- package/dist/index.js +506 -399
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +506 -397
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/components/AccountOverviewTab.tsx +5 -5
- package/src/components/AccountReviewsTab.tsx +4 -4
- package/src/components/CartItem.tsx +15 -15
- package/src/components/Header.tsx +1 -1
- package/src/components/Notification.tsx +3 -3
- package/src/components/OrderCard.tsx +1 -1
- package/src/components/ProductCard.tsx +11 -11
- package/src/components/QuickViewModal.tsx +16 -16
- package/src/components/RatingDistribution.tsx +2 -2
- package/src/components/ReviewCard.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 -1
- 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/category-sales-dto.ts +51 -0
- 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/{country-stats-response-dto.ts → customer-segment-dto.ts} +12 -13
- 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/group-with-no-users-dto.ts +0 -6
- package/src/lib/Apis/models/group-with-users-dto.ts +0 -6
- package/src/lib/Apis/models/index.ts +29 -38
- package/src/lib/Apis/models/{single-recipient-dto.ts → inline-response200.ts} +11 -10
- package/src/lib/Apis/models/{create-contact-dto.ts → inline-response2001.ts} +11 -11
- 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/{single-link-stats-dto.ts → order-status-count-dto.ts} +10 -10
- package/src/lib/Apis/models/order.ts +0 -6
- package/src/lib/Apis/models/payout-history-item-dto.ts +45 -0
- package/src/lib/Apis/models/{single-country-stats-dto.ts → popular-time-slot-dto.ts} +10 -10
- package/src/lib/Apis/models/populated-order.ts +0 -6
- package/src/lib/Apis/models/preference-update-item.ts +1 -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/{create-contact-list-dto.ts → products-aidraft-body.ts} +4 -4
- package/src/lib/Apis/models/{schedule-campaign-draft-dto.ts → products-processimage-body.ts} +5 -5
- package/src/lib/Apis/models/{contact-full-response-dto.ts → rating-distribution-dto.ts} +9 -10
- 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/{link-stats-response-dto.ts → store-finance-overview-dto.ts} +10 -15
- package/src/lib/Apis/models/store.ts +12 -0
- package/src/lib/Apis/models/{add-contact-to-list-dto.ts → time-series-point-dto.ts} +9 -9
- package/src/lib/Apis/models/{create-email-template-dto.ts → top-customer-dto.ts} +20 -14
- package/src/lib/Apis/models/{marketing-list-contact-dto.ts → top-discount-dto.ts} +12 -12
- package/src/lib/Apis/models/{single-browser-stats-dto.ts → top-product-dto.ts} +18 -12
- package/src/lib/Apis/models/{marketing-campaign-content-dto.ts → unread-count-dto.ts} +6 -6
- package/src/lib/Apis/models/update-store-dto.ts +12 -0
- package/src/lib/Apis/models/update-user-dto.ts +0 -6
- package/src/lib/Apis/models/user-group.ts +0 -6
- package/src/lib/Apis/models/user-with-no-id.ts +0 -6
- package/src/lib/Apis/sharedConfig.ts +1 -1
- package/src/screens/CartScreen.tsx +10 -10
- package/src/screens/CheckoutScreen.tsx +12 -12
- package/src/screens/OrderReviewsScreen.tsx +6 -6
- package/src/screens/ProductDetailScreen.tsx +40 -40
- package/src/screens/SearchResultsScreen.tsx +17 -21
- package/src/screens/ShopScreen.tsx +20 -82
- package/src/lib/Apis/apis/marketing-api.ts +0 -3099
- package/src/lib/Apis/models/api-key-info-dto.ts +0 -49
- package/src/lib/Apis/models/browser-stats-response-dto.ts +0 -40
- package/src/lib/Apis/models/campaign-content-response-dto.ts +0 -40
- package/src/lib/Apis/models/campaign-draft-dto.ts +0 -175
- package/src/lib/Apis/models/campaign-draft-response-dto.ts +0 -40
- package/src/lib/Apis/models/campaign-draft-schedule-dto.ts +0 -49
- package/src/lib/Apis/models/campaign-draft-schedule-response-dto.ts +0 -40
- package/src/lib/Apis/models/campaign-draft-sending-dto.ts +0 -43
- package/src/lib/Apis/models/campaign-draft-sending-response-dto.ts +0 -40
- package/src/lib/Apis/models/contact-aggregated-stats-response-dto.ts +0 -40
- package/src/lib/Apis/models/contact-full-dto.ts +0 -93
- package/src/lib/Apis/models/contact-list-stats-response-dto.ts +0 -40
- package/src/lib/Apis/models/contact-lists-response-dto.ts +0 -40
- package/src/lib/Apis/models/create-marketing-campaign-dto.ts +0 -81
- package/src/lib/Apis/models/email-template-response-dto.ts +0 -117
- package/src/lib/Apis/models/general-stats-response-dto.ts +0 -40
- package/src/lib/Apis/models/send-test-email-dto.ts +0 -28
- package/src/lib/Apis/models/single-contact-aggregated-stats-dto.ts +0 -129
- package/src/lib/Apis/models/single-contact-list-stats-dto.ts +0 -117
- package/src/lib/Apis/models/single-general-stats.ts +0 -153
- package/src/lib/Apis/models/store-api-keys-response-dto.ts +0 -34
- package/src/lib/Apis/models/update-api-keys-dto.ts +0 -39
- package/src/lib/Apis/models/update-campaign-draft-content-dto.ts +0 -27
- package/src/lib/Apis/models/update-marketing-camp-draft-dto.ts +0 -81
|
@@ -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';
|
|
@@ -21,7 +22,6 @@ export * from './apis/events-api';
|
|
|
21
22
|
export * from './apis/file-proccesor-api';
|
|
22
23
|
export * from './apis/health-api';
|
|
23
24
|
export * from './apis/images-api';
|
|
24
|
-
export * from './apis/marketing-api';
|
|
25
25
|
export * from './apis/notifications-api';
|
|
26
26
|
export * from './apis/orders-api';
|
|
27
27
|
export * from './apis/payments-api';
|