hey-pharmacist-ecommerce 1.0.5 → 1.0.6
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 +107 -1
- package/dist/index.d.mts +3636 -316
- package/dist/index.d.ts +3636 -316
- package/dist/index.js +6802 -3866
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6756 -3818
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -14
- package/src/components/AddressFormModal.tsx +171 -0
- package/src/components/CartItem.tsx +17 -12
- package/src/components/FilterChips.tsx +195 -0
- package/src/components/Header.tsx +121 -71
- package/src/components/OrderCard.tsx +18 -25
- package/src/components/ProductCard.tsx +209 -72
- package/src/components/ui/Button.tsx +13 -5
- package/src/components/ui/Card.tsx +46 -0
- package/src/hooks/useAddresses.ts +83 -0
- package/src/hooks/useOrders.ts +37 -19
- package/src/hooks/useProducts.ts +55 -63
- package/src/hooks/useWishlistProducts.ts +75 -0
- package/src/index.ts +3 -19
- package/src/lib/Apis/api.ts +1 -0
- package/src/lib/Apis/apis/cart-api.ts +3 -3
- package/src/lib/Apis/apis/inventory-api.ts +0 -108
- package/src/lib/Apis/apis/stores-api.ts +70 -0
- package/src/lib/Apis/apis/wishlist-api.ts +447 -0
- package/src/lib/Apis/models/cart-item-populated.ts +0 -1
- package/src/lib/Apis/models/create-single-variant-product-dto.ts +3 -10
- package/src/lib/Apis/models/create-variant-dto.ts +26 -33
- package/src/lib/Apis/models/extended-product-dto.ts +20 -24
- package/src/lib/Apis/models/index.ts +2 -1
- package/src/lib/Apis/models/order-time-line-dto.ts +49 -0
- package/src/lib/Apis/models/order.ts +3 -8
- package/src/lib/Apis/models/populated-order.ts +3 -8
- package/src/lib/Apis/models/product-variant.ts +29 -0
- package/src/lib/Apis/models/update-product-variant-dto.ts +16 -23
- package/src/lib/Apis/models/wishlist.ts +51 -0
- package/src/lib/Apis/wrapper.ts +18 -7
- package/src/lib/api-adapter/index.ts +0 -12
- package/src/lib/types/index.ts +16 -61
- package/src/lib/utils/colors.ts +7 -4
- package/src/lib/utils/format.ts +1 -1
- package/src/lib/validations/address.ts +14 -0
- package/src/providers/AuthProvider.tsx +61 -31
- package/src/providers/CartProvider.tsx +18 -28
- package/src/providers/EcommerceProvider.tsx +7 -0
- package/src/providers/FavoritesProvider.tsx +86 -0
- package/src/providers/ThemeProvider.tsx +16 -1
- package/src/providers/WishlistProvider.tsx +174 -0
- package/src/screens/AddressesScreen.tsx +484 -0
- package/src/screens/CartScreen.tsx +120 -84
- package/src/screens/CategoriesScreen.tsx +120 -0
- package/src/screens/CheckoutScreen.tsx +919 -241
- package/src/screens/CurrentOrdersScreen.tsx +125 -61
- package/src/screens/HomeScreen.tsx +209 -0
- package/src/screens/LoginScreen.tsx +133 -88
- package/src/screens/NewAddressScreen.tsx +187 -0
- package/src/screens/OrdersScreen.tsx +162 -50
- package/src/screens/ProductDetailScreen.tsx +641 -190
- package/src/screens/ProfileScreen.tsx +192 -116
- package/src/screens/RegisterScreen.tsx +193 -144
- package/src/screens/SearchResultsScreen.tsx +165 -0
- package/src/screens/ShopScreen.tsx +1110 -146
- package/src/screens/WishlistScreen.tsx +428 -0
- package/src/lib/Apis/models/inventory-paginated-response.ts +0 -75
- package/src/lib/api/auth.ts +0 -81
- package/src/lib/api/cart.ts +0 -42
- package/src/lib/api/orders.ts +0 -53
- package/src/lib/api/products.ts +0 -51
- package/src/lib/api-adapter/auth-adapter.ts +0 -196
- package/src/lib/api-adapter/cart-adapter.ts +0 -193
- package/src/lib/api-adapter/mappers.ts +0 -152
- package/src/lib/api-adapter/orders-adapter.ts +0 -195
- package/src/lib/api-adapter/products-adapter.ts +0 -194
package/src/hooks/useProducts.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
|
|
3
|
+
import { CategoriesApi, CategoryPopulated, ExtendedProductDTO, ProductsApi } from '@/lib/Apis';
|
|
4
|
+
import { ProductFilters } from '@/lib/types';
|
|
4
5
|
|
|
5
6
|
export function useProducts(filters?: ProductFilters, page: number = 1, limit: number = 20) {
|
|
6
|
-
const [products, setProducts] = useState<
|
|
7
|
+
const [products, setProducts] = useState<ExtendedProductDTO[]>([]);
|
|
7
8
|
const [isLoading, setIsLoading] = useState(true);
|
|
8
9
|
const [error, setError] = useState<Error | null>(null);
|
|
9
10
|
const [pagination, setPagination] = useState({
|
|
@@ -17,31 +18,59 @@ export function useProducts(filters?: ProductFilters, page: number = 1, limit: n
|
|
|
17
18
|
setIsLoading(true);
|
|
18
19
|
setError(null);
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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: response.data.totalItems || products.length,
|
|
57
|
+
totalPages: response.data.totalPages || 1,
|
|
58
|
+
});
|
|
23
59
|
} catch (err) {
|
|
24
60
|
setError(err as Error);
|
|
25
|
-
} finally {
|
|
26
|
-
setIsLoading(false);
|
|
27
61
|
}
|
|
62
|
+
setIsLoading(false);
|
|
28
63
|
}, [filters, page, limit]);
|
|
29
64
|
|
|
30
65
|
useEffect(() => {
|
|
31
66
|
fetchProducts();
|
|
32
67
|
}, [fetchProducts]);
|
|
33
68
|
|
|
34
|
-
return {
|
|
35
|
-
products,
|
|
36
|
-
isLoading,
|
|
37
|
-
error,
|
|
38
|
-
pagination,
|
|
39
|
-
refetch: fetchProducts,
|
|
40
|
-
};
|
|
69
|
+
return { products, isLoading, error, pagination };
|
|
41
70
|
}
|
|
42
71
|
|
|
43
72
|
export function useProduct(id: string) {
|
|
44
|
-
const [product, setProduct] = useState<
|
|
73
|
+
const [product, setProduct] = useState<ExtendedProductDTO | null>(null);
|
|
45
74
|
const [isLoading, setIsLoading] = useState(true);
|
|
46
75
|
const [error, setError] = useState<Error | null>(null);
|
|
47
76
|
|
|
@@ -50,76 +79,39 @@ export function useProduct(id: string) {
|
|
|
50
79
|
setIsLoading(true);
|
|
51
80
|
setError(null);
|
|
52
81
|
try {
|
|
53
|
-
const response = await
|
|
54
|
-
|
|
55
|
-
setProduct(response.data);
|
|
56
|
-
}
|
|
82
|
+
const response = await new ProductsApi(AXIOS_CONFIG).getSingleProduct(id);
|
|
83
|
+
setProduct(response.data);
|
|
57
84
|
} catch (err) {
|
|
58
85
|
setError(err as Error);
|
|
59
|
-
} finally {
|
|
60
|
-
setIsLoading(false);
|
|
61
86
|
}
|
|
87
|
+
setIsLoading(false);
|
|
62
88
|
};
|
|
63
|
-
|
|
64
|
-
if (id) {
|
|
65
|
-
fetchProduct();
|
|
66
|
-
}
|
|
89
|
+
fetchProduct();
|
|
67
90
|
}, [id]);
|
|
68
91
|
|
|
69
92
|
return { product, isLoading, error };
|
|
70
93
|
}
|
|
71
94
|
|
|
72
|
-
export function useFeaturedProducts(limit: number = 8) {
|
|
73
|
-
const [products, setProducts] = useState<Product[]>([]);
|
|
74
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
75
|
-
const [error, setError] = useState<Error | null>(null);
|
|
76
|
-
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
const fetchFeaturedProducts = async () => {
|
|
79
|
-
setIsLoading(true);
|
|
80
|
-
setError(null);
|
|
81
|
-
try {
|
|
82
|
-
const response = await productsApi.getFeaturedProducts(limit);
|
|
83
|
-
if (response.success) {
|
|
84
|
-
setProducts(response.data);
|
|
85
|
-
}
|
|
86
|
-
} catch (err) {
|
|
87
|
-
setError(err as Error);
|
|
88
|
-
} finally {
|
|
89
|
-
setIsLoading(false);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
fetchFeaturedProducts();
|
|
94
|
-
}, [limit]);
|
|
95
|
-
|
|
96
|
-
return { products, isLoading, error };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
95
|
export function useCategories() {
|
|
100
|
-
const [categories, setCategories] = useState<
|
|
96
|
+
const [categories, setCategories] = useState<CategoryPopulated[]>([]);
|
|
101
97
|
const [isLoading, setIsLoading] = useState(true);
|
|
102
98
|
const [error, setError] = useState<Error | null>(null);
|
|
103
99
|
|
|
104
100
|
useEffect(() => {
|
|
105
101
|
const fetchCategories = async () => {
|
|
106
|
-
setIsLoading(true);
|
|
107
|
-
setError(null);
|
|
108
102
|
try {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
setIsLoading(true);
|
|
104
|
+
setError(null);
|
|
105
|
+
const response = await new CategoriesApi(AXIOS_CONFIG).getAllCategories();
|
|
106
|
+
setCategories(response.data?.data || []);
|
|
113
107
|
} catch (err) {
|
|
114
108
|
setError(err as Error);
|
|
115
109
|
} finally {
|
|
116
110
|
setIsLoading(false);
|
|
117
111
|
}
|
|
118
112
|
};
|
|
119
|
-
|
|
120
113
|
fetchCategories();
|
|
121
114
|
}, []);
|
|
122
115
|
|
|
123
116
|
return { categories, isLoading, error };
|
|
124
|
-
}
|
|
125
|
-
|
|
117
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { ProductsApi } from '@/lib/Apis';
|
|
5
|
+
import { AXIOS_CONFIG } from '@/lib/Apis/wrapper';
|
|
6
|
+
import { ExtendedProductDTO } from '@/lib/Apis/models/extended-product-dto';
|
|
7
|
+
|
|
8
|
+
interface UseWishlistProductsResult {
|
|
9
|
+
products: ExtendedProductDTO[];
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
refetch: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fetches full product details for a given list of wishlist product IDs.
|
|
17
|
+
* Minimises duplicate requests by caching results during the component lifecycle.
|
|
18
|
+
*/
|
|
19
|
+
export function useWishlistProducts(productIds: string[] = []): UseWishlistProductsResult {
|
|
20
|
+
const [products, setProducts] = useState<ExtendedProductDTO[]>([]);
|
|
21
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
22
|
+
const [error, setError] = useState<Error | null>(null);
|
|
23
|
+
const [cache] = useState<Map<string, ExtendedProductDTO>>(() => new Map());
|
|
24
|
+
|
|
25
|
+
const uniqueIds = useMemo(
|
|
26
|
+
() => Array.from(new Set((productIds || []).filter(Boolean))),
|
|
27
|
+
[productIds]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const fetchProducts = useCallback(async () => {
|
|
31
|
+
if (uniqueIds.length === 0) {
|
|
32
|
+
setProducts([]);
|
|
33
|
+
setIsLoading(false);
|
|
34
|
+
setError(null);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setIsLoading(true);
|
|
39
|
+
setError(null);
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const api = new ProductsApi(AXIOS_CONFIG);
|
|
43
|
+
|
|
44
|
+
const results = await Promise.all(
|
|
45
|
+
uniqueIds.map(async (id) => {
|
|
46
|
+
if (cache.has(id)) return cache.get(id)!;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const response = await api.getSingleProduct(id?._id || id || '');
|
|
49
|
+
const product = response.data;
|
|
50
|
+
cache.set(id, product);
|
|
51
|
+
return product;
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
setProducts(results);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
setError(err as Error);
|
|
58
|
+
console.error('Failed to load wishlist products', err);
|
|
59
|
+
} finally {
|
|
60
|
+
setIsLoading(false);
|
|
61
|
+
}
|
|
62
|
+
}, [cache, uniqueIds]);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
fetchProducts();
|
|
66
|
+
}, [fetchProducts]);
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
products,
|
|
70
|
+
isLoading,
|
|
71
|
+
error,
|
|
72
|
+
refetch: fetchProducts,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { RegisterScreen } from './screens/RegisterScreen';
|
|
|
16
16
|
export { ProfileScreen } from './screens/ProfileScreen';
|
|
17
17
|
export { OrdersScreen } from './screens/OrdersScreen';
|
|
18
18
|
export { CurrentOrdersScreen } from './screens/CurrentOrdersScreen';
|
|
19
|
+
export { AddressesScreen } from './screens/AddressesScreen';
|
|
19
20
|
|
|
20
21
|
// Components
|
|
21
22
|
export { Header } from './components/Header';
|
|
@@ -33,14 +34,10 @@ export { Modal } from './components/ui/Modal';
|
|
|
33
34
|
export { Skeleton, ProductCardSkeleton, OrderCardSkeleton } from './components/ui/Skeleton';
|
|
34
35
|
|
|
35
36
|
// Hooks
|
|
36
|
-
export { useProducts, useProduct,
|
|
37
|
+
export { useProducts, useProduct, useCategories } from './hooks/useProducts';
|
|
37
38
|
export { useOrders, useOrder, useCurrentOrders } from './hooks/useOrders';
|
|
39
|
+
export { useAddresses } from './hooks/useAddresses';
|
|
38
40
|
|
|
39
|
-
// API
|
|
40
|
-
export { productsApi } from './lib/api/products';
|
|
41
|
-
export { authApi } from './lib/api/auth';
|
|
42
|
-
export { cartApi } from './lib/api/cart';
|
|
43
|
-
export { ordersApi } from './lib/api/orders';
|
|
44
41
|
|
|
45
42
|
// API Adapter (for advanced usage)
|
|
46
43
|
export { initializeApiAdapter, getApiConfiguration } from './lib/api-adapter';
|
|
@@ -48,24 +45,11 @@ export { initializeApiAdapter, getApiConfiguration } from './lib/api-adapter';
|
|
|
48
45
|
// Types
|
|
49
46
|
export type {
|
|
50
47
|
EcommerceConfig,
|
|
51
|
-
Product,
|
|
52
48
|
ProductFilters,
|
|
53
49
|
Category,
|
|
54
|
-
CartItem as CartItemType,
|
|
55
|
-
Cart,
|
|
56
|
-
Order,
|
|
57
|
-
OrderItem,
|
|
58
50
|
OrderStatus,
|
|
59
|
-
Address,
|
|
60
|
-
User,
|
|
61
|
-
AuthTokens,
|
|
62
|
-
LoginCredentials,
|
|
63
|
-
RegisterData,
|
|
64
|
-
ApiResponse,
|
|
65
|
-
PaginatedResponse,
|
|
66
51
|
} from './lib/types';
|
|
67
52
|
|
|
68
53
|
// Utils
|
|
69
54
|
export { formatPrice, formatDate, truncate, getInitials } from './lib/utils/format';
|
|
70
55
|
export { generateColorShades, hexToRgb } from './lib/utils/colors';
|
|
71
|
-
|
package/src/lib/Apis/api.ts
CHANGED
|
@@ -319,7 +319,7 @@ export const CartApiFp = function(configuration?: Configuration) {
|
|
|
319
319
|
* @param {*} [options] Override http request option.
|
|
320
320
|
* @throws {RequiredError}
|
|
321
321
|
*/
|
|
322
|
-
async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<
|
|
322
|
+
async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<CartResponseDto>>> {
|
|
323
323
|
const localVarAxiosArgs = await CartApiAxiosParamCreator(configuration).handleUserCart(body, options);
|
|
324
324
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
325
325
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
@@ -379,7 +379,7 @@ export const CartApiFactory = function (configuration?: Configuration, basePath?
|
|
|
379
379
|
* @param {*} [options] Override http request option.
|
|
380
380
|
* @throws {RequiredError}
|
|
381
381
|
*/
|
|
382
|
-
async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig): Promise<AxiosResponse<
|
|
382
|
+
async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig): Promise<AxiosResponse<CartResponseDto>> {
|
|
383
383
|
return CartApiFp(configuration).handleUserCart(body, options).then((request) => request(axios, basePath));
|
|
384
384
|
},
|
|
385
385
|
/**
|
|
@@ -435,7 +435,7 @@ export class CartApi extends BaseAPI {
|
|
|
435
435
|
* @throws {RequiredError}
|
|
436
436
|
* @memberof CartApi
|
|
437
437
|
*/
|
|
438
|
-
public async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig) : Promise<AxiosResponse<
|
|
438
|
+
public async handleUserCart(body: CartBodyDTO, options?: AxiosRequestConfig) : Promise<AxiosResponse<CartResponseDto>> {
|
|
439
439
|
return CartApiFp(this.configuration).handleUserCart(body, options).then((request) => request(this.axios, this.basePath));
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
@@ -16,7 +16,6 @@ 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 { InventoryPaginatedResponse } from '../models';
|
|
20
19
|
/**
|
|
21
20
|
* InventoryApi - axios parameter creator
|
|
22
21
|
* @export
|
|
@@ -92,72 +91,6 @@ export const InventoryApiAxiosParamCreator = function (configuration?: Configura
|
|
|
92
91
|
options: localVarRequestOptions,
|
|
93
92
|
};
|
|
94
93
|
},
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* @summary Get Inventory
|
|
98
|
-
* @param {string} [status]
|
|
99
|
-
* @param {number} [page]
|
|
100
|
-
* @param {number} [limit]
|
|
101
|
-
* @param {*} [options] Override http request option.
|
|
102
|
-
* @throws {RequiredError}
|
|
103
|
-
*/
|
|
104
|
-
getInventoryPaginated: async (status?: string, page?: number, limit?: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
105
|
-
const localVarPath = `/inventory`;
|
|
106
|
-
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
107
|
-
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
|
108
|
-
let baseOptions;
|
|
109
|
-
if (configuration) {
|
|
110
|
-
baseOptions = configuration.baseOptions;
|
|
111
|
-
}
|
|
112
|
-
const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
|
|
113
|
-
const localVarHeaderParameter = {} as any;
|
|
114
|
-
const localVarQueryParameter = {} as any;
|
|
115
|
-
|
|
116
|
-
// authentication bearer required
|
|
117
|
-
// http bearer authentication required
|
|
118
|
-
if (configuration && configuration.accessToken) {
|
|
119
|
-
const accessToken = typeof configuration.accessToken === 'function'
|
|
120
|
-
? await configuration.accessToken()
|
|
121
|
-
: await configuration.accessToken;
|
|
122
|
-
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// authentication x-store-key required
|
|
126
|
-
if (configuration && configuration.apiKey) {
|
|
127
|
-
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
128
|
-
? await configuration.apiKey("x-store-key")
|
|
129
|
-
: await configuration.apiKey;
|
|
130
|
-
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (status !== undefined) {
|
|
134
|
-
localVarQueryParameter['status'] = status;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (page !== undefined) {
|
|
138
|
-
localVarQueryParameter['page'] = page;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (limit !== undefined) {
|
|
142
|
-
localVarQueryParameter['limit'] = limit;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const query = new URLSearchParams(localVarUrlObj.search);
|
|
146
|
-
for (const key in localVarQueryParameter) {
|
|
147
|
-
query.set(key, localVarQueryParameter[key]);
|
|
148
|
-
}
|
|
149
|
-
for (const key in options.params) {
|
|
150
|
-
query.set(key, options.params[key]);
|
|
151
|
-
}
|
|
152
|
-
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
|
153
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
154
|
-
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
158
|
-
options: localVarRequestOptions,
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
94
|
/**
|
|
162
95
|
*
|
|
163
96
|
* @summary Update Product inventory
|
|
@@ -251,22 +184,6 @@ export const InventoryApiFp = function(configuration?: Configuration) {
|
|
|
251
184
|
return axios.request(axiosRequestArgs);
|
|
252
185
|
};
|
|
253
186
|
},
|
|
254
|
-
/**
|
|
255
|
-
*
|
|
256
|
-
* @summary Get Inventory
|
|
257
|
-
* @param {string} [status]
|
|
258
|
-
* @param {number} [page]
|
|
259
|
-
* @param {number} [limit]
|
|
260
|
-
* @param {*} [options] Override http request option.
|
|
261
|
-
* @throws {RequiredError}
|
|
262
|
-
*/
|
|
263
|
-
async getInventoryPaginated(status?: string, page?: number, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<InventoryPaginatedResponse>>> {
|
|
264
|
-
const localVarAxiosArgs = await InventoryApiAxiosParamCreator(configuration).getInventoryPaginated(status, page, limit, options);
|
|
265
|
-
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
266
|
-
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
267
|
-
return axios.request(axiosRequestArgs);
|
|
268
|
-
};
|
|
269
|
-
},
|
|
270
187
|
/**
|
|
271
188
|
*
|
|
272
189
|
* @summary Update Product inventory
|
|
@@ -302,18 +219,6 @@ export const InventoryApiFactory = function (configuration?: Configuration, base
|
|
|
302
219
|
async createInventory(variantId: string, count: number, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
|
303
220
|
return InventoryApiFp(configuration).createInventory(variantId, count, options).then((request) => request(axios, basePath));
|
|
304
221
|
},
|
|
305
|
-
/**
|
|
306
|
-
*
|
|
307
|
-
* @summary Get Inventory
|
|
308
|
-
* @param {string} [status]
|
|
309
|
-
* @param {number} [page]
|
|
310
|
-
* @param {number} [limit]
|
|
311
|
-
* @param {*} [options] Override http request option.
|
|
312
|
-
* @throws {RequiredError}
|
|
313
|
-
*/
|
|
314
|
-
async getInventoryPaginated(status?: string, page?: number, limit?: number, options?: AxiosRequestConfig): Promise<AxiosResponse<InventoryPaginatedResponse>> {
|
|
315
|
-
return InventoryApiFp(configuration).getInventoryPaginated(status, page, limit, options).then((request) => request(axios, basePath));
|
|
316
|
-
},
|
|
317
222
|
/**
|
|
318
223
|
*
|
|
319
224
|
* @summary Update Product inventory
|
|
@@ -347,19 +252,6 @@ export class InventoryApi extends BaseAPI {
|
|
|
347
252
|
public async createInventory(variantId: string, count: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
|
348
253
|
return InventoryApiFp(this.configuration).createInventory(variantId, count, options).then((request) => request(this.axios, this.basePath));
|
|
349
254
|
}
|
|
350
|
-
/**
|
|
351
|
-
*
|
|
352
|
-
* @summary Get Inventory
|
|
353
|
-
* @param {string} [status]
|
|
354
|
-
* @param {number} [page]
|
|
355
|
-
* @param {number} [limit]
|
|
356
|
-
* @param {*} [options] Override http request option.
|
|
357
|
-
* @throws {RequiredError}
|
|
358
|
-
* @memberof InventoryApi
|
|
359
|
-
*/
|
|
360
|
-
public async getInventoryPaginated(status?: string, page?: number, limit?: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<InventoryPaginatedResponse>> {
|
|
361
|
-
return InventoryApiFp(this.configuration).getInventoryPaginated(status, page, limit, options).then((request) => request(this.axios, this.basePath));
|
|
362
|
-
}
|
|
363
255
|
/**
|
|
364
256
|
*
|
|
365
257
|
* @summary Update Product inventory
|
|
@@ -617,6 +617,47 @@ export const StoresApiAxiosParamCreator = function (configuration?: Configuratio
|
|
|
617
617
|
options: localVarRequestOptions,
|
|
618
618
|
};
|
|
619
619
|
},
|
|
620
|
+
/**
|
|
621
|
+
*
|
|
622
|
+
* @param {*} [options] Override http request option.
|
|
623
|
+
* @throws {RequiredError}
|
|
624
|
+
*/
|
|
625
|
+
sendMghBookingForm: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
626
|
+
const localVarPath = `/stores/send-mgh-booking-form`;
|
|
627
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
628
|
+
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
|
629
|
+
let baseOptions;
|
|
630
|
+
if (configuration) {
|
|
631
|
+
baseOptions = configuration.baseOptions;
|
|
632
|
+
}
|
|
633
|
+
const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
|
|
634
|
+
const localVarHeaderParameter = {} as any;
|
|
635
|
+
const localVarQueryParameter = {} as any;
|
|
636
|
+
|
|
637
|
+
// authentication x-store-key required
|
|
638
|
+
if (configuration && configuration.apiKey) {
|
|
639
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
640
|
+
? await configuration.apiKey("x-store-key")
|
|
641
|
+
: await configuration.apiKey;
|
|
642
|
+
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
const query = new URLSearchParams(localVarUrlObj.search);
|
|
646
|
+
for (const key in localVarQueryParameter) {
|
|
647
|
+
query.set(key, localVarQueryParameter[key]);
|
|
648
|
+
}
|
|
649
|
+
for (const key in options.params) {
|
|
650
|
+
query.set(key, options.params[key]);
|
|
651
|
+
}
|
|
652
|
+
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
|
653
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
654
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
655
|
+
|
|
656
|
+
return {
|
|
657
|
+
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
658
|
+
options: localVarRequestOptions,
|
|
659
|
+
};
|
|
660
|
+
},
|
|
620
661
|
/**
|
|
621
662
|
*
|
|
622
663
|
* @param {TransferePatientsRequestDto} body
|
|
@@ -1068,6 +1109,18 @@ export const StoresApiFp = function(configuration?: Configuration) {
|
|
|
1068
1109
|
return axios.request(axiosRequestArgs);
|
|
1069
1110
|
};
|
|
1070
1111
|
},
|
|
1112
|
+
/**
|
|
1113
|
+
*
|
|
1114
|
+
* @param {*} [options] Override http request option.
|
|
1115
|
+
* @throws {RequiredError}
|
|
1116
|
+
*/
|
|
1117
|
+
async sendMghBookingForm(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
|
1118
|
+
const localVarAxiosArgs = await StoresApiAxiosParamCreator(configuration).sendMghBookingForm(options);
|
|
1119
|
+
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
1120
|
+
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
1121
|
+
return axios.request(axiosRequestArgs);
|
|
1122
|
+
};
|
|
1123
|
+
},
|
|
1071
1124
|
/**
|
|
1072
1125
|
*
|
|
1073
1126
|
* @param {TransferePatientsRequestDto} body
|
|
@@ -1267,6 +1320,14 @@ export const StoresApiFactory = function (configuration?: Configuration, basePat
|
|
|
1267
1320
|
async sendGMJoinUsEmail(options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
|
1268
1321
|
return StoresApiFp(configuration).sendGMJoinUsEmail(options).then((request) => request(axios, basePath));
|
|
1269
1322
|
},
|
|
1323
|
+
/**
|
|
1324
|
+
*
|
|
1325
|
+
* @param {*} [options] Override http request option.
|
|
1326
|
+
* @throws {RequiredError}
|
|
1327
|
+
*/
|
|
1328
|
+
async sendMghBookingForm(options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
|
1329
|
+
return StoresApiFp(configuration).sendMghBookingForm(options).then((request) => request(axios, basePath));
|
|
1330
|
+
},
|
|
1270
1331
|
/**
|
|
1271
1332
|
*
|
|
1272
1333
|
* @param {TransferePatientsRequestDto} body
|
|
@@ -1460,6 +1521,15 @@ export class StoresApi extends BaseAPI {
|
|
|
1460
1521
|
public async sendGMJoinUsEmail(options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
|
1461
1522
|
return StoresApiFp(this.configuration).sendGMJoinUsEmail(options).then((request) => request(this.axios, this.basePath));
|
|
1462
1523
|
}
|
|
1524
|
+
/**
|
|
1525
|
+
*
|
|
1526
|
+
* @param {*} [options] Override http request option.
|
|
1527
|
+
* @throws {RequiredError}
|
|
1528
|
+
* @memberof StoresApi
|
|
1529
|
+
*/
|
|
1530
|
+
public async sendMghBookingForm(options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
|
1531
|
+
return StoresApiFp(this.configuration).sendMghBookingForm(options).then((request) => request(this.axios, this.basePath));
|
|
1532
|
+
}
|
|
1463
1533
|
/**
|
|
1464
1534
|
*
|
|
1465
1535
|
* @param {TransferePatientsRequestDto} body
|