hey-pharmacist-ecommerce 1.1.29 → 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.
Files changed (104) hide show
  1. package/dist/index.d.mts +10957 -1331
  2. package/dist/index.d.ts +10957 -1331
  3. package/dist/index.js +12364 -5144
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +9353 -2205
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +4 -3
  8. package/src/components/AccountReviewsTab.tsx +97 -0
  9. package/src/components/CouponCodeInput.tsx +190 -0
  10. package/src/components/Header.tsx +5 -1
  11. package/src/components/Notification.tsx +1 -1
  12. package/src/components/NotificationBell.tsx +33 -0
  13. package/src/components/NotificationCard.tsx +211 -0
  14. package/src/components/NotificationDrawer.tsx +195 -0
  15. package/src/components/OrderCard.tsx +164 -99
  16. package/src/components/ProductReviewsSection.tsx +30 -0
  17. package/src/components/RatingDistribution.tsx +86 -0
  18. package/src/components/ReviewCard.tsx +59 -0
  19. package/src/components/ReviewForm.tsx +207 -0
  20. package/src/components/ReviewPromptBanner.tsx +98 -0
  21. package/src/components/ReviewsList.tsx +151 -0
  22. package/src/components/StarRating.tsx +98 -0
  23. package/src/hooks/useDiscounts.ts +7 -0
  24. package/src/hooks/useOrders.ts +15 -0
  25. package/src/hooks/useReviews.ts +230 -0
  26. package/src/hooks/useStoreCapabilities.ts +87 -0
  27. package/src/index.ts +29 -0
  28. package/src/lib/Apis/apis/auth-api.ts +19 -7
  29. package/src/lib/Apis/apis/categories-api.ts +97 -0
  30. package/src/lib/Apis/apis/discounts-api.ts +23 -72
  31. package/src/lib/Apis/apis/notifications-api.ts +196 -231
  32. package/src/lib/Apis/apis/products-api.ts +181 -0
  33. package/src/lib/Apis/apis/review-api.ts +283 -4
  34. package/src/lib/Apis/apis/shipping-api.ts +105 -0
  35. package/src/lib/Apis/apis/stores-api.ts +536 -0
  36. package/src/lib/Apis/apis/sub-categories-api.ts +97 -0
  37. package/src/lib/Apis/apis/users-api.ts +8 -8
  38. package/src/lib/Apis/models/address-created-request.ts +0 -12
  39. package/src/lib/Apis/models/address.ts +0 -12
  40. package/src/lib/Apis/models/api-key-info-dto.ts +49 -0
  41. package/src/lib/Apis/models/bulk-channel-toggle-dto.ts +52 -0
  42. package/src/lib/Apis/models/cart-body-populated.ts +3 -3
  43. package/src/lib/Apis/models/channel-settings-dto.ts +39 -0
  44. package/src/lib/Apis/models/{discount-paginated-response.ts → completed-order-dto.ts} +21 -16
  45. package/src/lib/Apis/models/create-address-dto.ts +0 -12
  46. package/src/lib/Apis/models/create-discount-dto.ts +31 -100
  47. package/src/lib/Apis/models/create-review-dto.ts +4 -4
  48. package/src/lib/Apis/models/create-shippo-account-dto.ts +45 -0
  49. package/src/lib/Apis/models/create-store-address-dto.ts +0 -12
  50. package/src/lib/Apis/models/create-store-dto-settings.ts +51 -0
  51. package/src/lib/Apis/models/create-store-dto.ts +13 -0
  52. package/src/lib/Apis/models/create-variant-dto.ts +0 -6
  53. package/src/lib/Apis/models/discount.ts +37 -106
  54. package/src/lib/Apis/models/discounts-insights-dto.ts +12 -0
  55. package/src/lib/Apis/models/index.ts +24 -7
  56. package/src/lib/Apis/models/{manual-discount.ts → manual-discount-dto.ts} +10 -10
  57. package/src/lib/Apis/models/manual-order-dto.ts +3 -3
  58. package/src/lib/Apis/models/populated-discount.ts +41 -109
  59. package/src/lib/Apis/models/preference-update-item.ts +59 -0
  60. package/src/lib/Apis/models/product-light-dto.ts +40 -0
  61. package/src/lib/Apis/models/product-variant.ts +0 -6
  62. package/src/lib/Apis/models/reorder-categories-dto.ts +27 -0
  63. package/src/lib/Apis/models/reorder-products-dto.ts +49 -0
  64. package/src/lib/Apis/models/{check-notifications-response-dto.ts → reorder-products-success-response-dto.ts} +7 -7
  65. package/src/lib/Apis/models/reorder-subcategories-dto.ts +33 -0
  66. package/src/lib/Apis/models/reorder-success-response-dto.ts +33 -0
  67. package/src/lib/Apis/models/review-status-dto.ts +34 -0
  68. package/src/lib/Apis/models/review.ts +9 -3
  69. package/src/lib/Apis/models/reviewable-order-dto.ts +58 -0
  70. package/src/lib/Apis/models/reviewable-product-dto.ts +81 -0
  71. package/src/lib/Apis/models/shipment-with-order.ts +18 -0
  72. package/src/lib/Apis/models/shipment.ts +18 -0
  73. package/src/lib/Apis/models/shippo-account-response-dto.ts +51 -0
  74. package/src/lib/Apis/models/store-api-keys-response-dto.ts +34 -0
  75. package/src/lib/Apis/models/store-capabilities-dto.ts +63 -0
  76. package/src/lib/Apis/models/store-entity.ts +13 -0
  77. package/src/lib/Apis/models/store.ts +13 -0
  78. package/src/lib/Apis/models/update-address-dto.ts +0 -12
  79. package/src/lib/Apis/models/update-api-keys-dto.ts +39 -0
  80. package/src/lib/Apis/models/update-discount-dto.ts +31 -100
  81. package/src/lib/Apis/models/update-manual-shipment-status-dto.ts +47 -0
  82. package/src/lib/Apis/models/update-notification-settings-dto.ts +28 -0
  83. package/src/lib/Apis/models/update-review-dto.ts +4 -4
  84. package/src/lib/Apis/models/update-store-dto.ts +13 -0
  85. package/src/lib/Apis/models/update-variant-dto.ts +0 -6
  86. package/src/lib/Apis/models/{pick-type-class.ts → variant-light-dto.ts} +20 -14
  87. package/src/lib/utils/discount.ts +155 -0
  88. package/src/lib/validations/discount.ts +11 -0
  89. package/src/providers/CartProvider.tsx +2 -2
  90. package/src/providers/DiscountProvider.tsx +97 -0
  91. package/src/providers/EcommerceProvider.tsx +13 -5
  92. package/src/providers/NotificationCenterProvider.tsx +436 -0
  93. package/src/screens/CartScreen.tsx +1 -1
  94. package/src/screens/CheckoutScreen.tsx +402 -290
  95. package/src/screens/NotificationSettingsScreen.tsx +413 -0
  96. package/src/screens/OrderDetailScreen.tsx +283 -0
  97. package/src/screens/OrderReviewsScreen.tsx +308 -0
  98. package/src/screens/OrdersScreen.tsx +31 -7
  99. package/src/screens/ProductDetailScreen.tsx +24 -11
  100. package/src/screens/ProfileScreen.tsx +5 -0
  101. package/src/screens/ResetPasswordScreen.tsx +10 -4
  102. package/src/lib/Apis/models/create-notification-dto.ts +0 -75
  103. package/src/lib/Apis/models/notification.ts +0 -93
  104. 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
+ }
@@ -0,0 +1,87 @@
1
+ 'use client';
2
+
3
+ import { useCallback, useEffect, useState } from 'react';
4
+ import { StoreCapabilitiesDto, StoresApi } from '@/lib/Apis';
5
+ import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
6
+ import { getCurrentConfig } from '@/lib/api-adapter/config';
7
+
8
+ interface UseStoreCapabilitiesReturn {
9
+ capabilities: StoreCapabilitiesDto | null;
10
+ isLoading: boolean;
11
+ error: Error | null;
12
+ refresh: () => Promise<void>;
13
+ // Computed convenience properties
14
+ showCardPayment: boolean;
15
+ showShippoDelivery: boolean;
16
+ showCustomDelivery: boolean;
17
+ }
18
+
19
+ // Cache to avoid redundant API calls across components
20
+ let cachedCapabilities: StoreCapabilitiesDto | null = null;
21
+ let cacheStoreId: string | null = null;
22
+
23
+ export function useStoreCapabilities(): UseStoreCapabilitiesReturn {
24
+ const [capabilities, setCapabilities] = useState<StoreCapabilitiesDto | null>(cachedCapabilities);
25
+ const [isLoading, setIsLoading] = useState<boolean>(!cachedCapabilities);
26
+ const [error, setError] = useState<Error | null>(null);
27
+
28
+ const fetchCapabilities = useCallback(async (forceRefresh = false) => {
29
+ try {
30
+ const config = getCurrentConfig();
31
+ const storeId = config?.storeId;
32
+
33
+ if (!storeId) {
34
+ setError(new Error('Store ID not configured'));
35
+ setIsLoading(false);
36
+ return;
37
+ }
38
+
39
+ // Use cache if available and for the same store
40
+ if (!forceRefresh && cachedCapabilities && cacheStoreId === storeId) {
41
+ setCapabilities(cachedCapabilities);
42
+ setIsLoading(false);
43
+ return;
44
+ }
45
+
46
+ setIsLoading(true);
47
+ setError(null);
48
+
49
+ const api = new StoresApi(AXIOS_CONFIG);
50
+ const response = await api.getStoreCapabilities(storeId);
51
+
52
+ // Update cache
53
+ cachedCapabilities = response.data;
54
+ cacheStoreId = storeId;
55
+
56
+ setCapabilities(response.data);
57
+ } catch (err) {
58
+ console.error('Failed to fetch store capabilities:', err);
59
+ setError(err instanceof Error ? err : new Error('Failed to fetch store capabilities'));
60
+ } finally {
61
+ setIsLoading(false);
62
+ }
63
+ }, []);
64
+
65
+ const refresh = useCallback(async () => {
66
+ await fetchCapabilities(true);
67
+ }, [fetchCapabilities]);
68
+
69
+ useEffect(() => {
70
+ fetchCapabilities();
71
+ }, [fetchCapabilities]);
72
+
73
+ // Computed convenience properties based on the logic from the API guide
74
+ const showCardPayment = Boolean(capabilities?.hasStripeKey && capabilities?.cardPaymentEnabled);
75
+ const showShippoDelivery = Boolean(capabilities?.hasShippoKey && capabilities?.shippoDeliveryEnabled);
76
+ const showCustomDelivery = Boolean(capabilities?.customDeliveryEnabled);
77
+
78
+ return {
79
+ capabilities,
80
+ isLoading,
81
+ error,
82
+ refresh,
83
+ showCardPayment,
84
+ showShippoDelivery,
85
+ showCustomDelivery,
86
+ };
87
+ }
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';
@@ -45,6 +61,16 @@ export { Skeleton, ProductCardSkeleton, OrderCardSkeleton } from './components/u
45
61
  export { useProducts, useProduct, useCategories } from './hooks/useProducts';
46
62
  export { useOrders, useOrder, useCurrentOrders } from './hooks/useOrders';
47
63
  export { useAddresses } from './hooks/useAddresses';
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';
48
74
 
49
75
 
50
76
  // API Adapter (for advanced usage)
@@ -58,6 +84,9 @@ export type {
58
84
  OrderStatus,
59
85
  } from './lib/types';
60
86
 
87
+ // Export all API types (generated from Swagger)
88
+ export * from './lib/Apis/models';
89
+
61
90
  // Utils
62
91
  export { formatPrice, formatDate, truncate, getInitials } from './lib/utils/format';
63
92
  export { generateColorShades, hexToRgb } from './lib/utils/colors';
@@ -189,10 +189,11 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
189
189
  * @summary Reset user password
190
190
  * @param {string} newPassword
191
191
  * @param {string} token
192
+ * @param {string} xStoreKey
192
193
  * @param {*} [options] Override http request option.
193
194
  * @throws {RequiredError}
194
195
  */
195
- resetPassword: async (newPassword: string, token: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
196
+ resetPassword: async (newPassword: string, token: string, xStoreKey: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
196
197
  // verify required parameter 'newPassword' is not null or undefined
197
198
  if (newPassword === null || newPassword === undefined) {
198
199
  throw new RequiredError('newPassword','Required parameter newPassword was null or undefined when calling resetPassword.');
@@ -201,6 +202,10 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
201
202
  if (token === null || token === undefined) {
202
203
  throw new RequiredError('token','Required parameter token was null or undefined when calling resetPassword.');
203
204
  }
205
+ // verify required parameter 'xStoreKey' is not null or undefined
206
+ if (xStoreKey === null || xStoreKey === undefined) {
207
+ throw new RequiredError('xStoreKey','Required parameter xStoreKey was null or undefined when calling resetPassword.');
208
+ }
204
209
  const localVarPath = `/auth/reset-password`;
205
210
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
206
211
  const localVarUrlObj = new URL(localVarPath, 'https://example.com');
@@ -228,6 +233,10 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
228
233
  localVarHeaderParameter['token'] = String(token);
229
234
  }
230
235
 
236
+ if (xStoreKey !== undefined && xStoreKey !== null) {
237
+ localVarHeaderParameter['x-store-key'] = String(xStoreKey);
238
+ }
239
+
231
240
  const query = new URLSearchParams(localVarUrlObj.search);
232
241
  for (const key in localVarQueryParameter) {
233
242
  query.set(key, localVarQueryParameter[key]);
@@ -606,11 +615,12 @@ export const AuthApiFp = function(configuration?: Configuration) {
606
615
  * @summary Reset user password
607
616
  * @param {string} newPassword
608
617
  * @param {string} token
618
+ * @param {string} xStoreKey
609
619
  * @param {*} [options] Override http request option.
610
620
  * @throws {RequiredError}
611
621
  */
612
- async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
613
- const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).resetPassword(newPassword, token, options);
622
+ async resetPassword(newPassword: string, token: string, xStoreKey: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
623
+ const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).resetPassword(newPassword, token, xStoreKey, options);
614
624
  return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
615
625
  const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
616
626
  return axios.request(axiosRequestArgs);
@@ -744,11 +754,12 @@ export const AuthApiFactory = function (configuration?: Configuration, basePath?
744
754
  * @summary Reset user password
745
755
  * @param {string} newPassword
746
756
  * @param {string} token
757
+ * @param {string} xStoreKey
747
758
  * @param {*} [options] Override http request option.
748
759
  * @throws {RequiredError}
749
760
  */
750
- async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
751
- return AuthApiFp(configuration).resetPassword(newPassword, token, options).then((request) => request(axios, basePath));
761
+ async resetPassword(newPassword: string, token: string, xStoreKey: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
762
+ return AuthApiFp(configuration).resetPassword(newPassword, token, xStoreKey, options).then((request) => request(axios, basePath));
752
763
  },
753
764
  /**
754
765
  *
@@ -858,12 +869,13 @@ export class AuthApi extends BaseAPI {
858
869
  * @summary Reset user password
859
870
  * @param {string} newPassword
860
871
  * @param {string} token
872
+ * @param {string} xStoreKey
861
873
  * @param {*} [options] Override http request option.
862
874
  * @throws {RequiredError}
863
875
  * @memberof AuthApi
864
876
  */
865
- public async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
866
- return AuthApiFp(this.configuration).resetPassword(newPassword, token, options).then((request) => request(this.axios, this.basePath));
877
+ public async resetPassword(newPassword: string, token: string, xStoreKey: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
878
+ return AuthApiFp(this.configuration).resetPassword(newPassword, token, xStoreKey, options).then((request) => request(this.axios, this.basePath));
867
879
  }
868
880
  /**
869
881
  *
@@ -22,6 +22,8 @@ import { CategoryFilters } from '../models';
22
22
  import { CategoryPopulated } from '../models';
23
23
  import { CategorysHeadlinesResponseDTO } from '../models';
24
24
  import { CreateCategoryDto } from '../models';
25
+ import { ReorderCategoriesDto } from '../models';
26
+ import { ReorderSuccessResponseDto } from '../models';
25
27
  import { UpdateCategoryDto } from '../models';
26
28
  /**
27
29
  * CategoriesApi - axios parameter creator
@@ -377,6 +379,66 @@ export const CategoriesApiAxiosParamCreator = function (configuration?: Configur
377
379
  options: localVarRequestOptions,
378
380
  };
379
381
  },
382
+ /**
383
+ *
384
+ * @summary Reorder categories
385
+ * @param {ReorderCategoriesDto} body
386
+ * @param {*} [options] Override http request option.
387
+ * @throws {RequiredError}
388
+ */
389
+ reorderCategories: async (body: ReorderCategoriesDto, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
390
+ // verify required parameter 'body' is not null or undefined
391
+ if (body === null || body === undefined) {
392
+ throw new RequiredError('body','Required parameter body was null or undefined when calling reorderCategories.');
393
+ }
394
+ const localVarPath = `/categories/reorder`;
395
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
396
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
397
+ let baseOptions;
398
+ if (configuration) {
399
+ baseOptions = configuration.baseOptions;
400
+ }
401
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options};
402
+ const localVarHeaderParameter = {} as any;
403
+ const localVarQueryParameter = {} as any;
404
+
405
+ // authentication bearer required
406
+ // http bearer authentication required
407
+ if (configuration && configuration.accessToken) {
408
+ const accessToken = typeof configuration.accessToken === 'function'
409
+ ? await configuration.accessToken()
410
+ : await configuration.accessToken;
411
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
412
+ }
413
+
414
+ // authentication x-store-key required
415
+ if (configuration && configuration.apiKey) {
416
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
417
+ ? await configuration.apiKey("x-store-key")
418
+ : await configuration.apiKey;
419
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
420
+ }
421
+
422
+ localVarHeaderParameter['Content-Type'] = 'application/json';
423
+
424
+ const query = new URLSearchParams(localVarUrlObj.search);
425
+ for (const key in localVarQueryParameter) {
426
+ query.set(key, localVarQueryParameter[key]);
427
+ }
428
+ for (const key in options.params) {
429
+ query.set(key, options.params[key]);
430
+ }
431
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
432
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
433
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
434
+ const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
435
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
436
+
437
+ return {
438
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
439
+ options: localVarRequestOptions,
440
+ };
441
+ },
380
442
  /**
381
443
  *
382
444
  * @summary Update category by id
@@ -537,6 +599,20 @@ export const CategoriesApiFp = function(configuration?: Configuration) {
537
599
  return axios.request(axiosRequestArgs);
538
600
  };
539
601
  },
602
+ /**
603
+ *
604
+ * @summary Reorder categories
605
+ * @param {ReorderCategoriesDto} body
606
+ * @param {*} [options] Override http request option.
607
+ * @throws {RequiredError}
608
+ */
609
+ async reorderCategories(body: ReorderCategoriesDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ReorderSuccessResponseDto>>> {
610
+ const localVarAxiosArgs = await CategoriesApiAxiosParamCreator(configuration).reorderCategories(body, options);
611
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
612
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
613
+ return axios.request(axiosRequestArgs);
614
+ };
615
+ },
540
616
  /**
541
617
  *
542
618
  * @summary Update category by id
@@ -622,6 +698,16 @@ export const CategoriesApiFactory = function (configuration?: Configuration, bas
622
698
  async getSingleCategory(id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<CategoryPopulated>> {
623
699
  return CategoriesApiFp(configuration).getSingleCategory(id, options).then((request) => request(axios, basePath));
624
700
  },
701
+ /**
702
+ *
703
+ * @summary Reorder categories
704
+ * @param {ReorderCategoriesDto} body
705
+ * @param {*} [options] Override http request option.
706
+ * @throws {RequiredError}
707
+ */
708
+ async reorderCategories(body: ReorderCategoriesDto, options?: AxiosRequestConfig): Promise<AxiosResponse<ReorderSuccessResponseDto>> {
709
+ return CategoriesApiFp(configuration).reorderCategories(body, options).then((request) => request(axios, basePath));
710
+ },
625
711
  /**
626
712
  *
627
713
  * @summary Update category by id
@@ -710,6 +796,17 @@ export class CategoriesApi extends BaseAPI {
710
796
  public async getSingleCategory(id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<CategoryPopulated>> {
711
797
  return CategoriesApiFp(this.configuration).getSingleCategory(id, options).then((request) => request(this.axios, this.basePath));
712
798
  }
799
+ /**
800
+ *
801
+ * @summary Reorder categories
802
+ * @param {ReorderCategoriesDto} body
803
+ * @param {*} [options] Override http request option.
804
+ * @throws {RequiredError}
805
+ * @memberof CategoriesApi
806
+ */
807
+ public async reorderCategories(body: ReorderCategoriesDto, options?: AxiosRequestConfig) : Promise<AxiosResponse<ReorderSuccessResponseDto>> {
808
+ return CategoriesApiFp(this.configuration).reorderCategories(body, options).then((request) => request(this.axios, this.basePath));
809
+ }
713
810
  /**
714
811
  *
715
812
  * @summary Update category by id