hey-pharmacist-ecommerce 1.1.28 → 1.1.30

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 (91) hide show
  1. package/dist/index.d.mts +10552 -1370
  2. package/dist/index.d.ts +10552 -1370
  3. package/dist/index.js +4696 -1281
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +4640 -1283
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/AccountOrdersTab.tsx +1 -1
  9. package/src/components/AccountSettingsTab.tsx +88 -6
  10. package/src/components/CartItem.tsx +1 -1
  11. package/src/components/Header.tsx +8 -2
  12. package/src/components/OrderCard.tsx +4 -4
  13. package/src/components/ProductCard.tsx +59 -42
  14. package/src/components/QuickViewModal.tsx +13 -13
  15. package/src/hooks/useAddresses.ts +4 -1
  16. package/src/hooks/usePaymentMethods.ts +26 -31
  17. package/src/hooks/useProducts.ts +63 -64
  18. package/src/hooks/useStoreCapabilities.ts +87 -0
  19. package/src/hooks/useWishlistProducts.ts +4 -5
  20. package/src/index.ts +6 -0
  21. package/src/lib/Apis/api.ts +0 -1
  22. package/src/lib/Apis/apis/auth-api.ts +37 -36
  23. package/src/lib/Apis/apis/categories-api.ts +97 -0
  24. package/src/lib/Apis/apis/products-api.ts +942 -405
  25. package/src/lib/Apis/apis/shipping-api.ts +105 -0
  26. package/src/lib/Apis/apis/stores-api.ts +356 -0
  27. package/src/lib/Apis/apis/sub-categories-api.ts +97 -0
  28. package/src/lib/Apis/apis/users-api.ts +8 -8
  29. package/src/lib/Apis/models/address-created-request.ts +0 -12
  30. package/src/lib/Apis/models/address.ts +0 -12
  31. package/src/lib/Apis/models/api-key-info-dto.ts +49 -0
  32. package/src/lib/Apis/models/category-populated.ts +0 -12
  33. package/src/lib/Apis/models/category-sub-category-populated.ts +2 -2
  34. package/src/lib/Apis/models/category.ts +0 -18
  35. package/src/lib/Apis/models/{table-cell-dto.ts → change-password-dto.ts} +6 -6
  36. package/src/lib/Apis/models/create-address-dto.ts +0 -12
  37. package/src/lib/Apis/models/create-discount-dto.ts +0 -8
  38. package/src/lib/Apis/models/create-product-dto.ts +30 -23
  39. package/src/lib/Apis/models/create-store-address-dto.ts +0 -12
  40. package/src/lib/Apis/models/create-store-dto-settings.ts +51 -0
  41. package/src/lib/Apis/models/create-store-dto.ts +7 -0
  42. package/src/lib/Apis/models/create-sub-category-dto.ts +6 -0
  43. package/src/lib/Apis/models/create-variant-dto.ts +26 -32
  44. package/src/lib/Apis/models/discount.ts +0 -8
  45. package/src/lib/Apis/models/index.ts +16 -7
  46. package/src/lib/Apis/models/paginated-products-dto.ts +6 -6
  47. package/src/lib/Apis/models/populated-discount.ts +0 -8
  48. package/src/lib/Apis/models/product-summary.ts +69 -0
  49. package/src/lib/Apis/models/product-variant.ts +31 -68
  50. package/src/lib/Apis/models/product.ts +138 -0
  51. package/src/lib/Apis/models/products-insights-dto.ts +12 -0
  52. package/src/lib/Apis/models/reorder-categories-dto.ts +27 -0
  53. package/src/lib/Apis/models/reorder-products-dto.ts +49 -0
  54. package/src/lib/Apis/models/{table-dto.ts → reorder-products-success-response-dto.ts} +8 -9
  55. package/src/lib/Apis/models/reorder-subcategories-dto.ts +33 -0
  56. package/src/lib/Apis/models/{shallow-parent-category-dto.ts → reorder-success-response-dto.ts} +7 -7
  57. package/src/lib/Apis/models/shipment-with-order.ts +18 -0
  58. package/src/lib/Apis/models/shipment.ts +18 -0
  59. package/src/lib/Apis/models/single-product-media.ts +0 -12
  60. package/src/lib/Apis/models/store-api-keys-response-dto.ts +34 -0
  61. package/src/lib/Apis/models/store-capabilities-dto.ts +63 -0
  62. package/src/lib/Apis/models/store-entity.ts +7 -0
  63. package/src/lib/Apis/models/store.ts +7 -0
  64. package/src/lib/Apis/models/sub-category.ts +6 -12
  65. package/src/lib/Apis/models/update-address-dto.ts +0 -12
  66. package/src/lib/Apis/models/update-api-keys-dto.ts +39 -0
  67. package/src/lib/Apis/models/update-discount-dto.ts +0 -8
  68. package/src/lib/Apis/models/update-manual-shipment-status-dto.ts +47 -0
  69. package/src/lib/Apis/models/update-product-dto.ts +30 -19
  70. package/src/lib/Apis/models/update-store-dto.ts +7 -0
  71. package/src/lib/Apis/models/update-sub-category-dto.ts +6 -0
  72. package/src/lib/Apis/models/{update-product-variant-dto.ts → update-variant-dto.ts} +46 -46
  73. package/src/lib/Apis/models/variant-id-inventory-body.ts +27 -0
  74. package/src/lib/api-adapter/config.ts +53 -0
  75. package/src/lib/validations/address.ts +1 -1
  76. package/src/providers/FavoritesProvider.tsx +5 -5
  77. package/src/providers/WishlistProvider.tsx +4 -4
  78. package/src/screens/CartScreen.tsx +1 -1
  79. package/src/screens/ChangePasswordScreen.tsx +2 -6
  80. package/src/screens/CheckoutScreen.tsx +402 -288
  81. package/src/screens/ForgotPasswordScreen.tsx +153 -0
  82. package/src/screens/ProductDetailScreen.tsx +51 -60
  83. package/src/screens/RegisterScreen.tsx +31 -31
  84. package/src/screens/ResetPasswordScreen.tsx +208 -0
  85. package/src/screens/SearchResultsScreen.tsx +264 -26
  86. package/src/screens/ShopScreen.tsx +42 -45
  87. package/src/screens/WishlistScreen.tsx +35 -31
  88. package/src/lib/Apis/apis/product-variants-api.ts +0 -552
  89. package/src/lib/Apis/models/create-single-variant-product-dto.ts +0 -154
  90. package/src/lib/Apis/models/extended-product-dto.ts +0 -206
  91. package/src/lib/Apis/models/frequently-bought-product-dto.ts +0 -71
@@ -1,79 +1,78 @@
1
- import { useState, useEffect, useCallback } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
3
- import { CategoriesApi, CategoryPopulated, ExtendedProductDTO, ProductsApi } from '@/lib/Apis';
3
+ import { CategoriesApi, CategoryPopulated, ProductsApi, Product } from '@/lib/Apis';
4
4
  import { ProductFilters } from '@/lib/types';
5
+ import { useQuery } from '@tanstack/react-query';
6
+
7
+ export enum SortOrder {
8
+ Asc = "asc",
9
+ Desc = "desc",
10
+ }
5
11
 
6
12
  export function useProducts(filters?: ProductFilters, page: number = 1, limit: number = 20) {
7
- const [products, setProducts] = useState<ExtendedProductDTO[]>([]);
8
- const [isLoading, setIsLoading] = useState(true);
9
- const [error, setError] = useState<Error | null>(null);
10
- const [pagination, setPagination] = useState({
11
- page: 1,
12
- limit: 20,
13
- total: 0,
14
- totalPages: 0,
15
- });
13
+ const { data, isLoading, error, refetch } = useQuery({
14
+ queryKey: [
15
+ "products",
16
+ filters?.search,
17
+ filters?.category,
18
+ filters?.subCategory,
19
+ filters?.maxPrice,
20
+ filters?.minPrice,
21
+ filters?.inStock,
22
+ page,
23
+ limit
24
+ ],
25
+ queryFn: async () => {
26
+ const response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
27
+ filters?.search ?? "", // searchTerm
28
+ filters?.maxPrice, // maxPrice
29
+ filters?.minPrice, // minPrice
30
+ undefined, // brandFilter
31
+ filters?.inStock !== undefined ? (filters.inStock ? 'in-stock' : 'out-of-stock') : undefined, // availability
32
+ "createdAt", // sort
33
+ filters?.subCategory, // subCategoryId
34
+ filters?.category, // categoryId
35
+ true, // isActive
36
+ limit, // limit
37
+ page // page
38
+ );
16
39
 
17
- const fetchProducts = useCallback(async () => {
18
- setIsLoading(true);
19
- setError(null);
20
- try {
21
- let response;
22
- if (filters?.subCategory) {
23
- response = await new ProductsApi(AXIOS_CONFIG).getAllProducts(
24
- filters.subCategory,
25
- filters?.search,
26
- filters?.maxPrice,
27
- filters?.minPrice,
28
- undefined, // brandFilter
29
- filters?.inStock !== undefined ? (filters.inStock ? 'in-stock' : 'out-of-stock') : undefined,
30
- undefined, // sort
31
- true, // includeNoVariantProducts
32
- true, // isActive
33
- limit,
34
- page
35
- );
36
- } else {
37
- response = await new ProductsApi(AXIOS_CONFIG).getAllProductsForStore(
38
- filters?.search,
39
- undefined, // productType
40
- filters?.category,
41
- filters?.maxPrice,
42
- filters?.minPrice,
43
- undefined, // brandFilter
44
- filters?.inStock !== undefined ? (filters.inStock ? 'in-stock' : 'out-of-stock') : undefined,
45
- undefined, // sort
46
- true, // includeNoVariantProducts
47
- true, // isActive
48
- limit,
49
- page
50
- );
51
- }
52
- setProducts(response.data.data);
53
- setPagination({
54
- page: response.data.currentPage || page,
55
- limit: response.data.limit || limit,
56
- total: products.length, // Use filtered count
57
- totalPages: Math.ceil(products.length / limit),
58
- });
59
- } catch (err) {
60
- setError(err as Error);
61
- }
62
- setIsLoading(false);
63
- }, [filters, page, limit]);
40
+ const res = response.data;
41
+ console.log("Products API response:", res);
64
42
 
65
- useEffect(() => {
66
- fetchProducts();
67
- }, [fetchProducts]);
43
+ return {
44
+ products: res.data || [],
45
+ pagination: {
46
+ page: res.currentPage || page,
47
+ limit: res.limit || limit,
48
+ total: res.totalItems || 0,
49
+ totalPages: res.totalPages || 0,
50
+ },
51
+ };
52
+ },
53
+ });
68
54
 
69
- return { products, isLoading, error, pagination };
55
+ console.log("useProducts data:", data);
56
+
57
+ return {
58
+ products: data?.products || [],
59
+ isLoading,
60
+ error: error as Error | null,
61
+ pagination: data?.pagination || {
62
+ page: 1,
63
+ limit: 20,
64
+ total: 0,
65
+ totalPages: 0,
66
+ },
67
+ refetch,
68
+ };
70
69
  }
71
70
 
72
71
  export function useProduct(id: string) {
73
- const [product, setProduct] = useState<ExtendedProductDTO | null>(null);
72
+ const [product, setProduct] = useState<Product | null>(null);
74
73
  const [isLoading, setIsLoading] = useState(true);
75
74
  const [error, setError] = useState<Error | null>(null);
76
-
75
+ console.log("product", product);
77
76
  useEffect(() => {
78
77
  const fetchProduct = async () => {
79
78
  setIsLoading(true);
@@ -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
+ }
@@ -1,12 +1,11 @@
1
1
  'use client';
2
2
 
3
3
  import { useCallback, useEffect, useMemo, useState } from 'react';
4
- import { ProductsApi } from '@/lib/Apis';
4
+ import { ProductsApi, Product } from '@/lib/Apis';
5
5
  import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
6
- import { ExtendedProductDTO } from '@/lib/Apis/models/extended-product-dto';
7
6
 
8
7
  interface UseWishlistProductsResult {
9
- products: ExtendedProductDTO[];
8
+ products: Product[];
10
9
  isLoading: boolean;
11
10
  error: Error | null;
12
11
  refetch: () => Promise<void>;
@@ -17,10 +16,10 @@ interface UseWishlistProductsResult {
17
16
  * Minimises duplicate requests by caching results during the component lifecycle.
18
17
  */
19
18
  export function useWishlistProducts(productIds: string[] = []): UseWishlistProductsResult {
20
- const [products, setProducts] = useState<ExtendedProductDTO[]>([]);
19
+ const [products, setProducts] = useState<Product[]>([]);
21
20
  const [isLoading, setIsLoading] = useState<boolean>(false);
22
21
  const [error, setError] = useState<Error | null>(null);
23
- const [cache] = useState<Map<string, ExtendedProductDTO>>(() => new Map());
22
+ const [cache] = useState<Map<string, Product>>(() => new Map());
24
23
 
25
24
  const uniqueIds = useMemo(
26
25
  () => Array.from(new Set((productIds || []).filter(Boolean))),
package/src/index.ts CHANGED
@@ -15,6 +15,8 @@ export { CartScreen } from './screens/CartScreen';
15
15
  export { CheckoutScreen } from './screens/CheckoutScreen';
16
16
  export { LoginScreen } from './screens/LoginScreen';
17
17
  export { RegisterScreen } from './screens/RegisterScreen';
18
+ export { ForgotPasswordScreen } from './screens/ForgotPasswordScreen';
19
+ export { ResetPasswordScreen } from './screens/ResetPasswordScreen';
18
20
  export { default as ProfileScreen } from './screens/ProfileScreen';
19
21
  export { OrdersScreen } from './screens/OrdersScreen';
20
22
  export { CurrentOrdersScreen } from './screens/CurrentOrdersScreen';
@@ -43,6 +45,7 @@ export { Skeleton, ProductCardSkeleton, OrderCardSkeleton } from './components/u
43
45
  export { useProducts, useProduct, useCategories } from './hooks/useProducts';
44
46
  export { useOrders, useOrder, useCurrentOrders } from './hooks/useOrders';
45
47
  export { useAddresses } from './hooks/useAddresses';
48
+ export { useStoreCapabilities } from './hooks/useStoreCapabilities';
46
49
 
47
50
 
48
51
  // API Adapter (for advanced usage)
@@ -56,6 +59,9 @@ export type {
56
59
  OrderStatus,
57
60
  } from './lib/types';
58
61
 
62
+ // Export all API types (generated from Swagger)
63
+ export * from './lib/Apis/models';
64
+
59
65
  // Utils
60
66
  export { formatPrice, formatDate, truncate, getInitials } from './lib/utils/format';
61
67
  export { generateColorShades, hexToRgb } from './lib/utils/colors';
@@ -25,7 +25,6 @@ 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';
28
- export * from './apis/product-variants-api';
29
28
  export * from './apis/products-api';
30
29
  export * from './apis/review-api';
31
30
  export * from './apis/shipping-api';
@@ -16,6 +16,7 @@ import { Configuration } from '../configuration';
16
16
  // Some imports not used depending on template conditions
17
17
  // @ts-ignore
18
18
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
19
+ import { ChangePasswordDto } from '../models';
19
20
  import { CreateUserDto } from '../models';
20
21
  import { ForgetPassword } from '../models';
21
22
  import { LoginDto } from '../models';
@@ -84,19 +85,14 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
84
85
  /**
85
86
  *
86
87
  * @summary Change user password
87
- * @param {string} oldPassword
88
- * @param {string} newPassword
88
+ * @param {ChangePasswordDto} body
89
89
  * @param {*} [options] Override http request option.
90
90
  * @throws {RequiredError}
91
91
  */
92
- changePassword: async (oldPassword: string, newPassword: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
93
- // verify required parameter 'oldPassword' is not null or undefined
94
- if (oldPassword === null || oldPassword === undefined) {
95
- throw new RequiredError('oldPassword','Required parameter oldPassword was null or undefined when calling changePassword.');
96
- }
97
- // verify required parameter 'newPassword' is not null or undefined
98
- if (newPassword === null || newPassword === undefined) {
99
- throw new RequiredError('newPassword','Required parameter newPassword was null or undefined when calling changePassword.');
92
+ changePassword: async (body: ChangePasswordDto, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
93
+ // verify required parameter 'body' is not null or undefined
94
+ if (body === null || body === undefined) {
95
+ throw new RequiredError('body','Required parameter body was null or undefined when calling changePassword.');
100
96
  }
101
97
  const localVarPath = `/auth/change-password`;
102
98
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
@@ -117,13 +113,7 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
117
113
  localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
118
114
  }
119
115
 
120
- if (oldPassword !== undefined && oldPassword !== null) {
121
- localVarHeaderParameter['oldPassword'] = String(oldPassword);
122
- }
123
-
124
- if (newPassword !== undefined && newPassword !== null) {
125
- localVarHeaderParameter['newPassword'] = String(newPassword);
126
- }
116
+ localVarHeaderParameter['Content-Type'] = 'application/json';
127
117
 
128
118
  const query = new URLSearchParams(localVarUrlObj.search);
129
119
  for (const key in localVarQueryParameter) {
@@ -135,6 +125,8 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
135
125
  localVarUrlObj.search = (new URLSearchParams(query)).toString();
136
126
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
137
127
  localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
128
+ const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
129
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
138
130
 
139
131
  return {
140
132
  url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
@@ -197,10 +189,11 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
197
189
  * @summary Reset user password
198
190
  * @param {string} newPassword
199
191
  * @param {string} token
192
+ * @param {string} xStoreKey
200
193
  * @param {*} [options] Override http request option.
201
194
  * @throws {RequiredError}
202
195
  */
203
- resetPassword: async (newPassword: string, token: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
196
+ resetPassword: async (newPassword: string, token: string, xStoreKey: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
204
197
  // verify required parameter 'newPassword' is not null or undefined
205
198
  if (newPassword === null || newPassword === undefined) {
206
199
  throw new RequiredError('newPassword','Required parameter newPassword was null or undefined when calling resetPassword.');
@@ -209,6 +202,10 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
209
202
  if (token === null || token === undefined) {
210
203
  throw new RequiredError('token','Required parameter token was null or undefined when calling resetPassword.');
211
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
+ }
212
209
  const localVarPath = `/auth/reset-password`;
213
210
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
214
211
  const localVarUrlObj = new URL(localVarPath, 'https://example.com');
@@ -236,6 +233,10 @@ export const AuthApiAxiosParamCreator = function (configuration?: Configuration)
236
233
  localVarHeaderParameter['token'] = String(token);
237
234
  }
238
235
 
236
+ if (xStoreKey !== undefined && xStoreKey !== null) {
237
+ localVarHeaderParameter['x-store-key'] = String(xStoreKey);
238
+ }
239
+
239
240
  const query = new URLSearchParams(localVarUrlObj.search);
240
241
  for (const key in localVarQueryParameter) {
241
242
  query.set(key, localVarQueryParameter[key]);
@@ -584,13 +585,12 @@ export const AuthApiFp = function(configuration?: Configuration) {
584
585
  /**
585
586
  *
586
587
  * @summary Change user password
587
- * @param {string} oldPassword
588
- * @param {string} newPassword
588
+ * @param {ChangePasswordDto} body
589
589
  * @param {*} [options] Override http request option.
590
590
  * @throws {RequiredError}
591
591
  */
592
- async changePassword(oldPassword: string, newPassword: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
593
- const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(oldPassword, newPassword, options);
592
+ async changePassword(body: ChangePasswordDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
593
+ const localVarAxiosArgs = await AuthApiAxiosParamCreator(configuration).changePassword(body, options);
594
594
  return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
595
595
  const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
596
596
  return axios.request(axiosRequestArgs);
@@ -615,11 +615,12 @@ export const AuthApiFp = function(configuration?: Configuration) {
615
615
  * @summary Reset user password
616
616
  * @param {string} newPassword
617
617
  * @param {string} token
618
+ * @param {string} xStoreKey
618
619
  * @param {*} [options] Override http request option.
619
620
  * @throws {RequiredError}
620
621
  */
621
- async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
622
- 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);
623
624
  return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
624
625
  const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
625
626
  return axios.request(axiosRequestArgs);
@@ -731,13 +732,12 @@ export const AuthApiFactory = function (configuration?: Configuration, basePath?
731
732
  /**
732
733
  *
733
734
  * @summary Change user password
734
- * @param {string} oldPassword
735
- * @param {string} newPassword
735
+ * @param {ChangePasswordDto} body
736
736
  * @param {*} [options] Override http request option.
737
737
  * @throws {RequiredError}
738
738
  */
739
- async changePassword(oldPassword: string, newPassword: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
740
- return AuthApiFp(configuration).changePassword(oldPassword, newPassword, options).then((request) => request(axios, basePath));
739
+ async changePassword(body: ChangePasswordDto, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
740
+ return AuthApiFp(configuration).changePassword(body, options).then((request) => request(axios, basePath));
741
741
  },
742
742
  /**
743
743
  *
@@ -754,11 +754,12 @@ export const AuthApiFactory = function (configuration?: Configuration, basePath?
754
754
  * @summary Reset user password
755
755
  * @param {string} newPassword
756
756
  * @param {string} token
757
+ * @param {string} xStoreKey
757
758
  * @param {*} [options] Override http request option.
758
759
  * @throws {RequiredError}
759
760
  */
760
- async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
761
- 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));
762
763
  },
763
764
  /**
764
765
  *
@@ -844,14 +845,13 @@ export class AuthApi extends BaseAPI {
844
845
  /**
845
846
  *
846
847
  * @summary Change user password
847
- * @param {string} oldPassword
848
- * @param {string} newPassword
848
+ * @param {ChangePasswordDto} body
849
849
  * @param {*} [options] Override http request option.
850
850
  * @throws {RequiredError}
851
851
  * @memberof AuthApi
852
852
  */
853
- public async changePassword(oldPassword: string, newPassword: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
854
- return AuthApiFp(this.configuration).changePassword(oldPassword, newPassword, options).then((request) => request(this.axios, this.basePath));
853
+ public async changePassword(body: ChangePasswordDto, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
854
+ return AuthApiFp(this.configuration).changePassword(body, options).then((request) => request(this.axios, this.basePath));
855
855
  }
856
856
  /**
857
857
  *
@@ -869,12 +869,13 @@ export class AuthApi extends BaseAPI {
869
869
  * @summary Reset user password
870
870
  * @param {string} newPassword
871
871
  * @param {string} token
872
+ * @param {string} xStoreKey
872
873
  * @param {*} [options] Override http request option.
873
874
  * @throws {RequiredError}
874
875
  * @memberof AuthApi
875
876
  */
876
- public async resetPassword(newPassword: string, token: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
877
- 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));
878
879
  }
879
880
  /**
880
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