@infrab4a/connect-angular 0.12.6 → 0.13.0-beta.0

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 (35) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +256 -276
  2. package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
  3. package/esm2015/lib/angular-connect.module.js +22 -6
  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/order.service.js +11 -13
  18. package/fesm2015/infrab4a-connect-angular.js +244 -261
  19. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  20. package/lib/angular-connect.module.d.ts +4 -5
  21. package/lib/angular-firebase-auth.module.d.ts +3 -4
  22. package/lib/angular-firestore.module.d.ts +3 -4
  23. package/lib/factories/firebase-app.factory.d.ts +4 -0
  24. package/lib/factories/firebase-firestore.factory.d.ts +2 -0
  25. package/lib/providers/firebase-app.provider.d.ts +17 -0
  26. package/lib/providers/firebase-firestore.provider.d.ts +7 -0
  27. package/lib/providers/index.d.ts +2 -0
  28. package/lib/services/auth.service.d.ts +5 -3
  29. package/lib/services/checkout-subscription.service.d.ts +2 -7
  30. package/lib/services/coupon.service.d.ts +2 -3
  31. package/lib/services/errors/index.d.ts +0 -1
  32. package/lib/services/order.service.d.ts +3 -3
  33. package/package.json +3 -4
  34. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +0 -7
  35. package/lib/services/errors/group-invalid-coupon.error.d.ts +0 -5
@@ -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,40 +739,76 @@
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
 
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
+ }
782
+ }
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;
793
+ }());
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
+ };
811
+
836
812
  var AngularFirebaseAuthModule = /** @class */ (function () {
837
813
  function AngularFirebaseAuthModule() {
838
814
  }
@@ -840,16 +816,17 @@
840
816
  return {
841
817
  ngModule: AngularFirebaseAuthModule,
842
818
  providers: [
843
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
844
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
819
+ { provide: FIREBASE_OPTIONS, useValue: options },
820
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
845
821
  ],
846
822
  };
847
823
  };
848
824
  return AngularFirebaseAuthModule;
849
825
  }());
850
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 });
851
- 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 });
852
828
  AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
829
+ FirebaseAppProvider,
853
830
  {
854
831
  provide: 'Authentication',
855
832
  useFactory: function (authenticationService, userRepository) {
@@ -859,10 +836,10 @@
859
836
  },
860
837
  {
861
838
  provide: 'AuthenticationService',
862
- useFactory: function (angularFireAuth) {
863
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
839
+ useFactory: function (app) {
840
+ return new i2.AuthenticationFirebaseAuthService(app.auth());
864
841
  },
865
- deps: [i1.AngularFireAuth],
842
+ deps: [FirebaseAppProvider],
866
843
  },
867
844
  {
868
845
  provide: 'Register',
@@ -873,10 +850,10 @@
873
850
  },
874
851
  {
875
852
  provide: 'RegisterService',
876
- useFactory: function (angularFireAuth) {
877
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
853
+ useFactory: function (app) {
854
+ return new i2.RegisterFirebaseAuthService(app.auth());
878
855
  },
879
- deps: [i1.AngularFireAuth],
856
+ deps: [FirebaseAppProvider],
880
857
  },
881
858
  {
882
859
  provide: 'SignOut',
@@ -885,19 +862,12 @@
885
862
  },
886
863
  deps: ['AuthenticationService'],
887
864
  },
888
- {
889
- provide: 'RecoveryPassword',
890
- useFactory: function (authenticationService) {
891
- return new i2.RecoveryPassword(authenticationService);
892
- },
893
- deps: ['AuthenticationService'],
894
- },
895
- ], imports: [[fire.AngularFireModule]] });
865
+ ] });
896
866
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
897
867
  type: i0.NgModule,
898
868
  args: [{
899
- imports: [fire.AngularFireModule],
900
869
  providers: [
870
+ FirebaseAppProvider,
901
871
  {
902
872
  provide: 'Authentication',
903
873
  useFactory: function (authenticationService, userRepository) {
@@ -907,10 +877,10 @@
907
877
  },
908
878
  {
909
879
  provide: 'AuthenticationService',
910
- useFactory: function (angularFireAuth) {
911
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
880
+ useFactory: function (app) {
881
+ return new i2.AuthenticationFirebaseAuthService(app.auth());
912
882
  },
913
- deps: [i1.AngularFireAuth],
883
+ deps: [FirebaseAppProvider],
914
884
  },
915
885
  {
916
886
  provide: 'Register',
@@ -921,10 +891,10 @@
921
891
  },
922
892
  {
923
893
  provide: 'RegisterService',
924
- useFactory: function (angularFireAuth) {
925
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
894
+ useFactory: function (app) {
895
+ return new i2.RegisterFirebaseAuthService(app.auth());
926
896
  },
927
- deps: [i1.AngularFireAuth],
897
+ deps: [FirebaseAppProvider],
928
898
  },
929
899
  {
930
900
  provide: 'SignOut',
@@ -933,13 +903,6 @@
933
903
  },
934
904
  deps: ['AuthenticationService'],
935
905
  },
936
- {
937
- provide: 'RecoveryPassword',
938
- useFactory: function (authenticationService) {
939
- return new i2.RecoveryPassword(authenticationService);
940
- },
941
- deps: ['AuthenticationService'],
942
- },
943
906
  ],
944
907
  }]
945
908
  }] });
@@ -951,329 +914,330 @@
951
914
  return {
952
915
  ngModule: AngularFirestoreModule,
953
916
  providers: [
954
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
955
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
917
+ { provide: FIREBASE_OPTIONS, useValue: options },
918
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
956
919
  ],
957
920
  };
958
921
  };
959
922
  return AngularFirestoreModule;
960
923
  }());
961
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 });
962
- 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 });
963
926
  AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
927
+ FirebaseAppProvider,
964
928
  {
965
929
  provide: 'BeautyProfileRepository',
966
- useFactory: function (firestore, userRepository) {
967
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
930
+ useFactory: function (app, userRepository) {
931
+ return new i2.UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
968
932
  },
969
- deps: [i1$1.AngularFirestore, 'UserRepository'],
933
+ deps: [FirebaseAppProvider, 'UserRepository'],
970
934
  },
971
935
  {
972
936
  provide: 'Buy2WinRepository',
973
- useFactory: function (firestore) {
974
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
937
+ useFactory: function (app) {
938
+ return new i2.Buy2WinFirestoreRepository(app.firestore());
975
939
  },
976
- deps: [i1$1.AngularFirestore],
940
+ deps: [FirebaseAppProvider],
977
941
  },
978
942
  {
979
943
  provide: 'CategoryRepository',
980
- useFactory: function (firestore) {
981
- return new i2.CategoryFirestoreRepository(firestore.firestore);
944
+ useFactory: function (app) {
945
+ return new i2.CategoryFirestoreRepository(app.firestore());
982
946
  },
983
- deps: [i1$1.AngularFirestore],
947
+ deps: [FirebaseAppProvider],
984
948
  },
985
949
  {
986
950
  provide: 'CheckoutRepository',
987
- useFactory: function (firestore) {
988
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
951
+ useFactory: function (app) {
952
+ return new i2.CheckoutFirestoreRepository(app.firestore());
989
953
  },
990
- deps: [i1$1.AngularFirestore],
954
+ deps: [FirebaseAppProvider],
991
955
  },
992
956
  {
993
957
  provide: 'CheckoutSubscriptionRepository',
994
- useFactory: function (firestore) {
995
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
958
+ useFactory: function (app) {
959
+ return new i2.CheckoutSubscriptionFirestoreRepository(app.firestore());
996
960
  },
997
- deps: [i1$1.AngularFirestore],
961
+ deps: [FirebaseAppProvider],
998
962
  },
999
963
  {
1000
964
  provide: 'CouponRepository',
1001
- useFactory: function (firestore) {
1002
- return new i2.CouponFirestoreRepository(firestore.firestore);
965
+ useFactory: function (app) {
966
+ return new i2.CouponFirestoreRepository(app.firestore());
1003
967
  },
1004
- deps: [i1$1.AngularFirestore],
968
+ deps: [FirebaseAppProvider],
1005
969
  },
1006
970
  {
1007
971
  provide: 'EditionRepository',
1008
- useFactory: function (firestore, subscriptionRepository) {
1009
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
972
+ useFactory: function (app, subscriptionRepository) {
973
+ return new i2.SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
1010
974
  },
1011
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
975
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1012
976
  },
1013
977
  {
1014
978
  provide: 'HomeRepository',
1015
- useFactory: function (firestore) {
1016
- return new i2.HomeFirestoreRepository(firestore.firestore);
979
+ useFactory: function (app) {
980
+ return new i2.HomeFirestoreRepository(app.firestore());
1017
981
  },
1018
- deps: [i1$1.AngularFirestore],
982
+ deps: [FirebaseAppProvider],
1019
983
  },
1020
984
  {
1021
985
  provide: 'LeadRepository',
1022
- useFactory: function (firestore) {
1023
- return new i2.LeadFirestoreRepository(firestore.firestore);
986
+ useFactory: function (app) {
987
+ return new i2.LeadFirestoreRepository(app.firestore());
1024
988
  },
1025
- deps: [i1$1.AngularFirestore],
989
+ deps: [FirebaseAppProvider],
1026
990
  },
1027
991
  {
1028
992
  provide: 'LegacyOrderRepository',
1029
- useFactory: function (firestore) {
1030
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
993
+ useFactory: function (app) {
994
+ return new i2.LegacyOrderFirestoreRepository(app.firestore());
1031
995
  },
1032
- deps: [i1$1.AngularFirestore],
996
+ deps: [FirebaseAppProvider],
1033
997
  },
1034
998
  {
1035
999
  provide: 'ShopMenuRepository',
1036
- useFactory: function (firestore) {
1037
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1000
+ useFactory: function (app) {
1001
+ return new i2.ShopMenuFirestoreRepository(app.firestore());
1038
1002
  },
1039
- deps: [i1$1.AngularFirestore],
1003
+ deps: [FirebaseAppProvider],
1040
1004
  },
1041
1005
  {
1042
1006
  provide: 'OrderRepository',
1043
- useFactory: function (firestore) {
1044
- return new i2.OrderFirestoreRepository(firestore.firestore);
1007
+ useFactory: function (app) {
1008
+ return new i2.OrderFirestoreRepository(app.firestore());
1045
1009
  },
1046
- deps: [i1$1.AngularFirestore],
1010
+ deps: [FirebaseAppProvider],
1047
1011
  },
1048
1012
  {
1049
1013
  provide: 'PaymentRepository',
1050
- useFactory: function (firestore) {
1051
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1014
+ useFactory: function (app) {
1015
+ return new i2.PaymentFirestoreRepository(app.firestore());
1052
1016
  },
1053
- deps: [i1$1.AngularFirestore],
1017
+ deps: [FirebaseAppProvider],
1054
1018
  },
1055
1019
  {
1056
1020
  provide: 'ProductRepository',
1057
- useFactory: function (firestore) {
1058
- return new i2.ProductFirestoreRepository(firestore.firestore);
1021
+ useFactory: function (app) {
1022
+ return new i2.ProductFirestoreRepository(app.firestore());
1059
1023
  },
1060
- deps: [i1$1.AngularFirestore],
1024
+ deps: [FirebaseAppProvider],
1061
1025
  },
1062
1026
  {
1063
1027
  provide: 'SubscriptionPaymentRepository',
1064
- useFactory: function (firestore, subscriptionRepository) {
1065
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1028
+ useFactory: function (app, subscriptionRepository) {
1029
+ return new i2.SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
1066
1030
  },
1067
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1031
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1068
1032
  },
1069
1033
  {
1070
1034
  provide: 'SubscriptionPlanRepository',
1071
- useFactory: function (firestore) {
1072
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1035
+ useFactory: function (app) {
1036
+ return new i2.SubscriptionPlanFirestoreRepository(app.firestore());
1073
1037
  },
1074
- deps: [i1$1.AngularFirestore],
1038
+ deps: [FirebaseAppProvider],
1075
1039
  },
1076
1040
  {
1077
1041
  provide: 'SubscriptionProductRepository',
1078
- useFactory: function (firestore) {
1079
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1042
+ useFactory: function (app) {
1043
+ return new i2.SubscriptionProductFirestoreRepository(app.firestore());
1080
1044
  },
1081
- deps: [i1$1.AngularFirestore],
1045
+ deps: [FirebaseAppProvider],
1082
1046
  },
1083
1047
  {
1084
1048
  provide: 'SubscriptionRepository',
1085
- useFactory: function (firestore) {
1086
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1049
+ useFactory: function (app) {
1050
+ return new i2.SubscriptionFirestoreRepository(app.firestore());
1087
1051
  },
1088
- deps: [i1$1.AngularFirestore],
1052
+ deps: [FirebaseAppProvider],
1089
1053
  },
1090
1054
  {
1091
1055
  provide: 'UserRepository',
1092
- useFactory: function (firestore) {
1093
- return new i2.UserFirestoreRepository(firestore.firestore);
1056
+ useFactory: function (app) {
1057
+ return new i2.UserFirestoreRepository(app.firestore());
1094
1058
  },
1095
- deps: [i1$1.AngularFirestore],
1059
+ deps: [FirebaseAppProvider],
1096
1060
  },
1097
1061
  {
1098
1062
  provide: 'UserAddressRepository',
1099
- useFactory: function (firestore, userRepository) {
1100
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1063
+ useFactory: function (app, userRepository) {
1064
+ return new i2.UserAddressFirestoreRepository(app.firestore(), userRepository);
1101
1065
  },
1102
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1066
+ deps: [FirebaseAppProvider, 'UserRepository'],
1103
1067
  },
1104
1068
  {
1105
1069
  provide: 'UserPaymentMethodRepository',
1106
- useFactory: function (firestore, userRepository) {
1107
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1070
+ useFactory: function (app, userRepository) {
1071
+ return new i2.UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
1108
1072
  },
1109
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1073
+ deps: [FirebaseAppProvider, 'UserRepository'],
1110
1074
  },
1111
1075
  {
1112
1076
  provide: 'VariantRepository',
1113
- useFactory: function (firestore, productRepository) {
1114
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1077
+ useFactory: function (app, productRepository) {
1078
+ return new i2.ProductVariantFirestoreRepository(app.firestore(), productRepository);
1115
1079
  },
1116
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1080
+ deps: [FirebaseAppProvider, 'ProductRepository'],
1117
1081
  },
1118
- ], imports: [[fire.AngularFireModule]] });
1082
+ ] });
1119
1083
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1120
1084
  type: i0.NgModule,
1121
1085
  args: [{
1122
- imports: [fire.AngularFireModule],
1123
1086
  providers: [
1087
+ FirebaseAppProvider,
1124
1088
  {
1125
1089
  provide: 'BeautyProfileRepository',
1126
- useFactory: function (firestore, userRepository) {
1127
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1090
+ useFactory: function (app, userRepository) {
1091
+ return new i2.UserBeautyProfileFirestoreRepository(app.firestore(), userRepository);
1128
1092
  },
1129
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1093
+ deps: [FirebaseAppProvider, 'UserRepository'],
1130
1094
  },
1131
1095
  {
1132
1096
  provide: 'Buy2WinRepository',
1133
- useFactory: function (firestore) {
1134
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1097
+ useFactory: function (app) {
1098
+ return new i2.Buy2WinFirestoreRepository(app.firestore());
1135
1099
  },
1136
- deps: [i1$1.AngularFirestore],
1100
+ deps: [FirebaseAppProvider],
1137
1101
  },
1138
1102
  {
1139
1103
  provide: 'CategoryRepository',
1140
- useFactory: function (firestore) {
1141
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1104
+ useFactory: function (app) {
1105
+ return new i2.CategoryFirestoreRepository(app.firestore());
1142
1106
  },
1143
- deps: [i1$1.AngularFirestore],
1107
+ deps: [FirebaseAppProvider],
1144
1108
  },
1145
1109
  {
1146
1110
  provide: 'CheckoutRepository',
1147
- useFactory: function (firestore) {
1148
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1111
+ useFactory: function (app) {
1112
+ return new i2.CheckoutFirestoreRepository(app.firestore());
1149
1113
  },
1150
- deps: [i1$1.AngularFirestore],
1114
+ deps: [FirebaseAppProvider],
1151
1115
  },
1152
1116
  {
1153
1117
  provide: 'CheckoutSubscriptionRepository',
1154
- useFactory: function (firestore) {
1155
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1118
+ useFactory: function (app) {
1119
+ return new i2.CheckoutSubscriptionFirestoreRepository(app.firestore());
1156
1120
  },
1157
- deps: [i1$1.AngularFirestore],
1121
+ deps: [FirebaseAppProvider],
1158
1122
  },
1159
1123
  {
1160
1124
  provide: 'CouponRepository',
1161
- useFactory: function (firestore) {
1162
- return new i2.CouponFirestoreRepository(firestore.firestore);
1125
+ useFactory: function (app) {
1126
+ return new i2.CouponFirestoreRepository(app.firestore());
1163
1127
  },
1164
- deps: [i1$1.AngularFirestore],
1128
+ deps: [FirebaseAppProvider],
1165
1129
  },
1166
1130
  {
1167
1131
  provide: 'EditionRepository',
1168
- useFactory: function (firestore, subscriptionRepository) {
1169
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1132
+ useFactory: function (app, subscriptionRepository) {
1133
+ return new i2.SubscriptionEditionFirestoreRepository(app.firestore(), subscriptionRepository);
1170
1134
  },
1171
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1135
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1172
1136
  },
1173
1137
  {
1174
1138
  provide: 'HomeRepository',
1175
- useFactory: function (firestore) {
1176
- return new i2.HomeFirestoreRepository(firestore.firestore);
1139
+ useFactory: function (app) {
1140
+ return new i2.HomeFirestoreRepository(app.firestore());
1177
1141
  },
1178
- deps: [i1$1.AngularFirestore],
1142
+ deps: [FirebaseAppProvider],
1179
1143
  },
1180
1144
  {
1181
1145
  provide: 'LeadRepository',
1182
- useFactory: function (firestore) {
1183
- return new i2.LeadFirestoreRepository(firestore.firestore);
1146
+ useFactory: function (app) {
1147
+ return new i2.LeadFirestoreRepository(app.firestore());
1184
1148
  },
1185
- deps: [i1$1.AngularFirestore],
1149
+ deps: [FirebaseAppProvider],
1186
1150
  },
1187
1151
  {
1188
1152
  provide: 'LegacyOrderRepository',
1189
- useFactory: function (firestore) {
1190
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1153
+ useFactory: function (app) {
1154
+ return new i2.LegacyOrderFirestoreRepository(app.firestore());
1191
1155
  },
1192
- deps: [i1$1.AngularFirestore],
1156
+ deps: [FirebaseAppProvider],
1193
1157
  },
1194
1158
  {
1195
1159
  provide: 'ShopMenuRepository',
1196
- useFactory: function (firestore) {
1197
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1160
+ useFactory: function (app) {
1161
+ return new i2.ShopMenuFirestoreRepository(app.firestore());
1198
1162
  },
1199
- deps: [i1$1.AngularFirestore],
1163
+ deps: [FirebaseAppProvider],
1200
1164
  },
1201
1165
  {
1202
1166
  provide: 'OrderRepository',
1203
- useFactory: function (firestore) {
1204
- return new i2.OrderFirestoreRepository(firestore.firestore);
1167
+ useFactory: function (app) {
1168
+ return new i2.OrderFirestoreRepository(app.firestore());
1205
1169
  },
1206
- deps: [i1$1.AngularFirestore],
1170
+ deps: [FirebaseAppProvider],
1207
1171
  },
1208
1172
  {
1209
1173
  provide: 'PaymentRepository',
1210
- useFactory: function (firestore) {
1211
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1174
+ useFactory: function (app) {
1175
+ return new i2.PaymentFirestoreRepository(app.firestore());
1212
1176
  },
1213
- deps: [i1$1.AngularFirestore],
1177
+ deps: [FirebaseAppProvider],
1214
1178
  },
1215
1179
  {
1216
1180
  provide: 'ProductRepository',
1217
- useFactory: function (firestore) {
1218
- return new i2.ProductFirestoreRepository(firestore.firestore);
1181
+ useFactory: function (app) {
1182
+ return new i2.ProductFirestoreRepository(app.firestore());
1219
1183
  },
1220
- deps: [i1$1.AngularFirestore],
1184
+ deps: [FirebaseAppProvider],
1221
1185
  },
1222
1186
  {
1223
1187
  provide: 'SubscriptionPaymentRepository',
1224
- useFactory: function (firestore, subscriptionRepository) {
1225
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1188
+ useFactory: function (app, subscriptionRepository) {
1189
+ return new i2.SubscriptionPaymentFirestoreRepository(app.firestore(), subscriptionRepository);
1226
1190
  },
1227
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1191
+ deps: [FirebaseAppProvider, 'SubscriptionRepository'],
1228
1192
  },
1229
1193
  {
1230
1194
  provide: 'SubscriptionPlanRepository',
1231
- useFactory: function (firestore) {
1232
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1195
+ useFactory: function (app) {
1196
+ return new i2.SubscriptionPlanFirestoreRepository(app.firestore());
1233
1197
  },
1234
- deps: [i1$1.AngularFirestore],
1198
+ deps: [FirebaseAppProvider],
1235
1199
  },
1236
1200
  {
1237
1201
  provide: 'SubscriptionProductRepository',
1238
- useFactory: function (firestore) {
1239
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1202
+ useFactory: function (app) {
1203
+ return new i2.SubscriptionProductFirestoreRepository(app.firestore());
1240
1204
  },
1241
- deps: [i1$1.AngularFirestore],
1205
+ deps: [FirebaseAppProvider],
1242
1206
  },
1243
1207
  {
1244
1208
  provide: 'SubscriptionRepository',
1245
- useFactory: function (firestore) {
1246
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1209
+ useFactory: function (app) {
1210
+ return new i2.SubscriptionFirestoreRepository(app.firestore());
1247
1211
  },
1248
- deps: [i1$1.AngularFirestore],
1212
+ deps: [FirebaseAppProvider],
1249
1213
  },
1250
1214
  {
1251
1215
  provide: 'UserRepository',
1252
- useFactory: function (firestore) {
1253
- return new i2.UserFirestoreRepository(firestore.firestore);
1216
+ useFactory: function (app) {
1217
+ return new i2.UserFirestoreRepository(app.firestore());
1254
1218
  },
1255
- deps: [i1$1.AngularFirestore],
1219
+ deps: [FirebaseAppProvider],
1256
1220
  },
1257
1221
  {
1258
1222
  provide: 'UserAddressRepository',
1259
- useFactory: function (firestore, userRepository) {
1260
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1223
+ useFactory: function (app, userRepository) {
1224
+ return new i2.UserAddressFirestoreRepository(app.firestore(), userRepository);
1261
1225
  },
1262
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1226
+ deps: [FirebaseAppProvider, 'UserRepository'],
1263
1227
  },
1264
1228
  {
1265
1229
  provide: 'UserPaymentMethodRepository',
1266
- useFactory: function (firestore, userRepository) {
1267
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1230
+ useFactory: function (app, userRepository) {
1231
+ return new i2.UserPaymentMethodFirestoreRepository(app.firestore(), userRepository);
1268
1232
  },
1269
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1233
+ deps: [FirebaseAppProvider, 'UserRepository'],
1270
1234
  },
1271
1235
  {
1272
1236
  provide: 'VariantRepository',
1273
- useFactory: function (firestore, productRepository) {
1274
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1237
+ useFactory: function (app, productRepository) {
1238
+ return new i2.ProductVariantFirestoreRepository(app.firestore(), productRepository);
1275
1239
  },
1276
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1240
+ deps: [FirebaseAppProvider, 'ProductRepository'],
1277
1241
  },
1278
1242
  ],
1279
1243
  }]
@@ -1285,19 +1249,35 @@
1285
1249
  AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1286
1250
  return {
1287
1251
  ngModule: AngularConnectModule,
1288
- 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 }]))),
1289
1253
  };
1290
1254
  };
1291
1255
  return AngularConnectModule;
1292
1256
  }());
1293
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 });
1294
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1295
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService], 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] });
1259
+ AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1260
+ AuthService,
1261
+ CartService,
1262
+ CheckoutService,
1263
+ CheckoutSubscriptionService,
1264
+ CouponService,
1265
+ OrderService,
1266
+ FirebaseAppProvider,
1267
+ ], imports: [[AngularFirestoreModule]] });
1296
1268
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1297
1269
  type: i0.NgModule,
1298
1270
  args: [{
1299
- imports: [fire.AngularFireModule, AngularFirestoreModule],
1300
- providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService],
1271
+ imports: [AngularFirestoreModule],
1272
+ providers: [
1273
+ AuthService,
1274
+ CartService,
1275
+ CheckoutService,
1276
+ CheckoutSubscriptionService,
1277
+ CouponService,
1278
+ OrderService,
1279
+ FirebaseAppProvider,
1280
+ ],
1301
1281
  }]
1302
1282
  }] });
1303
1283