@artisan-commerce/types 0.13.0-canary.6 → 0.13.0-canary.8

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/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.13.0-canary.8](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.7...@artisan-commerce/types@0.13.0-canary.8) (2021-06-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * **global:** coupons functionality ([6a538c4](https://bitbucket.org/tradesystem/artisan_monorepo/commit/6a538c40d7e0eb380c6bbb274bd640b591787bc8))
12
+ * **global:** coupons functionality ([33117c2](https://bitbucket.org/tradesystem/artisan_monorepo/commit/33117c27c0e9f2d5e28705934abd1597fc92092e))
13
+ * **global:** coupons functionality ([2202f0d](https://bitbucket.org/tradesystem/artisan_monorepo/commit/2202f0dd41a393eca7697d056df6f75f80748bb1))
14
+
15
+
16
+
17
+ ## [0.13.0-canary.7](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.6...@artisan-commerce/types@0.13.0-canary.7) (2021-04-22)
18
+
19
+
20
+ ### Features
21
+
22
+ * **types:** add country types and interfaces ([f73fabd](https://bitbucket.org/tradesystem/artisan_monorepo/commit/f73fabd5615ae1bb39c9ca59a8b79a5437eca9d1))
23
+
24
+
25
+
6
26
  ## [0.13.0-canary.6](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.5...@artisan-commerce/types@0.13.0-canary.6) (2021-04-21)
7
27
 
8
28
 
package/build/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./types/category.types";
5
5
  export * from "./types/channel.types";
6
6
  export * from "./types/common.types";
7
7
  export * from "./types/coupons.types";
8
+ export * from "./types/country.types";
8
9
  export * from "./types/currency.types";
9
10
  export * from "./types/image.types";
10
11
  export * from "./types/product.types";
package/build/index.js CHANGED
@@ -18,6 +18,7 @@ __exportStar(require("./types/category.types"), exports);
18
18
  __exportStar(require("./types/channel.types"), exports);
19
19
  __exportStar(require("./types/common.types"), exports);
20
20
  __exportStar(require("./types/coupons.types"), exports);
21
+ __exportStar(require("./types/country.types"), exports);
21
22
  __exportStar(require("./types/currency.types"), exports);
22
23
  __exportStar(require("./types/image.types"), exports);
23
24
  __exportStar(require("./types/product.types"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO;AACP,oDAAkC;AAClC,wDAAsC;AACtC,0DAAwC;AACxC,yDAAuC;AACvC,wDAAsC;AACtC,uDAAqC;AACrC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC;AACpC,wDAAsC;AACtC,6DAA2C;AAC3C,6DAA2C;AAC3C,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,4DAA0C;AAC1C,4DAA0C;AAC1C,gEAA8C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO;AACP,oDAAkC;AAClC,wDAAsC;AACtC,0DAAwC;AACxC,yDAAuC;AACvC,wDAAsC;AACtC,uDAAqC;AACrC,wDAAsC;AACtC,wDAAsC;AACtC,yDAAuC;AACvC,sDAAoC;AACpC,wDAAsC;AACtC,6DAA2C;AAC3C,6DAA2C;AAC3C,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,4DAA0C;AAC1C,4DAA0C;AAC1C,gEAA8C"}
@@ -1,4 +1,4 @@
1
- import { Country } from "./common.types";
1
+ import { CountrySummary } from "./common.types";
2
2
  import { DocumentType } from "./common.types";
3
3
  export interface BaseBillingData {
4
4
  nickname: string;
@@ -9,7 +9,7 @@ export interface BaseBillingData {
9
9
  phone: string;
10
10
  email: string;
11
11
  default: boolean;
12
- country: Country;
12
+ country: CountrySummary;
13
13
  }
14
14
  export interface BillingData extends BaseBillingData {
15
15
  id: number;
@@ -2,7 +2,7 @@ export interface Objectify<T> {
2
2
  [key: string]: T;
3
3
  }
4
4
  export declare type DocumentType = "CI" | "RUC" | "PASSPORT";
5
- export interface Country {
5
+ export interface CountrySummary {
6
6
  id: number;
7
7
  name: string;
8
8
  }
@@ -0,0 +1,18 @@
1
+ export interface Country {
2
+ countryId: string;
3
+ name: string;
4
+ code: string;
5
+ active: boolean;
6
+ currency: CountryCurrency;
7
+ taxes: CountryTax[];
8
+ }
9
+ export interface CountryCurrency {
10
+ currencyId: string;
11
+ name: string;
12
+ sign: string;
13
+ }
14
+ export interface CountryTax {
15
+ tax: string;
16
+ vatRate: string;
17
+ percentage: string;
18
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Country types and interfaces
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=country.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.types.js","sourceRoot":"","sources":["../../src/types/country.types.ts"],"names":[],"mappings":";AAAA,+BAA+B"}
@@ -2,14 +2,47 @@ import { ArtisanDBCollectionReference } from "./artisanDB.types";
2
2
  import { ArtisanDBQueryDocumentSnapshot } from "./artisanDB.types";
3
3
  import { ArtisanDBDocumentData } from "./artisanDB.types";
4
4
  import { Image } from "./image.types";
5
+ /**
6
+ * Walllet user information.
7
+ *
8
+ * @interface Wallet
9
+ * @since 0.5.14
10
+ * @property {Benefit[]} benefits Benefit's array from firestore user wallet
11
+ *
12
+ */
5
13
  export interface Wallet {
6
14
  benefits: Benefit[];
7
- usedBenefits: Benefit[];
8
- unusedBenefits: Benefit[];
9
15
  }
16
+ /**
17
+ * Benefit information.
18
+ *
19
+ * @interface Benefit
20
+ * @since 0.5.14
21
+ * @property {string} hash The user wallet id
22
+ * @property {Award} award The benefit awards
23
+ * @property {number} benefitId Benefit id
24
+ * @property {number} benefitWalletId Benefit wallet id
25
+ * @property {null} code Benefit code in back-end
26
+ * @property {string} combined Combined
27
+ * @property {string} createdAt Benefit creation date
28
+ * @property {string} description Benefit description
29
+ * @property {number} discountPercentage Benefit discount percentage
30
+ * @property {string} expirationDate Benefit expiration date
31
+ * @property {null} externalId External benefit id
32
+ * @property {Image[]} image Benefit images
33
+ * @property {null} limitAward The award limit
34
+ * @property {number} limitBenefit The benefit limit
35
+ * @property {string} logicOperator The logic operator of the benefit
36
+ * @property {number} quantity Benefit stock
37
+ * @property {any[]} rules The rules of the benefit
38
+ * @property {string} title The benefit title
39
+ * @property {BenefitTypes} type Benefit type
40
+ * @property {string} updatedAt Benefit update date
41
+ *
42
+ */
10
43
  export interface Benefit {
11
44
  hash: string;
12
- award: Award[];
45
+ award: Award;
13
46
  benefitId: number;
14
47
  benefitWalletId: number;
15
48
  code: null;
@@ -26,18 +59,32 @@ export interface Benefit {
26
59
  quantity: number;
27
60
  rules: any[];
28
61
  title: string;
29
- type: string;
62
+ type: BenefitTypes;
30
63
  updatedAt: string;
31
64
  }
65
+ /**
66
+ * Award information.
67
+ *
68
+ * @interface Award
69
+ * @since 0.5.14
70
+ * @property {number} id The id of the award
71
+ * @property {number} benefitId The id of the benefit
72
+ * @property {number} discountPercentage Benefit discount percentage
73
+ * @property {null} discountValue Benefit discount value
74
+ *
75
+ */
32
76
  export interface Award {
33
77
  id: number;
34
78
  benefitId: number;
35
79
  discountPercentage: number;
36
80
  discountValue: null;
37
81
  }
38
- export interface ShoppingCartBenefits {
39
- [key: string]: Benefit;
40
- }
82
+ /**
83
+ * Applied benefit array in shopping cart
84
+ *
85
+ * @type ShoppingCartBenefits
86
+ **/
87
+ export declare type ShoppingCartBenefits = Benefit[];
41
88
  export declare type BenefitsByUserNode = ArtisanDBQueryDocumentSnapshot<ArtisanDBDocumentData>;
42
89
  export declare type BenefitsByUserNodes = ArtisanDBCollectionReference<ArtisanDBDocumentData>;
43
90
  export declare type BenefitTypes = "ALTER_DELIVERY" | "PRODUCT" | "DISCOUNT";
@@ -1,16 +1,38 @@
1
1
  import { Image } from "./image.types";
2
2
  import { Alert } from "./shoppingCart.types";
3
3
  export declare type Product = BaseProduct | ProductDetails | CartProduct;
4
+ /**
5
+ * Base product attributes.
6
+ *
7
+ * @interface BaseProduct
8
+ * @since 0.5.14
9
+ * @property {string} productId The product id
10
+ * @property {string} name The name of the product
11
+ * @property {string} description The description of the product
12
+ * @property {ProductType} type The type of the product
13
+ * @property {string} coverUrl The cover url of the product
14
+ * @property {ProductPrices} prices The prices object of the product
15
+ * @property {boolean} addDirectlyToCart Indicates if a product can be added directly to cart
16
+ * @property {boolean} outOfService Inidicates if a product is out of service
17
+ * @property {boolean} outOfStock Inidicates if a product is out of stock
18
+ * @property {number} outOfStock The stock of the product
19
+ * @property {string} measure The measure of the product
20
+ * @property {ProductAttributes} attributes The attributes of the product
21
+ * @property {string} suggestedPrice The suggested price of the product
22
+ * @property {boolean} available Indicates if a product is available
23
+ * @property {Image[]} images The images of the product
24
+ * @property {string} standardTime The standard time of the product
25
+ * @property {boolean} sponsored Indicates if a product is sponsored
26
+ * @property {ProductStatus} status The status of the product
27
+ *
28
+ */
4
29
  export interface BaseProduct {
5
30
  productId: string;
6
31
  name: string;
7
32
  description: string;
8
33
  type: ProductType;
9
34
  coverUrl: string;
10
- prices: {
11
- NORMAL: PriceCategory;
12
- POINTS: PriceCategory;
13
- };
35
+ prices: ProductPrices;
14
36
  addDirectlyToCart: boolean;
15
37
  outOfService: boolean;
16
38
  outOfStock: boolean;
@@ -22,7 +44,20 @@ export interface BaseProduct {
22
44
  images: Image[];
23
45
  standardTime: string;
24
46
  sponsored: boolean;
25
- status: "ACTIVE" | "INACTIVE";
47
+ status: ProductStatus;
48
+ }
49
+ /**
50
+ * Product prices attributes.
51
+ *
52
+ * @interface ProductPrices
53
+ * @since 0.5.14
54
+ * @property {PriceCategory} NORMAL Normal price cotegory
55
+ * @property {PriceCategory} POINTS Points price category
56
+ *
57
+ */
58
+ export interface ProductPrices {
59
+ NORMAL: PriceCategory;
60
+ POINTS: PriceCategory;
26
61
  }
27
62
  export interface PriceCategory {
28
63
  category: PriceCategoryType;
@@ -47,6 +82,13 @@ export interface ProductAttributes {
47
82
  externalId: string;
48
83
  showInMenu: boolean;
49
84
  }
85
+ /**
86
+ * The product status
87
+ *
88
+ * @since 0.5.14
89
+ * @type ProductStatus
90
+ **/
91
+ export declare type ProductStatus = "ACTIVE" | "INACTIVE";
50
92
  export declare enum ProductType {
51
93
  PRODUCT = "PRODUCT",
52
94
  MODIFIER = "MODIFIER"
@@ -83,12 +125,26 @@ export interface ProductQuestion {
83
125
  images: Image[] | undefined;
84
126
  }
85
127
  declare type CommonProductAndAnswersProps = "name" | "prices" | "attributes" | "productId" | "type" | "images";
128
+ /**
129
+ * Product details attributes.
130
+ *
131
+ * @interface ProductDetails
132
+ * @since 0.5.14
133
+ * @property {boolean} isPriceVip Indicates if a product has a price vip
134
+ * @property {string[]} manufacturer The manufacturer of the product
135
+ * @property {number} maxAmountForSale The mas amount for sale of the product
136
+ * @property {DayOfWeek[]} schedule The schedule of the product
137
+ * @property {ProductQuestion[]} questions The questions of the product
138
+ * @property {number} benefitId The benefit id of the product
139
+ *
140
+ */
86
141
  export interface ProductDetails extends BaseProduct {
87
142
  isPriceVip: boolean;
88
143
  manufacturer: string[];
89
144
  maxAmountForSale: number;
90
145
  schedule: DayOfWeek[];
91
146
  questions: ProductQuestion[];
147
+ benefitId?: number;
92
148
  }
93
149
  export interface ProductAnswer extends Pick<Product, CommonProductAndAnswersProps> {
94
150
  questions: ProductDetails["questions"];
@@ -1 +1 @@
1
- {"version":3,"file":"product.types.js","sourceRoot":"","sources":["../../src/types/product.types.ts"],"names":[],"mappings":";;;AAwDA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;AACvB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AACD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AACD,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,sBAAW,CAAA;AACb,CAAC,EAFW,OAAO,GAAP,eAAO,KAAP,eAAO,QAElB;AAQD,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;AACnB,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB"}
1
+ {"version":3,"file":"product.types.js","sourceRoot":"","sources":["../../src/types/product.types.ts"],"names":[],"mappings":";;;AAoGA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;AACvB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AACD,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,sCAAiB,CAAA;AACnB,CAAC,EAHW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAG5B;AACD,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,sBAAW,CAAA;AACb,CAAC,EAFW,OAAO,GAAP,eAAO,KAAP,eAAO,QAElB;AAQD,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;AACnB,CAAC,EARW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAQxB"}
@@ -1,4 +1,4 @@
1
- import { Country } from "./common.types";
1
+ import { CountrySummary } from "./common.types";
2
2
  import { LivingPlace, LivingPlaceToSave } from "./livingPlace.types";
3
3
  export interface BaseShippingAddress {
4
4
  default: boolean;
@@ -9,7 +9,7 @@ export interface BaseShippingAddress {
9
9
  number: string;
10
10
  secondaryStreet: string;
11
11
  addressReference: string;
12
- country: Country;
12
+ country: CountrySummary;
13
13
  }
14
14
  export interface ShippingAddress extends BaseShippingAddress {
15
15
  id: number;
@@ -7,6 +7,27 @@ import { ShoppingCartBenefits } from "./coupons.types";
7
7
  import { ArtisanDBCollectionReference } from "./artisanDB.types";
8
8
  import { ArtisanDBQueryDocumentSnapshot } from "./artisanDB.types";
9
9
  import { ArtisanDBDocumentData } from "./artisanDB.types";
10
+ /**
11
+ * ShoppingCart attributes.
12
+ *
13
+ * @interface ShoppingCart
14
+ * @since 0.5.14
15
+ * @property {string} id The id of the shopping cart
16
+ * @property {string} name The name of the shopping cart
17
+ * @property {number} latitude The latitude of the shopping cart
18
+ * @property {number} longitude The longitude of the shopping cart
19
+ * @property {PriceCategoryType} priceCategory The priceCategory of the shopping cart
20
+ * @property {string} createdAt Shopping cart creation date
21
+ * @property {string} updatedAt Shopping cart update date
22
+ * @property {number} channelId The channel id of he shopping cart
23
+ * @property {Objectify<CartStore>} stores The stores of the shopping cart
24
+ * @property {ShippingCost} shippingCost The shipping cost of the shopping cart
25
+ * @property {Record<string, any>} additional_info The additional info of the shopping cart
26
+ * @property {BillTotal} billTotal The bill total of the shopping cart
27
+ * @property {ShoppingCartBenefits} benefits The applied benefits of the shopping cart
28
+ * @property {string} benefitsHash The user wallet id of the shopping cart
29
+ *
30
+ */
10
31
  export interface ShoppingCart {
11
32
  id: string;
12
33
  name: string;
@@ -21,7 +42,7 @@ export interface ShoppingCart {
21
42
  additional_info?: Record<string, any>;
22
43
  billTotal: BillTotal;
23
44
  benefits?: ShoppingCartBenefits;
24
- benefitHash?: string;
45
+ benefitsHash?: string;
25
46
  }
26
47
  export interface Alert {
27
48
  errorLevel: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@artisan-commerce/types",
3
3
  "description": "Artisan's types and interfaces library",
4
- "version": "0.13.0-canary.6",
4
+ "version": "0.13.0-canary.8",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "files": [
@@ -42,5 +42,5 @@
42
42
  "prettier": "^2.1.2",
43
43
  "webpack-bundle-analyzer": "^3.9.0"
44
44
  },
45
- "gitHead": "abb51980630496cead2a6960fb525aa393599aeb"
45
+ "gitHead": "d1b6289c5e717daec9c4675d822c1b29c850bb9e"
46
46
  }