hey-pharmacist-ecommerce 1.1.30 → 1.1.31
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 +1451 -1303
- package/dist/index.d.ts +1451 -1303
- package/dist/index.js +10502 -5728
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7817 -3059
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/components/AccountReviewsTab.tsx +97 -0
- package/src/components/CouponCodeInput.tsx +190 -0
- package/src/components/Header.tsx +5 -1
- package/src/components/Notification.tsx +1 -1
- package/src/components/NotificationBell.tsx +33 -0
- package/src/components/NotificationCard.tsx +211 -0
- package/src/components/NotificationDrawer.tsx +195 -0
- package/src/components/OrderCard.tsx +164 -99
- package/src/components/ProductReviewsSection.tsx +30 -0
- package/src/components/RatingDistribution.tsx +86 -0
- package/src/components/ReviewCard.tsx +59 -0
- package/src/components/ReviewForm.tsx +207 -0
- package/src/components/ReviewPromptBanner.tsx +98 -0
- package/src/components/ReviewsList.tsx +151 -0
- package/src/components/StarRating.tsx +98 -0
- package/src/hooks/useDiscounts.ts +7 -0
- package/src/hooks/useOrders.ts +15 -0
- package/src/hooks/useReviews.ts +230 -0
- package/src/index.ts +25 -0
- package/src/lib/Apis/apis/discounts-api.ts +23 -72
- package/src/lib/Apis/apis/notifications-api.ts +196 -231
- package/src/lib/Apis/apis/products-api.ts +84 -0
- package/src/lib/Apis/apis/review-api.ts +283 -4
- package/src/lib/Apis/apis/stores-api.ts +180 -0
- package/src/lib/Apis/models/bulk-channel-toggle-dto.ts +52 -0
- package/src/lib/Apis/models/cart-body-populated.ts +3 -3
- package/src/lib/Apis/models/channel-settings-dto.ts +39 -0
- package/src/lib/Apis/models/{discount-paginated-response.ts → completed-order-dto.ts} +21 -16
- package/src/lib/Apis/models/create-discount-dto.ts +31 -92
- package/src/lib/Apis/models/create-review-dto.ts +4 -4
- package/src/lib/Apis/models/create-shippo-account-dto.ts +45 -0
- package/src/lib/Apis/models/create-store-dto.ts +6 -0
- package/src/lib/Apis/models/discount.ts +37 -98
- package/src/lib/Apis/models/discounts-insights-dto.ts +12 -0
- package/src/lib/Apis/models/index.ts +13 -7
- package/src/lib/Apis/models/{manual-discount.ts → manual-discount-dto.ts} +10 -10
- package/src/lib/Apis/models/manual-order-dto.ts +3 -3
- package/src/lib/Apis/models/populated-discount.ts +41 -101
- package/src/lib/Apis/models/preference-update-item.ts +59 -0
- package/src/lib/Apis/models/product-light-dto.ts +40 -0
- package/src/lib/Apis/models/{check-notifications-response-dto.ts → review-status-dto.ts} +8 -7
- package/src/lib/Apis/models/review.ts +9 -3
- package/src/lib/Apis/models/reviewable-order-dto.ts +58 -0
- package/src/lib/Apis/models/reviewable-product-dto.ts +81 -0
- package/src/lib/Apis/models/shippo-account-response-dto.ts +51 -0
- package/src/lib/Apis/models/store-entity.ts +6 -0
- package/src/lib/Apis/models/store.ts +6 -0
- package/src/lib/Apis/models/update-discount-dto.ts +31 -92
- package/src/lib/Apis/models/update-notification-settings-dto.ts +28 -0
- package/src/lib/Apis/models/update-review-dto.ts +4 -4
- package/src/lib/Apis/models/update-store-dto.ts +6 -0
- package/src/lib/Apis/models/{pick-type-class.ts → variant-light-dto.ts} +20 -14
- package/src/lib/utils/discount.ts +155 -0
- package/src/lib/validations/discount.ts +11 -0
- package/src/providers/CartProvider.tsx +2 -2
- package/src/providers/DiscountProvider.tsx +97 -0
- package/src/providers/EcommerceProvider.tsx +13 -5
- package/src/providers/NotificationCenterProvider.tsx +436 -0
- package/src/screens/CartScreen.tsx +1 -1
- package/src/screens/CheckoutScreen.tsx +39 -12
- package/src/screens/NotificationSettingsScreen.tsx +413 -0
- package/src/screens/OrderDetailScreen.tsx +283 -0
- package/src/screens/OrderReviewsScreen.tsx +308 -0
- package/src/screens/OrdersScreen.tsx +31 -7
- package/src/screens/ProductDetailScreen.tsx +24 -11
- package/src/screens/ProfileScreen.tsx +5 -0
- package/src/lib/Apis/models/create-notification-dto.ts +0 -75
- package/src/lib/Apis/models/notification.ts +0 -93
- package/src/lib/Apis/models/single-notification-dto.ts +0 -99
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { ReviewApi } from '@/lib/Apis/apis/review-api';
|
|
3
|
+
import { getApiConfiguration } from '@/lib/api-adapter';
|
|
4
|
+
import { Review, CreateReviewDto } from '@/lib/Apis/models';
|
|
5
|
+
import { useAuth } from '@/providers/AuthProvider';
|
|
6
|
+
|
|
7
|
+
export function useProductReviews(productId: string) {
|
|
8
|
+
const [reviews, setReviews] = useState<Review[]>([]);
|
|
9
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
10
|
+
const [error, setError] = useState<Error | null>(null);
|
|
11
|
+
|
|
12
|
+
const fetchReviews = useCallback(async () => {
|
|
13
|
+
if (!productId) {
|
|
14
|
+
setIsLoading(false);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setIsLoading(true);
|
|
19
|
+
setError(null);
|
|
20
|
+
try {
|
|
21
|
+
const response = await new ReviewApi(getApiConfiguration()).getReviewsByProduct(productId);
|
|
22
|
+
setReviews(response.data || []);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setError(err as Error);
|
|
25
|
+
} finally {
|
|
26
|
+
setIsLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, [productId]);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
fetchReviews();
|
|
32
|
+
}, [fetchReviews]);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
reviews,
|
|
36
|
+
isLoading,
|
|
37
|
+
error,
|
|
38
|
+
refetch: fetchReviews,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function useUserReviews(userId?: string) {
|
|
43
|
+
const [reviews, setReviews] = useState<Review[]>([]);
|
|
44
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
45
|
+
const [error, setError] = useState<Error | null>(null);
|
|
46
|
+
const { user } = useAuth();
|
|
47
|
+
const resolvedUserId = userId || (user as any)?._id || (user as any)?.id;
|
|
48
|
+
|
|
49
|
+
const fetchReviews = useCallback(async () => {
|
|
50
|
+
if (!resolvedUserId) {
|
|
51
|
+
setIsLoading(false);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setIsLoading(true);
|
|
56
|
+
setError(null);
|
|
57
|
+
try {
|
|
58
|
+
const response = await new ReviewApi(getApiConfiguration()).getReviewsByUser(resolvedUserId);
|
|
59
|
+
setReviews(response.data || []);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
setError(err as Error);
|
|
62
|
+
} finally {
|
|
63
|
+
setIsLoading(false);
|
|
64
|
+
}
|
|
65
|
+
}, [resolvedUserId]);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
fetchReviews();
|
|
69
|
+
}, [fetchReviews]);
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
reviews,
|
|
73
|
+
isLoading,
|
|
74
|
+
error,
|
|
75
|
+
refetch: fetchReviews,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function useReviewsByRating(rating: number) {
|
|
80
|
+
const [reviews, setReviews] = useState<Review[]>([]);
|
|
81
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
82
|
+
const [error, setError] = useState<Error | null>(null);
|
|
83
|
+
|
|
84
|
+
const fetchReviews = useCallback(async () => {
|
|
85
|
+
if (!rating || rating < 1 || rating > 5) {
|
|
86
|
+
setIsLoading(false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setIsLoading(true);
|
|
91
|
+
setError(null);
|
|
92
|
+
try {
|
|
93
|
+
const response = await new ReviewApi(getApiConfiguration()).getReviewsByRating(rating);
|
|
94
|
+
setReviews(response.data || []);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
setError(err as Error);
|
|
97
|
+
} finally {
|
|
98
|
+
setIsLoading(false);
|
|
99
|
+
}
|
|
100
|
+
}, [rating]);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
fetchReviews();
|
|
104
|
+
}, [fetchReviews]);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
reviews,
|
|
108
|
+
isLoading,
|
|
109
|
+
error,
|
|
110
|
+
refetch: fetchReviews,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function useCreateReview() {
|
|
115
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
116
|
+
const [error, setError] = useState<Error | null>(null);
|
|
117
|
+
const [success, setSuccess] = useState(false);
|
|
118
|
+
|
|
119
|
+
const createReview = useCallback(async (orderId: string, reviewData: CreateReviewDto) => {
|
|
120
|
+
setIsLoading(true);
|
|
121
|
+
setError(null);
|
|
122
|
+
setSuccess(false);
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const response = await new ReviewApi(getApiConfiguration()).createReview(reviewData, orderId);
|
|
126
|
+
setSuccess(true);
|
|
127
|
+
return response.data;
|
|
128
|
+
} catch (err) {
|
|
129
|
+
setError(err as Error);
|
|
130
|
+
throw err;
|
|
131
|
+
} finally {
|
|
132
|
+
setIsLoading(false);
|
|
133
|
+
}
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
const reset = useCallback(() => {
|
|
137
|
+
setError(null);
|
|
138
|
+
setSuccess(false);
|
|
139
|
+
setIsLoading(false);
|
|
140
|
+
}, []);
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
createReview,
|
|
144
|
+
isLoading,
|
|
145
|
+
error,
|
|
146
|
+
success,
|
|
147
|
+
reset,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function useUpdateReview() {
|
|
152
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
153
|
+
const [error, setError] = useState<Error | null>(null);
|
|
154
|
+
|
|
155
|
+
const updateReview = useCallback(async (reviewId: string, reviewData: any) => {
|
|
156
|
+
setIsLoading(true);
|
|
157
|
+
setError(null);
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
const response = await new ReviewApi(getApiConfiguration()).updateReview(reviewData, reviewId);
|
|
161
|
+
return response.data;
|
|
162
|
+
} catch (err) {
|
|
163
|
+
setError(err as Error);
|
|
164
|
+
throw err;
|
|
165
|
+
} finally {
|
|
166
|
+
setIsLoading(false);
|
|
167
|
+
}
|
|
168
|
+
}, []);
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
updateReview,
|
|
172
|
+
isLoading,
|
|
173
|
+
error,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function useDeleteReview() {
|
|
178
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
179
|
+
const [error, setError] = useState<Error | null>(null);
|
|
180
|
+
|
|
181
|
+
const deleteReview = useCallback(async (reviewId: string) => {
|
|
182
|
+
setIsLoading(true);
|
|
183
|
+
setError(null);
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
await new ReviewApi(getApiConfiguration()).removeReview(reviewId);
|
|
187
|
+
} catch (err) {
|
|
188
|
+
setError(err as Error);
|
|
189
|
+
throw err;
|
|
190
|
+
} finally {
|
|
191
|
+
setIsLoading(false);
|
|
192
|
+
}
|
|
193
|
+
}, []);
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
deleteReview,
|
|
197
|
+
isLoading,
|
|
198
|
+
error,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function useReviewStats() {
|
|
203
|
+
const [count, setCount] = useState(0);
|
|
204
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
205
|
+
const [error, setError] = useState<Error | null>(null);
|
|
206
|
+
|
|
207
|
+
const fetchCount = useCallback(async () => {
|
|
208
|
+
setIsLoading(true);
|
|
209
|
+
setError(null);
|
|
210
|
+
try {
|
|
211
|
+
const response = await new ReviewApi(getApiConfiguration()).getReviewCount();
|
|
212
|
+
setCount(response.data || 0);
|
|
213
|
+
} catch (err) {
|
|
214
|
+
setError(err as Error);
|
|
215
|
+
} finally {
|
|
216
|
+
setIsLoading(false);
|
|
217
|
+
}
|
|
218
|
+
}, []);
|
|
219
|
+
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
fetchCount();
|
|
222
|
+
}, [fetchCount]);
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
count,
|
|
226
|
+
isLoading,
|
|
227
|
+
error,
|
|
228
|
+
refetch: fetchCount,
|
|
229
|
+
};
|
|
230
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { AuthProvider, useAuth } from './providers/AuthProvider';
|
|
|
7
7
|
export { CartProvider, useCart } from './providers/CartProvider';
|
|
8
8
|
export { WishlistProvider, useWishlist } from './providers/WishlistProvider';
|
|
9
9
|
export { useBasePath } from './providers/BasePathProvider';
|
|
10
|
+
export { NotificationCenterProvider, useNotificationCenter } from './providers/NotificationCenterProvider';
|
|
10
11
|
|
|
11
12
|
// Screens
|
|
12
13
|
export { ShopScreen } from './screens/ShopScreen';
|
|
@@ -25,6 +26,8 @@ export { default as WishlistScreen } from './screens/WishlistScreen';
|
|
|
25
26
|
export { default as SearchResultsScreen } from './screens/SearchResultsScreen';
|
|
26
27
|
export { default as NewAddressScreen } from './screens/NewAddressScreen';
|
|
27
28
|
export { EditProfileScreen } from './screens/EditProfileScreen';
|
|
29
|
+
export { OrderReviewsScreen } from './screens/OrderReviewsScreen';
|
|
30
|
+
export { NotificationSettingsScreen } from './screens/NotificationSettingsScreen';
|
|
28
31
|
|
|
29
32
|
// Components
|
|
30
33
|
export { Header } from './components/Header';
|
|
@@ -33,6 +36,19 @@ export { ProductCard } from './components/ProductCard';
|
|
|
33
36
|
export { CartItem } from './components/CartItem';
|
|
34
37
|
export { OrderCard } from './components/OrderCard';
|
|
35
38
|
export { EmptyState } from './components/EmptyState';
|
|
39
|
+
export { NotificationBell } from './components/NotificationBell';
|
|
40
|
+
export { NotificationDrawer } from './components/NotificationDrawer';
|
|
41
|
+
export { NotificationCard } from './components/NotificationCard';
|
|
42
|
+
|
|
43
|
+
// Review Components
|
|
44
|
+
export { StarRating } from './components/StarRating';
|
|
45
|
+
export { ReviewCard } from './components/ReviewCard';
|
|
46
|
+
export { ReviewForm } from './components/ReviewForm';
|
|
47
|
+
export { RatingDistribution } from './components/RatingDistribution';
|
|
48
|
+
export { ReviewsList } from './components/ReviewsList';
|
|
49
|
+
export { ProductReviewsSection } from './components/ProductReviewsSection';
|
|
50
|
+
export { ReviewPromptBanner } from './components/ReviewPromptBanner';
|
|
51
|
+
export { AccountReviewsTab } from './components/AccountReviewsTab';
|
|
36
52
|
|
|
37
53
|
// UI Components
|
|
38
54
|
export { Button } from './components/ui/Button';
|
|
@@ -46,6 +62,15 @@ export { useProducts, useProduct, useCategories } from './hooks/useProducts';
|
|
|
46
62
|
export { useOrders, useOrder, useCurrentOrders } from './hooks/useOrders';
|
|
47
63
|
export { useAddresses } from './hooks/useAddresses';
|
|
48
64
|
export { useStoreCapabilities } from './hooks/useStoreCapabilities';
|
|
65
|
+
export {
|
|
66
|
+
useProductReviews,
|
|
67
|
+
useUserReviews,
|
|
68
|
+
useReviewsByRating,
|
|
69
|
+
useCreateReview,
|
|
70
|
+
useUpdateReview,
|
|
71
|
+
useDeleteReview,
|
|
72
|
+
useReviewStats,
|
|
73
|
+
} from './hooks/useReviews';
|
|
49
74
|
|
|
50
75
|
|
|
51
76
|
// API Adapter (for advanced usage)
|
|
@@ -18,7 +18,6 @@ import { Configuration } from '../configuration';
|
|
|
18
18
|
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
|
19
19
|
import { CreateDiscountDto } from '../models';
|
|
20
20
|
import { Discount } from '../models';
|
|
21
|
-
import { DiscountPaginatedResponse } from '../models';
|
|
22
21
|
import { DiscountsInsightsDto } from '../models';
|
|
23
22
|
import { PopulatedDiscount } from '../models';
|
|
24
23
|
import { UpdateDiscountDto } from '../models';
|
|
@@ -147,17 +146,11 @@ export const DiscountsApiAxiosParamCreator = function (configuration?: Configura
|
|
|
147
146
|
},
|
|
148
147
|
/**
|
|
149
148
|
*
|
|
150
|
-
* @summary Get all discounts
|
|
151
|
-
* @param {string} [discountState]
|
|
152
|
-
* @param {number} [page]
|
|
153
|
-
* @param {number} [limit]
|
|
154
|
-
* @param {string} [search]
|
|
155
|
-
* @param {string} [sortingColumn]
|
|
156
|
-
* @param {string} [sortingOrder]
|
|
149
|
+
* @summary Get all discounts with filters and pagination
|
|
157
150
|
* @param {*} [options] Override http request option.
|
|
158
151
|
* @throws {RequiredError}
|
|
159
152
|
*/
|
|
160
|
-
getAllDiscounts: async (
|
|
153
|
+
getAllDiscounts: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
161
154
|
const localVarPath = `/discounts`;
|
|
162
155
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
163
156
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
|
@@ -186,30 +179,6 @@ export const DiscountsApiAxiosParamCreator = function (configuration?: Configura
|
|
|
186
179
|
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
187
180
|
}
|
|
188
181
|
|
|
189
|
-
if (discountState !== undefined) {
|
|
190
|
-
localVarQueryParameter['discountState'] = discountState;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (page !== undefined) {
|
|
194
|
-
localVarQueryParameter['page'] = page;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (limit !== undefined) {
|
|
198
|
-
localVarQueryParameter['limit'] = limit;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (search !== undefined) {
|
|
202
|
-
localVarQueryParameter['search'] = search;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (sortingColumn !== undefined) {
|
|
206
|
-
localVarQueryParameter['sortingColumn'] = sortingColumn;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (sortingOrder !== undefined) {
|
|
210
|
-
localVarQueryParameter['sortingOrder'] = sortingOrder;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
182
|
const query = new URLSearchParams(localVarUrlObj.search);
|
|
214
183
|
for (const key in localVarQueryParameter) {
|
|
215
184
|
query.set(key, localVarQueryParameter[key]);
|
|
@@ -228,7 +197,7 @@ export const DiscountsApiAxiosParamCreator = function (configuration?: Configura
|
|
|
228
197
|
},
|
|
229
198
|
/**
|
|
230
199
|
*
|
|
231
|
-
* @summary Get insights
|
|
200
|
+
* @summary Get dashboard insights for discounts
|
|
232
201
|
* @param {*} [options] Override http request option.
|
|
233
202
|
* @throws {RequiredError}
|
|
234
203
|
*/
|
|
@@ -279,7 +248,7 @@ export const DiscountsApiAxiosParamCreator = function (configuration?: Configura
|
|
|
279
248
|
},
|
|
280
249
|
/**
|
|
281
250
|
*
|
|
282
|
-
* @summary Get discount by
|
|
251
|
+
* @summary Get a single discount by ID
|
|
283
252
|
* @param {string} id
|
|
284
253
|
* @param {*} [options] Override http request option.
|
|
285
254
|
* @throws {RequiredError}
|
|
@@ -402,7 +371,7 @@ export const DiscountsApiAxiosParamCreator = function (configuration?: Configura
|
|
|
402
371
|
},
|
|
403
372
|
/**
|
|
404
373
|
*
|
|
405
|
-
* @summary
|
|
374
|
+
* @summary Validate a coupon code (by code or discountId)
|
|
406
375
|
* @param {string} [code]
|
|
407
376
|
* @param {string} [userId]
|
|
408
377
|
* @param {string} [discountId]
|
|
@@ -505,18 +474,12 @@ export const DiscountsApiFp = function(configuration?: Configuration) {
|
|
|
505
474
|
},
|
|
506
475
|
/**
|
|
507
476
|
*
|
|
508
|
-
* @summary Get all discounts
|
|
509
|
-
* @param {string} [discountState]
|
|
510
|
-
* @param {number} [page]
|
|
511
|
-
* @param {number} [limit]
|
|
512
|
-
* @param {string} [search]
|
|
513
|
-
* @param {string} [sortingColumn]
|
|
514
|
-
* @param {string} [sortingOrder]
|
|
477
|
+
* @summary Get all discounts with filters and pagination
|
|
515
478
|
* @param {*} [options] Override http request option.
|
|
516
479
|
* @throws {RequiredError}
|
|
517
480
|
*/
|
|
518
|
-
async getAllDiscounts(
|
|
519
|
-
const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).getAllDiscounts(
|
|
481
|
+
async getAllDiscounts(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Array<PopulatedDiscount>>>> {
|
|
482
|
+
const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).getAllDiscounts(options);
|
|
520
483
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
521
484
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
522
485
|
return axios.request(axiosRequestArgs);
|
|
@@ -524,7 +487,7 @@ export const DiscountsApiFp = function(configuration?: Configuration) {
|
|
|
524
487
|
},
|
|
525
488
|
/**
|
|
526
489
|
*
|
|
527
|
-
* @summary Get insights
|
|
490
|
+
* @summary Get dashboard insights for discounts
|
|
528
491
|
* @param {*} [options] Override http request option.
|
|
529
492
|
* @throws {RequiredError}
|
|
530
493
|
*/
|
|
@@ -537,7 +500,7 @@ export const DiscountsApiFp = function(configuration?: Configuration) {
|
|
|
537
500
|
},
|
|
538
501
|
/**
|
|
539
502
|
*
|
|
540
|
-
* @summary Get discount by
|
|
503
|
+
* @summary Get a single discount by ID
|
|
541
504
|
* @param {string} id
|
|
542
505
|
* @param {*} [options] Override http request option.
|
|
543
506
|
* @throws {RequiredError}
|
|
@@ -566,7 +529,7 @@ export const DiscountsApiFp = function(configuration?: Configuration) {
|
|
|
566
529
|
},
|
|
567
530
|
/**
|
|
568
531
|
*
|
|
569
|
-
* @summary
|
|
532
|
+
* @summary Validate a coupon code (by code or discountId)
|
|
570
533
|
* @param {string} [code]
|
|
571
534
|
* @param {string} [userId]
|
|
572
535
|
* @param {string} [discountId]
|
|
@@ -611,22 +574,16 @@ export const DiscountsApiFactory = function (configuration?: Configuration, base
|
|
|
611
574
|
},
|
|
612
575
|
/**
|
|
613
576
|
*
|
|
614
|
-
* @summary Get all discounts
|
|
615
|
-
* @param {string} [discountState]
|
|
616
|
-
* @param {number} [page]
|
|
617
|
-
* @param {number} [limit]
|
|
618
|
-
* @param {string} [search]
|
|
619
|
-
* @param {string} [sortingColumn]
|
|
620
|
-
* @param {string} [sortingOrder]
|
|
577
|
+
* @summary Get all discounts with filters and pagination
|
|
621
578
|
* @param {*} [options] Override http request option.
|
|
622
579
|
* @throws {RequiredError}
|
|
623
580
|
*/
|
|
624
|
-
async getAllDiscounts(
|
|
625
|
-
return DiscountsApiFp(configuration).getAllDiscounts(
|
|
581
|
+
async getAllDiscounts(options?: AxiosRequestConfig): Promise<AxiosResponse<Array<PopulatedDiscount>>> {
|
|
582
|
+
return DiscountsApiFp(configuration).getAllDiscounts(options).then((request) => request(axios, basePath));
|
|
626
583
|
},
|
|
627
584
|
/**
|
|
628
585
|
*
|
|
629
|
-
* @summary Get insights
|
|
586
|
+
* @summary Get dashboard insights for discounts
|
|
630
587
|
* @param {*} [options] Override http request option.
|
|
631
588
|
* @throws {RequiredError}
|
|
632
589
|
*/
|
|
@@ -635,7 +592,7 @@ export const DiscountsApiFactory = function (configuration?: Configuration, base
|
|
|
635
592
|
},
|
|
636
593
|
/**
|
|
637
594
|
*
|
|
638
|
-
* @summary Get discount by
|
|
595
|
+
* @summary Get a single discount by ID
|
|
639
596
|
* @param {string} id
|
|
640
597
|
* @param {*} [options] Override http request option.
|
|
641
598
|
* @throws {RequiredError}
|
|
@@ -656,7 +613,7 @@ export const DiscountsApiFactory = function (configuration?: Configuration, base
|
|
|
656
613
|
},
|
|
657
614
|
/**
|
|
658
615
|
*
|
|
659
|
-
* @summary
|
|
616
|
+
* @summary Validate a coupon code (by code or discountId)
|
|
660
617
|
* @param {string} [code]
|
|
661
618
|
* @param {string} [userId]
|
|
662
619
|
* @param {string} [discountId]
|
|
@@ -700,23 +657,17 @@ export class DiscountsApi extends BaseAPI {
|
|
|
700
657
|
}
|
|
701
658
|
/**
|
|
702
659
|
*
|
|
703
|
-
* @summary Get all discounts
|
|
704
|
-
* @param {string} [discountState]
|
|
705
|
-
* @param {number} [page]
|
|
706
|
-
* @param {number} [limit]
|
|
707
|
-
* @param {string} [search]
|
|
708
|
-
* @param {string} [sortingColumn]
|
|
709
|
-
* @param {string} [sortingOrder]
|
|
660
|
+
* @summary Get all discounts with filters and pagination
|
|
710
661
|
* @param {*} [options] Override http request option.
|
|
711
662
|
* @throws {RequiredError}
|
|
712
663
|
* @memberof DiscountsApi
|
|
713
664
|
*/
|
|
714
|
-
public async getAllDiscounts(
|
|
715
|
-
return DiscountsApiFp(this.configuration).getAllDiscounts(
|
|
665
|
+
public async getAllDiscounts(options?: AxiosRequestConfig) : Promise<AxiosResponse<Array<PopulatedDiscount>>> {
|
|
666
|
+
return DiscountsApiFp(this.configuration).getAllDiscounts(options).then((request) => request(this.axios, this.basePath));
|
|
716
667
|
}
|
|
717
668
|
/**
|
|
718
669
|
*
|
|
719
|
-
* @summary Get insights
|
|
670
|
+
* @summary Get dashboard insights for discounts
|
|
720
671
|
* @param {*} [options] Override http request option.
|
|
721
672
|
* @throws {RequiredError}
|
|
722
673
|
* @memberof DiscountsApi
|
|
@@ -726,7 +677,7 @@ export class DiscountsApi extends BaseAPI {
|
|
|
726
677
|
}
|
|
727
678
|
/**
|
|
728
679
|
*
|
|
729
|
-
* @summary Get discount by
|
|
680
|
+
* @summary Get a single discount by ID
|
|
730
681
|
* @param {string} id
|
|
731
682
|
* @param {*} [options] Override http request option.
|
|
732
683
|
* @throws {RequiredError}
|
|
@@ -749,7 +700,7 @@ export class DiscountsApi extends BaseAPI {
|
|
|
749
700
|
}
|
|
750
701
|
/**
|
|
751
702
|
*
|
|
752
|
-
* @summary
|
|
703
|
+
* @summary Validate a coupon code (by code or discountId)
|
|
753
704
|
* @param {string} [code]
|
|
754
705
|
* @param {string} [userId]
|
|
755
706
|
* @param {string} [discountId]
|