@artisan-commerce/products 0.5.6 → 0.6.0
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 +93 -93
- package/build/main.bundle.js +2 -2
- package/build/report.html +2 -2
- package/build/src/config/constants.d.ts +23 -23
- package/build/src/errors/api.errors.d.ts +7 -7
- package/build/src/index.d.ts +13 -13
- package/build/src/lib/aritmetics.d.ts +1 -1
- package/build/src/lib/common.d.ts +15 -15
- package/build/src/lib/getCategories/getCategories.d.ts +1 -1
- package/build/src/lib/getCategories/getCategories.test.d.ts +1 -1
- package/build/src/lib/getProductDetails/getProductDetails.d.ts +7 -7
- package/build/src/lib/getProductDetails/getProductDetails.test.d.ts +1 -1
- package/build/src/lib/getProductDetails/getProductDetails.types.d.ts +7 -7
- package/build/src/lib/getProducts/getProducts.d.ts +7 -7
- package/build/src/lib/getProducts/getProducts.test.d.ts +1 -1
- package/build/src/lib/getProducts/getProducts.types.d.ts +3 -3
- package/build/src/lib/getRecommendedProducts/getRecommendedProducts.d.ts +1 -1
- package/build/src/lib/getRecommendedProducts/getRecommendedProducts.test.d.ts +1 -1
- package/build/src/lib/getRelatedProducts/getRelatedProducts.d.ts +1 -1
- package/build/src/lib/getRelatedProducts/getRelatedProducts.test.d.ts +1 -1
- package/build/src/lib/getStoreDetails/getStoreDetails.d.ts +7 -7
- package/build/src/lib/getStoreDetails/getStoreDetails.test.d.ts +1 -1
- package/build/src/lib/getStoreDetails/getStoreDetails.types.d.ts +7 -7
- package/build/src/lib/initProducts/initProducts.d.ts +10 -10
- package/build/src/lib/registerModifiersForm/registerModifiersForm.d.ts +1 -1
- package/build/src/lib/registerModifiersForm/registerModifiersForm.test.d.ts +1 -1
- package/build/src/lib/validateProduct/validateProduct.d.ts +1 -1
- package/build/src/lib/validateProduct/validateProduct.test.d.ts +1 -1
- package/build/src/services/fetchProductDetails/fetchProductDetails.service.d.ts +2 -2
- package/build/src/services/fetchProductDetails/fetchProductDetails.service.mock.d.ts +2 -2
- package/build/src/services/fetchProductDetails/fetchProductDetails.service.types.d.ts +1 -1
- package/build/src/services/fetchProducts/fetchPRoducts.service.mock.d.ts +2 -2
- package/build/src/services/fetchProducts/fetchProducts.service.d.ts +2 -2
- package/build/src/services/fetchProducts/fetchProducts.service.types.d.ts +1 -1
- package/build/src/services/fetchStoreDetails/fetchStoreDetails.service.d.ts +2 -2
- package/build/src/services/fetchStoreDetails/fetchStoreDetails.service.types.d.ts +1 -1
- package/build/src/tests/exports.test.d.ts +1 -1
- package/build/src/types/common.types.d.ts +15 -15
- package/build/src/types/http.types.d.ts +66 -66
- package/build/src/utils/assertions/assertions.utils.d.ts +6 -6
- package/build/src/utils/bugsnag.d.ts +2 -2
- package/build/src/utils/caculations/calculations.utils.d.ts +17 -17
- package/build/src/utils/caculations/calculations.utils.test.d.ts +1 -1
- package/build/src/utils/caculations/calculations.utils.types.d.ts +6 -6
- package/build/src/utils/common.utils.d.ts +2 -2
- package/build/src/utils/http/cache.utils.d.ts +4 -4
- package/build/src/utils/http/http.utils.d.ts +9 -9
- package/build/src/utils/http/purge.utils.d.ts +38 -38
- package/build/src/utils/http/request.utils.d.ts +7 -7
- package/build/src/utils/transformers/api.transformer.d.ts +7 -7
- package/build/src/utils/transformers/transformers.utils.d.ts +2 -2
- package/build/src/vendors.d.ts +1 -1
- package/build/vendors.bundle.js +1 -1
- package/package.json +4 -4
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { GROUPS as Groups } from "../types/http.types";
|
|
2
|
-
declare const CONSTANTS: {
|
|
3
|
-
CLIENT_NAME: string;
|
|
4
|
-
DEFAULT_REQUEST_TIMEOUT: number;
|
|
5
|
-
EXCLUDED_LOGGER_STATUS_CODES: number[];
|
|
6
|
-
INCLUDED_LOGGER_ENVS: string[];
|
|
7
|
-
INCLUDED_INTL_LOG_ENVS: string[];
|
|
8
|
-
COUNTRY: {
|
|
9
|
-
NAME: string;
|
|
10
|
-
CODE: string;
|
|
11
|
-
LANGUAGE: string;
|
|
12
|
-
};
|
|
13
|
-
DEFAULT_API_TIMEOUT: number;
|
|
14
|
-
HEADERS: string[];
|
|
15
|
-
FILTERS: ("productId" | "vendorId" | "storeId" | "catalogueId" | "categoryId")[];
|
|
16
|
-
GROUPS: Groups[];
|
|
17
|
-
ORDER_FIELDS: string[];
|
|
18
|
-
ORDER_TYPES: ("ALPHABETIC" | "PRICE" | "PREDEFINED" | undefined)[];
|
|
19
|
-
ORDER_SORTS: ("ASC" | "DESC" | undefined)[];
|
|
20
|
-
PAGINATION: string[];
|
|
21
|
-
ADDITIONAL_FILTERS: string[];
|
|
22
|
-
};
|
|
23
|
-
export default CONSTANTS;
|
|
1
|
+
import { GROUPS as Groups } from "../types/http.types";
|
|
2
|
+
declare const CONSTANTS: {
|
|
3
|
+
CLIENT_NAME: string;
|
|
4
|
+
DEFAULT_REQUEST_TIMEOUT: number;
|
|
5
|
+
EXCLUDED_LOGGER_STATUS_CODES: number[];
|
|
6
|
+
INCLUDED_LOGGER_ENVS: string[];
|
|
7
|
+
INCLUDED_INTL_LOG_ENVS: string[];
|
|
8
|
+
COUNTRY: {
|
|
9
|
+
NAME: string;
|
|
10
|
+
CODE: string;
|
|
11
|
+
LANGUAGE: string;
|
|
12
|
+
};
|
|
13
|
+
DEFAULT_API_TIMEOUT: number;
|
|
14
|
+
HEADERS: string[];
|
|
15
|
+
FILTERS: ("productId" | "vendorId" | "storeId" | "catalogueId" | "categoryId")[];
|
|
16
|
+
GROUPS: Groups[];
|
|
17
|
+
ORDER_FIELDS: string[];
|
|
18
|
+
ORDER_TYPES: ("ALPHABETIC" | "PRICE" | "PREDEFINED" | undefined)[];
|
|
19
|
+
ORDER_SORTS: ("ASC" | "DESC" | undefined)[];
|
|
20
|
+
PAGINATION: string[];
|
|
21
|
+
ADDITIONAL_FILTERS: string[];
|
|
22
|
+
};
|
|
23
|
+
export default CONSTANTS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProductHints } from "../types/common.types";
|
|
2
|
-
import { ID, ProductsHTTPConfig, RequestData } from "../types/http.types";
|
|
3
|
-
export declare const checkAccountId: (accountId: ProductHints["accountId"] | undefined, message?: string) => void;
|
|
4
|
-
export declare const checkVendorId: (vendorId: ID | undefined, message?: string) => void;
|
|
5
|
-
export declare const checkStoreId: (storeId: ID | undefined, message?: string) => void;
|
|
6
|
-
export declare const checkCatalogueId: (catalogueId: ID | undefined, message?: string) => void;
|
|
7
|
-
export declare const checkHTTPMinimumConfig: (config: ProductsHTTPConfig, data: RequestData, message?: string) => void;
|
|
1
|
+
import { ProductHints } from "../types/common.types";
|
|
2
|
+
import { ID, ProductsHTTPConfig, RequestData } from "../types/http.types";
|
|
3
|
+
export declare const checkAccountId: (accountId: ProductHints["accountId"] | undefined, message?: string) => void;
|
|
4
|
+
export declare const checkVendorId: (vendorId: ID | undefined, message?: string) => void;
|
|
5
|
+
export declare const checkStoreId: (storeId: ID | undefined, message?: string) => void;
|
|
6
|
+
export declare const checkCatalogueId: (catalogueId: ID | undefined, message?: string) => void;
|
|
7
|
+
export declare const checkHTTPMinimumConfig: (config: ProductsHTTPConfig, data: RequestData, message?: string) => void;
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as transformers from "./utils/transformers/transformers.utils";
|
|
2
|
-
import * as assertions from "./utils/assertions/assertions.utils";
|
|
3
|
-
export { getCategories } from "./lib/getCategories/getCategories";
|
|
4
|
-
export { getProductDetails } from "./lib/getProductDetails/getProductDetails";
|
|
5
|
-
export { getProducts } from "./lib/getProducts/getProducts";
|
|
6
|
-
export { getRecommendedProducts } from "./lib/getRecommendedProducts/getRecommendedProducts";
|
|
7
|
-
export { getRelatedProducts } from "./lib/getRelatedProducts/getRelatedProducts";
|
|
8
|
-
export { getStoreDetails } from "./lib/getStoreDetails/getStoreDetails";
|
|
9
|
-
export { registerModifiersForm } from "./lib/registerModifiersForm/registerModifiersForm";
|
|
10
|
-
export { validateProduct } from "./lib/validateProduct/validateProduct";
|
|
11
|
-
export { initProducts } from "./lib/initProducts/initProducts";
|
|
12
|
-
export { getProductTotals } from "./utils/caculations/calculations.utils";
|
|
13
|
-
export { transformers, assertions };
|
|
1
|
+
import * as transformers from "./utils/transformers/transformers.utils";
|
|
2
|
+
import * as assertions from "./utils/assertions/assertions.utils";
|
|
3
|
+
export { getCategories } from "./lib/getCategories/getCategories";
|
|
4
|
+
export { getProductDetails } from "./lib/getProductDetails/getProductDetails";
|
|
5
|
+
export { getProducts } from "./lib/getProducts/getProducts";
|
|
6
|
+
export { getRecommendedProducts } from "./lib/getRecommendedProducts/getRecommendedProducts";
|
|
7
|
+
export { getRelatedProducts } from "./lib/getRelatedProducts/getRelatedProducts";
|
|
8
|
+
export { getStoreDetails } from "./lib/getStoreDetails/getStoreDetails";
|
|
9
|
+
export { registerModifiersForm } from "./lib/registerModifiersForm/registerModifiersForm";
|
|
10
|
+
export { validateProduct } from "./lib/validateProduct/validateProduct";
|
|
11
|
+
export { initProducts } from "./lib/initProducts/initProducts";
|
|
12
|
+
export { getProductTotals } from "./utils/caculations/calculations.utils";
|
|
13
|
+
export { transformers, assertions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sum: (a: number, b: number) => number;
|
|
1
|
+
export declare const sum: (a: number, b: number) => number;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { GlobalState } from "../types/common.types";
|
|
2
|
-
export declare const initialState: GlobalState;
|
|
3
|
-
export declare const setState: (overrides: Partial<GlobalState>) => void;
|
|
4
|
-
export declare const getState: () => {
|
|
5
|
-
artisanApp: import("../../../types/build").ArtisanApp | undefined;
|
|
6
|
-
apiCache: import("../types/common.types").ApiCache;
|
|
7
|
-
expiresAt: number;
|
|
8
|
-
timeout?: number | undefined;
|
|
9
|
-
accountId?: string | number | undefined;
|
|
10
|
-
productId?: string | number | undefined;
|
|
11
|
-
vendorId?: string | number | undefined;
|
|
12
|
-
storeId?: number | undefined;
|
|
13
|
-
catalogueId?: string | number | undefined;
|
|
14
|
-
categoryId?: string | number | undefined;
|
|
15
|
-
};
|
|
1
|
+
import { GlobalState } from "../types/common.types";
|
|
2
|
+
export declare const initialState: GlobalState;
|
|
3
|
+
export declare const setState: (overrides: Partial<GlobalState>) => void;
|
|
4
|
+
export declare const getState: () => {
|
|
5
|
+
artisanApp: import("../../../types/build").ArtisanApp | undefined;
|
|
6
|
+
apiCache: import("../types/common.types").ApiCache;
|
|
7
|
+
expiresAt: number;
|
|
8
|
+
timeout?: number | undefined;
|
|
9
|
+
accountId?: string | number | undefined;
|
|
10
|
+
productId?: string | number | undefined;
|
|
11
|
+
vendorId?: string | number | undefined;
|
|
12
|
+
storeId?: number | undefined;
|
|
13
|
+
catalogueId?: string | number | undefined;
|
|
14
|
+
categoryId?: string | number | undefined;
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCategories: () => void;
|
|
1
|
+
export declare const getCategories: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchProductDetailsConfig } from "./getProductDetails.types";
|
|
2
|
-
export declare const getProductDetails: (productId: number | string, config: FetchProductDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
-
data: any;
|
|
4
|
-
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
-
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
-
error: string | undefined;
|
|
7
|
-
} | import("../../../../types/build").Product[]>;
|
|
1
|
+
import { FetchProductDetailsConfig } from "./getProductDetails.types";
|
|
2
|
+
export declare const getProductDetails: (productId: number | string, config: FetchProductDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
+
data: any;
|
|
4
|
+
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
+
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
} | import("../../../../types/build").Product[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
-
export interface FetchProductDetailsConfig extends ProductsHTTPConfig {
|
|
3
|
-
groupBy?: undefined;
|
|
4
|
-
orderBy?: undefined;
|
|
5
|
-
pagination?: undefined;
|
|
6
|
-
additionalFilters?: undefined;
|
|
7
|
-
}
|
|
1
|
+
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
+
export interface FetchProductDetailsConfig extends ProductsHTTPConfig {
|
|
3
|
+
groupBy?: undefined;
|
|
4
|
+
orderBy?: undefined;
|
|
5
|
+
pagination?: undefined;
|
|
6
|
+
additionalFilters?: undefined;
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchProductsConfig } from "./getProducts.types";
|
|
2
|
-
export declare const getProducts: (config: FetchProductsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
-
data: any;
|
|
4
|
-
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
-
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
-
error: string | undefined;
|
|
7
|
-
} | import("../../../../types/build").Product[]>;
|
|
1
|
+
import { FetchProductsConfig } from "./getProducts.types";
|
|
2
|
+
export declare const getProducts: (config: FetchProductsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
+
data: any;
|
|
4
|
+
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
+
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
} | import("../../../../types/build").Product[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
-
export interface FetchProductsConfig extends ProductsHTTPConfig {
|
|
3
|
-
}
|
|
1
|
+
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
+
export interface FetchProductsConfig extends ProductsHTTPConfig {
|
|
3
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getRecommendedProducts: () => void;
|
|
1
|
+
export declare const getRecommendedProducts: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getRelatedProducts: () => void;
|
|
1
|
+
export declare const getRelatedProducts: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FetchStoreDetailsConfig } from "./getStoreDetails.types";
|
|
2
|
-
export declare const getStoreDetails: (config: FetchStoreDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
-
data: any;
|
|
4
|
-
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
-
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
-
error: string | undefined;
|
|
7
|
-
} | import("../../../../types/build").Product[]>;
|
|
1
|
+
import { FetchStoreDetailsConfig } from "./getStoreDetails.types";
|
|
2
|
+
export declare const getStoreDetails: (config: FetchStoreDetailsConfig) => Promise<import("../../../../types/build").BaseProduct | {
|
|
3
|
+
data: any;
|
|
4
|
+
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
5
|
+
config: import("../../../../types/build").ArtisanRequest;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
} | import("../../../../types/build").Product[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
-
export interface FetchStoreDetailsConfig extends ProductsHTTPConfig {
|
|
3
|
-
groupBy?: undefined;
|
|
4
|
-
orderBy?: undefined;
|
|
5
|
-
pagination?: undefined;
|
|
6
|
-
additionalFilters?: undefined;
|
|
7
|
-
}
|
|
1
|
+
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
+
export interface FetchStoreDetailsConfig extends ProductsHTTPConfig {
|
|
3
|
+
groupBy?: undefined;
|
|
4
|
+
orderBy?: undefined;
|
|
5
|
+
pagination?: undefined;
|
|
6
|
+
additionalFilters?: undefined;
|
|
7
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ArtisanApp } from "@artisan-commerce/types";
|
|
2
|
-
import { InitProductsConfig } from "../../types/common.types";
|
|
3
|
-
/**
|
|
4
|
-
* Initialize products metadata, stores initial global state for future needs.
|
|
5
|
-
* @author Luis Eduardo Andrade
|
|
6
|
-
* @since 1.0
|
|
7
|
-
* @param artisanApp: An artisan initialized app.
|
|
8
|
-
* @param config: Global products state that can be configure at the function call level
|
|
9
|
-
*/
|
|
10
|
-
export declare const initProducts: (artisanApp: ArtisanApp, config?: InitProductsConfig) => void;
|
|
1
|
+
import { ArtisanApp } from "@artisan-commerce/types";
|
|
2
|
+
import { InitProductsConfig } from "../../types/common.types";
|
|
3
|
+
/**
|
|
4
|
+
* Initialize products metadata, stores initial global state for future needs.
|
|
5
|
+
* @author Luis Eduardo Andrade
|
|
6
|
+
* @since 1.0
|
|
7
|
+
* @param artisanApp: An artisan initialized app.
|
|
8
|
+
* @param config: Global products state that can be configure at the function call level
|
|
9
|
+
*/
|
|
10
|
+
export declare const initProducts: (artisanApp: ArtisanApp, config?: InitProductsConfig) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const registerModifiersForm: () => void;
|
|
1
|
+
export declare const registerModifiersForm: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const validateProduct: () => void;
|
|
1
|
+
export declare const validateProduct: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ArtisanRequest, ProductDetails } from "@artisan-commerce/types";
|
|
2
|
-
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<ProductDetails>;
|
|
1
|
+
import { ArtisanRequest, ProductDetails } from "@artisan-commerce/types";
|
|
2
|
+
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<ProductDetails>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ProductDetails, ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
-
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<ProductDetails>;
|
|
1
|
+
import { ProductDetails, ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
+
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<ProductDetails>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BaseProduct, ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
-
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
1
|
+
import { BaseProduct, ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
+
export declare const fetchProductDetails: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ArtisanRequest, BaseProduct } from "@artisan-commerce/types";
|
|
2
|
-
export declare const fetchProducts: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
1
|
+
import { ArtisanRequest, BaseProduct } from "@artisan-commerce/types";
|
|
2
|
+
export declare const fetchProducts: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ArtisanRequest, BaseProduct } from "@artisan-commerce/types";
|
|
2
|
-
export declare const fetchStoreDetails: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
1
|
+
import { ArtisanRequest, BaseProduct } from "@artisan-commerce/types";
|
|
2
|
+
export declare const fetchStoreDetails: (request: ArtisanRequest) => Promise<BaseProduct[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ArtisanApp, ArtisanHints, Product } from "@artisan-commerce/types";
|
|
2
|
-
export interface ProductHints extends Omit<ArtisanHints, "accountId"> {
|
|
3
|
-
accountId?: ArtisanHints["accountId"];
|
|
4
|
-
}
|
|
5
|
-
export interface InitProductsConfig extends ProductHints {
|
|
6
|
-
timeout?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface GlobalState extends InitProductsConfig {
|
|
9
|
-
artisanApp: ArtisanApp | undefined;
|
|
10
|
-
apiCache: ApiCache;
|
|
11
|
-
expiresAt: number;
|
|
12
|
-
}
|
|
13
|
-
export interface ApiCache {
|
|
14
|
-
[key: string]: Product | Product[];
|
|
15
|
-
}
|
|
1
|
+
import { ArtisanApp, ArtisanHints, Product } from "@artisan-commerce/types";
|
|
2
|
+
export interface ProductHints extends Omit<ArtisanHints, "accountId"> {
|
|
3
|
+
accountId?: ArtisanHints["accountId"];
|
|
4
|
+
}
|
|
5
|
+
export interface InitProductsConfig extends ProductHints {
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface GlobalState extends InitProductsConfig {
|
|
9
|
+
artisanApp: ArtisanApp | undefined;
|
|
10
|
+
apiCache: ApiCache;
|
|
11
|
+
expiresAt: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ApiCache {
|
|
14
|
+
[key: string]: Product | Product[];
|
|
15
|
+
}
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { ArtisanRequestHeaders } from "@artisan-commerce/types";
|
|
2
|
-
export interface ProductsHTTPConfig {
|
|
3
|
-
filterBy: Filters;
|
|
4
|
-
groupBy?: GROUPS;
|
|
5
|
-
orderBy?: Order;
|
|
6
|
-
pagination?: Pagination;
|
|
7
|
-
additionalFilters?: AdditionalFilters;
|
|
8
|
-
}
|
|
9
|
-
export declare type ID = string | number | (string | number)[];
|
|
10
|
-
export interface Filters {
|
|
11
|
-
vendorId: ID;
|
|
12
|
-
storeId: ID;
|
|
13
|
-
catalogueId: ID;
|
|
14
|
-
categoryId?: ID;
|
|
15
|
-
productId?: ID;
|
|
16
|
-
}
|
|
17
|
-
export declare type GROUPS = "CATEGORIES" | "TAGS";
|
|
18
|
-
export declare type ORDER_TYPES = "ALPHABETIC" | "PRICE" | "PREDEFINED";
|
|
19
|
-
export interface Order {
|
|
20
|
-
type?: ORDER_TYPES;
|
|
21
|
-
sort?: "ASC" | "DESC";
|
|
22
|
-
}
|
|
23
|
-
export interface Pagination {
|
|
24
|
-
page?: number;
|
|
25
|
-
vendor?: {
|
|
26
|
-
size: number;
|
|
27
|
-
};
|
|
28
|
-
store?: {
|
|
29
|
-
size: number;
|
|
30
|
-
};
|
|
31
|
-
catalogue?: {
|
|
32
|
-
size: number;
|
|
33
|
-
};
|
|
34
|
-
category?: {
|
|
35
|
-
size: number;
|
|
36
|
-
};
|
|
37
|
-
product?: {
|
|
38
|
-
size: number;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export interface AdditionalFilters {
|
|
42
|
-
price?: {
|
|
43
|
-
type?: "NORMAL" | "POINTS";
|
|
44
|
-
from?: number;
|
|
45
|
-
to?: number;
|
|
46
|
-
};
|
|
47
|
-
query?: string;
|
|
48
|
-
tags?: string[];
|
|
49
|
-
manufacturerId?: number | number[];
|
|
50
|
-
weigth?: {
|
|
51
|
-
unit: string;
|
|
52
|
-
value: number;
|
|
53
|
-
};
|
|
54
|
-
dimensions?: {
|
|
55
|
-
unit: string;
|
|
56
|
-
width: number;
|
|
57
|
-
height: number;
|
|
58
|
-
depth: number;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export interface RequestData {
|
|
62
|
-
headers: ArtisanRequestHeaders;
|
|
63
|
-
params: Record<string, string | number>;
|
|
64
|
-
query: Record<string, string | number | boolean>;
|
|
65
|
-
body: Record<string, any>;
|
|
66
|
-
}
|
|
1
|
+
import { ArtisanRequestHeaders } from "@artisan-commerce/types";
|
|
2
|
+
export interface ProductsHTTPConfig {
|
|
3
|
+
filterBy: Filters;
|
|
4
|
+
groupBy?: GROUPS;
|
|
5
|
+
orderBy?: Order;
|
|
6
|
+
pagination?: Pagination;
|
|
7
|
+
additionalFilters?: AdditionalFilters;
|
|
8
|
+
}
|
|
9
|
+
export declare type ID = string | number | (string | number)[];
|
|
10
|
+
export interface Filters {
|
|
11
|
+
vendorId: ID;
|
|
12
|
+
storeId: ID;
|
|
13
|
+
catalogueId: ID;
|
|
14
|
+
categoryId?: ID;
|
|
15
|
+
productId?: ID;
|
|
16
|
+
}
|
|
17
|
+
export declare type GROUPS = "CATEGORIES" | "TAGS";
|
|
18
|
+
export declare type ORDER_TYPES = "ALPHABETIC" | "PRICE" | "PREDEFINED";
|
|
19
|
+
export interface Order {
|
|
20
|
+
type?: ORDER_TYPES;
|
|
21
|
+
sort?: "ASC" | "DESC";
|
|
22
|
+
}
|
|
23
|
+
export interface Pagination {
|
|
24
|
+
page?: number;
|
|
25
|
+
vendor?: {
|
|
26
|
+
size: number;
|
|
27
|
+
};
|
|
28
|
+
store?: {
|
|
29
|
+
size: number;
|
|
30
|
+
};
|
|
31
|
+
catalogue?: {
|
|
32
|
+
size: number;
|
|
33
|
+
};
|
|
34
|
+
category?: {
|
|
35
|
+
size: number;
|
|
36
|
+
};
|
|
37
|
+
product?: {
|
|
38
|
+
size: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface AdditionalFilters {
|
|
42
|
+
price?: {
|
|
43
|
+
type?: "NORMAL" | "POINTS";
|
|
44
|
+
from?: number;
|
|
45
|
+
to?: number;
|
|
46
|
+
};
|
|
47
|
+
query?: string;
|
|
48
|
+
tags?: string[];
|
|
49
|
+
manufacturerId?: number | number[];
|
|
50
|
+
weigth?: {
|
|
51
|
+
unit: string;
|
|
52
|
+
value: number;
|
|
53
|
+
};
|
|
54
|
+
dimensions?: {
|
|
55
|
+
unit: string;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
depth: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface RequestData {
|
|
62
|
+
headers: ArtisanRequestHeaders;
|
|
63
|
+
params: Record<string, string | number>;
|
|
64
|
+
query: Record<string, string | number | boolean>;
|
|
65
|
+
body: Record<string, any>;
|
|
66
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseProduct } from "@artisan-commerce/types";
|
|
2
|
-
import { ProductDetails } from "@artisan-commerce/types";
|
|
3
|
-
import { CartProduct } from "@artisan-commerce/types";
|
|
4
|
-
export declare const isBaseProduct: (product: BaseProduct) => boolean;
|
|
5
|
-
export declare const isProductDetails: (product: ProductDetails) => boolean;
|
|
6
|
-
export declare const isCartProduct: (product: CartProduct) => boolean;
|
|
1
|
+
import { BaseProduct } from "@artisan-commerce/types";
|
|
2
|
+
import { ProductDetails } from "@artisan-commerce/types";
|
|
3
|
+
import { CartProduct } from "@artisan-commerce/types";
|
|
4
|
+
export declare const isBaseProduct: (product: BaseProduct) => boolean;
|
|
5
|
+
export declare const isProductDetails: (product: ProductDetails) => boolean;
|
|
6
|
+
export declare const isCartProduct: (product: CartProduct) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare let bugsnagClient: any;
|
|
2
|
-
export default bugsnagClient;
|
|
1
|
+
declare let bugsnagClient: any;
|
|
2
|
+
export default bugsnagClient;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Product, PriceCategoryTax } from "@artisan-commerce/types";
|
|
2
|
-
import { ProductTotals } from "./calculations.utils.types";
|
|
3
|
-
/**
|
|
4
|
-
* Get a summary of all price totals of a given product
|
|
5
|
-
*
|
|
6
|
-
* @author Luis Eduardo Andrade, John Arias
|
|
7
|
-
* @since 1.0
|
|
8
|
-
* @param product the product that will be calculated
|
|
9
|
-
* @returns an object with a summary of the prodcut totals
|
|
10
|
-
*/
|
|
11
|
-
export declare const getProductTotals: (product: Product) => ProductTotals;
|
|
12
|
-
export declare const getProductTotalTaxes: (product: Product) => number;
|
|
13
|
-
export declare const getProductGrossPrice: (product: Product) => number;
|
|
14
|
-
export declare const getProductTotalDiscounts: (product: Product) => number;
|
|
15
|
-
export declare const getProductNetPrice: (product: Product) => number;
|
|
16
|
-
export declare const getProductFieldPrice: (product: Product, field: "grossPrice" | "netPrice") => number;
|
|
17
|
-
export declare const getTaxTotal: (taxes: PriceCategoryTax[], grossPrice: number) => number;
|
|
1
|
+
import { Product, PriceCategoryTax } from "@artisan-commerce/types";
|
|
2
|
+
import { ProductTotals } from "./calculations.utils.types";
|
|
3
|
+
/**
|
|
4
|
+
* Get a summary of all price totals of a given product
|
|
5
|
+
*
|
|
6
|
+
* @author Luis Eduardo Andrade, John Arias
|
|
7
|
+
* @since 1.0
|
|
8
|
+
* @param product the product that will be calculated
|
|
9
|
+
* @returns an object with a summary of the prodcut totals
|
|
10
|
+
*/
|
|
11
|
+
export declare const getProductTotals: (product: Product) => ProductTotals;
|
|
12
|
+
export declare const getProductTotalTaxes: (product: Product) => number;
|
|
13
|
+
export declare const getProductGrossPrice: (product: Product) => number;
|
|
14
|
+
export declare const getProductTotalDiscounts: (product: Product) => number;
|
|
15
|
+
export declare const getProductNetPrice: (product: Product) => number;
|
|
16
|
+
export declare const getProductFieldPrice: (product: Product, field: "grossPrice" | "netPrice") => number;
|
|
17
|
+
export declare const getTaxTotal: (taxes: PriceCategoryTax[], grossPrice: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface ProductTotals {
|
|
2
|
-
grossPrice: number;
|
|
3
|
-
totalDiscounts: number;
|
|
4
|
-
totalTaxes: number;
|
|
5
|
-
netPrice: number;
|
|
6
|
-
}
|
|
1
|
+
export interface ProductTotals {
|
|
2
|
+
grossPrice: number;
|
|
3
|
+
totalDiscounts: number;
|
|
4
|
+
totalTaxes: number;
|
|
5
|
+
netPrice: number;
|
|
6
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const stringIsNumber: (value: string) => boolean;
|
|
2
|
-
export declare const enumToArray: (enumObj: any) => string[];
|
|
1
|
+
export declare const stringIsNumber: (value: string) => boolean;
|
|
2
|
+
export declare const enumToArray: (enumObj: any) => string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const getCacheKey: (hash: string) => import("../../../../types/build").BaseProduct | import("../../../../types/build").ProductDetails | import("../../../../types/build").CartProduct | import("../../../../types/build").Product[];
|
|
2
|
-
export declare const setCacheKey: (hash: string, data: any) => void;
|
|
3
|
-
export declare const isCacheExpired: () => boolean;
|
|
4
|
-
export declare const flushCache: () => void;
|
|
1
|
+
export declare const getCacheKey: (hash: string) => import("../../../../types/build").BaseProduct | import("../../../../types/build").ProductDetails | import("../../../../types/build").CartProduct | import("../../../../types/build").Product[];
|
|
2
|
+
export declare const setCacheKey: (hash: string, data: any) => void;
|
|
3
|
+
export declare const isCacheExpired: () => boolean;
|
|
4
|
+
export declare const flushCache: () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
-
import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
|
|
3
|
-
export declare const handleHTTPCall: <T extends ProductsHTTPConfig>(path: string, config: T, data: RequestData, callback: (request: ArtisanRequest) => any) => Promise<import("../../../../types/build").BaseProduct | {
|
|
4
|
-
data: any;
|
|
5
|
-
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
6
|
-
config: ArtisanRequest;
|
|
7
|
-
error: string | undefined;
|
|
8
|
-
} | import("../../../../types/build").Product[]>;
|
|
9
|
-
export declare const fetchHandler: <T>(request: ArtisanRequest) => Promise<T>;
|
|
1
|
+
import { ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
+
import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
|
|
3
|
+
export declare const handleHTTPCall: <T extends ProductsHTTPConfig>(path: string, config: T, data: RequestData, callback: (request: ArtisanRequest) => any) => Promise<import("../../../../types/build").BaseProduct | {
|
|
4
|
+
data: any;
|
|
5
|
+
hints: Partial<import("../../../../types/build").ArtisanHints>;
|
|
6
|
+
config: ArtisanRequest;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
} | import("../../../../types/build").Product[]>;
|
|
9
|
+
export declare const fetchHandler: <T>(request: ArtisanRequest) => Promise<T>;
|