hey-pharmacist-ecommerce 1.1.29 → 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.
- package/dist/index.d.mts +10734 -1256
- package/dist/index.d.ts +10734 -1256
- package/dist/index.js +2741 -295
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2686 -296
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useStoreCapabilities.ts +87 -0
- package/src/index.ts +4 -0
- package/src/lib/Apis/apis/auth-api.ts +19 -7
- package/src/lib/Apis/apis/categories-api.ts +97 -0
- package/src/lib/Apis/apis/products-api.ts +97 -0
- package/src/lib/Apis/apis/shipping-api.ts +105 -0
- package/src/lib/Apis/apis/stores-api.ts +356 -0
- package/src/lib/Apis/apis/sub-categories-api.ts +97 -0
- package/src/lib/Apis/apis/users-api.ts +8 -8
- package/src/lib/Apis/models/address-created-request.ts +0 -12
- package/src/lib/Apis/models/address.ts +0 -12
- package/src/lib/Apis/models/api-key-info-dto.ts +49 -0
- package/src/lib/Apis/models/create-address-dto.ts +0 -12
- package/src/lib/Apis/models/create-discount-dto.ts +0 -8
- package/src/lib/Apis/models/create-store-address-dto.ts +0 -12
- package/src/lib/Apis/models/create-store-dto-settings.ts +51 -0
- package/src/lib/Apis/models/create-store-dto.ts +7 -0
- package/src/lib/Apis/models/create-variant-dto.ts +0 -6
- package/src/lib/Apis/models/discount.ts +0 -8
- package/src/lib/Apis/models/index.ts +11 -0
- package/src/lib/Apis/models/populated-discount.ts +0 -8
- package/src/lib/Apis/models/product-variant.ts +0 -6
- package/src/lib/Apis/models/reorder-categories-dto.ts +27 -0
- package/src/lib/Apis/models/reorder-products-dto.ts +49 -0
- package/src/lib/Apis/models/reorder-products-success-response-dto.ts +33 -0
- package/src/lib/Apis/models/reorder-subcategories-dto.ts +33 -0
- package/src/lib/Apis/models/reorder-success-response-dto.ts +33 -0
- package/src/lib/Apis/models/shipment-with-order.ts +18 -0
- package/src/lib/Apis/models/shipment.ts +18 -0
- package/src/lib/Apis/models/store-api-keys-response-dto.ts +34 -0
- package/src/lib/Apis/models/store-capabilities-dto.ts +63 -0
- package/src/lib/Apis/models/store-entity.ts +7 -0
- package/src/lib/Apis/models/store.ts +7 -0
- package/src/lib/Apis/models/update-address-dto.ts +0 -12
- package/src/lib/Apis/models/update-api-keys-dto.ts +39 -0
- package/src/lib/Apis/models/update-discount-dto.ts +0 -8
- package/src/lib/Apis/models/update-manual-shipment-status-dto.ts +47 -0
- package/src/lib/Apis/models/update-store-dto.ts +7 -0
- package/src/lib/Apis/models/update-variant-dto.ts +0 -6
- package/src/screens/CheckoutScreen.tsx +363 -278
- package/src/screens/ResetPasswordScreen.tsx +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hey-pharmacist-ecommerce",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.30",
|
|
4
4
|
"description": "Production-ready, multi-tenant e‑commerce UI + API adapter for Next.js with auth, carts, checkout, orders, theming, and pharmacist-focused UX.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -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
|
@@ -45,6 +45,7 @@ export { Skeleton, ProductCardSkeleton, OrderCardSkeleton } from './components/u
|
|
|
45
45
|
export { useProducts, useProduct, useCategories } from './hooks/useProducts';
|
|
46
46
|
export { useOrders, useOrder, useCurrentOrders } from './hooks/useOrders';
|
|
47
47
|
export { useAddresses } from './hooks/useAddresses';
|
|
48
|
+
export { useStoreCapabilities } from './hooks/useStoreCapabilities';
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
// API Adapter (for advanced usage)
|
|
@@ -58,6 +59,9 @@ export type {
|
|
|
58
59
|
OrderStatus,
|
|
59
60
|
} from './lib/types';
|
|
60
61
|
|
|
62
|
+
// Export all API types (generated from Swagger)
|
|
63
|
+
export * from './lib/Apis/models';
|
|
64
|
+
|
|
61
65
|
// Utils
|
|
62
66
|
export { formatPrice, formatDate, truncate, getInitials } from './lib/utils/format';
|
|
63
67
|
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
|
|
@@ -21,6 +21,8 @@ import { CreateVariantDto } from '../models';
|
|
|
21
21
|
import { PaginatedProductsDto } from '../models';
|
|
22
22
|
import { Product } from '../models';
|
|
23
23
|
import { ProductsInsightsDto } from '../models';
|
|
24
|
+
import { ReorderProductsDto } from '../models';
|
|
25
|
+
import { ReorderProductsSuccessResponseDto } from '../models';
|
|
24
26
|
import { UpdateProductDto } from '../models';
|
|
25
27
|
import { UpdateVariantDto } from '../models';
|
|
26
28
|
import { VariantIdInventoryBody } from '../models';
|
|
@@ -1003,6 +1005,66 @@ export const ProductsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
1003
1005
|
options: localVarRequestOptions,
|
|
1004
1006
|
};
|
|
1005
1007
|
},
|
|
1008
|
+
/**
|
|
1009
|
+
*
|
|
1010
|
+
* @summary Reorder products within a category or subcategory
|
|
1011
|
+
* @param {ReorderProductsDto} body
|
|
1012
|
+
* @param {*} [options] Override http request option.
|
|
1013
|
+
* @throws {RequiredError}
|
|
1014
|
+
*/
|
|
1015
|
+
reorderProducts: async (body: ReorderProductsDto, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
1016
|
+
// verify required parameter 'body' is not null or undefined
|
|
1017
|
+
if (body === null || body === undefined) {
|
|
1018
|
+
throw new RequiredError('body','Required parameter body was null or undefined when calling reorderProducts.');
|
|
1019
|
+
}
|
|
1020
|
+
const localVarPath = `/products/reorder`;
|
|
1021
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1022
|
+
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
|
1023
|
+
let baseOptions;
|
|
1024
|
+
if (configuration) {
|
|
1025
|
+
baseOptions = configuration.baseOptions;
|
|
1026
|
+
}
|
|
1027
|
+
const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options};
|
|
1028
|
+
const localVarHeaderParameter = {} as any;
|
|
1029
|
+
const localVarQueryParameter = {} as any;
|
|
1030
|
+
|
|
1031
|
+
// authentication bearer required
|
|
1032
|
+
// http bearer authentication required
|
|
1033
|
+
if (configuration && configuration.accessToken) {
|
|
1034
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
1035
|
+
? await configuration.accessToken()
|
|
1036
|
+
: await configuration.accessToken;
|
|
1037
|
+
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
// authentication x-store-key required
|
|
1041
|
+
if (configuration && configuration.apiKey) {
|
|
1042
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
1043
|
+
? await configuration.apiKey("x-store-key")
|
|
1044
|
+
: await configuration.apiKey;
|
|
1045
|
+
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1049
|
+
|
|
1050
|
+
const query = new URLSearchParams(localVarUrlObj.search);
|
|
1051
|
+
for (const key in localVarQueryParameter) {
|
|
1052
|
+
query.set(key, localVarQueryParameter[key]);
|
|
1053
|
+
}
|
|
1054
|
+
for (const key in options.params) {
|
|
1055
|
+
query.set(key, options.params[key]);
|
|
1056
|
+
}
|
|
1057
|
+
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
|
1058
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1059
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
1060
|
+
const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
|
|
1061
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
|
1062
|
+
|
|
1063
|
+
return {
|
|
1064
|
+
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
1065
|
+
options: localVarRequestOptions,
|
|
1066
|
+
};
|
|
1067
|
+
},
|
|
1006
1068
|
/**
|
|
1007
1069
|
*
|
|
1008
1070
|
* @summary Update variant inventory (add or subtract)
|
|
@@ -1457,6 +1519,20 @@ export const ProductsApiFp = function(configuration?: Configuration) {
|
|
|
1457
1519
|
return axios.request(axiosRequestArgs);
|
|
1458
1520
|
};
|
|
1459
1521
|
},
|
|
1522
|
+
/**
|
|
1523
|
+
*
|
|
1524
|
+
* @summary Reorder products within a category or subcategory
|
|
1525
|
+
* @param {ReorderProductsDto} body
|
|
1526
|
+
* @param {*} [options] Override http request option.
|
|
1527
|
+
* @throws {RequiredError}
|
|
1528
|
+
*/
|
|
1529
|
+
async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<ReorderProductsSuccessResponseDto>>> {
|
|
1530
|
+
const localVarAxiosArgs = await ProductsApiAxiosParamCreator(configuration).reorderProducts(body, options);
|
|
1531
|
+
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
1532
|
+
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
1533
|
+
return axios.request(axiosRequestArgs);
|
|
1534
|
+
};
|
|
1535
|
+
},
|
|
1460
1536
|
/**
|
|
1461
1537
|
*
|
|
1462
1538
|
* @summary Update variant inventory (add or subtract)
|
|
@@ -1684,6 +1760,16 @@ export const ProductsApiFactory = function (configuration?: Configuration, baseP
|
|
|
1684
1760
|
async getTopSellingProducts(limit?: number, page?: number, options?: AxiosRequestConfig): Promise<AxiosResponse<PaginatedProductsDto>> {
|
|
1685
1761
|
return ProductsApiFp(configuration).getTopSellingProducts(limit, page, options).then((request) => request(axios, basePath));
|
|
1686
1762
|
},
|
|
1763
|
+
/**
|
|
1764
|
+
*
|
|
1765
|
+
* @summary Reorder products within a category or subcategory
|
|
1766
|
+
* @param {ReorderProductsDto} body
|
|
1767
|
+
* @param {*} [options] Override http request option.
|
|
1768
|
+
* @throws {RequiredError}
|
|
1769
|
+
*/
|
|
1770
|
+
async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig): Promise<AxiosResponse<ReorderProductsSuccessResponseDto>> {
|
|
1771
|
+
return ProductsApiFp(configuration).reorderProducts(body, options).then((request) => request(axios, basePath));
|
|
1772
|
+
},
|
|
1687
1773
|
/**
|
|
1688
1774
|
*
|
|
1689
1775
|
* @summary Update variant inventory (add or subtract)
|
|
@@ -1916,6 +2002,17 @@ export class ProductsApi extends BaseAPI {
|
|
|
1916
2002
|
public async getTopSellingProducts(limit?: number, page?: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<PaginatedProductsDto>> {
|
|
1917
2003
|
return ProductsApiFp(this.configuration).getTopSellingProducts(limit, page, options).then((request) => request(this.axios, this.basePath));
|
|
1918
2004
|
}
|
|
2005
|
+
/**
|
|
2006
|
+
*
|
|
2007
|
+
* @summary Reorder products within a category or subcategory
|
|
2008
|
+
* @param {ReorderProductsDto} body
|
|
2009
|
+
* @param {*} [options] Override http request option.
|
|
2010
|
+
* @throws {RequiredError}
|
|
2011
|
+
* @memberof ProductsApi
|
|
2012
|
+
*/
|
|
2013
|
+
public async reorderProducts(body: ReorderProductsDto, options?: AxiosRequestConfig) : Promise<AxiosResponse<ReorderProductsSuccessResponseDto>> {
|
|
2014
|
+
return ProductsApiFp(this.configuration).reorderProducts(body, options).then((request) => request(this.axios, this.basePath));
|
|
2015
|
+
}
|
|
1919
2016
|
/**
|
|
1920
2017
|
*
|
|
1921
2018
|
* @summary Update variant inventory (add or subtract)
|
|
@@ -19,6 +19,7 @@ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } fr
|
|
|
19
19
|
import { CartBodyDTO } from '../models';
|
|
20
20
|
import { Shipment } from '../models';
|
|
21
21
|
import { ShipmentWithOrder } from '../models';
|
|
22
|
+
import { UpdateManualShipmentStatusDto } from '../models';
|
|
22
23
|
/**
|
|
23
24
|
* ShippingApi - axios parameter creator
|
|
24
25
|
* @export
|
|
@@ -296,6 +297,72 @@ export const ShippingApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
296
297
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
297
298
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
298
299
|
|
|
300
|
+
return {
|
|
301
|
+
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
302
|
+
options: localVarRequestOptions,
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
/**
|
|
306
|
+
*
|
|
307
|
+
* @summary Update manual shipment status (for non-Shippo deliveries only)
|
|
308
|
+
* @param {UpdateManualShipmentStatusDto} body
|
|
309
|
+
* @param {string} shipmentId
|
|
310
|
+
* @param {*} [options] Override http request option.
|
|
311
|
+
* @throws {RequiredError}
|
|
312
|
+
*/
|
|
313
|
+
updateManualShipmentStatus: async (body: UpdateManualShipmentStatusDto, shipmentId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
|
314
|
+
// verify required parameter 'body' is not null or undefined
|
|
315
|
+
if (body === null || body === undefined) {
|
|
316
|
+
throw new RequiredError('body','Required parameter body was null or undefined when calling updateManualShipmentStatus.');
|
|
317
|
+
}
|
|
318
|
+
// verify required parameter 'shipmentId' is not null or undefined
|
|
319
|
+
if (shipmentId === null || shipmentId === undefined) {
|
|
320
|
+
throw new RequiredError('shipmentId','Required parameter shipmentId was null or undefined when calling updateManualShipmentStatus.');
|
|
321
|
+
}
|
|
322
|
+
const localVarPath = `/shipping/shipments/{shipmentId}/status`
|
|
323
|
+
.replace(`{${"shipmentId"}}`, encodeURIComponent(String(shipmentId)));
|
|
324
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
325
|
+
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
|
326
|
+
let baseOptions;
|
|
327
|
+
if (configuration) {
|
|
328
|
+
baseOptions = configuration.baseOptions;
|
|
329
|
+
}
|
|
330
|
+
const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options};
|
|
331
|
+
const localVarHeaderParameter = {} as any;
|
|
332
|
+
const localVarQueryParameter = {} as any;
|
|
333
|
+
|
|
334
|
+
// authentication bearer required
|
|
335
|
+
// http bearer authentication required
|
|
336
|
+
if (configuration && configuration.accessToken) {
|
|
337
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
338
|
+
? await configuration.accessToken()
|
|
339
|
+
: await configuration.accessToken;
|
|
340
|
+
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// authentication x-store-key required
|
|
344
|
+
if (configuration && configuration.apiKey) {
|
|
345
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
346
|
+
? await configuration.apiKey("x-store-key")
|
|
347
|
+
: await configuration.apiKey;
|
|
348
|
+
localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
352
|
+
|
|
353
|
+
const query = new URLSearchParams(localVarUrlObj.search);
|
|
354
|
+
for (const key in localVarQueryParameter) {
|
|
355
|
+
query.set(key, localVarQueryParameter[key]);
|
|
356
|
+
}
|
|
357
|
+
for (const key in options.params) {
|
|
358
|
+
query.set(key, options.params[key]);
|
|
359
|
+
}
|
|
360
|
+
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
|
361
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
362
|
+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
363
|
+
const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
|
|
364
|
+
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
|
365
|
+
|
|
299
366
|
return {
|
|
300
367
|
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
|
301
368
|
options: localVarRequestOptions,
|
|
@@ -378,6 +445,21 @@ export const ShippingApiFp = function(configuration?: Configuration) {
|
|
|
378
445
|
return axios.request(axiosRequestArgs);
|
|
379
446
|
};
|
|
380
447
|
},
|
|
448
|
+
/**
|
|
449
|
+
*
|
|
450
|
+
* @summary Update manual shipment status (for non-Shippo deliveries only)
|
|
451
|
+
* @param {UpdateManualShipmentStatusDto} body
|
|
452
|
+
* @param {string} shipmentId
|
|
453
|
+
* @param {*} [options] Override http request option.
|
|
454
|
+
* @throws {RequiredError}
|
|
455
|
+
*/
|
|
456
|
+
async updateManualShipmentStatus(body: UpdateManualShipmentStatusDto, shipmentId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Shipment>>> {
|
|
457
|
+
const localVarAxiosArgs = await ShippingApiAxiosParamCreator(configuration).updateManualShipmentStatus(body, shipmentId, options);
|
|
458
|
+
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
459
|
+
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
460
|
+
return axios.request(axiosRequestArgs);
|
|
461
|
+
};
|
|
462
|
+
},
|
|
381
463
|
}
|
|
382
464
|
};
|
|
383
465
|
|
|
@@ -435,6 +517,17 @@ export const ShippingApiFactory = function (configuration?: Configuration, baseP
|
|
|
435
517
|
async getStoreAddress(options?: AxiosRequestConfig): Promise<AxiosResponse<any>> {
|
|
436
518
|
return ShippingApiFp(configuration).getStoreAddress(options).then((request) => request(axios, basePath));
|
|
437
519
|
},
|
|
520
|
+
/**
|
|
521
|
+
*
|
|
522
|
+
* @summary Update manual shipment status (for non-Shippo deliveries only)
|
|
523
|
+
* @param {UpdateManualShipmentStatusDto} body
|
|
524
|
+
* @param {string} shipmentId
|
|
525
|
+
* @param {*} [options] Override http request option.
|
|
526
|
+
* @throws {RequiredError}
|
|
527
|
+
*/
|
|
528
|
+
async updateManualShipmentStatus(body: UpdateManualShipmentStatusDto, shipmentId: string, options?: AxiosRequestConfig): Promise<AxiosResponse<Shipment>> {
|
|
529
|
+
return ShippingApiFp(configuration).updateManualShipmentStatus(body, shipmentId, options).then((request) => request(axios, basePath));
|
|
530
|
+
},
|
|
438
531
|
};
|
|
439
532
|
};
|
|
440
533
|
|
|
@@ -498,4 +591,16 @@ export class ShippingApi extends BaseAPI {
|
|
|
498
591
|
public async getStoreAddress(options?: AxiosRequestConfig) : Promise<AxiosResponse<any>> {
|
|
499
592
|
return ShippingApiFp(this.configuration).getStoreAddress(options).then((request) => request(this.axios, this.basePath));
|
|
500
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
*
|
|
596
|
+
* @summary Update manual shipment status (for non-Shippo deliveries only)
|
|
597
|
+
* @param {UpdateManualShipmentStatusDto} body
|
|
598
|
+
* @param {string} shipmentId
|
|
599
|
+
* @param {*} [options] Override http request option.
|
|
600
|
+
* @throws {RequiredError}
|
|
601
|
+
* @memberof ShippingApi
|
|
602
|
+
*/
|
|
603
|
+
public async updateManualShipmentStatus(body: UpdateManualShipmentStatusDto, shipmentId: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<Shipment>> {
|
|
604
|
+
return ShippingApiFp(this.configuration).updateManualShipmentStatus(body, shipmentId, options).then((request) => request(this.axios, this.basePath));
|
|
605
|
+
}
|
|
501
606
|
}
|