@infrab4a/connect-angular 0.13.0-beta.13 → 0.13.0-beta.3

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