@artisan-commerce/types 0.13.0-canary.10 → 0.13.0-canary.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/CHANGELOG.md CHANGED
@@ -3,70 +3,6 @@
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.10](https://bitbucket.org/tradesystem/artisan_sdk/compare/@artisan-commerce/types@0.13.0-canary.9...@artisan-commerce/types@0.13.0-canary.10) (2021-07-26)
7
-
8
-
9
- ### Features
10
-
11
- * **global:** anonymous shopping cart ([99762c1](https://bitbucket.org/tradesystem/artisan_sdk/commit/99762c1ee8e2bce47eb936b3f76a280048579916))
12
-
13
-
14
-
15
- ## [0.13.0-canary.9](https://bitbucket.org/tradesystem/artisan_sdk/compare/@artisan-commerce/types@0.13.0-canary.8...@artisan-commerce/types@0.13.0-canary.9) (2021-06-18)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * **global:** fix remove benefit method ([a6cb684](https://bitbucket.org/tradesystem/artisan_sdk/commit/a6cb68453250ca855d8609b9f3c8de8c0d5d9b90))
21
-
22
-
23
-
24
- ## [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)
25
-
26
-
27
- ### Features
28
-
29
- * **global:** coupons functionality ([6a538c4](https://bitbucket.org/tradesystem/artisan_monorepo/commit/6a538c40d7e0eb380c6bbb274bd640b591787bc8))
30
- * **global:** coupons functionality ([33117c2](https://bitbucket.org/tradesystem/artisan_monorepo/commit/33117c27c0e9f2d5e28705934abd1597fc92092e))
31
- * **global:** coupons functionality ([2202f0d](https://bitbucket.org/tradesystem/artisan_monorepo/commit/2202f0dd41a393eca7697d056df6f75f80748bb1))
32
-
33
-
34
-
35
- ## [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)
36
-
37
-
38
- ### Features
39
-
40
- * **types:** add country types and interfaces ([f73fabd](https://bitbucket.org/tradesystem/artisan_monorepo/commit/f73fabd5615ae1bb39c9ca59a8b79a5437eca9d1))
41
-
42
-
43
-
44
- ## [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)
45
-
46
-
47
- ### Features
48
-
49
- * **global:** update account types and add account builders ([4a6fecd](https://bitbucket.org/tradesystem/artisan_monorepo/commit/4a6fecdc45b363f068a6089eccbf36483f517288))
50
-
51
-
52
-
53
- ## [0.13.0-canary.5](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.4...@artisan-commerce/types@0.13.0-canary.5) (2021-04-16)
54
-
55
- **Note:** Version bump only for package @artisan-commerce/types
56
-
57
-
58
-
59
-
60
-
61
- ## [0.13.0-canary.4](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.3...@artisan-commerce/types@0.13.0-canary.4) (2021-04-06)
62
-
63
-
64
- ### Performance Improvements
65
-
66
- * **global:** move typescript to be a global dependency ([32370e1](https://bitbucket.org/tradesystem/artisan_monorepo/commit/32370e134f1bcc4f79c55e2bae0ee22fee193e77))
67
-
68
-
69
-
70
6
  ## [0.13.0-canary.3](https://bitbucket.org/tradesystem/artisan_monorepo/compare/@artisan-commerce/types@0.13.0-canary.2...@artisan-commerce/types@0.13.0-canary.3) (2021-04-01)
71
7
 
72
8
  **Note:** Version bump only for package @artisan-commerce/types
package/build/index.d.ts CHANGED
@@ -5,7 +5,6 @@ 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";
9
8
  export * from "./types/currency.types";
10
9
  export * from "./types/image.types";
11
10
  export * from "./types/product.types";
package/build/index.js CHANGED
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
7
7
  o[k2] = m[k];
8
8
  }));
9
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  // Main
@@ -18,7 +18,6 @@ __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);
22
21
  __exportStar(require("./types/currency.types"), exports);
23
22
  __exportStar(require("./types/image.types"), exports);
24
23
  __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,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,yDAAuC;AACvC,sDAAoC;AACpC,wDAAsC;AACtC,6DAA2C;AAC3C,6DAA2C;AAC3C,sDAAoC;AACpC,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,4DAA0C;AAC1C,4DAA0C;AAC1C,gEAA8C"}
@@ -1,17 +1,12 @@
1
- import { Image } from "./image.types";
2
1
  /**
3
- * Representation of a Commerce Account
2
+ * Representation of a Customer Account
4
3
  *
5
4
  * @interface Account
6
5
  * @since 0.5.14
7
6
  * @property {number} accountId artisan's account unique identifier.
8
7
  * @property {string} name account's name.
9
- * @property {string} description account's description.
10
- * @property {string} images account's images.
11
8
  */
12
9
  export interface Account {
13
10
  accountId: number;
14
11
  name: string;
15
- description?: string;
16
- images: Image[];
17
12
  }
@@ -1,4 +1,4 @@
1
- import { CountrySummary } from "./common.types";
1
+ import { Country } 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: CountrySummary;
12
+ country: Country;
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 CountrySummary {
5
+ export interface Country {
6
6
  id: number;
7
7
  name: string;
8
8
  }
@@ -2,50 +2,14 @@ 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
- */
13
5
  export interface Wallet {
14
6
  benefits: Benefit[];
7
+ usedBenefits: Benefit[];
8
+ unusedBenefits: Benefit[];
15
9
  }
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
- * @property {number} channelId The channel id of the benefit
42
- * @property {number} vendorId The vendor id of the benefit
43
- * @property {number} accountId The account id of the benefit
44
- *
45
- */
46
10
  export interface Benefit {
47
11
  hash: string;
48
- award: Award;
12
+ award: Award[];
49
13
  benefitId: number;
50
14
  benefitWalletId: number;
51
15
  code: null;
@@ -62,35 +26,18 @@ export interface Benefit {
62
26
  quantity: number;
63
27
  rules: any[];
64
28
  title: string;
65
- type: BenefitTypes;
29
+ type: string;
66
30
  updatedAt: string;
67
- channelId: number;
68
- vendorId: number;
69
- accountId: number;
70
31
  }
71
- /**
72
- * Award information.
73
- *
74
- * @interface Award
75
- * @since 0.5.14
76
- * @property {number} id The id of the award
77
- * @property {number} benefitId The id of the benefit
78
- * @property {number} discountPercentage Benefit discount percentage
79
- * @property {null} discountValue Benefit discount value
80
- *
81
- */
82
32
  export interface Award {
83
33
  id: number;
84
34
  benefitId: number;
85
35
  discountPercentage: number;
86
36
  discountValue: null;
87
37
  }
88
- /**
89
- * Applied benefit array in shopping cart
90
- *
91
- * @type ShoppingCartBenefits
92
- **/
93
- export declare type ShoppingCartBenefits = Benefit[];
38
+ export interface ShoppingCartBenefits {
39
+ [key: string]: Benefit;
40
+ }
94
41
  export declare type BenefitsByUserNode = ArtisanDBQueryDocumentSnapshot<ArtisanDBDocumentData>;
95
42
  export declare type BenefitsByUserNodes = ArtisanDBCollectionReference<ArtisanDBDocumentData>;
96
43
  export declare type BenefitTypes = "ALTER_DELIVERY" | "PRODUCT" | "DISCOUNT";
@@ -1,38 +1,16 @@
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
- */
29
4
  export interface BaseProduct {
30
5
  productId: string;
31
6
  name: string;
32
7
  description: string;
33
8
  type: ProductType;
34
9
  coverUrl: string;
35
- prices: ProductPrices;
10
+ prices: {
11
+ NORMAL: PriceCategory;
12
+ POINTS: PriceCategory;
13
+ };
36
14
  addDirectlyToCart: boolean;
37
15
  outOfService: boolean;
38
16
  outOfStock: boolean;
@@ -44,20 +22,7 @@ export interface BaseProduct {
44
22
  images: Image[];
45
23
  standardTime: string;
46
24
  sponsored: boolean;
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;
25
+ status: "ACTIVE" | "INACTIVE";
61
26
  }
62
27
  export interface PriceCategory {
63
28
  category: PriceCategoryType;
@@ -82,13 +47,6 @@ export interface ProductAttributes {
82
47
  externalId: string;
83
48
  showInMenu: boolean;
84
49
  }
85
- /**
86
- * The product status
87
- *
88
- * @since 0.5.14
89
- * @type ProductStatus
90
- **/
91
- export declare type ProductStatus = "ACTIVE" | "INACTIVE";
92
50
  export declare enum ProductType {
93
51
  PRODUCT = "PRODUCT",
94
52
  MODIFIER = "MODIFIER"
@@ -125,26 +83,12 @@ export interface ProductQuestion {
125
83
  images: Image[] | undefined;
126
84
  }
127
85
  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
- */
141
86
  export interface ProductDetails extends BaseProduct {
142
87
  isPriceVip: boolean;
143
88
  manufacturer: string[];
144
89
  maxAmountForSale: number;
145
90
  schedule: DayOfWeek[];
146
91
  questions: ProductQuestion[];
147
- benefitId?: number;
148
92
  }
149
93
  export interface ProductAnswer extends Pick<Product, CommonProductAndAnswersProps> {
150
94
  questions: ProductDetails["questions"];
@@ -1 +1 @@
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
+ {"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,4 +1,4 @@
1
- import { CountrySummary } from "./common.types";
1
+ import { Country } 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: CountrySummary;
12
+ country: Country;
13
13
  }
14
14
  export interface ShippingAddress extends BaseShippingAddress {
15
15
  id: number;
@@ -7,27 +7,6 @@ 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
- */
31
10
  export interface ShoppingCart {
32
11
  id: string;
33
12
  name: string;
@@ -42,7 +21,7 @@ export interface ShoppingCart {
42
21
  additional_info?: Record<string, any>;
43
22
  billTotal: BillTotal;
44
23
  benefits?: ShoppingCartBenefits;
45
- benefitsHash?: string;
24
+ benefitHash?: string;
46
25
  }
47
26
  export interface Alert {
48
27
  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.10",
4
+ "version": "0.13.0-canary.3",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
7
7
  "files": [
@@ -26,6 +26,7 @@
26
26
  "@types/node": "^14.0.24",
27
27
  "@typescript-eslint/eslint-plugin": "^3.7.0",
28
28
  "@typescript-eslint/parser": "^3.7.0",
29
+ "cross-env": "^7.0.2",
29
30
  "eslint": "^7.5.0",
30
31
  "eslint-config-prettier": "^6.11.0",
31
32
  "eslint-config-react-app": "^5.2.1",
@@ -40,7 +41,8 @@
40
41
  "jest-extended": "^0.11.5",
41
42
  "npm-run-all": "^4.1.5",
42
43
  "prettier": "^2.1.2",
44
+ "typescript": "^3.9.7",
43
45
  "webpack-bundle-analyzer": "^3.9.0"
44
46
  },
45
- "gitHead": "d40676dbade0365a3d0fb195a095e65965e08162"
47
+ "gitHead": "3d5feece7729bab1e4d4ccbf1a283fe7ac95ba22"
46
48
  }
@@ -1,18 +0,0 @@
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
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- // Country types and interfaces
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- //# sourceMappingURL=country.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"country.types.js","sourceRoot":"","sources":["../../src/types/country.types.ts"],"names":[],"mappings":";AAAA,+BAA+B"}