@artisan-commerce/products 0.7.3 → 0.7.4
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/report.json +1 -1
- 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 +16 -16
- package/build/src/lib/aritmetics.d.ts +1 -1
- package/build/src/lib/common.d.ts +16 -16
- 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 +3 -3
- package/build/src/lib/registerModifiersForm/registerModifiersForm.test.d.ts +1 -1
- package/build/src/lib/registerModifiersForm/registerModifiersForm.types.d.ts +34 -34
- package/build/src/lib/validateProduct/validateProduct.d.ts +1 -1
- package/build/src/lib/validateProduct/validateProduct.test.d.ts +1 -1
- package/build/src/lib/validateProduct/validateProduct.types.d.ts +2 -2
- 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 +20 -20
- package/build/src/types/http.types.d.ts +66 -66
- package/build/src/types/modifiers.types.d.ts +57 -57
- package/build/src/utils/assertions/assertions.utils.d.ts +8 -8
- 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 +3 -3
- 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/modifiers/common.utils.d.ts +12 -12
- package/build/src/utils/modifiers/form.utils.d.ts +3 -3
- package/build/src/utils/modifiers/handleChange.utils.d.ts +1 -1
- package/build/src/utils/modifiers/renderer.utils.d.ts +11 -11
- package/build/src/utils/modifiers/rendererTraversal.utils.d.ts +4 -4
- package/build/src/utils/modifiers/updateRenderer.utils.d.ts +5 -5
- package/build/src/utils/transformers/api.transformer.d.ts +7 -7
- package/build/src/utils/transformers/transformers.utils.d.ts +9 -9
- package/build/src/vendors.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { CartProduct, Product } from "@artisan-commerce/types";
|
|
2
|
-
import { ValidateProduct } from "../validateProduct/validateProduct.types";
|
|
3
|
-
import { ModifierTypes } from "../../types/modifiers.types";
|
|
4
|
-
import { ModifierGroupRenderer } from "../../types/modifiers.types";
|
|
5
|
-
export interface ModifiersForm {
|
|
6
|
-
renderer: ModifierGroupRenderer[];
|
|
7
|
-
product: CartProduct;
|
|
8
|
-
validate: ValidateProduct;
|
|
9
|
-
}
|
|
10
|
-
export interface ModifiersFormInternal extends ModifiersForm {
|
|
11
|
-
callback: ModifiersFormCallback;
|
|
12
|
-
}
|
|
13
|
-
export declare type ModifiersFormCallback = (form: ModifiersForm) => void;
|
|
14
|
-
export declare type ModifiersFormUnsuscriber = () => void;
|
|
15
|
-
export declare type HandleChangeFunction = (amount: number) => void;
|
|
16
|
-
export declare type RegisterModifiersForm = (product: Product, callback: ModifiersFormCallback) => ModifiersFormUnsuscriber;
|
|
17
|
-
export interface BuildModifierRendererConfig {
|
|
18
|
-
rootId: string;
|
|
19
|
-
min: number;
|
|
20
|
-
max: number;
|
|
21
|
-
type: ModifierTypes;
|
|
22
|
-
modifiersCount: number;
|
|
23
|
-
amount: number;
|
|
24
|
-
path: string[];
|
|
25
|
-
}
|
|
26
|
-
export interface BuildModifierGroupConfig {
|
|
27
|
-
amount: number;
|
|
28
|
-
rootId: string;
|
|
29
|
-
path: string[];
|
|
30
|
-
}
|
|
31
|
-
export interface BuildRendererConfig {
|
|
32
|
-
rootId: string;
|
|
33
|
-
path: string[];
|
|
34
|
-
}
|
|
1
|
+
import { CartProduct, Product } from "@artisan-commerce/types";
|
|
2
|
+
import { ValidateProduct } from "../validateProduct/validateProduct.types";
|
|
3
|
+
import { ModifierTypes } from "../../types/modifiers.types";
|
|
4
|
+
import { ModifierGroupRenderer } from "../../types/modifiers.types";
|
|
5
|
+
export interface ModifiersForm {
|
|
6
|
+
renderer: ModifierGroupRenderer[];
|
|
7
|
+
product: CartProduct;
|
|
8
|
+
validate: ValidateProduct;
|
|
9
|
+
}
|
|
10
|
+
export interface ModifiersFormInternal extends ModifiersForm {
|
|
11
|
+
callback: ModifiersFormCallback;
|
|
12
|
+
}
|
|
13
|
+
export declare type ModifiersFormCallback = (form: ModifiersForm) => void;
|
|
14
|
+
export declare type ModifiersFormUnsuscriber = () => void;
|
|
15
|
+
export declare type HandleChangeFunction = (amount: number) => void;
|
|
16
|
+
export declare type RegisterModifiersForm = (product: Product, callback: ModifiersFormCallback) => ModifiersFormUnsuscriber;
|
|
17
|
+
export interface BuildModifierRendererConfig {
|
|
18
|
+
rootId: string;
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
type: ModifierTypes;
|
|
22
|
+
modifiersCount: number;
|
|
23
|
+
amount: number;
|
|
24
|
+
path: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface BuildModifierGroupConfig {
|
|
27
|
+
amount: number;
|
|
28
|
+
rootId: string;
|
|
29
|
+
path: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface BuildRendererConfig {
|
|
32
|
+
rootId: string;
|
|
33
|
+
path: string[];
|
|
34
|
+
}
|
|
@@ -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 { CartProduct } from "@artisan-commerce/types";
|
|
2
|
-
export declare type ValidateProduct = (product: CartProduct) => void;
|
|
1
|
+
import { CartProduct } from "@artisan-commerce/types";
|
|
2
|
+
export declare type ValidateProduct = (product: CartProduct) => void;
|
|
@@ -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,20 +1,20 @@
|
|
|
1
|
-
import { ArtisanApp, ArtisanHints, Product } from "@artisan-commerce/types";
|
|
2
|
-
import { ModifiersFormInternal } from "../lib/registerModifiersForm/registerModifiersForm.types";
|
|
3
|
-
export interface ProductHints extends Omit<ArtisanHints, "accountId"> {
|
|
4
|
-
accountId?: ArtisanHints["accountId"];
|
|
5
|
-
}
|
|
6
|
-
export interface InitProductsConfig extends ProductHints {
|
|
7
|
-
timeout?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface GlobalState extends InitProductsConfig {
|
|
10
|
-
artisanApp: ArtisanApp | undefined;
|
|
11
|
-
apiCache: ApiCache;
|
|
12
|
-
expiresAt: number;
|
|
13
|
-
forms: ModifiersForms;
|
|
14
|
-
}
|
|
15
|
-
export interface ApiCache {
|
|
16
|
-
[key: string]: Product | Product[];
|
|
17
|
-
}
|
|
18
|
-
export interface ModifiersForms {
|
|
19
|
-
[key: string]: ModifiersFormInternal;
|
|
20
|
-
}
|
|
1
|
+
import { ArtisanApp, ArtisanHints, Product } from "@artisan-commerce/types";
|
|
2
|
+
import { ModifiersFormInternal } from "../lib/registerModifiersForm/registerModifiersForm.types";
|
|
3
|
+
export interface ProductHints extends Omit<ArtisanHints, "accountId"> {
|
|
4
|
+
accountId?: ArtisanHints["accountId"];
|
|
5
|
+
}
|
|
6
|
+
export interface InitProductsConfig extends ProductHints {
|
|
7
|
+
timeout?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface GlobalState extends InitProductsConfig {
|
|
10
|
+
artisanApp: ArtisanApp | undefined;
|
|
11
|
+
apiCache: ApiCache;
|
|
12
|
+
expiresAt: number;
|
|
13
|
+
forms: ModifiersForms;
|
|
14
|
+
}
|
|
15
|
+
export interface ApiCache {
|
|
16
|
+
[key: string]: Product | Product[];
|
|
17
|
+
}
|
|
18
|
+
export interface ModifiersForms {
|
|
19
|
+
[key: string]: ModifiersFormInternal;
|
|
20
|
+
}
|
|
@@ -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,57 +1,57 @@
|
|
|
1
|
-
import { CartProduct, Image } from "@artisan-commerce/types";
|
|
2
|
-
import { CartProductQuestion } from "@artisan-commerce/types";
|
|
3
|
-
import { CartProductAnswer } from "@artisan-commerce/types";
|
|
4
|
-
import { HandleChangeFunction } from "../lib/registerModifiersForm/registerModifiersForm.types";
|
|
5
|
-
import { ProductTotals } from "../utils/caculations/calculations.utils.types";
|
|
6
|
-
export declare type RenderTypes = "RADIO" | "CHECKBOX" | "COUNTER";
|
|
7
|
-
export interface ModifierGroupRenderer {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
images: Image[];
|
|
12
|
-
data: CartProductQuestion;
|
|
13
|
-
type: GroupTypes;
|
|
14
|
-
error: string;
|
|
15
|
-
hidden: boolean;
|
|
16
|
-
required: boolean;
|
|
17
|
-
touched: boolean;
|
|
18
|
-
modifiers: ModifierRenderer[];
|
|
19
|
-
}
|
|
20
|
-
export declare type GroupTypes = RenderTypes;
|
|
21
|
-
export interface ModifierRenderer {
|
|
22
|
-
id: string;
|
|
23
|
-
groupId: string;
|
|
24
|
-
name: string;
|
|
25
|
-
amount: number;
|
|
26
|
-
images: Image[];
|
|
27
|
-
min: number;
|
|
28
|
-
max: number;
|
|
29
|
-
groups: ModifierGroupRenderer[];
|
|
30
|
-
data: CartProductAnswer;
|
|
31
|
-
type: ModifierTypes;
|
|
32
|
-
error: string;
|
|
33
|
-
hidden: boolean;
|
|
34
|
-
required: boolean;
|
|
35
|
-
touched: boolean;
|
|
36
|
-
handleChange: HandleChangeFunction;
|
|
37
|
-
totals: ModifierTotals;
|
|
38
|
-
}
|
|
39
|
-
export declare type ModifierTypes = RenderTypes;
|
|
40
|
-
export interface ModifierTotals extends ProductTotals {
|
|
41
|
-
}
|
|
42
|
-
export interface FormCartProduct extends Omit<CartProduct, "questions"> {
|
|
43
|
-
questions: FormCartProductQuestions[];
|
|
44
|
-
}
|
|
45
|
-
export interface FormCartProductQuestions extends Omit<CartProductQuestion, "answers"> {
|
|
46
|
-
answers: FormCartProductAnswer[];
|
|
47
|
-
}
|
|
48
|
-
export interface FormCartProductAnswer extends CartProductAnswer {
|
|
49
|
-
min: number;
|
|
50
|
-
max: number;
|
|
51
|
-
renderType: ModifierTypes;
|
|
52
|
-
}
|
|
53
|
-
export interface GetModifierTypeConfig {
|
|
54
|
-
min: number;
|
|
55
|
-
max: number;
|
|
56
|
-
groupType: GroupTypes;
|
|
57
|
-
}
|
|
1
|
+
import { CartProduct, Image } from "@artisan-commerce/types";
|
|
2
|
+
import { CartProductQuestion } from "@artisan-commerce/types";
|
|
3
|
+
import { CartProductAnswer } from "@artisan-commerce/types";
|
|
4
|
+
import { HandleChangeFunction } from "../lib/registerModifiersForm/registerModifiersForm.types";
|
|
5
|
+
import { ProductTotals } from "../utils/caculations/calculations.utils.types";
|
|
6
|
+
export declare type RenderTypes = "RADIO" | "CHECKBOX" | "COUNTER";
|
|
7
|
+
export interface ModifierGroupRenderer {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
images: Image[];
|
|
12
|
+
data: CartProductQuestion;
|
|
13
|
+
type: GroupTypes;
|
|
14
|
+
error: string;
|
|
15
|
+
hidden: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
touched: boolean;
|
|
18
|
+
modifiers: ModifierRenderer[];
|
|
19
|
+
}
|
|
20
|
+
export declare type GroupTypes = RenderTypes;
|
|
21
|
+
export interface ModifierRenderer {
|
|
22
|
+
id: string;
|
|
23
|
+
groupId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
images: Image[];
|
|
27
|
+
min: number;
|
|
28
|
+
max: number;
|
|
29
|
+
groups: ModifierGroupRenderer[];
|
|
30
|
+
data: CartProductAnswer;
|
|
31
|
+
type: ModifierTypes;
|
|
32
|
+
error: string;
|
|
33
|
+
hidden: boolean;
|
|
34
|
+
required: boolean;
|
|
35
|
+
touched: boolean;
|
|
36
|
+
handleChange: HandleChangeFunction;
|
|
37
|
+
totals: ModifierTotals;
|
|
38
|
+
}
|
|
39
|
+
export declare type ModifierTypes = RenderTypes;
|
|
40
|
+
export interface ModifierTotals extends ProductTotals {
|
|
41
|
+
}
|
|
42
|
+
export interface FormCartProduct extends Omit<CartProduct, "questions"> {
|
|
43
|
+
questions: FormCartProductQuestions[];
|
|
44
|
+
}
|
|
45
|
+
export interface FormCartProductQuestions extends Omit<CartProductQuestion, "answers"> {
|
|
46
|
+
answers: FormCartProductAnswer[];
|
|
47
|
+
}
|
|
48
|
+
export interface FormCartProductAnswer extends CartProductAnswer {
|
|
49
|
+
min: number;
|
|
50
|
+
max: number;
|
|
51
|
+
renderType: ModifierTypes;
|
|
52
|
+
}
|
|
53
|
+
export interface GetModifierTypeConfig {
|
|
54
|
+
min: number;
|
|
55
|
+
max: number;
|
|
56
|
+
groupType: GroupTypes;
|
|
57
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseProduct } from "@artisan-commerce/types";
|
|
2
|
-
import { ProductDetails } from "@artisan-commerce/types";
|
|
3
|
-
import { CartProduct } from "@artisan-commerce/types";
|
|
4
|
-
import { FormCartProduct } from "../../types/modifiers.types";
|
|
5
|
-
export declare const isBaseProduct: (product: BaseProduct) => boolean;
|
|
6
|
-
export declare const isProductDetails: (product: ProductDetails) => boolean;
|
|
7
|
-
export declare const isCartProduct: (product: CartProduct) => boolean;
|
|
8
|
-
export declare const isFormCartProduct: (product: FormCartProduct) => boolean;
|
|
1
|
+
import { BaseProduct } from "@artisan-commerce/types";
|
|
2
|
+
import { ProductDetails } from "@artisan-commerce/types";
|
|
3
|
+
import { CartProduct } from "@artisan-commerce/types";
|
|
4
|
+
import { FormCartProduct } from "../../types/modifiers.types";
|
|
5
|
+
export declare const isBaseProduct: (product: BaseProduct) => boolean;
|
|
6
|
+
export declare const isProductDetails: (product: ProductDetails) => boolean;
|
|
7
|
+
export declare const isCartProduct: (product: CartProduct) => boolean;
|
|
8
|
+
export declare const isFormCartProduct: (product: FormCartProduct) => 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,3 +1,3 @@
|
|
|
1
|
-
export declare const stringIsNumber: (value: string) => boolean;
|
|
2
|
-
export declare const enumToArray: (enumObj: any) => string[];
|
|
3
|
-
export declare const logError: (message: string) => void;
|
|
1
|
+
export declare const stringIsNumber: (value: string) => boolean;
|
|
2
|
+
export declare const enumToArray: (enumObj: any) => string[];
|
|
3
|
+
export declare const logError: (message: string) => void;
|
|
@@ -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>;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
-
/**
|
|
3
|
-
* Purge all invalid fields and values from the products http config
|
|
4
|
-
*/
|
|
5
|
-
export declare const purgeHTTPConfig: <T extends ProductsHTTPConfig>(config: T) => T;
|
|
6
|
-
/**
|
|
7
|
-
* Purge invalid Filters
|
|
8
|
-
*/
|
|
9
|
-
export declare const purgeFilters: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
10
|
-
export declare const purgeGroup: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
11
|
-
/**
|
|
12
|
-
* Purge Order invalid values
|
|
13
|
-
*/
|
|
14
|
-
export declare const purgeOrder: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
15
|
-
/**
|
|
16
|
-
* Purge pagination invalid keys
|
|
17
|
-
*/
|
|
18
|
-
export declare const purgePagination: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
19
|
-
/**
|
|
20
|
-
* Purge AdditionalFilters invalid keys
|
|
21
|
-
*/
|
|
22
|
-
export declare const purgeAdditionalFilters: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
23
|
-
/**
|
|
24
|
-
* Remove object field
|
|
25
|
-
*/
|
|
26
|
-
export declare const purgeObject: (obj: Record<string, any>, validKeys: string[], field: string) => {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Remove field value
|
|
31
|
-
*/
|
|
32
|
-
export declare const purgeField: (obj: Record<string, any>, validKeys: string[], fieldName: string) => {
|
|
33
|
-
[x: string]: any;
|
|
34
|
-
};
|
|
35
|
-
export declare const purgeNotID: (obj: Record<string, any>) => {
|
|
36
|
-
[x: string]: any;
|
|
37
|
-
};
|
|
38
|
-
export declare const isNumberOrString: (data: any) => boolean;
|
|
1
|
+
import { ProductsHTTPConfig } from "../../types/http.types";
|
|
2
|
+
/**
|
|
3
|
+
* Purge all invalid fields and values from the products http config
|
|
4
|
+
*/
|
|
5
|
+
export declare const purgeHTTPConfig: <T extends ProductsHTTPConfig>(config: T) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Purge invalid Filters
|
|
8
|
+
*/
|
|
9
|
+
export declare const purgeFilters: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
10
|
+
export declare const purgeGroup: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
11
|
+
/**
|
|
12
|
+
* Purge Order invalid values
|
|
13
|
+
*/
|
|
14
|
+
export declare const purgeOrder: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
15
|
+
/**
|
|
16
|
+
* Purge pagination invalid keys
|
|
17
|
+
*/
|
|
18
|
+
export declare const purgePagination: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
19
|
+
/**
|
|
20
|
+
* Purge AdditionalFilters invalid keys
|
|
21
|
+
*/
|
|
22
|
+
export declare const purgeAdditionalFilters: <T extends ProductsHTTPConfig>(config: ProductsHTTPConfig) => T;
|
|
23
|
+
/**
|
|
24
|
+
* Remove object field
|
|
25
|
+
*/
|
|
26
|
+
export declare const purgeObject: (obj: Record<string, any>, validKeys: string[], field: string) => {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Remove field value
|
|
31
|
+
*/
|
|
32
|
+
export declare const purgeField: (obj: Record<string, any>, validKeys: string[], fieldName: string) => {
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
};
|
|
35
|
+
export declare const purgeNotID: (obj: Record<string, any>) => {
|
|
36
|
+
[x: string]: any;
|
|
37
|
+
};
|
|
38
|
+
export declare const isNumberOrString: (data: any) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
-
import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
|
|
3
|
-
export declare const buildHTTPRequest: (path: string, config: ProductsHTTPConfig, data: RequestData) => ArtisanRequest;
|
|
4
|
-
export declare const filtersToQuery: (filters: ProductsHTTPConfig["filterBy"]) => {};
|
|
5
|
-
export declare const additionalFiltersToQuery: (filters?: ProductsHTTPConfig["additionalFilters"]) => {};
|
|
6
|
-
export declare const parseRoute: (path: string, params: RequestData["params"]) => string;
|
|
7
|
-
export declare const getRequestHash: (url: string) => string;
|
|
1
|
+
import { ArtisanRequest } from "@artisan-commerce/types";
|
|
2
|
+
import { ProductsHTTPConfig, RequestData } from "../../types/http.types";
|
|
3
|
+
export declare const buildHTTPRequest: (path: string, config: ProductsHTTPConfig, data: RequestData) => ArtisanRequest;
|
|
4
|
+
export declare const filtersToQuery: (filters: ProductsHTTPConfig["filterBy"]) => {};
|
|
5
|
+
export declare const additionalFiltersToQuery: (filters?: ProductsHTTPConfig["additionalFilters"]) => {};
|
|
6
|
+
export declare const parseRoute: (path: string, params: RequestData["params"]) => string;
|
|
7
|
+
export declare const getRequestHash: (url: string) => string;
|