@infrab4a/connect-angular 4.0.0-beta.38 → 4.0.0-beta.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.
Files changed (94) hide show
  1. package/angular-connect.module.d.ts +19 -21
  2. package/angular-elastic-search.module.d.ts +9 -9
  3. package/angular-firebase-auth.module.d.ts +12 -12
  4. package/angular-firestore.module.d.ts +17 -18
  5. package/angular-hasura-graphql.module.d.ts +16 -16
  6. package/consts/default-shop.const.d.ts +1 -1
  7. package/consts/es-config.const.d.ts +1 -1
  8. package/consts/firebase-const.d.ts +3 -3
  9. package/consts/hasura-options.const.d.ts +1 -1
  10. package/consts/index.d.ts +4 -6
  11. package/esm2020/angular-connect.module.mjs +49 -63
  12. package/esm2020/angular-elastic-search.module.mjs +38 -34
  13. package/esm2020/angular-firebase-auth.module.mjs +130 -130
  14. package/esm2020/angular-firestore.module.mjs +358 -447
  15. package/esm2020/angular-hasura-graphql.module.mjs +131 -219
  16. package/esm2020/consts/default-shop.const.mjs +2 -2
  17. package/esm2020/consts/es-config.const.mjs +2 -2
  18. package/esm2020/consts/firebase-const.mjs +4 -4
  19. package/esm2020/consts/hasura-options.const.mjs +2 -2
  20. package/esm2020/consts/index.mjs +5 -7
  21. package/esm2020/index.mjs +6 -6
  22. package/esm2020/infrab4a-connect-angular.mjs +4 -4
  23. package/esm2020/services/auth.service.mjs +37 -37
  24. package/esm2020/services/cart.service.mjs +143 -281
  25. package/esm2020/services/checkout-subscription.service.mjs +51 -53
  26. package/esm2020/services/checkout.service.mjs +73 -71
  27. package/esm2020/services/coupon.service.mjs +226 -214
  28. package/esm2020/services/errors/group-invalid-coupon.error.mjs +8 -0
  29. package/esm2020/services/errors/index.mjs +3 -0
  30. package/esm2020/services/errors/invalid-coupon.error.mjs +7 -0
  31. package/esm2020/services/home-shop.service.mjs +114 -114
  32. package/esm2020/services/index.mjs +8 -10
  33. package/esm2020/services/order.service.mjs +30 -30
  34. package/esm2020/services/types/index.mjs +3 -3
  35. package/esm2020/services/types/required-checkout-data.type.mjs +2 -2
  36. package/esm2020/services/types/required-checkout-subscription-data.type.mjs +2 -2
  37. package/esm2020/types/firebase-app-config.type.mjs +2 -2
  38. package/esm2020/types/index.mjs +2 -2
  39. package/fesm2015/infrab4a-connect-angular.mjs +1341 -1959
  40. package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
  41. package/fesm2020/infrab4a-connect-angular.mjs +1297 -1902
  42. package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
  43. package/index.d.ts +5 -5
  44. package/package.json +3 -2
  45. package/services/auth.service.d.ts +18 -18
  46. package/services/cart.service.d.ts +35 -42
  47. package/services/checkout-subscription.service.d.ts +18 -18
  48. package/services/checkout.service.d.ts +23 -23
  49. package/services/coupon.service.d.ts +25 -28
  50. package/services/errors/group-invalid-coupon.error.d.ts +6 -0
  51. package/services/errors/index.d.ts +2 -0
  52. package/services/errors/invalid-coupon.error.d.ts +4 -0
  53. package/services/home-shop.service.d.ts +25 -25
  54. package/services/index.d.ts +7 -9
  55. package/services/order.service.d.ts +13 -13
  56. package/services/types/index.d.ts +2 -2
  57. package/services/types/required-checkout-data.type.d.ts +2 -2
  58. package/services/types/required-checkout-subscription-data.type.d.ts +2 -2
  59. package/types/firebase-app-config.type.d.ts +1 -1
  60. package/types/index.d.ts +1 -1
  61. package/consts/backend-url.const.d.ts +0 -1
  62. package/consts/category-structure.d.ts +0 -1
  63. package/esm2020/consts/backend-url.const.mjs +0 -2
  64. package/esm2020/consts/category-structure.mjs +0 -2
  65. package/esm2020/services/catalog/adapters/category-structure.adapter.mjs +0 -2
  66. package/esm2020/services/catalog/adapters/index.mjs +0 -4
  67. package/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +0 -42
  68. package/esm2020/services/catalog/adapters/old-category-structure.adapter.mjs +0 -23
  69. package/esm2020/services/catalog/catalog.service.mjs +0 -96
  70. package/esm2020/services/catalog/category.service.mjs +0 -51
  71. package/esm2020/services/catalog/enums/index.mjs +0 -2
  72. package/esm2020/services/catalog/enums/product-sorts.enum.mjs +0 -11
  73. package/esm2020/services/catalog/index.mjs +0 -6
  74. package/esm2020/services/catalog/models/category-with-tree.model.mjs +0 -10
  75. package/esm2020/services/catalog/models/index.mjs +0 -2
  76. package/esm2020/services/catalog/types/index.mjs +0 -2
  77. package/esm2020/services/catalog/types/product-sort.type.mjs +0 -2
  78. package/esm2020/services/shipping.service.mjs +0 -96
  79. package/esm2020/services/types/shipping-methods.type.mjs +0 -2
  80. package/services/catalog/adapters/category-structure.adapter.d.ts +0 -4
  81. package/services/catalog/adapters/index.d.ts +0 -3
  82. package/services/catalog/adapters/new-category-structure.adapter.d.ts +0 -14
  83. package/services/catalog/adapters/old-category-structure.adapter.d.ts +0 -10
  84. package/services/catalog/catalog.service.d.ts +0 -54
  85. package/services/catalog/category.service.d.ts +0 -15
  86. package/services/catalog/enums/index.d.ts +0 -1
  87. package/services/catalog/enums/product-sorts.enum.d.ts +0 -9
  88. package/services/catalog/index.d.ts +0 -5
  89. package/services/catalog/models/category-with-tree.model.d.ts +0 -4
  90. package/services/catalog/models/index.d.ts +0 -1
  91. package/services/catalog/types/index.d.ts +0 -1
  92. package/services/catalog/types/product-sort.type.d.ts +0 -2
  93. package/services/shipping.service.d.ts +0 -19
  94. package/services/types/shipping-methods.type.d.ts +0 -12
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './angular-connect.module';
2
- export * from './angular-firebase-auth.module';
3
- export * from './angular-firestore.module';
4
- export * from './angular-hasura-graphql.module';
5
- export * from './services';
1
+ export * from './services';
2
+ export * from './angular-firebase-auth.module';
3
+ export * from './angular-firestore.module';
4
+ export * from './angular-connect.module';
5
+ export * from './angular-hasura-graphql.module';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect-angular",
3
- "version": "4.0.0-beta.38",
3
+ "version": "4.0.0-beta.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -12,7 +12,8 @@
12
12
  "@angular/common": "^15.1.4",
13
13
  "@angular/core": "^15.1.4",
14
14
  "@angular/fire": "^7.5.0",
15
- "@infrab4a/connect": "^4.0.0-beta.37",
15
+ "@infrab4a/connect": "^4.0.0-beta.10",
16
+ "js-cookie": "^3.0.1",
16
17
  "rxjs": "^6.6.7"
17
18
  },
18
19
  "dependencies": {
@@ -1,18 +1,18 @@
1
- import { Auth, User as FirebaseUser } from '@angular/fire/auth';
2
- import { User, UserRepository } from '@infrab4a/connect';
3
- import { Observable } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare class AuthService {
6
- private readonly angularFireAuth;
7
- private readonly userRepository;
8
- constructor(angularFireAuth: Auth, userRepository: UserRepository);
9
- getAuthstate(): Observable<{
10
- user: User;
11
- isAnonymous: boolean;
12
- }>;
13
- getUser(): Observable<User>;
14
- getTokenId(): Observable<string>;
15
- getFireUser(): Observable<FirebaseUser>;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
17
- static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
18
- }
1
+ import { Auth, User as FirebaseUser } from '@angular/fire/auth';
2
+ import { User, UserRepository } from '@infrab4a/connect';
3
+ import { Observable } from 'rxjs';
4
+ import * as i0 from "@angular/core";
5
+ export declare class AuthService {
6
+ private readonly angularFireAuth;
7
+ private readonly userRepository;
8
+ constructor(angularFireAuth: Auth, userRepository: UserRepository);
9
+ getAuthstate(): Observable<{
10
+ user: User;
11
+ isAnonymous: boolean;
12
+ }>;
13
+ getUser(): Observable<User>;
14
+ getTokenId(): Observable<string>;
15
+ getFireUser(): Observable<FirebaseUser>;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
18
+ }
@@ -1,42 +1,35 @@
1
- import { Buy2WinFirestoreRepository, CategoryRepository, LineItem, ProductRepository, Shops, User, VariantRepository } from '@infrab4a/connect';
2
- import { Observable } from 'rxjs';
3
- import { AuthService } from './auth.service';
4
- import { CheckoutService } from './checkout.service';
5
- import { RequiredCheckoutData } from './types';
6
- import * as i0 from "@angular/core";
7
- export declare type Cart = {
8
- [id: string]: LineItem;
9
- };
10
- export declare class CartService {
11
- private readonly authService;
12
- private readonly checkoutService;
13
- private readonly defaultShop;
14
- private readonly productRepository;
15
- private readonly categoryRepository;
16
- private readonly variantRepository;
17
- private readonly buy2WinRepository;
18
- private cartSubject;
19
- constructor(authService: AuthService, checkoutService: CheckoutService, defaultShop: Shops, productRepository: ProductRepository, categoryRepository: CategoryRepository, variantRepository: VariantRepository, buy2WinRepository: Buy2WinFirestoreRepository);
20
- addItem(item: LineItem, quantity?: number): Observable<Cart>;
21
- decreaseItem(item: LineItem): Observable<Cart>;
22
- getCart(checkout?: RequiredCheckoutData): Observable<Cart>;
23
- /**
24
- * @deprecated The method should not be used
25
- */
26
- getVariantPriceDiscount(item: LineItem): Observable<number>;
27
- removeItem(item: LineItem): Observable<Cart>;
28
- updateUserCart(user: User): Observable<Cart>;
29
- clearCart(): Observable<Cart>;
30
- private buildCartFromCheckout;
31
- private updateLineItemInCart;
32
- private generateCartObject;
33
- private buildLineItem;
34
- private roundPrice;
35
- private getProductData;
36
- private getProductPrice;
37
- private checkMaxStock;
38
- getGifts(): Observable<Cart>;
39
- private giftToLineItems;
40
- static ɵfac: i0.ɵɵFactoryDeclaration<CartService, never>;
41
- static ɵprov: i0.ɵɵInjectableDeclaration<CartService>;
42
- }
1
+ import { LineItem, ProductRepository, Shops, User } from '@infrab4a/connect';
2
+ import { Observable } from 'rxjs';
3
+ import { AuthService } from './auth.service';
4
+ import { CheckoutService } from './checkout.service';
5
+ import { RequiredCheckoutData } from './types';
6
+ import * as i0 from "@angular/core";
7
+ export declare type Cart = {
8
+ [id: string]: LineItem;
9
+ };
10
+ export declare class CartService {
11
+ private readonly authService;
12
+ private readonly checkoutService;
13
+ private readonly defaultShop;
14
+ private readonly productRepository;
15
+ private cartSubject;
16
+ constructor(authService: AuthService, checkoutService: CheckoutService, defaultShop: Shops, productRepository: ProductRepository);
17
+ addItem(item: LineItem, quantity?: number): Observable<Cart>;
18
+ decreaseItem(item: LineItem): Observable<Cart>;
19
+ getCart(checkout?: RequiredCheckoutData): Observable<Cart>;
20
+ /**
21
+ * @deprecated The method should not be used
22
+ */
23
+ getVariantPriceDiscount(item: LineItem): Observable<number>;
24
+ removeItem(item: LineItem): Observable<Cart>;
25
+ updateUserCart(user: User): Observable<Cart>;
26
+ clearCart(): Observable<Cart>;
27
+ private buildCartFromCheckout;
28
+ private updateLineItemInCart;
29
+ private generateCartObject;
30
+ private buildLineItem;
31
+ private getProductPrice;
32
+ private checkMaxStock;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<CartService, never>;
34
+ static ɵprov: i0.ɵɵInjectableDeclaration<CartService>;
35
+ }
@@ -1,18 +1,18 @@
1
- import { CheckoutSubscription, CheckoutSubscriptionRepository, Coupon, SubscriptionRepository } from '@infrab4a/connect';
2
- import { Observable } from 'rxjs';
3
- import { RequiredCheckoutSubscriptionData } from './types';
4
- import { CouponService } from './coupon.service';
5
- import * as i0 from "@angular/core";
6
- export declare class CheckoutSubscriptionService {
7
- private readonly checkoutSubscriptionRepository;
8
- private readonly subscriptionRepository;
9
- private readonly couponService;
10
- constructor(checkoutSubscriptionRepository: CheckoutSubscriptionRepository, subscriptionRepository: SubscriptionRepository, couponService: CouponService);
11
- getCheckoutSubscription(checkoutData?: RequiredCheckoutSubscriptionData): Observable<CheckoutSubscription>;
12
- private createCheckoutSubscription;
13
- clearCheckoutSubscriptionFromSession(): Observable<void>;
14
- checkCoupon(nickname: string, userEmail: string): Observable<Coupon>;
15
- calcDiscountSubscription(coupon: Coupon): Observable<number>;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutSubscriptionService, never>;
17
- static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutSubscriptionService>;
18
- }
1
+ import { CheckoutSubscription, CheckoutSubscriptionRepository, Coupon, SubscriptionRepository } from '@infrab4a/connect';
2
+ import { Observable } from 'rxjs';
3
+ import { RequiredCheckoutSubscriptionData } from './types';
4
+ import { CouponService } from './coupon.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class CheckoutSubscriptionService {
7
+ private readonly checkoutSubscriptionRepository;
8
+ private readonly subscriptionRepository;
9
+ private readonly couponService;
10
+ constructor(checkoutSubscriptionRepository: CheckoutSubscriptionRepository, subscriptionRepository: SubscriptionRepository, couponService: CouponService);
11
+ getCheckoutSubscription(checkoutData?: RequiredCheckoutSubscriptionData): Observable<CheckoutSubscription>;
12
+ private createCheckoutSubscription;
13
+ clearCheckoutSubscriptionFromSession(): Observable<void>;
14
+ checkCoupon(nickname: string, userEmail: string): Observable<Coupon>;
15
+ calcDiscountSubscription(coupon: Coupon): Observable<number>;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutSubscriptionService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutSubscriptionService>;
18
+ }
@@ -1,23 +1,23 @@
1
- import { Checkout, CheckoutRepository, CheckoutTypes, Coupon, OrderRepository, Shops, User, UserRepository } from '@infrab4a/connect';
2
- import { Observable } from 'rxjs';
3
- import { CouponService } from './coupon.service';
4
- import { RequiredCheckoutData } from './types';
5
- import * as i0 from "@angular/core";
6
- export declare class CheckoutService {
7
- private readonly couponService;
8
- private readonly checkoutRepository;
9
- private readonly orderRepository;
10
- private readonly userRepository;
11
- private readonly defaultShop;
12
- constructor(couponService: CouponService, checkoutRepository: CheckoutRepository, orderRepository: OrderRepository, userRepository: UserRepository, defaultShop: Shops);
13
- getCheckout(checkoutData?: RequiredCheckoutData): Observable<Checkout>;
14
- getUserByCheckout(checkoutId: string): Observable<User>;
15
- updateCheckoutLineItems(checkout: Partial<Checkout>): Observable<Checkout>;
16
- updateCheckoutUser(checkout: Partial<Checkout>): Observable<Checkout>;
17
- clearCheckoutFromSession(): Observable<void>;
18
- calcDiscount(coupon: Coupon): Observable<number>;
19
- checkCoupon(nickname: string, checkoutType: CheckoutTypes): Observable<Coupon>;
20
- private createCheckout;
21
- static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutService, never>;
22
- static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutService>;
23
- }
1
+ import { Checkout, CheckoutRepository, CheckoutTypes, Coupon, OrderRepository, Shops, User, UserRepository } from '@infrab4a/connect';
2
+ import { Observable } from 'rxjs';
3
+ import { CouponService } from './coupon.service';
4
+ import { RequiredCheckoutData } from './types';
5
+ import * as i0 from "@angular/core";
6
+ export declare class CheckoutService {
7
+ private readonly couponService;
8
+ private readonly checkoutRepository;
9
+ private readonly orderRepository;
10
+ private readonly userRepository;
11
+ private readonly defaultShop;
12
+ constructor(couponService: CouponService, checkoutRepository: CheckoutRepository, orderRepository: OrderRepository, userRepository: UserRepository, defaultShop: Shops);
13
+ getCheckout(checkoutData?: RequiredCheckoutData): Observable<Checkout>;
14
+ getUserByCheckout(checkoutId: string): Observable<User>;
15
+ updateCheckoutLineItems(checkout: Partial<Checkout>): Observable<Checkout>;
16
+ updateCheckoutUser(checkout: Partial<Checkout>): Observable<Checkout>;
17
+ clearCheckoutFromSession(): Observable<void>;
18
+ calcDiscount(coupon: Coupon): Observable<number>;
19
+ checkCoupon(nickname: string, checkoutType: CheckoutTypes): Observable<Coupon>;
20
+ private createCheckout;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckoutService, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<CheckoutService>;
23
+ }
@@ -1,28 +1,25 @@
1
- import { CategoryRepository, Checkout, CheckoutSubscription, CheckoutTypes, Coupon, CouponRepository, OrderRepository, Shops } from '@infrab4a/connect';
2
- import { Observable } from 'rxjs';
3
- import * as i0 from "@angular/core";
4
- export declare class CouponService {
5
- private readonly couponRepository;
6
- private readonly defaultShop;
7
- private readonly orderRepository;
8
- private readonly categoryRepository;
9
- constructor(couponRepository: CouponRepository, defaultShop: Shops, orderRepository: OrderRepository, categoryRepository: CategoryRepository);
10
- checkCoupon(nickname: string, checkoutType: CheckoutTypes, checkout: Partial<Checkout>, plan: string): Observable<Coupon>;
11
- private couponValidation;
12
- private couponRulesValidation;
13
- calcDiscountSubscription(coupon: Coupon, checkout: Partial<CheckoutSubscription>): Observable<number>;
14
- calcDiscountShopping(coupon: Coupon, checkout: Partial<Checkout>): Promise<number>;
15
- private calcDiscountByType;
16
- private hasMinSubTotal;
17
- private hasProductCategories;
18
- private coupomUserValidation;
19
- private getCouponCategoriesId;
20
- private emailIsFromCollaborator;
21
- private getLineItensEligebleForDiscount;
22
- private calcCheckoutSubtotal;
23
- private getOrdersWithCoupon;
24
- private countOrdersWithUser;
25
- private getCouponUseLimits;
26
- static ɵfac: i0.ɵɵFactoryDeclaration<CouponService, never>;
27
- static ɵprov: i0.ɵɵInjectableDeclaration<CouponService>;
28
- }
1
+ import { CategoryRepository, Checkout, CheckoutSubscription, CheckoutTypes, Coupon, CouponRepository, OrderRepository, Shops, SubscriptionRepository } from '@infrab4a/connect';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ export declare class CouponService {
5
+ private readonly couponRepository;
6
+ private readonly defaultShop;
7
+ private readonly orderRepository;
8
+ private readonly subscriptionRepository;
9
+ private readonly categoryRepository;
10
+ constructor(couponRepository: CouponRepository, defaultShop: Shops, orderRepository: OrderRepository, subscriptionRepository: SubscriptionRepository, categoryRepository: CategoryRepository);
11
+ checkCoupon(nickname: string, userEmail: string, checkoutType: CheckoutTypes, plan?: string, checkout?: Partial<Checkout>, isSubscription?: boolean): Observable<Coupon>;
12
+ private emailIsFromCollaborator;
13
+ private checkCouponRules;
14
+ private isValidCoupon;
15
+ private checkCouponUseAndLimit;
16
+ calcDiscountSubscription(coupon: Coupon, checkout: Partial<CheckoutSubscription>): Observable<number>;
17
+ calcDiscountShopping(coupon: Coupon, checkout: Partial<Checkout>): Promise<number>;
18
+ private calcShoppingPercentageDiscount;
19
+ private hasMinSubTotal;
20
+ private hasProductCategories;
21
+ private userValidationAndSubscriptionStatus;
22
+ private getCouponCategoriesId;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<CouponService, never>;
24
+ static ɵprov: i0.ɵɵInjectableDeclaration<CouponService>;
25
+ }
@@ -0,0 +1,6 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ export * from './invalid-coupon.error';
2
+ export * from './group-invalid-coupon.error';
@@ -0,0 +1,4 @@
1
+ import { CustomError } from 'ts-custom-error';
2
+ export declare class InvalidCouponError extends CustomError {
3
+ constructor(message: string);
4
+ }
@@ -1,25 +1,25 @@
1
- import { Banner, CategoryRepository, Home, HomeRepository, ProductRepository, Shops } from '@infrab4a/connect';
2
- import { Observable } from 'rxjs';
3
- import * as i0 from "@angular/core";
4
- declare type BannerType = 'brand' | 'buyToWin' | 'block' | 'blog';
5
- export declare class HomeShopService {
6
- private readonly categoryRepository;
7
- private readonly homeRepository;
8
- private readonly productRepository;
9
- private readonly defaultShop;
10
- private homeConfiguration;
11
- private get homeId();
12
- constructor(categoryRepository: CategoryRepository, homeRepository: HomeRepository, productRepository: ProductRepository, defaultShop: Shops);
13
- getHomeData(): Observable<Home>;
14
- getBanners(type: BannerType): Observable<Banner[]>;
15
- getMinValueForFreeShipping(): Observable<number>;
16
- private getDiscoverProducts;
17
- private getFeaturedProducts;
18
- private getVerticalProducts;
19
- private getHomeConfiguration;
20
- private saveHomeData;
21
- private buildCategoryGroupWithRequiredData;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<HomeShopService, never>;
23
- static ɵprov: i0.ɵɵInjectableDeclaration<HomeShopService>;
24
- }
25
- export {};
1
+ import { Banner, CategoryRepository, Home, HomeRepository, ProductRepository, Shops } from '@infrab4a/connect';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ declare type BannerType = 'brand' | 'buyToWin' | 'block' | 'blog';
5
+ export declare class HomeShopService {
6
+ private readonly categoryRepository;
7
+ private readonly homeRepository;
8
+ private readonly productRepository;
9
+ private readonly defaultShop;
10
+ private homeConfiguration;
11
+ private get homeId();
12
+ constructor(categoryRepository: CategoryRepository, homeRepository: HomeRepository, productRepository: ProductRepository, defaultShop: Shops);
13
+ getHomeData(): Observable<Home>;
14
+ getBanners(type: BannerType): Observable<Banner[]>;
15
+ getMinValueForFreeShipping(): Observable<number>;
16
+ private getDiscoverProducts;
17
+ private getFeaturedProducts;
18
+ private getVerticalProducts;
19
+ private getHomeConfiguration;
20
+ private saveHomeData;
21
+ private buildCategoryGroupWithRequiredData;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<HomeShopService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<HomeShopService>;
24
+ }
25
+ export {};
@@ -1,9 +1,7 @@
1
- export * from './auth.service';
2
- export * from './cart.service';
3
- export * from './catalog';
4
- export * from './checkout-subscription.service';
5
- export * from './checkout.service';
6
- export * from './coupon.service';
7
- export * from './home-shop.service';
8
- export * from './order.service';
9
- export * from './shipping.service';
1
+ export * from './auth.service';
2
+ export * from './cart.service';
3
+ export * from './checkout.service';
4
+ export * from './checkout-subscription.service';
5
+ export * from './order.service';
6
+ export * from './coupon.service';
7
+ export * from './home-shop.service';
@@ -1,13 +1,13 @@
1
- import { Firestore } from '@angular/fire/firestore';
2
- import { Order, OrderFirestoreRepository } from '@infrab4a/connect';
3
- import { Subject } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare class OrderService {
6
- private readonly angularFirestore;
7
- private readonly orderRepository;
8
- orderSubject: Subject<Order>;
9
- constructor(angularFirestore: Firestore, orderRepository: OrderFirestoreRepository);
10
- getOrder(id: string): Subject<Order>;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<OrderService, never>;
12
- static ɵprov: i0.ɵɵInjectableDeclaration<OrderService>;
13
- }
1
+ import { Firestore } from '@angular/fire/firestore';
2
+ import { Order, OrderFirestoreRepository } from '@infrab4a/connect';
3
+ import { Subject } from 'rxjs';
4
+ import * as i0 from "@angular/core";
5
+ export declare class OrderService {
6
+ private readonly angularFirestore;
7
+ private readonly orderRepository;
8
+ orderSubject: Subject<Order>;
9
+ constructor(angularFirestore: Firestore, orderRepository: OrderFirestoreRepository);
10
+ getOrder(id: string): Subject<Order>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<OrderService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<OrderService>;
13
+ }
@@ -1,2 +1,2 @@
1
- export * from './required-checkout-data.type';
2
- export * from './required-checkout-subscription-data.type';
1
+ export * from './required-checkout-data.type';
2
+ export * from './required-checkout-subscription-data.type';
@@ -1,2 +1,2 @@
1
- import { Checkout } from '@infrab4a/connect';
2
- export declare type RequiredCheckoutData = Partial<Pick<Checkout, 'id' | 'user' | 'shop' | 'lineItems'>>;
1
+ import { Checkout } from '@infrab4a/connect';
2
+ export declare type RequiredCheckoutData = Partial<Pick<Checkout, 'id' | 'user' | 'shop' | 'lineItems'>>;
@@ -1,2 +1,2 @@
1
- import { CheckoutSubscription } from '@infrab4a/connect';
2
- export declare type RequiredCheckoutSubscriptionData = Partial<Pick<CheckoutSubscription, 'id'>>;
1
+ import { CheckoutSubscription } from '@infrab4a/connect';
2
+ export declare type RequiredCheckoutSubscriptionData = Partial<Pick<CheckoutSubscription, 'id'>>;
@@ -1 +1 @@
1
- export declare type FirebaseAppConfig = Record<string, any>;
1
+ export declare type FirebaseAppConfig = Record<string, any>;
package/types/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './firebase-app-config.type';
1
+ export * from './firebase-app-config.type';
@@ -1 +0,0 @@
1
- export declare const BACKEND_URL = "BACKEND_URL";
@@ -1 +0,0 @@
1
- export declare const CATEGORY_STRUCTURE = "CATEGORY_STRUCTURE";
@@ -1,2 +0,0 @@
1
- export const BACKEND_URL = 'BACKEND_URL';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFja2VuZC11cmwuY29uc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL2NvbnN0cy9iYWNrZW5kLXVybC5jb25zdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxXQUFXLEdBQUcsYUFBYSxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IEJBQ0tFTkRfVVJMID0gJ0JBQ0tFTkRfVVJMJyJdfQ==
@@ -1,2 +0,0 @@
1
- export const CATEGORY_STRUCTURE = 'CATEGORY_STRUCTURE';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2F0ZWdvcnktc3RydWN0dXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvY29ubmVjdC1hbmd1bGFyL3NyYy9jb25zdHMvY2F0ZWdvcnktc3RydWN0dXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFHLG9CQUFvQixDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IENBVEVHT1JZX1NUUlVDVFVSRSA9ICdDQVRFR09SWV9TVFJVQ1RVUkUnXHJcbiJdfQ==
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2F0ZWdvcnktc3RydWN0dXJlLmFkYXB0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL3NlcnZpY2VzL2NhdGFsb2cvYWRhcHRlcnMvY2F0ZWdvcnktc3RydWN0dXJlLmFkYXB0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENhdGVnb3J5LCBQcm9kdWN0LCBSZXBvc2l0b3J5RmluZEZpZWx0ZXJzIH0gZnJvbSAnQGluZnJhYjRhL2Nvbm5lY3QvJ1xyXG5cclxuZXhwb3J0IGludGVyZmFjZSBDYXRlZ29yeVN0cnVjdHVyZUFkYXB0ZXIge1xyXG4gIGJ1aWxkUHJvZHVjdEZpbHRlckJ5Q2F0ZWdvcnkoY2F0ZWdvcnk6IENhdGVnb3J5KTogUHJvbWlzZTxSZXBvc2l0b3J5RmluZEZpZWx0ZXJzPFByb2R1Y3Q+PlxyXG59XHJcbiJdfQ==
@@ -1,4 +0,0 @@
1
- export * from './category-structure.adapter';
2
- export * from './new-category-structure.adapter';
3
- export * from './old-category-structure.adapter';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jb25uZWN0LWFuZ3VsYXIvc3JjL3NlcnZpY2VzL2NhdGFsb2cvYWRhcHRlcnMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyw4QkFBOEIsQ0FBQTtBQUM1QyxjQUFjLGtDQUFrQyxDQUFBO0FBQ2hELGNBQWMsa0NBQWtDLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2NhdGVnb3J5LXN0cnVjdHVyZS5hZGFwdGVyJ1xyXG5leHBvcnQgKiBmcm9tICcuL25ldy1jYXRlZ29yeS1zdHJ1Y3R1cmUuYWRhcHRlcidcclxuZXhwb3J0ICogZnJvbSAnLi9vbGQtY2F0ZWdvcnktc3RydWN0dXJlLmFkYXB0ZXInXHJcbiJdfQ==
@@ -1,42 +0,0 @@
1
- import { Inject, Injectable } from '@angular/core';
2
- import { isNil, Where, } from '@infrab4a/connect';
3
- import * as i0 from "@angular/core";
4
- export class NewCategoryStructureAdapter {
5
- constructor(categoryRepository, categoryCollectionChildrenRepository) {
6
- this.categoryRepository = categoryRepository;
7
- this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
8
- }
9
- async buildProductFilterByCategory(category) {
10
- const categoriesIds = (await this.isCollection(category))
11
- ? await this.getAllCategoriesIdFromCollection(category)
12
- : [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
13
- return { category: { id: { operator: Where.IN, value: categoriesIds } } };
14
- }
15
- async getAllCategoriesIdFromCategory(category) {
16
- return this.categoryRepository
17
- .getChildren(+category.id)
18
- .then((categories) => categories.map((category) => category.id.toString()));
19
- }
20
- async getAllCategoriesIdFromCollection(category) {
21
- return this.categoryCollectionChildrenRepository
22
- .find({ filters: { collectionId: +category.id } })
23
- .then(({ data }) => data.map((categoryCollection) => categoryCollection.categoryId.toString()));
24
- }
25
- async isCollection(category) {
26
- return !isNil(category.isCollection)
27
- ? category.isCollection
28
- : this.categoryRepository.get({ id: category.id }).then((category) => category.isCollection);
29
- }
30
- }
31
- NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
32
- NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
34
- type: Injectable
35
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
36
- type: Inject,
37
- args: ['CategoryRepository']
38
- }] }, { type: undefined, decorators: [{
39
- type: Inject,
40
- args: ['CategoryCollectionChildrenRepository']
41
- }] }]; } });
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3LWNhdGVnb3J5LXN0cnVjdHVyZS5hZGFwdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29ubmVjdC1hbmd1bGFyL3NyYy9zZXJ2aWNlcy9jYXRhbG9nL2FkYXB0ZXJzL25ldy1jYXRlZ29yeS1zdHJ1Y3R1cmUuYWRhcHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUNsRCxPQUFPLEVBSUwsS0FBSyxFQUdMLEtBQUssR0FDTixNQUFNLG1CQUFtQixDQUFBOztBQUkxQixNQUFNLE9BQU8sMkJBQTJCO0lBQ3RDLFlBQ2lELGtCQUFzQyxFQUVwRSxvQ0FBMEU7UUFGNUMsdUJBQWtCLEdBQWxCLGtCQUFrQixDQUFvQjtRQUVwRSx5Q0FBb0MsR0FBcEMsb0NBQW9DLENBQXNDO0lBQzFGLENBQUM7SUFFSixLQUFLLENBQUMsNEJBQTRCLENBQUMsUUFBa0I7UUFDbkQsTUFBTSxhQUFhLEdBQUcsQ0FBQyxNQUFNLElBQUksQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7WUFDdkQsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLGdDQUFnQyxDQUFDLFFBQVEsQ0FBQztZQUN2RCxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUMsTUFBTSxJQUFJLENBQUMsOEJBQThCLENBQUMsUUFBUSx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
- import { Inject, Injectable } from '@angular/core';
2
- import { Where } from '@infrab4a/connect';
3
- import * as i0 from "@angular/core";
4
- export class OldCategoryStructureAdapter {
5
- constructor(categoryRepository) {
6
- this.categoryRepository = categoryRepository;
7
- }
8
- async buildProductFilterByCategory(category) {
9
- const productsIds = category.products?.length
10
- ? category.products
11
- : await this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
12
- return { id: { operator: Where.IN, value: productsIds } };
13
- }
14
- }
15
- OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
16
- OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter });
17
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
18
- type: Injectable
19
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
20
- type: Inject,
21
- args: ['CategoryRepository']
22
- }] }]; } });
23
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib2xkLWNhdGVnb3J5LXN0cnVjdHVyZS5hZGFwdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY29ubmVjdC1hbmd1bGFyL3NyYy9zZXJ2aWNlcy9jYXRhbG9nL2FkYXB0ZXJzL29sZC1jYXRlZ29yeS1zdHJ1Y3R1cmUuYWRhcHRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUNsRCxPQUFPLEVBQWlFLEtBQUssRUFBR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