@infrab4a/connect-angular 0.13.0-beta.12 → 0.13.0-beta.2

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 (39) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +238 -393
  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 +19 -33
  5. package/esm2015/lib/angular-firestore.module.js +138 -138
  6. package/esm2015/lib/factories/firebase-app.factory.js +18 -0
  7. package/esm2015/lib/factories/firebase-firestore.factory.js +3 -0
  8. package/esm2015/lib/providers/firebase-app.provider.js +12 -0
  9. package/esm2015/lib/providers/firebase-firestore.provider.js +8 -0
  10. package/esm2015/lib/providers/index.js +3 -0
  11. package/esm2015/lib/services/auth.service.js +16 -13
  12. package/esm2015/lib/services/cart.service.js +2 -6
  13. package/esm2015/lib/services/checkout-subscription.service.js +6 -37
  14. package/esm2015/lib/services/checkout.service.js +3 -3
  15. package/esm2015/lib/services/coupon.service.js +10 -29
  16. package/esm2015/lib/services/errors/index.js +1 -2
  17. package/esm2015/lib/services/index.js +1 -2
  18. package/esm2015/lib/services/order.service.js +11 -13
  19. package/fesm2015/infrab4a-connect-angular.js +227 -359
  20. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  21. package/lib/angular-connect.module.d.ts +4 -5
  22. package/lib/angular-firebase-auth.module.d.ts +3 -4
  23. package/lib/angular-firestore.module.d.ts +3 -4
  24. package/lib/factories/firebase-app.factory.d.ts +4 -0
  25. package/lib/factories/firebase-firestore.factory.d.ts +2 -0
  26. package/lib/providers/firebase-app.provider.d.ts +17 -0
  27. package/lib/providers/firebase-firestore.provider.d.ts +7 -0
  28. package/lib/providers/index.d.ts +2 -0
  29. package/lib/services/auth.service.d.ts +5 -3
  30. package/lib/services/checkout-subscription.service.d.ts +2 -7
  31. package/lib/services/coupon.service.d.ts +2 -3
  32. package/lib/services/errors/index.d.ts +0 -1
  33. package/lib/services/index.d.ts +0 -1
  34. package/lib/services/order.service.d.ts +3 -3
  35. package/package.json +3 -4
  36. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +0 -7
  37. package/esm2015/lib/services/home-shop.service.js +0 -106
  38. package/lib/services/errors/group-invalid-coupon.error.d.ts +0 -5
  39. package/lib/services/home-shop.service.d.ts +0 -24
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('@angular/fire/firestore'), require('@angular/fire')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', '@angular/fire/firestore', '@angular/fire'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["@infrab4a/connect"], global["js-cookie"], global.ng.fire.firestore, global.ng.fire));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, i1$1, fire) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@firebase/auth-types'), require('@infrab4a/connect'), require('js-cookie'), require('@firebase/firestore-types'), require('firebase/app'), require('firebase')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@firebase/auth-types', '@infrab4a/connect', 'js-cookie', '@firebase/firestore-types', 'firebase/app', 'firebase'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.i1, global["@infrab4a/connect"], global["js-cookie"], global.i1$1, global.firebase, global.firebase));
5
+ })(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, i1$1, firebase, firebase$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -29,6 +29,8 @@
29
29
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
30
  var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
31
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
32
+ var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
33
+ var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
32
34
 
33
35
  /*! *****************************************************************************
34
36
  Copyright (c) Microsoft Corporation.
@@ -348,14 +350,17 @@
348
350
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
349
351
  }
350
352
 
353
+ var fromCallback = function (cb, zone) { return new rxjs.Observable(function (subscriber) { return ({ unsubscribe: zone.runOutsideAngular(function () { return cb(subscriber); }) }); }); };
351
354
  var AuthService = /** @class */ (function () {
352
- function AuthService(angularFireAuth, userRepository) {
353
- this.angularFireAuth = angularFireAuth;
355
+ function AuthService(firebaseAuth, userRepository, zone) {
356
+ this.firebaseAuth = firebaseAuth;
354
357
  this.userRepository = userRepository;
358
+ this.zone = zone;
355
359
  }
356
360
  AuthService.prototype.getAuthstate = function () {
361
+ this.firebaseAuth.onAuthStateChanged(function (user) { return user; });
357
362
  var observables = [
358
- this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
363
+ fromCallback(this.firebaseAuth.onAuthStateChanged, this.zone).pipe(operators.catchError(function () { return rxjs.of(null); })),
359
364
  this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
360
365
  ];
361
366
  return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
@@ -371,22 +376,22 @@
371
376
  return this.getFireUser().pipe(operators.map(function (user) { return user === null || user === void 0 ? void 0 : user.uid; }), operators.mergeMap(function (id) { return (id ? _this.userRepository.get({ id: id }) : rxjs.of(null)); }));
372
377
  };
373
378
  AuthService.prototype.getTokenId = function () {
374
- return this.angularFireAuth.idToken;
379
+ return rxjs.from(this.firebaseAuth.currentUser.getIdToken());
375
380
  };
376
381
  AuthService.prototype.getFireUser = function () {
377
- return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
382
+ return rxjs.of(this.firebaseAuth.currentUser).pipe(operators.catchError(function () { return rxjs.of(null); }));
378
383
  };
379
384
  return AuthService;
380
385
  }());
381
- AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
386
+ AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.FirebaseAuth }, { token: 'UserRepository' }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
382
387
  AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
383
388
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
384
389
  type: i0.Injectable
385
390
  }], ctorParameters: function () {
386
- return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
391
+ return [{ type: i1__namespace.FirebaseAuth }, { type: undefined, decorators: [{
387
392
  type: i0.Inject,
388
393
  args: ['UserRepository']
389
- }] }];
394
+ }] }, { type: i0__namespace.NgZone }];
390
395
  } });
391
396
 
392
397
  var DEFAULT_SHOP = 'DEFAULT_SHOP';
@@ -401,57 +406,26 @@
401
406
  return InvalidCouponError;
402
407
  }(Error));
403
408
 
404
- var GroupInvalidCouponError = /** @class */ (function (_super) {
405
- __extends(GroupInvalidCouponError, _super);
406
- function GroupInvalidCouponError(errors) {
407
- var _this = _super.call(this, 'Many coupon errors throw') || this;
408
- _this.errors = errors;
409
- return _this;
410
- }
411
- return GroupInvalidCouponError;
412
- }(Error));
413
-
414
409
  var CouponService = /** @class */ (function () {
415
410
  function CouponService(couponRepository, defaultShop) {
416
- var _this = this;
417
411
  this.couponRepository = couponRepository;
418
412
  this.defaultShop = defaultShop;
419
413
  this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
420
- this.separateValidCoupons = function (coupons, userEmail) { return coupons
421
- .map(function (coupon) {
422
- try {
423
- if (!i2.FinancialCoupon.isFinancialCoupon(coupon))
424
- throw new InvalidCouponError('Coupon is not valid');
425
- if (_this.isValidCoupon(coupon, userEmail))
426
- return coupon;
427
- }
428
- catch (error) {
429
- return error;
430
- }
431
- })
432
- .reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (i2.FinancialCoupon.isFinancialCoupon(coupon)
433
- ? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
434
- : { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
435
- valids: [],
436
- invalids: [],
437
- }); };
438
414
  }
439
- CouponService.prototype.checkCoupon = function (nickname, userEmail, checkoutType) {
415
+ CouponService.prototype.checkCoupon = function (nickname, userEmail) {
440
416
  var _this = this;
441
417
  return rxjs.from(this.couponRepository.find([
442
418
  {
443
419
  nickname: { operator: i2.Where.EQUALS, value: nickname },
444
420
  shopAvailability: { operator: i2.Where.EQUALS, value: this.defaultShop },
445
- checkoutType: { operator: i2.Where.EQUALS, value: checkoutType },
446
421
  },
447
- ])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i2.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data); }), operators.map(function (coupons) { return _this.separateValidCoupons(coupons, userEmail); }), operators.map(function (_a) {
448
- var valids = _a.valids, invalids = _a.invalids;
449
- if (!valids.length)
450
- throw new GroupInvalidCouponError(invalids);
451
- return valids;
452
- }));
422
+ ])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i2.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data[0]); }), operators.concatMap(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon) && _this.isValidCoupon(coupon, userEmail)
423
+ ? rxjs.of(coupon)
424
+ : rxjs.throwError(function () { return new InvalidCouponError('Coupon is not valid'); }); }));
453
425
  };
454
426
  CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
427
+ if (coupon.checkoutType !== i2.CheckoutTypes.ECOMMERCE)
428
+ throw new InvalidCouponError('Coupon is not ecommerce valid');
455
429
  if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i2.Exclusivities.COLLABORATORS)
456
430
  throw new InvalidCouponError('User is not a collaborator');
457
431
  if (coupon.exclusivityType === i2.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
@@ -511,7 +485,7 @@
511
485
  var _this = this;
512
486
  return this.getCheckout().pipe(operators.concatMap(function (checkout) {
513
487
  var _a;
514
- return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i2.CheckoutTypes.ECOMMERCE).pipe(operators.concatMap(function (coupons) { return rxjs.of(coupons.shift()); }), operators.concatMap(function (coupon) {
488
+ return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(operators.concatMap(function (coupon) {
515
489
  var _a, _b;
516
490
  return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
517
491
  ? rxjs.from(_this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(operators.concatMap(function (orders) {
@@ -616,7 +590,6 @@
616
590
  pricePaid: pricePaid,
617
591
  categories: categories,
618
592
  isGift: isGift,
619
- costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
620
593
  });
621
594
  };
622
595
  this.getProductPrice = function (_f) {
@@ -636,10 +609,7 @@
636
609
  CartService.prototype.addItem = function (item, quantity) {
637
610
  var _this = this;
638
611
  if (quantity === void 0) { quantity = 1; }
639
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({
640
- checkout: checkout,
641
- lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }),
642
- }); }), operators.concatMap(function (_f) {
612
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({ checkout: checkout, lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }) }); }), operators.concatMap(function (_f) {
643
613
  var checkout = _f.checkout, lineItem = _f.lineItem;
644
614
  return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
645
615
  }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
@@ -732,26 +702,8 @@
732
702
  } });
733
703
 
734
704
  var CheckoutSubscriptionService = /** @class */ (function () {
735
- function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
736
- var _this = this;
705
+ function CheckoutSubscriptionService(checkoutSubscriptionRepository) {
737
706
  this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
738
- this.subscriptionRepository = subscriptionRepository;
739
- this.couponService = couponService;
740
- this.checkCouponsWithCheckout = function (coupons, checkout) { return rxjs.forkJoin(coupons.map(function (coupon) {
741
- var _a;
742
- return rxjs.from(_this.subscriptionRepository.find([{ user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } }])).pipe(operators.map(function (subscriptions) { return ({ coupon: coupon, subscriptions: subscriptions }); }));
743
- })).pipe(operators.map(function (results) { return results.map(function (_b) {
744
- var coupon = _b.coupon, subscriptions = _b.subscriptions;
745
- if (subscriptions.data.length >= (coupon.useLimit || Infinity))
746
- return new InvalidCouponError('Coupon is already applied');
747
- return coupon;
748
- }); }), operators.map(function (validatedCoupons) { return ({
749
- valids: validatedCoupons.filter(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon); }),
750
- invalids: validatedCoupons.filter(function (coupon) { return coupon instanceof InvalidCouponError; }),
751
- }); }), operators.concatMap(function (_b) {
752
- var valids = _b.valids, invalids = _b.invalids;
753
- return valids.length ? rxjs.of(valids) : rxjs.throwError(new GroupInvalidCouponError(invalids));
754
- })); };
755
707
  }
756
708
  CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
757
709
  var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
@@ -762,11 +714,11 @@
762
714
  CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
763
715
  return __awaiter(this, void 0, void 0, function () {
764
716
  var checkout;
765
- return __generator(this, function (_b) {
766
- switch (_b.label) {
717
+ return __generator(this, function (_a) {
718
+ switch (_a.label) {
767
719
  case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
768
720
  case 1:
769
- checkout = _b.sent();
721
+ checkout = _a.sent();
770
722
  cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
771
723
  return [2 /*return*/, checkout];
772
724
  }
@@ -777,21 +729,9 @@
777
729
  cookie__default["default"].remove('checkoutSubscriptionId');
778
730
  return rxjs.of();
779
731
  };
780
- CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
781
- var _this = this;
782
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i2.CheckoutTypes.SUBSCRIPTION).pipe(operators.concatMap(function (coupons) {
783
- var couponsWithSamePlan = coupons.filter(function (coupon) { return checkout.subscriptionPlan.name === coupon.plan; });
784
- var couponsWithNoPlan = coupons.filter(function (coupon) { return !coupon.plan; });
785
- if (couponsWithSamePlan.length > 0)
786
- return rxjs.of(couponsWithSamePlan);
787
- if (couponsWithNoPlan.length > 0)
788
- return rxjs.of(couponsWithNoPlan);
789
- throw new Error("Coupon subscription plan is invalid.");
790
- }), operators.concatMap(function (coupons) { var _a; return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email) ? _this.checkCouponsWithCheckout(coupons, checkout) : rxjs.of(coupons); }), operators.map(function (validatedCoupons) { return validatedCoupons.shift(); })); }));
791
- };
792
732
  return CheckoutSubscriptionService;
793
733
  }());
794
- CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
734
+ CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
795
735
  CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
796
736
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
797
737
  type: i0.Injectable
@@ -799,157 +739,75 @@
799
739
  return [{ type: undefined, decorators: [{
800
740
  type: i0.Inject,
801
741
  args: ['CheckoutSubscriptionRepository']
802
- }] }, { type: undefined, decorators: [{
803
- type: i0.Inject,
804
- args: ['SubscriptionRepository']
805
- }] }, { type: CouponService }];
742
+ }] }];
806
743
  } });
807
744
 
808
745
  var OrderService = /** @class */ (function () {
809
- function OrderService(angularFirestore, orderRepository) {
810
- this.angularFirestore = angularFirestore;
746
+ function OrderService(firebaseFirestore, orderRepository) {
747
+ this.firebaseFirestore = firebaseFirestore;
811
748
  this.orderRepository = orderRepository;
812
749
  this.orderSubject = new rxjs.Subject();
813
750
  }
814
751
  OrderService.prototype.getOrder = function (id) {
815
752
  var _this = this;
816
- this.angularFirestore
817
- .doc(this.orderRepository.collectionName + "/" + id)
818
- .valueChanges()
819
- .pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
820
- .subscribe(function (doc) { return _this.orderSubject.next(doc); });
753
+ this.firebaseFirestore.doc(this.orderRepository.collectionName + "/" + id).onSnapshot(function (doc) {
754
+ var order = i2.Order.toInstance(Object.assign(Object.assign({}, doc.data()), { id: doc.id }));
755
+ _this.orderSubject.next(order);
756
+ });
821
757
  return this.orderSubject;
822
758
  };
823
759
  return OrderService;
824
760
  }());
825
- OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
761
+ OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.FirebaseFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
826
762
  OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
827
763
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
828
764
  type: i0.Injectable
829
765
  }], ctorParameters: function () {
830
- return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
766
+ return [{ type: i1__namespace$1.FirebaseFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
831
767
  type: i0.Inject,
832
768
  args: ['OrderRepository']
833
769
  }] }];
834
770
  } });
835
771
 
836
- var HomeShopService = /** @class */ (function () {
837
- function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
838
- this.categoryRepository = categoryRepository;
839
- this.homeRepository = homeRepository;
840
- this.productRepository = productRepository;
841
- this.defaultShop = defaultShop;
842
- this.buildCategoryGroupWithRequiredData = function (group) { return ({
843
- category: i2.Category.toInstance(i2.pick(group.category.toPlain(), ['id', 'name', 'slug'])),
844
- products: group.products.map(function (product) { return i2.Product.toInstance(i2.pick(product.toPlain(), [
845
- 'id',
846
- 'price',
847
- 'reviews',
848
- 'hasVariants',
849
- 'slug',
850
- 'sku',
851
- 'stock',
852
- 'costPrice',
853
- 'images',
854
- 'miniatures',
855
- ])); }),
856
- }); };
772
+ var FirebaseAppFactory = function (options, zone, nameOrConfig) {
773
+ var name = ((i2.isString(nameOrConfig) && nameOrConfig) || '[DEFAULT]').toString();
774
+ var config = ((i2.isObject(nameOrConfig) && nameOrConfig) || {});
775
+ config.name = config.name || name;
776
+ var existingApp = firebase__default["default"].apps.filter(function (firebaseApp) { return firebaseApp && firebaseApp.name === config.name; })[0];
777
+ var app = existingApp || zone.runOutsideAngular(function () { return firebase__default["default"].initializeApp(options, config); });
778
+ try {
779
+ if (JSON.stringify(options) !== JSON.stringify(app.options)) {
780
+ console.error('error', app.name + " Firebase App already initialized with different options : '.'\n }");
781
+ }
857
782
  }
858
- Object.defineProperty(HomeShopService.prototype, "homeId", {
859
- get: function () {
860
- if (this.defaultShop === i2.Shops.GLAMSHOP)
861
- return 'glamshop';
862
- if (this.defaultShop === i2.Shops.MENSMARKET)
863
- return 'mens_market';
864
- return null;
865
- },
866
- enumerable: false,
867
- configurable: true
868
- });
869
- HomeShopService.prototype.getHomeData = function () {
870
- var _this = this;
871
- return this.getHomeConfiguration().pipe(operators.map(function (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); }), operators.concatMap(function (home) { return home
872
- ? rxjs.of(home)
873
- : rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_b) {
874
- var _c = __read(_b, 3), discoverProducts = _c[0], featuredProducts = _c[1], verticalProducts = _c[2];
875
- return ({
876
- discoverProducts: discoverProducts,
877
- featuredProducts: featuredProducts,
878
- verticalProducts: verticalProducts,
879
- });
880
- }), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
881
- };
882
- HomeShopService.prototype.getBanners = function (type) {
883
- return this.getHomeConfiguration().pipe(operators.map(function (home) {
884
- if (type === 'brand')
885
- return home.brandsCarousel;
886
- if (type === 'buyToWin')
887
- return [home.buyToWinBanner];
888
- if (type === 'block')
889
- return home.blockBanners;
890
- if (type === 'blog')
891
- return [home.blogBanner];
892
- }));
893
- };
894
- HomeShopService.prototype.getDiscoverProducts = function () {
895
- var _this = this;
896
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
897
- };
898
- HomeShopService.prototype.getFeaturedProducts = function () {
899
- var _this = this;
900
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
901
- };
902
- HomeShopService.prototype.getVerticalProducts = function () {
903
- var _this = this;
904
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.map(function (id) { return rxjs.forkJoin([
905
- _this.categoryRepository.get({ id: id }),
906
- _this.productRepository.find([{ categories: { operator: i2.Where.LIKE, value: [id] } }], { limit: 12 }),
907
- ]).pipe(operators.map(function (_b) {
908
- var _c = __read(_b, 2), category = _c[0], products = _c[1];
909
- return ({ category: category, products: products.data });
910
- }), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
911
- };
912
- HomeShopService.prototype.getHomeConfiguration = function () {
913
- var _this = this;
914
- return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
915
- ? rxjs.of(home)
916
- : !_this.homeId
917
- ? rxjs.throwError(new i2.RequiredArgumentError(['homeId']))
918
- : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
919
- };
920
- HomeShopService.prototype.saveHomeData = function (homeData) {
921
- var _this = this;
922
- var data = {
923
- createdAt: new Date(),
924
- expiresAt: i2.add(new Date(), { hours: 1 }),
925
- data: homeData,
926
- };
927
- return rxjs.from(this.homeRepository.update({
928
- id: this.homeId,
929
- data: data,
930
- })).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
931
- };
932
- return HomeShopService;
783
+ catch (e) { }
784
+ return app;
785
+ };
786
+
787
+ var FIREBASE_OPTIONS = new i0.InjectionToken('connect-angular.app.options');
788
+ var FIREBASE_APP_NAME = new i0.InjectionToken('connect-angular.app.nameOrConfig');
789
+ var ConnectAngularFirebaseApp = /** @class */ (function () {
790
+ function ConnectAngularFirebaseApp() {
791
+ }
792
+ return ConnectAngularFirebaseApp;
933
793
  }());
934
- HomeShopService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
935
- HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
936
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
937
- type: i0.Injectable
938
- }], ctorParameters: function () {
939
- return [{ type: undefined, decorators: [{
940
- type: i0.Inject,
941
- args: ['CategoryRepository']
942
- }] }, { type: undefined, decorators: [{
943
- type: i0.Inject,
944
- args: ['HomeRepository']
945
- }] }, { type: undefined, decorators: [{
946
- type: i0.Inject,
947
- args: ['ProductRepository']
948
- }] }, { type: i2__namespace.Shops, decorators: [{
949
- type: i0.Inject,
950
- args: [DEFAULT_SHOP]
951
- }] }];
952
- } });
794
+ var FirebaseAppProvider = {
795
+ provide: ConnectAngularFirebaseApp,
796
+ useFactory: FirebaseAppFactory,
797
+ deps: [FIREBASE_OPTIONS, i0.NgZone, [new i0.Optional(), FIREBASE_APP_NAME]],
798
+ };
799
+
800
+ var FirebaseFirestoreFactory = function () { return firebase__default$1["default"].firestore(); };
801
+
802
+ var ConnectAngularFirebaseFirestore = /** @class */ (function () {
803
+ function ConnectAngularFirebaseFirestore() {
804
+ }
805
+ return ConnectAngularFirebaseFirestore;
806
+ }());
807
+ var FirebaseFirestoreProvider = {
808
+ provide: ConnectAngularFirebaseFirestore,
809
+ useFactory: FirebaseFirestoreFactory,
810
+ };
953
811
 
954
812
  var AngularFirebaseAuthModule = /** @class */ (function () {
955
813
  function AngularFirebaseAuthModule() {
@@ -958,16 +816,17 @@
958
816
  return {
959
817
  ngModule: AngularFirebaseAuthModule,
960
818
  providers: [
961
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
962
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
819
+ { provide: FIREBASE_OPTIONS, useValue: options },
820
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
963
821
  ],
964
822
  };
965
823
  };
966
824
  return AngularFirebaseAuthModule;
967
825
  }());
968
826
  AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
969
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
827
+ AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule });
970
828
  AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
829
+ FirebaseAppProvider,
971
830
  {
972
831
  provide: 'Authentication',
973
832
  useFactory: function (authenticationService, userRepository) {
@@ -977,10 +836,10 @@
977
836
  },
978
837
  {
979
838
  provide: 'AuthenticationService',
980
- useFactory: function (angularFireAuth) {
981
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
839
+ useFactory: function (app) {
840
+ return new i2.AuthenticationFirebaseAuthService(app.auth());
982
841
  },
983
- deps: [i1.AngularFireAuth],
842
+ deps: [FirebaseAppProvider],
984
843
  },
985
844
  {
986
845
  provide: 'Register',
@@ -991,10 +850,10 @@
991
850
  },
992
851
  {
993
852
  provide: 'RegisterService',
994
- useFactory: function (angularFireAuth) {
995
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
853
+ useFactory: function (app) {
854
+ return new i2.RegisterFirebaseAuthService(app.auth());
996
855
  },
997
- deps: [i1.AngularFireAuth],
856
+ deps: [FirebaseAppProvider],
998
857
  },
999
858
  {
1000
859
  provide: 'SignOut',
@@ -1003,19 +862,12 @@
1003
862
  },
1004
863
  deps: ['AuthenticationService'],
1005
864
  },
1006
- {
1007
- provide: 'RecoveryPassword',
1008
- useFactory: function (authenticationService) {
1009
- return new i2.RecoveryPassword(authenticationService);
1010
- },
1011
- deps: ['AuthenticationService'],
1012
- },
1013
- ], imports: [[fire.AngularFireModule]] });
865
+ ] });
1014
866
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
1015
867
  type: i0.NgModule,
1016
868
  args: [{
1017
- imports: [fire.AngularFireModule],
1018
869
  providers: [
870
+ FirebaseAppProvider,
1019
871
  {
1020
872
  provide: 'Authentication',
1021
873
  useFactory: function (authenticationService, userRepository) {
@@ -1025,10 +877,10 @@
1025
877
  },
1026
878
  {
1027
879
  provide: 'AuthenticationService',
1028
- useFactory: function (angularFireAuth) {
1029
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
880
+ useFactory: function (app) {
881
+ return new i2.AuthenticationFirebaseAuthService(app.auth());
1030
882
  },
1031
- deps: [i1.AngularFireAuth],
883
+ deps: [FirebaseAppProvider],
1032
884
  },
1033
885
  {
1034
886
  provide: 'Register',
@@ -1039,10 +891,10 @@
1039
891
  },
1040
892
  {
1041
893
  provide: 'RegisterService',
1042
- useFactory: function (angularFireAuth) {
1043
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
894
+ useFactory: function (app) {
895
+ return new i2.RegisterFirebaseAuthService(app.auth());
1044
896
  },
1045
- deps: [i1.AngularFireAuth],
897
+ deps: [FirebaseAppProvider],
1046
898
  },
1047
899
  {
1048
900
  provide: 'SignOut',
@@ -1051,13 +903,6 @@
1051
903
  },
1052
904
  deps: ['AuthenticationService'],
1053
905
  },
1054
- {
1055
- provide: 'RecoveryPassword',
1056
- useFactory: function (authenticationService) {
1057
- return new i2.RecoveryPassword(authenticationService);
1058
- },
1059
- deps: ['AuthenticationService'],
1060
- },
1061
906
  ],
1062
907
  }]
1063
908
  }] });
@@ -1069,329 +914,330 @@
1069
914
  return {
1070
915
  ngModule: AngularFirestoreModule,
1071
916
  providers: [
1072
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
1073
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
917
+ { provide: FIREBASE_OPTIONS, useValue: options },
918
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
1074
919
  ],
1075
920
  };
1076
921
  };
1077
922
  return AngularFirestoreModule;
1078
923
  }());
1079
924
  AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1080
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
925
+ AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule });
1081
926
  AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
927
+ FirebaseAppProvider,
1082
928
  {
1083
929
  provide: 'BeautyProfileRepository',
1084
- useFactory: function (firestore, userRepository) {
1085
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
930
+ useFactory: function (app, userRepository) {
931
+ return new i2.UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
1086
932
  },
1087
- deps: [i1$1.AngularFirestore, 'UserRepository'],
933
+ deps: [FirebaseAppProvider, 'UserRepository'],
1088
934
  },
1089
935
  {
1090
936
  provide: 'Buy2WinRepository',
1091
- useFactory: function (firestore) {
1092
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
937
+ useFactory: function (app) {
938
+ return new i2.Buy2WinFirestoreRepository(app.firestore());
1093
939
  },
1094
- deps: [i1$1.AngularFirestore],
940
+ deps: [FirebaseAppProvider],
1095
941
  },
1096
942
  {
1097
943
  provide: 'CategoryRepository',
1098
- useFactory: function (firestore) {
1099
- return new i2.CategoryFirestoreRepository(firestore.firestore);
944
+ useFactory: function (app) {
945
+ return new i2.CategoryFirestoreRepository(app.firestore());
1100
946
  },
1101
- deps: [i1$1.AngularFirestore],
947
+ deps: [FirebaseAppProvider],
1102
948
  },
1103
949
  {
1104
950
  provide: 'CheckoutRepository',
1105
- useFactory: function (firestore) {
1106
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
951
+ useFactory: function (app) {
952
+ return new i2.CheckoutFirestoreRepository(app.firestore());
1107
953
  },
1108
- deps: [i1$1.AngularFirestore],
954
+ deps: [FirebaseAppProvider],
1109
955
  },
1110
956
  {
1111
957
  provide: 'CheckoutSubscriptionRepository',
1112
- useFactory: function (firestore) {
1113
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
958
+ useFactory: function (app) {
959
+ return new i2.CheckoutSubscriptionFirestoreRepository(app.firestore());
1114
960
  },
1115
- deps: [i1$1.AngularFirestore],
961
+ deps: [FirebaseAppProvider],
1116
962
  },
1117
963
  {
1118
964
  provide: 'CouponRepository',
1119
- useFactory: function (firestore) {
1120
- return new i2.CouponFirestoreRepository(firestore.firestore);
965
+ useFactory: function (app) {
966
+ return new i2.CouponFirestoreRepository(app.firestore());
1121
967
  },
1122
- deps: [i1$1.AngularFirestore],
968
+ deps: [FirebaseAppProvider],
1123
969
  },
1124
970
  {
1125
971
  provide: 'EditionRepository',
1126
- useFactory: function (firestore, subscriptionRepository) {
1127
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
972
+ useFactory: function (app, subscriptionRepository) {
973
+ return new i2.SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
1128
974
  },
1129
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
975
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1130
976
  },
1131
977
  {
1132
978
  provide: 'HomeRepository',
1133
- useFactory: function (firestore) {
1134
- return new i2.HomeFirestoreRepository(firestore.firestore);
979
+ useFactory: function (app) {
980
+ return new i2.HomeFirestoreRepository(app.firestore());
1135
981
  },
1136
- deps: [i1$1.AngularFirestore],
982
+ deps: [FirebaseAppProvider],
1137
983
  },
1138
984
  {
1139
985
  provide: 'LeadRepository',
1140
- useFactory: function (firestore) {
1141
- return new i2.LeadFirestoreRepository(firestore.firestore);
986
+ useFactory: function (app) {
987
+ return new i2.LeadFirestoreRepository(app.firestore());
1142
988
  },
1143
- deps: [i1$1.AngularFirestore],
989
+ deps: [FirebaseAppProvider],
1144
990
  },
1145
991
  {
1146
992
  provide: 'LegacyOrderRepository',
1147
- useFactory: function (firestore) {
1148
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
993
+ useFactory: function (app) {
994
+ return new i2.LegacyOrderFirestoreRepository(app.firestore());
1149
995
  },
1150
- deps: [i1$1.AngularFirestore],
996
+ deps: [FirebaseAppProvider],
1151
997
  },
1152
998
  {
1153
999
  provide: 'ShopMenuRepository',
1154
- useFactory: function (firestore) {
1155
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1000
+ useFactory: function (app) {
1001
+ return new i2.ShopMenuFirestoreRepository(app.firestore());
1156
1002
  },
1157
- deps: [i1$1.AngularFirestore],
1003
+ deps: [FirebaseAppProvider],
1158
1004
  },
1159
1005
  {
1160
1006
  provide: 'OrderRepository',
1161
- useFactory: function (firestore) {
1162
- return new i2.OrderFirestoreRepository(firestore.firestore);
1007
+ useFactory: function (app) {
1008
+ return new i2.OrderFirestoreRepository(app.firestore());
1163
1009
  },
1164
- deps: [i1$1.AngularFirestore],
1010
+ deps: [FirebaseAppProvider],
1165
1011
  },
1166
1012
  {
1167
1013
  provide: 'PaymentRepository',
1168
- useFactory: function (firestore) {
1169
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1014
+ useFactory: function (app) {
1015
+ return new i2.PaymentFirestoreRepository(app.firestore());
1170
1016
  },
1171
- deps: [i1$1.AngularFirestore],
1017
+ deps: [FirebaseAppProvider],
1172
1018
  },
1173
1019
  {
1174
1020
  provide: 'ProductRepository',
1175
- useFactory: function (firestore) {
1176
- return new i2.ProductFirestoreRepository(firestore.firestore);
1021
+ useFactory: function (app) {
1022
+ return new i2.ProductFirestoreRepository(app.firestore());
1177
1023
  },
1178
- deps: [i1$1.AngularFirestore],
1024
+ deps: [FirebaseAppProvider],
1179
1025
  },
1180
1026
  {
1181
1027
  provide: 'SubscriptionPaymentRepository',
1182
- useFactory: function (firestore, subscriptionRepository) {
1183
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1028
+ useFactory: function (app, subscriptionRepository) {
1029
+ return new i2.SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
1184
1030
  },
1185
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1031
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1186
1032
  },
1187
1033
  {
1188
1034
  provide: 'SubscriptionPlanRepository',
1189
- useFactory: function (firestore) {
1190
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1035
+ useFactory: function (app) {
1036
+ return new i2.SubscriptionPlanFirestoreRepository(app.firestore());
1191
1037
  },
1192
- deps: [i1$1.AngularFirestore],
1038
+ deps: [FirebaseAppProvider],
1193
1039
  },
1194
1040
  {
1195
1041
  provide: 'SubscriptionProductRepository',
1196
- useFactory: function (firestore) {
1197
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1042
+ useFactory: function (app) {
1043
+ return new i2.SubscriptionProductFirestoreRepository(app.firestore());
1198
1044
  },
1199
- deps: [i1$1.AngularFirestore],
1045
+ deps: [FirebaseAppProvider],
1200
1046
  },
1201
1047
  {
1202
1048
  provide: 'SubscriptionRepository',
1203
- useFactory: function (firestore) {
1204
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1049
+ useFactory: function (app) {
1050
+ return new i2.SubscriptionFirestoreRepository(app.firestore());
1205
1051
  },
1206
- deps: [i1$1.AngularFirestore],
1052
+ deps: [FirebaseAppProvider],
1207
1053
  },
1208
1054
  {
1209
1055
  provide: 'UserRepository',
1210
- useFactory: function (firestore) {
1211
- return new i2.UserFirestoreRepository(firestore.firestore);
1056
+ useFactory: function (app) {
1057
+ return new i2.UserFirestoreRepository(app.firestore());
1212
1058
  },
1213
- deps: [i1$1.AngularFirestore],
1059
+ deps: [FirebaseAppProvider],
1214
1060
  },
1215
1061
  {
1216
1062
  provide: 'UserAddressRepository',
1217
- useFactory: function (firestore, userRepository) {
1218
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1063
+ useFactory: function (app, userRepository) {
1064
+ return new i2.UserAddressFirestoreRepository(app.firestore(), userRepository);
1219
1065
  },
1220
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1066
+ deps: [FirebaseAppProvider, 'UserRepository'],
1221
1067
  },
1222
1068
  {
1223
1069
  provide: 'UserPaymentMethodRepository',
1224
- useFactory: function (firestore, userRepository) {
1225
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1070
+ useFactory: function (app, userRepository) {
1071
+ return new i2.UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
1226
1072
  },
1227
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1073
+ deps: [FirebaseAppProvider, 'UserRepository'],
1228
1074
  },
1229
1075
  {
1230
1076
  provide: 'VariantRepository',
1231
- useFactory: function (firestore, productRepository) {
1232
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1077
+ useFactory: function (app, productRepository) {
1078
+ return new i2.ProductVariantFirestoreRepository(app.firestore(), productRepository);
1233
1079
  },
1234
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1080
+ deps: [FirebaseAppProvider, 'ProductRepository'],
1235
1081
  },
1236
- ], imports: [[fire.AngularFireModule]] });
1082
+ ] });
1237
1083
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1238
1084
  type: i0.NgModule,
1239
1085
  args: [{
1240
- imports: [fire.AngularFireModule],
1241
1086
  providers: [
1087
+ FirebaseAppProvider,
1242
1088
  {
1243
1089
  provide: 'BeautyProfileRepository',
1244
- useFactory: function (firestore, userRepository) {
1245
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1090
+ useFactory: function (app, userRepository) {
1091
+ return new i2.UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
1246
1092
  },
1247
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1093
+ deps: [FirebaseAppProvider, 'UserRepository'],
1248
1094
  },
1249
1095
  {
1250
1096
  provide: 'Buy2WinRepository',
1251
- useFactory: function (firestore) {
1252
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1097
+ useFactory: function (app) {
1098
+ return new i2.Buy2WinFirestoreRepository(app.firestore());
1253
1099
  },
1254
- deps: [i1$1.AngularFirestore],
1100
+ deps: [FirebaseAppProvider],
1255
1101
  },
1256
1102
  {
1257
1103
  provide: 'CategoryRepository',
1258
- useFactory: function (firestore) {
1259
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1104
+ useFactory: function (app) {
1105
+ return new i2.CategoryFirestoreRepository(app.firestore());
1260
1106
  },
1261
- deps: [i1$1.AngularFirestore],
1107
+ deps: [FirebaseAppProvider],
1262
1108
  },
1263
1109
  {
1264
1110
  provide: 'CheckoutRepository',
1265
- useFactory: function (firestore) {
1266
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1111
+ useFactory: function (app) {
1112
+ return new i2.CheckoutFirestoreRepository(app.firestore());
1267
1113
  },
1268
- deps: [i1$1.AngularFirestore],
1114
+ deps: [FirebaseAppProvider],
1269
1115
  },
1270
1116
  {
1271
1117
  provide: 'CheckoutSubscriptionRepository',
1272
- useFactory: function (firestore) {
1273
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1118
+ useFactory: function (app) {
1119
+ return new i2.CheckoutSubscriptionFirestoreRepository(app.firestore());
1274
1120
  },
1275
- deps: [i1$1.AngularFirestore],
1121
+ deps: [FirebaseAppProvider],
1276
1122
  },
1277
1123
  {
1278
1124
  provide: 'CouponRepository',
1279
- useFactory: function (firestore) {
1280
- return new i2.CouponFirestoreRepository(firestore.firestore);
1125
+ useFactory: function (app) {
1126
+ return new i2.CouponFirestoreRepository(app.firestore());
1281
1127
  },
1282
- deps: [i1$1.AngularFirestore],
1128
+ deps: [FirebaseAppProvider],
1283
1129
  },
1284
1130
  {
1285
1131
  provide: 'EditionRepository',
1286
- useFactory: function (firestore, subscriptionRepository) {
1287
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1132
+ useFactory: function (app, subscriptionRepository) {
1133
+ return new i2.SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
1288
1134
  },
1289
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1135
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1290
1136
  },
1291
1137
  {
1292
1138
  provide: 'HomeRepository',
1293
- useFactory: function (firestore) {
1294
- return new i2.HomeFirestoreRepository(firestore.firestore);
1139
+ useFactory: function (app) {
1140
+ return new i2.HomeFirestoreRepository(app.firestore());
1295
1141
  },
1296
- deps: [i1$1.AngularFirestore],
1142
+ deps: [FirebaseAppProvider],
1297
1143
  },
1298
1144
  {
1299
1145
  provide: 'LeadRepository',
1300
- useFactory: function (firestore) {
1301
- return new i2.LeadFirestoreRepository(firestore.firestore);
1146
+ useFactory: function (app) {
1147
+ return new i2.LeadFirestoreRepository(app.firestore());
1302
1148
  },
1303
- deps: [i1$1.AngularFirestore],
1149
+ deps: [FirebaseAppProvider],
1304
1150
  },
1305
1151
  {
1306
1152
  provide: 'LegacyOrderRepository',
1307
- useFactory: function (firestore) {
1308
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1153
+ useFactory: function (app) {
1154
+ return new i2.LegacyOrderFirestoreRepository(app.firestore());
1309
1155
  },
1310
- deps: [i1$1.AngularFirestore],
1156
+ deps: [FirebaseAppProvider],
1311
1157
  },
1312
1158
  {
1313
1159
  provide: 'ShopMenuRepository',
1314
- useFactory: function (firestore) {
1315
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1160
+ useFactory: function (app) {
1161
+ return new i2.ShopMenuFirestoreRepository(app.firestore());
1316
1162
  },
1317
- deps: [i1$1.AngularFirestore],
1163
+ deps: [FirebaseAppProvider],
1318
1164
  },
1319
1165
  {
1320
1166
  provide: 'OrderRepository',
1321
- useFactory: function (firestore) {
1322
- return new i2.OrderFirestoreRepository(firestore.firestore);
1167
+ useFactory: function (app) {
1168
+ return new i2.OrderFirestoreRepository(app.firestore());
1323
1169
  },
1324
- deps: [i1$1.AngularFirestore],
1170
+ deps: [FirebaseAppProvider],
1325
1171
  },
1326
1172
  {
1327
1173
  provide: 'PaymentRepository',
1328
- useFactory: function (firestore) {
1329
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1174
+ useFactory: function (app) {
1175
+ return new i2.PaymentFirestoreRepository(app.firestore());
1330
1176
  },
1331
- deps: [i1$1.AngularFirestore],
1177
+ deps: [FirebaseAppProvider],
1332
1178
  },
1333
1179
  {
1334
1180
  provide: 'ProductRepository',
1335
- useFactory: function (firestore) {
1336
- return new i2.ProductFirestoreRepository(firestore.firestore);
1181
+ useFactory: function (app) {
1182
+ return new i2.ProductFirestoreRepository(app.firestore());
1337
1183
  },
1338
- deps: [i1$1.AngularFirestore],
1184
+ deps: [FirebaseAppProvider],
1339
1185
  },
1340
1186
  {
1341
1187
  provide: 'SubscriptionPaymentRepository',
1342
- useFactory: function (firestore, subscriptionRepository) {
1343
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1188
+ useFactory: function (app, subscriptionRepository) {
1189
+ return new i2.SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
1344
1190
  },
1345
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1191
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1346
1192
  },
1347
1193
  {
1348
1194
  provide: 'SubscriptionPlanRepository',
1349
- useFactory: function (firestore) {
1350
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1195
+ useFactory: function (app) {
1196
+ return new i2.SubscriptionPlanFirestoreRepository(app.firestore());
1351
1197
  },
1352
- deps: [i1$1.AngularFirestore],
1198
+ deps: [FirebaseAppProvider],
1353
1199
  },
1354
1200
  {
1355
1201
  provide: 'SubscriptionProductRepository',
1356
- useFactory: function (firestore) {
1357
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1202
+ useFactory: function (app) {
1203
+ return new i2.SubscriptionProductFirestoreRepository(app.firestore());
1358
1204
  },
1359
- deps: [i1$1.AngularFirestore],
1205
+ deps: [FirebaseAppProvider],
1360
1206
  },
1361
1207
  {
1362
1208
  provide: 'SubscriptionRepository',
1363
- useFactory: function (firestore) {
1364
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1209
+ useFactory: function (app) {
1210
+ return new i2.SubscriptionFirestoreRepository(app.firestore());
1365
1211
  },
1366
- deps: [i1$1.AngularFirestore],
1212
+ deps: [FirebaseAppProvider],
1367
1213
  },
1368
1214
  {
1369
1215
  provide: 'UserRepository',
1370
- useFactory: function (firestore) {
1371
- return new i2.UserFirestoreRepository(firestore.firestore);
1216
+ useFactory: function (app) {
1217
+ return new i2.UserFirestoreRepository(app.firestore());
1372
1218
  },
1373
- deps: [i1$1.AngularFirestore],
1219
+ deps: [FirebaseAppProvider],
1374
1220
  },
1375
1221
  {
1376
1222
  provide: 'UserAddressRepository',
1377
- useFactory: function (firestore, userRepository) {
1378
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1223
+ useFactory: function (app, userRepository) {
1224
+ return new i2.UserAddressFirestoreRepository(app.firestore(), userRepository);
1379
1225
  },
1380
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1226
+ deps: [FirebaseAppProvider, 'UserRepository'],
1381
1227
  },
1382
1228
  {
1383
1229
  provide: 'UserPaymentMethodRepository',
1384
- useFactory: function (firestore, userRepository) {
1385
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1230
+ useFactory: function (app, userRepository) {
1231
+ return new i2.UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
1386
1232
  },
1387
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1233
+ deps: [FirebaseAppProvider, 'UserRepository'],
1388
1234
  },
1389
1235
  {
1390
1236
  provide: 'VariantRepository',
1391
- useFactory: function (firestore, productRepository) {
1392
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1237
+ useFactory: function (app, productRepository) {
1238
+ return new i2.ProductVariantFirestoreRepository(app.firestore(), productRepository);
1393
1239
  },
1394
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1240
+ deps: [FirebaseAppProvider, 'ProductRepository'],
1395
1241
  },
1396
1242
  ],
1397
1243
  }]
@@ -1403,34 +1249,34 @@
1403
1249
  AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1404
1250
  return {
1405
1251
  ngModule: AngularConnectModule,
1406
- providers: __spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
1252
+ providers: __spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options }]))), __read((i2.isNil(options) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
1407
1253
  };
1408
1254
  };
1409
1255
  return AngularConnectModule;
1410
1256
  }());
1411
1257
  AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1412
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1258
+ AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [AngularFirestoreModule] });
1413
1259
  AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1414
1260
  AuthService,
1415
1261
  CartService,
1416
1262
  CheckoutService,
1417
1263
  CheckoutSubscriptionService,
1418
1264
  CouponService,
1419
- HomeShopService,
1420
1265
  OrderService,
1421
- ], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
1266
+ FirebaseAppProvider,
1267
+ ], imports: [[AngularFirestoreModule]] });
1422
1268
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1423
1269
  type: i0.NgModule,
1424
1270
  args: [{
1425
- imports: [fire.AngularFireModule, AngularFirestoreModule],
1271
+ imports: [AngularFirestoreModule],
1426
1272
  providers: [
1427
1273
  AuthService,
1428
1274
  CartService,
1429
1275
  CheckoutService,
1430
1276
  CheckoutSubscriptionService,
1431
1277
  CouponService,
1432
- HomeShopService,
1433
1278
  OrderService,
1279
+ FirebaseAppProvider,
1434
1280
  ],
1435
1281
  }]
1436
1282
  }] });
@@ -1447,7 +1293,6 @@
1447
1293
  exports.CheckoutService = CheckoutService;
1448
1294
  exports.CheckoutSubscriptionService = CheckoutSubscriptionService;
1449
1295
  exports.CouponService = CouponService;
1450
- exports.HomeShopService = HomeShopService;
1451
1296
  exports.OrderService = OrderService;
1452
1297
 
1453
1298
  Object.defineProperty(exports, '__esModule', { value: true });