@infrab4a/connect-angular 3.9.1-beta2 → 3.9.1-beta4

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.
Files changed (54) hide show
  1. package/angular-connect.module.d.ts +1 -0
  2. package/bundles/infrab4a-connect-angular.umd.js +1944 -1525
  3. package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
  4. package/consts/category-structure.d.ts +1 -0
  5. package/consts/index.d.ts +1 -0
  6. package/esm2015/angular-connect.module.js +14 -3
  7. package/esm2015/angular-hasura-graphql.module.js +18 -2
  8. package/esm2015/consts/category-structure.js +2 -0
  9. package/esm2015/consts/index.js +2 -1
  10. package/esm2015/index.js +3 -3
  11. package/esm2015/services/cart.service.js +32 -12
  12. package/esm2015/services/catalog/adapters/category-structure.adapter.js +2 -0
  13. package/esm2015/services/catalog/adapters/index.js +4 -0
  14. package/esm2015/services/catalog/adapters/new-category-structure.adapter.js +51 -0
  15. package/esm2015/services/catalog/adapters/old-category-structure.adapter.js +27 -0
  16. package/esm2015/services/catalog/catalog.service.js +96 -0
  17. package/esm2015/services/catalog/category.service.js +56 -0
  18. package/esm2015/services/catalog/enums/index.js +2 -0
  19. package/esm2015/services/catalog/enums/product-sorts.enum.js +11 -0
  20. package/esm2015/services/catalog/index.js +6 -0
  21. package/esm2015/services/catalog/models/category-with-tree.model.js +10 -0
  22. package/esm2015/services/catalog/models/index.js +2 -0
  23. package/esm2015/services/catalog/types/index.js +2 -0
  24. package/esm2015/services/catalog/types/product-sort.type.js +2 -0
  25. package/esm2015/services/checkout-subscription.service.js +2 -2
  26. package/esm2015/services/checkout.service.js +2 -7
  27. package/esm2015/services/coupon.service.js +154 -159
  28. package/esm2015/services/index.js +2 -1
  29. package/fesm2015/infrab4a-connect-angular.js +1429 -1176
  30. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  31. package/index.d.ts +2 -2
  32. package/package.json +2 -2
  33. package/services/cart.service.d.ts +4 -2
  34. package/services/catalog/adapters/category-structure.adapter.d.ts +4 -0
  35. package/services/catalog/adapters/index.d.ts +3 -0
  36. package/services/catalog/adapters/new-category-structure.adapter.d.ts +14 -0
  37. package/services/catalog/adapters/old-category-structure.adapter.d.ts +10 -0
  38. package/services/catalog/catalog.service.d.ts +54 -0
  39. package/services/catalog/category.service.d.ts +15 -0
  40. package/services/catalog/enums/index.d.ts +1 -0
  41. package/services/catalog/enums/product-sorts.enum.d.ts +9 -0
  42. package/services/catalog/index.d.ts +5 -0
  43. package/services/catalog/models/category-with-tree.model.d.ts +4 -0
  44. package/services/catalog/models/index.d.ts +1 -0
  45. package/services/catalog/types/index.d.ts +1 -0
  46. package/services/catalog/types/product-sort.type.d.ts +2 -0
  47. package/services/coupon.service.d.ts +11 -8
  48. package/services/index.d.ts +1 -0
  49. package/esm2015/services/errors/group-invalid-coupon.error.js +0 -8
  50. package/esm2015/services/errors/index.js +0 -3
  51. package/esm2015/services/errors/invalid-coupon.error.js +0 -8
  52. package/services/errors/group-invalid-coupon.error.d.ts +0 -6
  53. package/services/errors/index.d.ts +0 -2
  54. package/services/errors/invalid-coupon.error.d.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect-angular",
3
- "version": "3.9.1-beta2",
3
+ "version": "3.9.1-beta4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -12,7 +12,7 @@
12
12
  "@angular/common": "^12.2.12",
13
13
  "@angular/core": "^12.2.12",
14
14
  "@angular/fire": "^6.1.5",
15
- "@infrab4a/connect": "^3.10.0",
15
+ "@infrab4a/connect": "^3.14.3",
16
16
  "firebase": "^7.24.0",
17
17
  "js-cookie": "^3.0.1",
18
18
  "rxjs": "^6.6.7"
@@ -1,4 +1,4 @@
1
- import { Buy2WinFirestoreRepository, LineItem, ProductRepository, Shops, User, VariantRepository } from '@infrab4a/connect';
1
+ import { Buy2WinFirestoreRepository, CategoryRepository, LineItem, ProductRepository, Shops, User, VariantRepository } from '@infrab4a/connect';
2
2
  import { Observable } from 'rxjs';
3
3
  import { AuthService } from './auth.service';
4
4
  import { CheckoutService } from './checkout.service';
@@ -12,10 +12,11 @@ export declare class CartService {
12
12
  private readonly checkoutService;
13
13
  private readonly defaultShop;
14
14
  private readonly productRepository;
15
+ private readonly categoryRepository;
15
16
  private readonly variantRepository;
16
17
  private readonly buy2WinRepository;
17
18
  private cartSubject;
18
- constructor(authService: AuthService, checkoutService: CheckoutService, defaultShop: Shops, productRepository: ProductRepository, variantRepository: VariantRepository, buy2WinRepository: Buy2WinFirestoreRepository);
19
+ constructor(authService: AuthService, checkoutService: CheckoutService, defaultShop: Shops, productRepository: ProductRepository, categoryRepository: CategoryRepository, variantRepository: VariantRepository, buy2WinRepository: Buy2WinFirestoreRepository);
19
20
  addItem(item: LineItem, quantity?: number): Observable<Cart>;
20
21
  decreaseItem(item: LineItem): Observable<Cart>;
21
22
  getCart(checkout?: RequiredCheckoutData): Observable<Cart>;
@@ -30,6 +31,7 @@ export declare class CartService {
30
31
  private updateLineItemInCart;
31
32
  private generateCartObject;
32
33
  private buildLineItem;
34
+ private roundPrice;
33
35
  private getProductData;
34
36
  private getProductPrice;
35
37
  private checkMaxStock;
@@ -0,0 +1,4 @@
1
+ import { Category, Product, RepositoryFindFielters } from '@infrab4a/connect/';
2
+ export interface CategoryStructureAdapter {
3
+ buildProductFilterByCategory(category: Category): Promise<RepositoryFindFielters<Product>>;
4
+ }
@@ -0,0 +1,3 @@
1
+ export * from './category-structure.adapter';
2
+ export * from './new-category-structure.adapter';
3
+ export * from './old-category-structure.adapter';
@@ -0,0 +1,14 @@
1
+ import { Category, CategoryCollectionChildrenRepository, CategoryRepository, Product, RepositoryFindFielters } from '@infrab4a/connect';
2
+ import { CategoryStructureAdapter } from './category-structure.adapter';
3
+ import * as i0 from "@angular/core";
4
+ export declare class NewCategoryStructureAdapter implements CategoryStructureAdapter {
5
+ private readonly categoryRepository;
6
+ private readonly categoryCollectionChildrenRepository;
7
+ constructor(categoryRepository: CategoryRepository, categoryCollectionChildrenRepository: CategoryCollectionChildrenRepository);
8
+ buildProductFilterByCategory(category: Category): Promise<RepositoryFindFielters<Product>>;
9
+ private getAllCategoriesIdFromCategory;
10
+ private getAllCategoriesIdFromCollection;
11
+ private isCollection;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<NewCategoryStructureAdapter, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<NewCategoryStructureAdapter>;
14
+ }
@@ -0,0 +1,10 @@
1
+ import { Category, CategoryRepository, Product, RepositoryFindFielters } from '@infrab4a/connect';
2
+ import { CategoryStructureAdapter } from './category-structure.adapter';
3
+ import * as i0 from "@angular/core";
4
+ export declare class OldCategoryStructureAdapter implements CategoryStructureAdapter {
5
+ private readonly categoryRepository;
6
+ constructor(categoryRepository: CategoryRepository);
7
+ buildProductFilterByCategory(category: Category): Promise<RepositoryFindFielters<Product>>;
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<OldCategoryStructureAdapter, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<OldCategoryStructureAdapter>;
10
+ }
@@ -0,0 +1,54 @@
1
+ import { Category, Product, ProductGender, ProductRepository, Shops } from '@infrab4a/connect';
2
+ import { CategoryStructureAdapter } from './adapters';
3
+ import { ProductSort } from './types/product-sort.type';
4
+ import * as i0 from "@angular/core";
5
+ declare type FetchProductsFilters = {
6
+ clubDiscount?: number[];
7
+ brands?: string[];
8
+ prices?: {
9
+ min?: number;
10
+ max?: number;
11
+ subscriberPrice?: boolean;
12
+ };
13
+ gender?: ProductGender[];
14
+ rate?: number;
15
+ tags?: [];
16
+ customOptions?: string[];
17
+ };
18
+ declare type FetchProductsOptions = {
19
+ page?: number;
20
+ perPage?: number;
21
+ filters?: FetchProductsFilters;
22
+ sort?: ProductSort;
23
+ mainGender?: ProductGender;
24
+ };
25
+ declare type FetchProductsResponse = {
26
+ products: {
27
+ data: Product[];
28
+ total: number;
29
+ };
30
+ pages: number;
31
+ prices: {
32
+ price: {
33
+ min: number;
34
+ max: number;
35
+ };
36
+ subscriberPrice: {
37
+ min: number;
38
+ max: number;
39
+ };
40
+ };
41
+ };
42
+ export declare class CatalogService {
43
+ private readonly productRepository;
44
+ private readonly categoryStructureAdapter;
45
+ private readonly shop;
46
+ constructor(productRepository: ProductRepository, categoryStructureAdapter: CategoryStructureAdapter, shop: Shops);
47
+ fetchProducts(category: Category, options?: FetchProductsOptions): Promise<FetchProductsResponse>;
48
+ private buildFilterQuery;
49
+ private buildSortQuery;
50
+ private buildLimitQuery;
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<CatalogService, never>;
52
+ static ɵprov: i0.ɵɵInjectableDeclaration<CatalogService>;
53
+ }
54
+ export {};
@@ -0,0 +1,15 @@
1
+ import { Category, CategoryFilterRepository, CategoryRepository, Filter, ProductGender, ProductRepository, Shops } from '@infrab4a/connect';
2
+ import { CategoryStructureAdapter } from './adapters';
3
+ import * as i0 from "@angular/core";
4
+ export declare class CategoryService {
5
+ private readonly productRepository;
6
+ private readonly categoryRepository;
7
+ private readonly categoryFilterRepository;
8
+ private readonly categoryStructureAdapter;
9
+ private readonly shop;
10
+ constructor(productRepository: ProductRepository, categoryRepository: CategoryRepository, categoryFilterRepository: CategoryFilterRepository, categoryStructureAdapter: CategoryStructureAdapter, shop: Shops);
11
+ fetchBrands(category: Category, mainGender?: ProductGender): Promise<Category[]>;
12
+ fetchFilterOptions(category: Category, filters?: string[]): Promise<Filter[]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<CategoryService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<CategoryService>;
15
+ }
@@ -0,0 +1 @@
1
+ export * from './product-sorts.enum';
@@ -0,0 +1,9 @@
1
+ export declare enum ProductSorts {
2
+ MOST_RELEVANT = "most-relevant",
3
+ BEST_SELLER = "best-sellers",
4
+ BIGGEST_PRICE = "biggest-price",
5
+ LOWEST_PRICE = "lowest-price",
6
+ BIGGEST_DISCOUNT = "biggest-discount",
7
+ BEST_RATING = "best-rating",
8
+ NEWS = "news"
9
+ }
@@ -0,0 +1,5 @@
1
+ export * from './catalog.service';
2
+ export * from './category.service';
3
+ export * from './enums';
4
+ export * from './models';
5
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ import { Category } from '@infrab4a/connect';
2
+ export declare class CategoryWithTree extends Category {
3
+ children?: CategoryWithTree[];
4
+ }
@@ -0,0 +1 @@
1
+ export * from './category-with-tree.model';
@@ -0,0 +1 @@
1
+ export * from './product-sort.type';
@@ -0,0 +1,2 @@
1
+ import { ProductSorts } from '../enums';
2
+ export declare type ProductSort = `${ProductSorts}`;
@@ -7,19 +7,22 @@ export declare class CouponService {
7
7
  private readonly orderRepository;
8
8
  private readonly categoryRepository;
9
9
  constructor(couponRepository: CouponRepository, defaultShop: Shops, orderRepository: OrderRepository, categoryRepository: CategoryRepository);
10
- checkCoupon(nickname: string, userEmail: string, checkoutType: CheckoutTypes, plan?: string, checkout?: Partial<Checkout>, isSubscription?: boolean): Observable<Coupon>;
11
- private emailIsFromCollaborator;
12
- private checkCouponRules;
13
- private isValidCoupon;
14
- private checkCouponUseAndLimit;
10
+ checkCoupon(nickname: string, checkoutType: CheckoutTypes, checkout: Partial<Checkout>, plan: string): Observable<Coupon>;
11
+ private couponValidation;
12
+ private couponRulesValidation;
15
13
  calcDiscountSubscription(coupon: Coupon, checkout: Partial<CheckoutSubscription>): Observable<number>;
16
14
  calcDiscountShopping(coupon: Coupon, checkout: Partial<Checkout>): Promise<number>;
17
- private calcShoppingPercentageDiscount;
15
+ private calcDiscountByType;
18
16
  private hasMinSubTotal;
19
17
  private hasProductCategories;
20
- private userValidationAndSubscriptionStatus;
18
+ private coupomUserValidation;
21
19
  private getCouponCategoriesId;
22
- private separateValidCoupons;
20
+ private emailIsFromCollaborator;
21
+ private getLineItensEligebleForDiscount;
22
+ private calcCheckoutSubtotal;
23
+ private getOrdersWithCoupon;
24
+ private countOrdersWithUser;
25
+ private getCouponUseLimits;
23
26
  static ɵfac: i0.ɵɵFactoryDeclaration<CouponService, never>;
24
27
  static ɵprov: i0.ɵɵInjectableDeclaration<CouponService>;
25
28
  }
@@ -1,5 +1,6 @@
1
1
  export * from './auth.service';
2
2
  export * from './cart.service';
3
+ export * from './catalog';
3
4
  export * from './checkout-subscription.service';
4
5
  export * from './checkout.service';
5
6
  export * from './coupon.service';
@@ -1,8 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- export class GroupInvalidCouponError extends CustomError {
3
- constructor(errors) {
4
- super('Many coupon errors throw');
5
- this.errors = errors;
6
- }
7
- }
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JvdXAtaW52YWxpZC1jb3Vwb24uZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL3NlcnZpY2VzL2Vycm9ycy9ncm91cC1pbnZhbGlkLWNvdXBvbi5lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFJN0MsTUFBTSxPQUFPLHVCQUF3QixTQUFRLFdBQVc7SUFDdEQsWUFBcUIsTUFBNEI7UUFDL0MsS0FBSyxDQUFDLDBCQUEwQixDQUFDLENBQUE7UUFEZCxXQUFNLEdBQU4sTUFBTSxDQUFzQjtJQUVqRCxDQUFDO0NBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDdXN0b21FcnJvciB9IGZyb20gJ3RzLWN1c3RvbS1lcnJvcidcblxuaW1wb3J0IHsgSW52YWxpZENvdXBvbkVycm9yIH0gZnJvbSAnLi9pbnZhbGlkLWNvdXBvbi5lcnJvcidcblxuZXhwb3J0IGNsYXNzIEdyb3VwSW52YWxpZENvdXBvbkVycm9yIGV4dGVuZHMgQ3VzdG9tRXJyb3Ige1xuICBjb25zdHJ1Y3RvcihyZWFkb25seSBlcnJvcnM6IEludmFsaWRDb3Vwb25FcnJvcltdKSB7XG4gICAgc3VwZXIoJ01hbnkgY291cG9uIGVycm9ycyB0aHJvdycpXG4gIH1cbn1cbiJdfQ==
@@ -1,3 +0,0 @@
1
- export * from './invalid-coupon.error';
2
- export * from './group-invalid-coupon.error';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL3NlcnZpY2VzL2Vycm9ycy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHdCQUF3QixDQUFBO0FBQ3RDLGNBQWMsOEJBQThCLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2ludmFsaWQtY291cG9uLmVycm9yJ1xuZXhwb3J0ICogZnJvbSAnLi9ncm91cC1pbnZhbGlkLWNvdXBvbi5lcnJvcidcbiJdfQ==
@@ -1,8 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- export class InvalidCouponError extends CustomError {
3
- constructor(message) {
4
- super(message);
5
- this.message = message;
6
- }
7
- }
8
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW52YWxpZC1jb3Vwb24uZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL3NlcnZpY2VzL2Vycm9ycy9pbnZhbGlkLWNvdXBvbi5lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFFN0MsTUFBTSxPQUFPLGtCQUFtQixTQUFRLFdBQVc7SUFDakQsWUFBcUIsT0FBTztRQUMxQixLQUFLLENBQUMsT0FBTyxDQUFDLENBQUE7UUFESyxZQUFPLEdBQVAsT0FBTyxDQUFBO0lBRTVCLENBQUM7Q0FDRiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEN1c3RvbUVycm9yIH0gZnJvbSAndHMtY3VzdG9tLWVycm9yJ1xuXG5leHBvcnQgY2xhc3MgSW52YWxpZENvdXBvbkVycm9yIGV4dGVuZHMgQ3VzdG9tRXJyb3Ige1xuICBjb25zdHJ1Y3RvcihyZWFkb25seSBtZXNzYWdlKSB7XG4gICAgc3VwZXIobWVzc2FnZSlcbiAgfVxufVxuIl19
@@ -1,6 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- import { InvalidCouponError } from './invalid-coupon.error';
3
- export declare class GroupInvalidCouponError extends CustomError {
4
- readonly errors: InvalidCouponError[];
5
- constructor(errors: InvalidCouponError[]);
6
- }
@@ -1,2 +0,0 @@
1
- export * from './invalid-coupon.error';
2
- export * from './group-invalid-coupon.error';
@@ -1,5 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- export declare class InvalidCouponError extends CustomError {
3
- readonly message: any;
4
- constructor(message: any);
5
- }