@artisan-commerce/products 0.7.0 → 0.7.3
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.json +1 -0
- 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/build/vendors.bundle.js +1 -1
- package/package.json +5 -4
- package/build/report.html +0 -53
|
@@ -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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ProductQuestion } from "@artisan-commerce/types";
|
|
2
|
-
import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
3
|
-
import { ModifierRenderer } from "../../types/modifiers.types";
|
|
4
|
-
import { FormCartProductQuestions } from "../../types/modifiers.types";
|
|
5
|
-
import { GetModifierTypeConfig } from "../../types/modifiers.types";
|
|
6
|
-
import { GroupTypes, ModifierTypes } from "../../types/modifiers.types";
|
|
7
|
-
export declare const getGroupType: (group: ProductQuestion) => GroupTypes;
|
|
8
|
-
export declare const getModifierType: (config: GetModifierTypeConfig) => ModifierTypes;
|
|
9
|
-
export declare const getModifierMin: (groupConfig: BuildModifierRendererConfig) => number;
|
|
10
|
-
export declare const getModifierMax: (groupConfig: BuildModifierRendererConfig) => number;
|
|
11
|
-
export declare const countGroupModifiersAmount: (group: FormCartProductQuestions) => number;
|
|
12
|
-
export declare const getModifierError: (modifier: ModifierRenderer, amount: number) => string;
|
|
1
|
+
import { ProductQuestion } from "@artisan-commerce/types";
|
|
2
|
+
import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
3
|
+
import { ModifierRenderer } from "../../types/modifiers.types";
|
|
4
|
+
import { FormCartProductQuestions } from "../../types/modifiers.types";
|
|
5
|
+
import { GetModifierTypeConfig } from "../../types/modifiers.types";
|
|
6
|
+
import { GroupTypes, ModifierTypes } from "../../types/modifiers.types";
|
|
7
|
+
export declare const getGroupType: (group: ProductQuestion) => GroupTypes;
|
|
8
|
+
export declare const getModifierType: (config: GetModifierTypeConfig) => ModifierTypes;
|
|
9
|
+
export declare const getModifierMin: (groupConfig: BuildModifierRendererConfig) => number;
|
|
10
|
+
export declare const getModifierMax: (groupConfig: BuildModifierRendererConfig) => number;
|
|
11
|
+
export declare const countGroupModifiersAmount: (group: FormCartProductQuestions) => number;
|
|
12
|
+
export declare const getModifierError: (modifier: ModifierRenderer, amount: number) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Product } from "@artisan-commerce/types";
|
|
2
|
-
import { ModifiersForm } from "../..";
|
|
3
|
-
export declare const createForm: (product: Product) => ModifiersForm;
|
|
1
|
+
import { Product } from "@artisan-commerce/types";
|
|
2
|
+
import { ModifiersForm } from "../..";
|
|
3
|
+
export declare const createForm: (product: Product) => ModifiersForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const handleModifierChange: (productId: string, path: string[], amount: number) => void;
|
|
1
|
+
export declare const handleModifierChange: (productId: string, path: string[], amount: number) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ModifierGroupRenderer } from "../..";
|
|
2
|
-
import { ModifierRenderer } from "../..";
|
|
3
|
-
import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
4
|
-
import { BuildRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
5
|
-
import { BuildModifierGroupConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
6
|
-
import { FormCartProduct } from "../../types/modifiers.types";
|
|
7
|
-
import { FormCartProductQuestions } from "../../types/modifiers.types";
|
|
8
|
-
import { FormCartProductAnswer } from "../../types/modifiers.types";
|
|
9
|
-
export declare const buildRenderer: (product: FormCartProduct, config: BuildRendererConfig) => ModifierGroupRenderer[];
|
|
10
|
-
export declare const buildModifierGroupRenderer: (modifierGroup: FormCartProductQuestions, parentConfig: BuildModifierGroupConfig) => ModifierGroupRenderer;
|
|
11
|
-
export declare const buildModifierRenderer: (modifier: FormCartProductAnswer, config: BuildModifierRendererConfig) => ModifierRenderer;
|
|
1
|
+
import { ModifierGroupRenderer } from "../..";
|
|
2
|
+
import { ModifierRenderer } from "../..";
|
|
3
|
+
import { BuildModifierRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
4
|
+
import { BuildRendererConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
5
|
+
import { BuildModifierGroupConfig } from "../../lib/registerModifiersForm/registerModifiersForm.types";
|
|
6
|
+
import { FormCartProduct } from "../../types/modifiers.types";
|
|
7
|
+
import { FormCartProductQuestions } from "../../types/modifiers.types";
|
|
8
|
+
import { FormCartProductAnswer } from "../../types/modifiers.types";
|
|
9
|
+
export declare const buildRenderer: (product: FormCartProduct, config: BuildRendererConfig) => ModifierGroupRenderer[];
|
|
10
|
+
export declare const buildModifierGroupRenderer: (modifierGroup: FormCartProductQuestions, parentConfig: BuildModifierGroupConfig) => ModifierGroupRenderer;
|
|
11
|
+
export declare const buildModifierRenderer: (modifier: FormCartProductAnswer, config: BuildModifierRendererConfig) => ModifierRenderer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModifierGroupRenderer, ModifierRenderer } from "../..";
|
|
2
|
-
export declare const getRendererPathNode: (groups: ModifierGroupRenderer[], path: string[]) => ModifierGroupRenderer | ModifierRenderer;
|
|
3
|
-
export declare const setRendererPathNode: (renderer: ModifierGroupRenderer[], path: string[], replacement: ModifierGroupRenderer | ModifierRenderer) => any[];
|
|
4
|
-
export declare const findNodeInPath: (segments: (ModifierGroupRenderer | ModifierRenderer)[], segmentId: string) => ModifierGroupRenderer | ModifierRenderer;
|
|
1
|
+
import { ModifierGroupRenderer, ModifierRenderer } from "../..";
|
|
2
|
+
export declare const getRendererPathNode: (groups: ModifierGroupRenderer[], path: string[]) => ModifierGroupRenderer | ModifierRenderer;
|
|
3
|
+
export declare const setRendererPathNode: (renderer: ModifierGroupRenderer[], path: string[], replacement: ModifierGroupRenderer | ModifierRenderer) => any[];
|
|
4
|
+
export declare const findNodeInPath: (segments: (ModifierGroupRenderer | ModifierRenderer)[], segmentId: string) => ModifierGroupRenderer | ModifierRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModifierGroupRenderer } from "../..";
|
|
2
|
-
import { ModifierRenderer } from "../..";
|
|
3
|
-
export declare const updateModifier: (renderer: ModifierGroupRenderer[], path: string[], node: ModifierRenderer, amount: number) => any[];
|
|
4
|
-
export declare const updateParentGroup: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
|
|
5
|
-
export declare const updateParentModifier: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
|
|
1
|
+
import { ModifierGroupRenderer } from "../..";
|
|
2
|
+
import { ModifierRenderer } from "../..";
|
|
3
|
+
export declare const updateModifier: (renderer: ModifierGroupRenderer[], path: string[], node: ModifierRenderer, amount: number) => any[];
|
|
4
|
+
export declare const updateParentGroup: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
|
|
5
|
+
export declare const updateParentModifier: (rootId: string, renderer: ModifierGroupRenderer[], path: string[]) => any[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ArtisanRequest, ArtisanHints } from "@artisan-commerce/types";
|
|
2
|
-
export declare const transformResponse: (data: any, error: Error | undefined, req: ArtisanRequest) => {
|
|
3
|
-
data: any;
|
|
4
|
-
hints: Partial<ArtisanHints>;
|
|
5
|
-
config: ArtisanRequest;
|
|
6
|
-
error: string | undefined;
|
|
7
|
-
};
|
|
1
|
+
import { ArtisanRequest, ArtisanHints } from "@artisan-commerce/types";
|
|
2
|
+
export declare const transformResponse: (data: any, error: Error | undefined, req: ArtisanRequest) => {
|
|
3
|
+
data: any;
|
|
4
|
+
hints: Partial<ArtisanHints>;
|
|
5
|
+
config: ArtisanRequest;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ProductDetails } from "@artisan-commerce/types";
|
|
2
|
-
import { Product, CartProduct } from "@artisan-commerce/types";
|
|
3
|
-
import { FormCartProduct } from "../../types/modifiers.types";
|
|
4
|
-
import { FormCartProductAnswer } from "../../types/modifiers.types";
|
|
5
|
-
export declare const toCartProduct: (product: Product, overrides?: Partial<CartProduct>) => CartProduct;
|
|
6
|
-
export declare const toFormCartProduct: (product: Product, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
7
|
-
export declare const toFormCartProductHelper: (product: CartProduct | FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
8
|
-
export declare const toFormCartProductFromProductDetails: (product: ProductDetails, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
9
|
-
export declare const toFormCartProductFromAnswer: (modifier: FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
1
|
+
import { ProductDetails } from "@artisan-commerce/types";
|
|
2
|
+
import { Product, CartProduct } from "@artisan-commerce/types";
|
|
3
|
+
import { FormCartProduct } from "../../types/modifiers.types";
|
|
4
|
+
import { FormCartProductAnswer } from "../../types/modifiers.types";
|
|
5
|
+
export declare const toCartProduct: (product: Product, overrides?: Partial<CartProduct>) => CartProduct;
|
|
6
|
+
export declare const toFormCartProduct: (product: Product, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
7
|
+
export declare const toFormCartProductHelper: (product: CartProduct | FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
8
|
+
export declare const toFormCartProductFromProductDetails: (product: ProductDetails, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
|
9
|
+
export declare const toFormCartProductFromAnswer: (modifier: FormCartProductAnswer, overrides?: Partial<FormCartProduct>) => FormCartProduct;
|
package/build/src/vendors.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/build/vendors.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("products",[],t):"object"==typeof exports?exports.products=t():e.products=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("products",[],t):"object"==typeof exports?exports.products=t():e.products=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=23)}({23:function(e,t){}})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artisan-commerce/products",
|
|
3
3
|
"description": "Artisan's product management library",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.3",
|
|
5
5
|
"main": "./build/main.bundle.js",
|
|
6
6
|
"types": "./build/src/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"author": "Luis Eduardo Andrade",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@artisan-commerce/
|
|
34
|
+
"@artisan-commerce/auth": "^0.8.11",
|
|
35
|
+
"@artisan-commerce/builders": "^0.4.7",
|
|
35
36
|
"@bugsnag/js": "^7.2.0",
|
|
36
37
|
"axios": "^0.19.2",
|
|
37
38
|
"i18next": "^19.6.2",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"sha1": "^1.1.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@artisan-commerce/types": "^0.10.
|
|
44
|
+
"@artisan-commerce/types": "^0.10.3",
|
|
44
45
|
"@babel/core": "^7.10.5",
|
|
45
46
|
"@babel/preset-env": "^7.10.4",
|
|
46
47
|
"@babel/preset-react": "^7.10.4",
|
|
@@ -87,5 +88,5 @@
|
|
|
87
88
|
"webpack-dev-server": "^3.11.0",
|
|
88
89
|
"webpack-merge": "^5.0.9"
|
|
89
90
|
},
|
|
90
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "856aa1c21d78ab6939f1923471f47063d1c6e32f"
|
|
91
92
|
}
|