@infrab4a/connect-angular 0.13.0-beta.13 → 0.13.0-beta.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.
Files changed (43) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +257 -395
  2. package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
  3. package/esm2015/lib/angular-connect.module.js +8 -8
  4. package/esm2015/lib/angular-firebase-auth.module.js +21 -33
  5. package/esm2015/lib/angular-firestore.module.js +140 -138
  6. package/esm2015/lib/factories/firebase-app.factory.js +18 -0
  7. package/esm2015/lib/factories/firebase-auth.factory.js +3 -0
  8. package/esm2015/lib/factories/firebase-firestore.factory.js +3 -0
  9. package/esm2015/lib/providers/firebase-app.provider.js +12 -0
  10. package/esm2015/lib/providers/firebase-auth.provider.js +13 -0
  11. package/esm2015/lib/providers/firebase-firestore.provider.js +12 -0
  12. package/esm2015/lib/providers/index.js +4 -0
  13. package/esm2015/lib/services/auth.service.js +16 -13
  14. package/esm2015/lib/services/cart.service.js +2 -6
  15. package/esm2015/lib/services/checkout-subscription.service.js +6 -37
  16. package/esm2015/lib/services/checkout.service.js +3 -3
  17. package/esm2015/lib/services/coupon.service.js +10 -29
  18. package/esm2015/lib/services/errors/index.js +1 -2
  19. package/esm2015/lib/services/index.js +1 -2
  20. package/esm2015/lib/services/order.service.js +11 -13
  21. package/fesm2015/infrab4a-connect-angular.js +245 -359
  22. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  23. package/lib/angular-connect.module.d.ts +4 -5
  24. package/lib/angular-firebase-auth.module.d.ts +3 -4
  25. package/lib/angular-firestore.module.d.ts +3 -4
  26. package/lib/factories/firebase-app.factory.d.ts +4 -0
  27. package/lib/factories/firebase-auth.factory.d.ts +2 -0
  28. package/lib/factories/firebase-firestore.factory.d.ts +2 -0
  29. package/lib/providers/firebase-app.provider.d.ts +17 -0
  30. package/lib/providers/firebase-auth.provider.d.ts +9 -0
  31. package/lib/providers/firebase-firestore.provider.d.ts +8 -0
  32. package/lib/providers/index.d.ts +3 -0
  33. package/lib/services/auth.service.d.ts +5 -3
  34. package/lib/services/checkout-subscription.service.d.ts +2 -7
  35. package/lib/services/coupon.service.d.ts +2 -3
  36. package/lib/services/errors/index.d.ts +0 -1
  37. package/lib/services/index.d.ts +0 -1
  38. package/lib/services/order.service.d.ts +3 -3
  39. package/package.json +3 -4
  40. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +0 -7
  41. package/esm2015/lib/services/home-shop.service.js +0 -106
  42. package/lib/services/errors/group-invalid-coupon.error.d.ts +0 -5
  43. package/lib/services/home-shop.service.d.ts +0 -24
@@ -1,25 +1,38 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Inject, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/fire/auth';
4
- import { AngularFireAuth } from '@angular/fire/auth';
5
- import { of, combineLatest, from, throwError, Subject, iif, forkJoin } from 'rxjs';
2
+ import { Injectable, Inject, InjectionToken, NgZone, Optional, NgModule } from '@angular/core';
3
+ import { Observable, of, combineLatest, from, throwError, Subject, iif } from 'rxjs';
6
4
  import { catchError, map, mergeMap, concatMap, tap } from 'rxjs/operators';
5
+ import firebase from 'firebase';
7
6
  import * as i2 from '@infrab4a/connect';
8
- import { FinancialCoupon, Where, NotFoundError, Exclusivities, isNil, Checkout, CheckoutTypes, pick, LineItem, CouponTypes, CouponSubtypes, CheckoutSubscription, Order, Category, Product, Shops, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository } from '@infrab4a/connect';
7
+ import { Where, NotFoundError, FinancialCoupon, CheckoutTypes, Exclusivities, isNil, Checkout, pick, LineItem, CouponTypes, CouponSubtypes, CheckoutSubscription, Order, isString, isObject, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository } from '@infrab4a/connect';
9
8
  import { __awaiter } from 'tslib';
10
9
  import cookie from 'js-cookie';
11
- import * as i1$1 from '@angular/fire/firestore';
12
- import { AngularFirestore } from '@angular/fire/firestore';
13
- import { FIREBASE_OPTIONS, FIREBASE_APP_NAME, AngularFireModule } from '@angular/fire';
10
+ import firebase$1 from 'firebase/app';
14
11
 
12
+ const FirebaseAuthFactory = () => firebase.auth();
13
+
14
+ class ConnectAngularFirebaseAuth {
15
+ constructor() {
16
+ this.onAuthStateChanged = firebase.auth().onAuthStateChanged;
17
+ this.currentUser = firebase.auth().currentUser;
18
+ }
19
+ }
20
+ const FirebaseAuthProvider = {
21
+ provide: ConnectAngularFirebaseAuth,
22
+ useFactory: FirebaseAuthFactory,
23
+ };
24
+
25
+ const fromCallback = (cb, zone) => new Observable((subscriber) => ({ unsubscribe: zone.runOutsideAngular(() => cb(subscriber)) }));
15
26
  class AuthService {
16
- constructor(angularFireAuth, userRepository) {
17
- this.angularFireAuth = angularFireAuth;
27
+ constructor(firebaseAuth, userRepository, zone) {
28
+ this.firebaseAuth = firebaseAuth;
18
29
  this.userRepository = userRepository;
30
+ this.zone = zone;
19
31
  }
20
32
  getAuthstate() {
33
+ this.firebaseAuth.onAuthStateChanged((user) => user);
21
34
  const observables = [
22
- this.angularFireAuth.authState.pipe(catchError(() => of(null))),
35
+ fromCallback(this.firebaseAuth.onAuthStateChanged, this.zone).pipe(catchError(() => of(null))),
23
36
  this.getUser().pipe(catchError(() => of(null))),
24
37
  ];
25
38
  return combineLatest(observables).pipe(map(([fireUser, user]) => {
@@ -33,20 +46,20 @@ class AuthService {
33
46
  return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? this.userRepository.get({ id }) : of(null))));
34
47
  }
35
48
  getTokenId() {
36
- return this.angularFireAuth.idToken;
49
+ return from(this.firebaseAuth.currentUser.getIdToken());
37
50
  }
38
51
  getFireUser() {
39
- return this.angularFireAuth.user.pipe(catchError(() => of(null)));
52
+ return of(this.firebaseAuth.currentUser).pipe(catchError(() => of(null)));
40
53
  }
41
54
  }
42
- AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, deps: [{ token: i1.AngularFireAuth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
55
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, deps: [{ token: ConnectAngularFirebaseAuth }, { token: 'UserRepository' }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
43
56
  AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService });
44
57
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, decorators: [{
45
58
  type: Injectable
46
- }], ctorParameters: function () { return [{ type: i1.AngularFireAuth }, { type: undefined, decorators: [{
59
+ }], ctorParameters: function () { return [{ type: ConnectAngularFirebaseAuth }, { type: undefined, decorators: [{
47
60
  type: Inject,
48
61
  args: ['UserRepository']
49
- }] }]; } });
62
+ }] }, { type: i0.NgZone }]; } });
50
63
 
51
64
  const DEFAULT_SHOP = 'DEFAULT_SHOP';
52
65
 
@@ -57,51 +70,25 @@ class InvalidCouponError extends Error {
57
70
  }
58
71
  }
59
72
 
60
- class GroupInvalidCouponError extends Error {
61
- constructor(errors) {
62
- super('Many coupon errors throw');
63
- this.errors = errors;
64
- }
65
- }
66
-
67
73
  class CouponService {
68
74
  constructor(couponRepository, defaultShop) {
69
75
  this.couponRepository = couponRepository;
70
76
  this.defaultShop = defaultShop;
71
77
  this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
72
- this.separateValidCoupons = (coupons, userEmail) => coupons
73
- .map((coupon) => {
74
- try {
75
- if (!FinancialCoupon.isFinancialCoupon(coupon))
76
- throw new InvalidCouponError('Coupon is not valid');
77
- if (this.isValidCoupon(coupon, userEmail))
78
- return coupon;
79
- }
80
- catch (error) {
81
- return error;
82
- }
83
- })
84
- .reduce((current, coupon) => (Object.assign(Object.assign({}, current), (FinancialCoupon.isFinancialCoupon(coupon)
85
- ? { valids: [...current.valids, coupon] }
86
- : { invalids: [...current.invalids, coupon] }))), {
87
- valids: [],
88
- invalids: [],
89
- });
90
78
  }
91
- checkCoupon(nickname, userEmail, checkoutType) {
79
+ checkCoupon(nickname, userEmail) {
92
80
  return from(this.couponRepository.find([
93
81
  {
94
82
  nickname: { operator: Where.EQUALS, value: nickname },
95
83
  shopAvailability: { operator: Where.EQUALS, value: this.defaultShop },
96
- checkoutType: { operator: Where.EQUALS, value: checkoutType },
97
84
  },
98
- ])).pipe(concatMap((coupons) => coupons.count < 1 ? throwError(() => new NotFoundError('Coupon not found')) : of(coupons.data)), map((coupons) => this.separateValidCoupons(coupons, userEmail)), map(({ valids, invalids }) => {
99
- if (!valids.length)
100
- throw new GroupInvalidCouponError(invalids);
101
- return valids;
102
- }));
85
+ ])).pipe(concatMap((coupons) => coupons.count < 1 ? throwError(() => new NotFoundError('Coupon not found')) : of(coupons.data[0])), concatMap((coupon) => FinancialCoupon.isFinancialCoupon(coupon) && this.isValidCoupon(coupon, userEmail)
86
+ ? of(coupon)
87
+ : throwError(() => new InvalidCouponError('Coupon is not valid'))));
103
88
  }
104
89
  isValidCoupon(coupon, userEmail) {
90
+ if (coupon.checkoutType !== CheckoutTypes.ECOMMERCE)
91
+ throw new InvalidCouponError('Coupon is not ecommerce valid');
105
92
  if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
106
93
  throw new InvalidCouponError('User is not a collaborator');
107
94
  if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
@@ -156,7 +143,7 @@ class CheckoutService {
156
143
  checkCoupon(nickname) {
157
144
  return this.getCheckout().pipe(concatMap((checkout) => {
158
145
  var _a;
159
- return this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, CheckoutTypes.ECOMMERCE).pipe(concatMap((coupons) => of(coupons.shift())), concatMap((coupon) => {
146
+ return this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(concatMap((coupon) => {
160
147
  var _a, _b;
161
148
  return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
162
149
  ? from(this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(concatMap((orders) => {
@@ -249,7 +236,6 @@ class CartService {
249
236
  pricePaid,
250
237
  categories,
251
238
  isGift,
252
- costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
253
239
  });
254
240
  };
255
241
  this.getProductPrice = ({ product, shop, isSubscriber, }) => {
@@ -266,10 +252,7 @@ class CartService {
266
252
  };
267
253
  }
268
254
  addItem(item, quantity = 1) {
269
- return this.checkoutService.getCheckout().pipe(map((checkout) => ({
270
- checkout,
271
- lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }),
272
- })), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
255
+ return this.checkoutService.getCheckout().pipe(map((checkout) => ({ checkout, lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }) })), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
273
256
  }
274
257
  decreaseItem(item) {
275
258
  return this.checkoutService.getCheckout().pipe(map((checkout) => {
@@ -350,21 +333,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
350
333
  }] }]; } });
351
334
 
352
335
  class CheckoutSubscriptionService {
353
- constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
336
+ constructor(checkoutSubscriptionRepository) {
354
337
  this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
355
- this.subscriptionRepository = subscriptionRepository;
356
- this.couponService = couponService;
357
- this.checkCouponsWithCheckout = (coupons, checkout) => forkJoin(coupons.map((coupon) => {
358
- var _a;
359
- return from(this.subscriptionRepository.find([{ user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } }])).pipe(map((subscriptions) => ({ coupon, subscriptions })));
360
- })).pipe(map((results) => results.map(({ coupon, subscriptions }) => {
361
- if (subscriptions.data.length >= (coupon.useLimit || Infinity))
362
- return new InvalidCouponError('Coupon is already applied');
363
- return coupon;
364
- })), map((validatedCoupons) => ({
365
- valids: validatedCoupons.filter((coupon) => FinancialCoupon.isFinancialCoupon(coupon)),
366
- invalids: validatedCoupons.filter((coupon) => coupon instanceof InvalidCouponError),
367
- })), concatMap(({ valids, invalids }) => valids.length ? of(valids) : throwError(new GroupInvalidCouponError(invalids))));
368
338
  }
369
339
  getCheckoutSubscription(checkoutData) {
370
340
  const checkoutId = cookie.get('checkoutSubscriptionId');
@@ -383,152 +353,76 @@ class CheckoutSubscriptionService {
383
353
  cookie.remove('checkoutSubscriptionId');
384
354
  return of();
385
355
  }
386
- checkCoupon(nickname, userEmail) {
387
- return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION).pipe(concatMap((coupons) => {
388
- const couponsWithSamePlan = coupons.filter((coupon) => checkout.subscriptionPlan.name === coupon.plan);
389
- const couponsWithNoPlan = coupons.filter((coupon) => !coupon.plan);
390
- if (couponsWithSamePlan.length > 0)
391
- return of(couponsWithSamePlan);
392
- if (couponsWithNoPlan.length > 0)
393
- return of(couponsWithNoPlan);
394
- throw new Error(`Coupon subscription plan is invalid.`);
395
- }), concatMap((coupons) => { var _a; return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email) ? this.checkCouponsWithCheckout(coupons, checkout) : of(coupons); }), map((validatedCoupons) => validatedCoupons.shift()))));
396
- }
397
356
  }
398
- CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable });
357
+ CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
399
358
  CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService });
400
359
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
401
360
  type: Injectable
402
361
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
403
362
  type: Inject,
404
363
  args: ['CheckoutSubscriptionRepository']
405
- }] }, { type: undefined, decorators: [{
406
- type: Inject,
407
- args: ['SubscriptionRepository']
408
- }] }, { type: CouponService }]; } });
364
+ }] }]; } });
365
+
366
+ const FirebaseFirestoreFactory = () => firebase.firestore();
367
+
368
+ class ConnectAngularFirebaseFirestore {
369
+ constructor() {
370
+ this.doc = firebase.firestore().doc;
371
+ }
372
+ }
373
+ const FirebaseFirestoreProvider = {
374
+ provide: ConnectAngularFirebaseFirestore,
375
+ useFactory: FirebaseFirestoreFactory,
376
+ };
409
377
 
410
378
  class OrderService {
411
- constructor(angularFirestore, orderRepository) {
412
- this.angularFirestore = angularFirestore;
379
+ constructor(firebaseFirestore, orderRepository) {
380
+ this.firebaseFirestore = firebaseFirestore;
413
381
  this.orderRepository = orderRepository;
414
382
  this.orderSubject = new Subject();
415
383
  }
416
384
  getOrder(id) {
417
- this.angularFirestore
418
- .doc(`${this.orderRepository.collectionName}/${id}`)
419
- .valueChanges()
420
- .pipe(map((doc) => Order.toInstance(doc)))
421
- .subscribe((doc) => this.orderSubject.next(doc));
385
+ this.firebaseFirestore.doc(`${this.orderRepository.collectionName}/${id}`).onSnapshot((doc) => {
386
+ const order = Order.toInstance(Object.assign(Object.assign({}, doc.data()), { id: doc.id }));
387
+ this.orderSubject.next(order);
388
+ });
422
389
  return this.orderSubject;
423
390
  }
424
391
  }
425
- OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: i1$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
392
+ OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: ConnectAngularFirebaseFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
426
393
  OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
427
394
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
428
395
  type: Injectable
429
- }], ctorParameters: function () { return [{ type: i1$1.AngularFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
396
+ }], ctorParameters: function () { return [{ type: ConnectAngularFirebaseFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
430
397
  type: Inject,
431
398
  args: ['OrderRepository']
432
399
  }] }]; } });
433
400
 
434
- class HomeShopService {
435
- constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
436
- this.categoryRepository = categoryRepository;
437
- this.homeRepository = homeRepository;
438
- this.productRepository = productRepository;
439
- this.defaultShop = defaultShop;
440
- this.buildCategoryGroupWithRequiredData = (group) => ({
441
- category: Category.toInstance(pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
442
- products: group.products.map((product) => Product.toInstance(pick(product.toPlain(), [
443
- 'id',
444
- 'price',
445
- 'reviews',
446
- 'hasVariants',
447
- 'slug',
448
- 'sku',
449
- 'stock',
450
- 'costPrice',
451
- 'images',
452
- 'miniatures',
453
- ]))),
454
- });
455
- }
456
- get homeId() {
457
- if (this.defaultShop === Shops.GLAMSHOP)
458
- return 'glamshop';
459
- if (this.defaultShop === Shops.MENSMARKET)
460
- return 'mens_market';
461
- return null;
462
- }
463
- getHomeData() {
464
- return this.getHomeConfiguration().pipe(tap((home) => { var _a; return console.log((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt); }), map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
465
- ? of(home)
466
- : forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
467
- discoverProducts,
468
- featuredProducts,
469
- verticalProducts,
470
- })), concatMap((data) => this.saveHomeData(data)))));
471
- }
472
- getBanners(type) {
473
- return this.getHomeConfiguration().pipe(map((home) => {
474
- if (type === 'brand')
475
- return home.brandsCarousel;
476
- if (type === 'buyToWin')
477
- return [home.buyToWinBanner];
478
- if (type === 'block')
479
- return home.blockBanners;
480
- if (type === 'blog')
481
- return [home.blogBanner];
482
- }));
483
- }
484
- getDiscoverProducts() {
485
- return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
486
- }
487
- getFeaturedProducts() {
488
- return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
489
- }
490
- getVerticalProducts() {
491
- return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.map((id) => forkJoin([
492
- this.categoryRepository.get({ id }),
493
- this.productRepository.find([{ categories: { operator: Where.LIKE, value: [id] } }], { limit: 12 }),
494
- ]).pipe(map(([category, products]) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
495
- }
496
- getHomeConfiguration() {
497
- return of(this.homeConfiguration).pipe(concatMap((home) => home
498
- ? of(home)
499
- : !this.homeId
500
- ? throwError(new RequiredArgumentError(['homeId']))
501
- : from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
502
- }
503
- saveHomeData(homeData) {
504
- const data = {
505
- createdAt: new Date(),
506
- expiresAt: add(new Date(), { hours: 1 }),
507
- data: homeData,
508
- };
509
- return from(this.homeRepository.update({
510
- id: this.homeId,
511
- data,
512
- })).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
401
+ const FirebaseAppFactory = (options, zone, nameOrConfig) => {
402
+ const name = ((isString(nameOrConfig) && nameOrConfig) || '[DEFAULT]').toString();
403
+ const config = ((isObject(nameOrConfig) && nameOrConfig) || {});
404
+ config.name = config.name || name;
405
+ const existingApp = firebase$1.apps.filter((firebaseApp) => firebaseApp && firebaseApp.name === config.name)[0];
406
+ const app = existingApp || zone.runOutsideAngular(() => firebase$1.initializeApp(options, config));
407
+ try {
408
+ if (JSON.stringify(options) !== JSON.stringify(app.options)) {
409
+ console.error('error', `${app.name} Firebase App already initialized with different options : '.'
410
+ }`);
411
+ }
513
412
  }
413
+ catch (e) { }
414
+ return app;
415
+ };
416
+
417
+ const FIREBASE_OPTIONS = new InjectionToken('connect-angular.app.options');
418
+ const FIREBASE_APP_NAME = new InjectionToken('connect-angular.app.nameOrConfig');
419
+ class ConnectAngularFirebaseApp {
514
420
  }
515
- HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
516
- HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService });
517
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, decorators: [{
518
- type: Injectable
519
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
520
- type: Inject,
521
- args: ['CategoryRepository']
522
- }] }, { type: undefined, decorators: [{
523
- type: Inject,
524
- args: ['HomeRepository']
525
- }] }, { type: undefined, decorators: [{
526
- type: Inject,
527
- args: ['ProductRepository']
528
- }] }, { type: i2.Shops, decorators: [{
529
- type: Inject,
530
- args: [DEFAULT_SHOP]
531
- }] }]; } });
421
+ const FirebaseAppProvider = {
422
+ provide: ConnectAngularFirebaseApp,
423
+ useFactory: FirebaseAppFactory,
424
+ deps: [FIREBASE_OPTIONS, NgZone, [new Optional(), FIREBASE_APP_NAME]],
425
+ };
532
426
 
533
427
  class AngularFirebaseAuthModule {
534
428
  static initializeApp(options, nameOrConfig) {
@@ -542,8 +436,10 @@ class AngularFirebaseAuthModule {
542
436
  }
543
437
  }
544
438
  AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
545
- AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
439
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule });
546
440
  AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
441
+ FirebaseAppProvider,
442
+ FirebaseAuthProvider,
547
443
  {
548
444
  provide: 'Authentication',
549
445
  useFactory: (authenticationService, userRepository) => {
@@ -553,10 +449,10 @@ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
553
449
  },
554
450
  {
555
451
  provide: 'AuthenticationService',
556
- useFactory: (angularFireAuth) => {
557
- return new AuthenticationFirebaseAuthService(angularFireAuth);
452
+ useFactory: (app) => {
453
+ return new AuthenticationFirebaseAuthService(app.auth());
558
454
  },
559
- deps: [AngularFireAuth],
455
+ deps: [FirebaseAppProvider],
560
456
  },
561
457
  {
562
458
  provide: 'Register',
@@ -567,10 +463,10 @@ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
567
463
  },
568
464
  {
569
465
  provide: 'RegisterService',
570
- useFactory: (angularFireAuth) => {
571
- return new RegisterFirebaseAuthService(angularFireAuth);
466
+ useFactory: (app) => {
467
+ return new RegisterFirebaseAuthService(app.auth());
572
468
  },
573
- deps: [AngularFireAuth],
469
+ deps: [FirebaseAppProvider],
574
470
  },
575
471
  {
576
472
  provide: 'SignOut',
@@ -579,19 +475,13 @@ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0
579
475
  },
580
476
  deps: ['AuthenticationService'],
581
477
  },
582
- {
583
- provide: 'RecoveryPassword',
584
- useFactory: (authenticationService) => {
585
- return new RecoveryPassword(authenticationService);
586
- },
587
- deps: ['AuthenticationService'],
588
- },
589
- ], imports: [[AngularFireModule]] });
478
+ ] });
590
479
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
591
480
  type: NgModule,
592
481
  args: [{
593
- imports: [AngularFireModule],
594
482
  providers: [
483
+ FirebaseAppProvider,
484
+ FirebaseAuthProvider,
595
485
  {
596
486
  provide: 'Authentication',
597
487
  useFactory: (authenticationService, userRepository) => {
@@ -601,10 +491,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
601
491
  },
602
492
  {
603
493
  provide: 'AuthenticationService',
604
- useFactory: (angularFireAuth) => {
605
- return new AuthenticationFirebaseAuthService(angularFireAuth);
494
+ useFactory: (app) => {
495
+ return new AuthenticationFirebaseAuthService(app.auth());
606
496
  },
607
- deps: [AngularFireAuth],
497
+ deps: [FirebaseAppProvider],
608
498
  },
609
499
  {
610
500
  provide: 'Register',
@@ -615,10 +505,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
615
505
  },
616
506
  {
617
507
  provide: 'RegisterService',
618
- useFactory: (angularFireAuth) => {
619
- return new RegisterFirebaseAuthService(angularFireAuth);
508
+ useFactory: (app) => {
509
+ return new RegisterFirebaseAuthService(app.auth());
620
510
  },
621
- deps: [AngularFireAuth],
511
+ deps: [FirebaseAppProvider],
622
512
  },
623
513
  {
624
514
  provide: 'SignOut',
@@ -627,13 +517,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
627
517
  },
628
518
  deps: ['AuthenticationService'],
629
519
  },
630
- {
631
- provide: 'RecoveryPassword',
632
- useFactory: (authenticationService) => {
633
- return new RecoveryPassword(authenticationService);
634
- },
635
- deps: ['AuthenticationService'],
636
- },
637
520
  ],
638
521
  }]
639
522
  }] });
@@ -650,321 +533,324 @@ class AngularFirestoreModule {
650
533
  }
651
534
  }
652
535
  AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
653
- AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule] });
536
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule });
654
537
  AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
538
+ FirebaseAppProvider,
539
+ FirebaseFirestoreProvider,
655
540
  {
656
541
  provide: 'BeautyProfileRepository',
657
- useFactory: (firestore, userRepository) => {
658
- return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
542
+ useFactory: (app, userRepository) => {
543
+ return new UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
659
544
  },
660
- deps: [AngularFirestore, 'UserRepository'],
545
+ deps: [FirebaseAppProvider, 'UserRepository'],
661
546
  },
662
547
  {
663
548
  provide: 'Buy2WinRepository',
664
- useFactory: (firestore) => {
665
- return new Buy2WinFirestoreRepository(firestore.firestore);
549
+ useFactory: (app) => {
550
+ return new Buy2WinFirestoreRepository(app.firestore());
666
551
  },
667
- deps: [AngularFirestore],
552
+ deps: [FirebaseAppProvider],
668
553
  },
669
554
  {
670
555
  provide: 'CategoryRepository',
671
- useFactory: (firestore) => {
672
- return new CategoryFirestoreRepository(firestore.firestore);
556
+ useFactory: (app) => {
557
+ return new CategoryFirestoreRepository(app.firestore());
673
558
  },
674
- deps: [AngularFirestore],
559
+ deps: [FirebaseAppProvider],
675
560
  },
676
561
  {
677
562
  provide: 'CheckoutRepository',
678
- useFactory: (firestore) => {
679
- return new CheckoutFirestoreRepository(firestore.firestore);
563
+ useFactory: (app) => {
564
+ return new CheckoutFirestoreRepository(app.firestore());
680
565
  },
681
- deps: [AngularFirestore],
566
+ deps: [FirebaseAppProvider],
682
567
  },
683
568
  {
684
569
  provide: 'CheckoutSubscriptionRepository',
685
- useFactory: (firestore) => {
686
- return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
570
+ useFactory: (app) => {
571
+ return new CheckoutSubscriptionFirestoreRepository(app.firestore());
687
572
  },
688
- deps: [AngularFirestore],
573
+ deps: [FirebaseAppProvider],
689
574
  },
690
575
  {
691
576
  provide: 'CouponRepository',
692
- useFactory: (firestore) => {
693
- return new CouponFirestoreRepository(firestore.firestore);
577
+ useFactory: (app) => {
578
+ return new CouponFirestoreRepository(app.firestore());
694
579
  },
695
- deps: [AngularFirestore],
580
+ deps: [FirebaseAppProvider],
696
581
  },
697
582
  {
698
583
  provide: 'EditionRepository',
699
- useFactory: (firestore, subscriptionRepository) => {
700
- return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
584
+ useFactory: (app, subscriptionRepository) => {
585
+ return new SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
701
586
  },
702
- deps: [AngularFirestore, 'SubscriptionRepository'],
587
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
703
588
  },
704
589
  {
705
590
  provide: 'HomeRepository',
706
- useFactory: (firestore) => {
707
- return new HomeFirestoreRepository(firestore.firestore);
591
+ useFactory: (app) => {
592
+ return new HomeFirestoreRepository(app.firestore());
708
593
  },
709
- deps: [AngularFirestore],
594
+ deps: [FirebaseAppProvider],
710
595
  },
711
596
  {
712
597
  provide: 'LeadRepository',
713
- useFactory: (firestore) => {
714
- return new LeadFirestoreRepository(firestore.firestore);
598
+ useFactory: (app) => {
599
+ return new LeadFirestoreRepository(app.firestore());
715
600
  },
716
- deps: [AngularFirestore],
601
+ deps: [FirebaseAppProvider],
717
602
  },
718
603
  {
719
604
  provide: 'LegacyOrderRepository',
720
- useFactory: (firestore) => {
721
- return new LegacyOrderFirestoreRepository(firestore.firestore);
605
+ useFactory: (app) => {
606
+ return new LegacyOrderFirestoreRepository(app.firestore());
722
607
  },
723
- deps: [AngularFirestore],
608
+ deps: [FirebaseAppProvider],
724
609
  },
725
610
  {
726
611
  provide: 'ShopMenuRepository',
727
- useFactory: (firestore) => {
728
- return new ShopMenuFirestoreRepository(firestore.firestore);
612
+ useFactory: (app) => {
613
+ return new ShopMenuFirestoreRepository(app.firestore());
729
614
  },
730
- deps: [AngularFirestore],
615
+ deps: [FirebaseAppProvider],
731
616
  },
732
617
  {
733
618
  provide: 'OrderRepository',
734
- useFactory: (firestore) => {
735
- return new OrderFirestoreRepository(firestore.firestore);
619
+ useFactory: (app) => {
620
+ return new OrderFirestoreRepository(app.firestore());
736
621
  },
737
- deps: [AngularFirestore],
622
+ deps: [FirebaseAppProvider],
738
623
  },
739
624
  {
740
625
  provide: 'PaymentRepository',
741
- useFactory: (firestore) => {
742
- return new PaymentFirestoreRepository(firestore.firestore);
626
+ useFactory: (app) => {
627
+ return new PaymentFirestoreRepository(app.firestore());
743
628
  },
744
- deps: [AngularFirestore],
629
+ deps: [FirebaseAppProvider],
745
630
  },
746
631
  {
747
632
  provide: 'ProductRepository',
748
- useFactory: (firestore) => {
749
- return new ProductFirestoreRepository(firestore.firestore);
633
+ useFactory: (app) => {
634
+ return new ProductFirestoreRepository(app.firestore());
750
635
  },
751
- deps: [AngularFirestore],
636
+ deps: [FirebaseAppProvider],
752
637
  },
753
638
  {
754
639
  provide: 'SubscriptionPaymentRepository',
755
- useFactory: (firestore, subscriptionRepository) => {
756
- return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
640
+ useFactory: (app, subscriptionRepository) => {
641
+ return new SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
757
642
  },
758
- deps: [AngularFirestore, 'SubscriptionRepository'],
643
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
759
644
  },
760
645
  {
761
646
  provide: 'SubscriptionPlanRepository',
762
- useFactory: (firestore) => {
763
- return new SubscriptionPlanFirestoreRepository(firestore.firestore);
647
+ useFactory: (app) => {
648
+ return new SubscriptionPlanFirestoreRepository(app.firestore());
764
649
  },
765
- deps: [AngularFirestore],
650
+ deps: [FirebaseAppProvider],
766
651
  },
767
652
  {
768
653
  provide: 'SubscriptionProductRepository',
769
- useFactory: (firestore) => {
770
- return new SubscriptionProductFirestoreRepository(firestore.firestore);
654
+ useFactory: (app) => {
655
+ return new SubscriptionProductFirestoreRepository(app.firestore());
771
656
  },
772
- deps: [AngularFirestore],
657
+ deps: [FirebaseAppProvider],
773
658
  },
774
659
  {
775
660
  provide: 'SubscriptionRepository',
776
- useFactory: (firestore) => {
777
- return new SubscriptionFirestoreRepository(firestore.firestore);
661
+ useFactory: (app) => {
662
+ return new SubscriptionFirestoreRepository(app.firestore());
778
663
  },
779
- deps: [AngularFirestore],
664
+ deps: [FirebaseAppProvider],
780
665
  },
781
666
  {
782
667
  provide: 'UserRepository',
783
- useFactory: (firestore) => {
784
- return new UserFirestoreRepository(firestore.firestore);
668
+ useFactory: (app) => {
669
+ return new UserFirestoreRepository(app.firestore());
785
670
  },
786
- deps: [AngularFirestore],
671
+ deps: [FirebaseAppProvider],
787
672
  },
788
673
  {
789
674
  provide: 'UserAddressRepository',
790
- useFactory: (firestore, userRepository) => {
791
- return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
675
+ useFactory: (app, userRepository) => {
676
+ return new UserAddressFirestoreRepository(app.firestore(), userRepository);
792
677
  },
793
- deps: [AngularFirestore, 'UserRepository'],
678
+ deps: [FirebaseAppProvider, 'UserRepository'],
794
679
  },
795
680
  {
796
681
  provide: 'UserPaymentMethodRepository',
797
- useFactory: (firestore, userRepository) => {
798
- return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
682
+ useFactory: (app, userRepository) => {
683
+ return new UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
799
684
  },
800
- deps: [AngularFirestore, 'UserRepository'],
685
+ deps: [FirebaseAppProvider, 'UserRepository'],
801
686
  },
802
687
  {
803
688
  provide: 'VariantRepository',
804
- useFactory: (firestore, productRepository) => {
805
- return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
689
+ useFactory: (app, productRepository) => {
690
+ return new ProductVariantFirestoreRepository(app.firestore(), productRepository);
806
691
  },
807
- deps: [AngularFirestore, 'ProductRepository'],
692
+ deps: [FirebaseAppProvider, 'ProductRepository'],
808
693
  },
809
- ], imports: [[AngularFireModule]] });
694
+ ] });
810
695
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
811
696
  type: NgModule,
812
697
  args: [{
813
- imports: [AngularFireModule],
814
698
  providers: [
699
+ FirebaseAppProvider,
700
+ FirebaseFirestoreProvider,
815
701
  {
816
702
  provide: 'BeautyProfileRepository',
817
- useFactory: (firestore, userRepository) => {
818
- return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
703
+ useFactory: (app, userRepository) => {
704
+ return new UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
819
705
  },
820
- deps: [AngularFirestore, 'UserRepository'],
706
+ deps: [FirebaseAppProvider, 'UserRepository'],
821
707
  },
822
708
  {
823
709
  provide: 'Buy2WinRepository',
824
- useFactory: (firestore) => {
825
- return new Buy2WinFirestoreRepository(firestore.firestore);
710
+ useFactory: (app) => {
711
+ return new Buy2WinFirestoreRepository(app.firestore());
826
712
  },
827
- deps: [AngularFirestore],
713
+ deps: [FirebaseAppProvider],
828
714
  },
829
715
  {
830
716
  provide: 'CategoryRepository',
831
- useFactory: (firestore) => {
832
- return new CategoryFirestoreRepository(firestore.firestore);
717
+ useFactory: (app) => {
718
+ return new CategoryFirestoreRepository(app.firestore());
833
719
  },
834
- deps: [AngularFirestore],
720
+ deps: [FirebaseAppProvider],
835
721
  },
836
722
  {
837
723
  provide: 'CheckoutRepository',
838
- useFactory: (firestore) => {
839
- return new CheckoutFirestoreRepository(firestore.firestore);
724
+ useFactory: (app) => {
725
+ return new CheckoutFirestoreRepository(app.firestore());
840
726
  },
841
- deps: [AngularFirestore],
727
+ deps: [FirebaseAppProvider],
842
728
  },
843
729
  {
844
730
  provide: 'CheckoutSubscriptionRepository',
845
- useFactory: (firestore) => {
846
- return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
731
+ useFactory: (app) => {
732
+ return new CheckoutSubscriptionFirestoreRepository(app.firestore());
847
733
  },
848
- deps: [AngularFirestore],
734
+ deps: [FirebaseAppProvider],
849
735
  },
850
736
  {
851
737
  provide: 'CouponRepository',
852
- useFactory: (firestore) => {
853
- return new CouponFirestoreRepository(firestore.firestore);
738
+ useFactory: (app) => {
739
+ return new CouponFirestoreRepository(app.firestore());
854
740
  },
855
- deps: [AngularFirestore],
741
+ deps: [FirebaseAppProvider],
856
742
  },
857
743
  {
858
744
  provide: 'EditionRepository',
859
- useFactory: (firestore, subscriptionRepository) => {
860
- return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
745
+ useFactory: (app, subscriptionRepository) => {
746
+ return new SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
861
747
  },
862
- deps: [AngularFirestore, 'SubscriptionRepository'],
748
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
863
749
  },
864
750
  {
865
751
  provide: 'HomeRepository',
866
- useFactory: (firestore) => {
867
- return new HomeFirestoreRepository(firestore.firestore);
752
+ useFactory: (app) => {
753
+ return new HomeFirestoreRepository(app.firestore());
868
754
  },
869
- deps: [AngularFirestore],
755
+ deps: [FirebaseAppProvider],
870
756
  },
871
757
  {
872
758
  provide: 'LeadRepository',
873
- useFactory: (firestore) => {
874
- return new LeadFirestoreRepository(firestore.firestore);
759
+ useFactory: (app) => {
760
+ return new LeadFirestoreRepository(app.firestore());
875
761
  },
876
- deps: [AngularFirestore],
762
+ deps: [FirebaseAppProvider],
877
763
  },
878
764
  {
879
765
  provide: 'LegacyOrderRepository',
880
- useFactory: (firestore) => {
881
- return new LegacyOrderFirestoreRepository(firestore.firestore);
766
+ useFactory: (app) => {
767
+ return new LegacyOrderFirestoreRepository(app.firestore());
882
768
  },
883
- deps: [AngularFirestore],
769
+ deps: [FirebaseAppProvider],
884
770
  },
885
771
  {
886
772
  provide: 'ShopMenuRepository',
887
- useFactory: (firestore) => {
888
- return new ShopMenuFirestoreRepository(firestore.firestore);
773
+ useFactory: (app) => {
774
+ return new ShopMenuFirestoreRepository(app.firestore());
889
775
  },
890
- deps: [AngularFirestore],
776
+ deps: [FirebaseAppProvider],
891
777
  },
892
778
  {
893
779
  provide: 'OrderRepository',
894
- useFactory: (firestore) => {
895
- return new OrderFirestoreRepository(firestore.firestore);
780
+ useFactory: (app) => {
781
+ return new OrderFirestoreRepository(app.firestore());
896
782
  },
897
- deps: [AngularFirestore],
783
+ deps: [FirebaseAppProvider],
898
784
  },
899
785
  {
900
786
  provide: 'PaymentRepository',
901
- useFactory: (firestore) => {
902
- return new PaymentFirestoreRepository(firestore.firestore);
787
+ useFactory: (app) => {
788
+ return new PaymentFirestoreRepository(app.firestore());
903
789
  },
904
- deps: [AngularFirestore],
790
+ deps: [FirebaseAppProvider],
905
791
  },
906
792
  {
907
793
  provide: 'ProductRepository',
908
- useFactory: (firestore) => {
909
- return new ProductFirestoreRepository(firestore.firestore);
794
+ useFactory: (app) => {
795
+ return new ProductFirestoreRepository(app.firestore());
910
796
  },
911
- deps: [AngularFirestore],
797
+ deps: [FirebaseAppProvider],
912
798
  },
913
799
  {
914
800
  provide: 'SubscriptionPaymentRepository',
915
- useFactory: (firestore, subscriptionRepository) => {
916
- return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
801
+ useFactory: (app, subscriptionRepository) => {
802
+ return new SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
917
803
  },
918
- deps: [AngularFirestore, 'SubscriptionRepository'],
804
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
919
805
  },
920
806
  {
921
807
  provide: 'SubscriptionPlanRepository',
922
- useFactory: (firestore) => {
923
- return new SubscriptionPlanFirestoreRepository(firestore.firestore);
808
+ useFactory: (app) => {
809
+ return new SubscriptionPlanFirestoreRepository(app.firestore());
924
810
  },
925
- deps: [AngularFirestore],
811
+ deps: [FirebaseAppProvider],
926
812
  },
927
813
  {
928
814
  provide: 'SubscriptionProductRepository',
929
- useFactory: (firestore) => {
930
- return new SubscriptionProductFirestoreRepository(firestore.firestore);
815
+ useFactory: (app) => {
816
+ return new SubscriptionProductFirestoreRepository(app.firestore());
931
817
  },
932
- deps: [AngularFirestore],
818
+ deps: [FirebaseAppProvider],
933
819
  },
934
820
  {
935
821
  provide: 'SubscriptionRepository',
936
- useFactory: (firestore) => {
937
- return new SubscriptionFirestoreRepository(firestore.firestore);
822
+ useFactory: (app) => {
823
+ return new SubscriptionFirestoreRepository(app.firestore());
938
824
  },
939
- deps: [AngularFirestore],
825
+ deps: [FirebaseAppProvider],
940
826
  },
941
827
  {
942
828
  provide: 'UserRepository',
943
- useFactory: (firestore) => {
944
- return new UserFirestoreRepository(firestore.firestore);
829
+ useFactory: (app) => {
830
+ return new UserFirestoreRepository(app.firestore());
945
831
  },
946
- deps: [AngularFirestore],
832
+ deps: [FirebaseAppProvider],
947
833
  },
948
834
  {
949
835
  provide: 'UserAddressRepository',
950
- useFactory: (firestore, userRepository) => {
951
- return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
836
+ useFactory: (app, userRepository) => {
837
+ return new UserAddressFirestoreRepository(app.firestore(), userRepository);
952
838
  },
953
- deps: [AngularFirestore, 'UserRepository'],
839
+ deps: [FirebaseAppProvider, 'UserRepository'],
954
840
  },
955
841
  {
956
842
  provide: 'UserPaymentMethodRepository',
957
- useFactory: (firestore, userRepository) => {
958
- return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
843
+ useFactory: (app, userRepository) => {
844
+ return new UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
959
845
  },
960
- deps: [AngularFirestore, 'UserRepository'],
846
+ deps: [FirebaseAppProvider, 'UserRepository'],
961
847
  },
962
848
  {
963
849
  provide: 'VariantRepository',
964
- useFactory: (firestore, productRepository) => {
965
- return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
850
+ useFactory: (app, productRepository) => {
851
+ return new ProductVariantFirestoreRepository(app.firestore(), productRepository);
966
852
  },
967
- deps: [AngularFirestore, 'ProductRepository'],
853
+ deps: [FirebaseAppProvider, 'ProductRepository'],
968
854
  },
969
855
  ],
970
856
  }]
@@ -983,28 +869,28 @@ class AngularConnectModule {
983
869
  }
984
870
  }
985
871
  AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
986
- AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
872
+ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFirestoreModule] });
987
873
  AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [
988
874
  AuthService,
989
875
  CartService,
990
876
  CheckoutService,
991
877
  CheckoutSubscriptionService,
992
878
  CouponService,
993
- HomeShopService,
994
879
  OrderService,
995
- ], imports: [[AngularFireModule, AngularFirestoreModule]] });
880
+ FirebaseAppProvider,
881
+ ], imports: [[AngularFirestoreModule]] });
996
882
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
997
883
  type: NgModule,
998
884
  args: [{
999
- imports: [AngularFireModule, AngularFirestoreModule],
885
+ imports: [AngularFirestoreModule],
1000
886
  providers: [
1001
887
  AuthService,
1002
888
  CartService,
1003
889
  CheckoutService,
1004
890
  CheckoutSubscriptionService,
1005
891
  CouponService,
1006
- HomeShopService,
1007
892
  OrderService,
893
+ FirebaseAppProvider,
1008
894
  ],
1009
895
  }]
1010
896
  }] });
@@ -1013,5 +899,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
1013
899
  * Generated bundle index. Do not edit.
1014
900
  */
1015
901
 
1016
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
902
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService };
1017
903
  //# sourceMappingURL=infrab4a-connect-angular.js.map