@infrab4a/connect-angular 0.5.0-beta.9 → 0.5.1

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.
@@ -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'), require('@angular/fire/firestore')) :
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', '@angular/fire/firestore'], 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, global.ng.fire.firestore));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, fire, firestore) { 'use strict';
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, i1$1, cookie, i1$2, fire) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -28,6 +28,7 @@
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
29
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
30
  var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
31
32
 
32
33
  var AuthService = /** @class */ (function () {
33
34
  function AuthService(angularFireAuth, userRepository) {
@@ -388,17 +389,24 @@
388
389
  };
389
390
  CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
390
391
  var _this = this;
391
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.mergeMap(function (checkout) { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? rxjs.of(checkout.user) : rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.mergeMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new i1$1.NotFoundError('User is not found'); }); }));
392
+ return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.concatMap(function (checkout) { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? rxjs.of(checkout.user) : rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.concatMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new i1$1.NotFoundError('User is not found'); }); }));
392
393
  };
393
394
  CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
394
395
  return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
395
396
  };
397
+ CheckoutService.prototype.updateCheckoutUser = function (checkout) {
398
+ return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
399
+ };
400
+ CheckoutService.prototype.clearCheckoutFromSession = function () {
401
+ cookie__default["default"].remove('checkoutId');
402
+ return rxjs.of();
403
+ };
396
404
  CheckoutService.prototype.createCheckout = function (checkoutData) {
397
405
  return __awaiter(this, void 0, void 0, function () {
398
406
  var checkout;
399
407
  return __generator(this, function (_b) {
400
408
  switch (_b.label) {
401
- case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i1$1.Checkout.toInstance(checkoutData).toPlain()), { shop: checkoutData.shop || this.defaultShop }))];
409
+ case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i1$1.Checkout.toInstance(i1$1.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
402
410
  case 1:
403
411
  checkout = _b.sent();
404
412
  cookie__default["default"].set('checkoutId', checkout.id);
@@ -433,18 +441,19 @@
433
441
  this.checkoutService = checkoutService;
434
442
  this.defaultShop = defaultShop;
435
443
  this.cartSubject = new rxjs.Subject();
436
- this.updateLineItemInCart = function (lineItem, quantity) { return _this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkoutLoaded) {
444
+ this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i1$1.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
437
445
  var _a;
438
446
  var items = [];
439
447
  var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
440
448
  if (index > -1) {
441
449
  checkoutLoaded.lineItems[index].quantity += quantity;
450
+ checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
442
451
  }
443
452
  else
444
453
  checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
445
454
  return _this.checkoutService
446
455
  .updateCheckoutLineItems(checkoutLoaded)
447
- .pipe(operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
456
+ .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
448
457
  })); };
449
458
  this.generateCartObject = function (items) {
450
459
  var cart = {};
@@ -454,15 +463,20 @@
454
463
  });
455
464
  return cart;
456
465
  };
457
- this.buildLineItem = function (_c) {
458
- var checkout = _c.checkout, item = _c.item, isSubscriber = _c.isSubscriber, quantity = _c.quantity;
459
- var _a, _b;
460
- if (_this.checkMaxStock(item))
461
- throw new Error('Desculpe! Temos apenas ' + ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) + ' em estoque.');
462
- var image = item.image || ((_b = item.images) === null || _b === void 0 ? void 0 : _b.shift());
463
- var pricePaid = _this.getProductPrice({ product: item, shop: checkout.shop || _this.defaultShop, isSubscriber: isSubscriber });
466
+ this.buildLineItem = function (_e) {
467
+ var checkout = _e.checkout, item = _e.item, quantity = _e.quantity;
468
+ var _a, _b, _c, _d;
469
+ item.quantity = item.quantity || ((_a = checkout.lineItems.find(function (lineItem) { return lineItem.sku === item.sku; })) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
470
+ if (_this.checkMaxStock(item, quantity || 0))
471
+ throw new Error('Desculpe! Temos apenas ' + ((_b = item.stock) === null || _b === void 0 ? void 0 : _b.quantity) + ' em estoque.');
472
+ var image = item.image || ((_c = item.images) === null || _c === void 0 ? void 0 : _c.shift());
464
473
  var id = item.id, name = item.name, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku;
465
474
  var isGift = item.isGift || null;
475
+ var pricePaid = _this.getProductPrice({
476
+ product: item,
477
+ shop: checkout.shop || _this.defaultShop,
478
+ isSubscriber: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.isSubscriber,
479
+ });
466
480
  return i1$1.LineItem.toInstance({
467
481
  id: id,
468
482
  name: name,
@@ -473,57 +487,47 @@
473
487
  price: price,
474
488
  image: image,
475
489
  weight: weight,
476
- quantity: quantity,
490
+ quantity: (item.quantity || 0) + (quantity || 0),
477
491
  pricePaid: pricePaid,
478
492
  categories: categories,
479
493
  isGift: isGift,
480
494
  });
481
495
  };
482
- this.getProductPrice = function (_c) {
483
- var product = _c.product, shop = _c.shop, isSubscriber = _c.isSubscriber;
484
- return product.getInfoByShop(shop)[isSubscriber ? 'subscriberPrice' : 'price'];
496
+ this.getProductPrice = function (_e) {
497
+ var product = _e.product, shop = _e.shop, isSubscriber = _e.isSubscriber;
498
+ var info = product.getInfoByShop(shop);
499
+ if (product.isGift)
500
+ return 0;
501
+ return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
485
502
  };
486
- this.checkMaxStock = function (item) {
503
+ this.checkMaxStock = function (item, quantity) {
487
504
  var _a;
488
505
  var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
489
- var quantity = item.quantity || 1;
490
- var currentItemAmount = item.quantity;
491
- return quantity > maxStock || currentItemAmount + quantity > maxStock;
506
+ var currentItemAmount = item.quantity || 0;
507
+ return currentItemAmount + quantity > maxStock;
492
508
  };
493
509
  }
494
- CartService.prototype.addItem = function (item, quantity, checkoutData) {
510
+ CartService.prototype.addItem = function (item, quantity) {
495
511
  var _this = this;
496
512
  if (quantity === void 0) { quantity = 1; }
497
- rxjs.of(checkoutData)
498
- .pipe(operators.mergeMap(function (checkout) { return (i1$1.isEmpty(checkout === null || checkout === void 0 ? void 0 : checkout.id) ? _this.checkoutService.getCheckout(checkoutData) : rxjs.of(checkout)); }), operators.mergeMap(function (checkout) {
499
- var _a;
500
- quantity = quantity || 1;
501
- return rxjs.of((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber).pipe(operators.mergeMap(function (isSubscriber) { return isSubscriber
502
- ? rxjs.of(isSubscriber)
503
- : _this.checkoutService.getUserByCheckout(checkout.id).pipe(operators.catchError(function () { return rxjs.of({ isSubscriber: false }); }), operators.map(function (user) { return user.isSubscriber; })); }), operators.mergeMap(function (isSubscriber) {
504
- return _this.buildCartFromCheckout().pipe(operators.map(function () { return _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity, isSubscriber: isSubscriber }); }), operators.mergeMap(function (lineItem) { return _this.updateLineItemInCart(lineItem, quantity); }));
505
- }));
506
- }))
507
- .subscribe(function (cart) { return _this.cartSubject.next(cart); });
508
- return this.cartSubject;
513
+ 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 (_e) {
514
+ var checkout = _e.checkout, lineItem = _e.lineItem;
515
+ return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
516
+ }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
509
517
  };
510
518
  CartService.prototype.decreaseItem = function (item) {
511
519
  var _this = this;
512
- this.checkoutService
513
- .getCheckout()
514
- .pipe(operators.map(function (checkout) {
520
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
515
521
  var _a;
516
522
  var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
517
523
  if (!i1$1.isNil(checkoutItem))
518
524
  checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
519
525
  return checkout;
520
- }), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }))
521
- .subscribe(function (cart) { return _this.cartSubject.next(cart); });
522
- return this.cartSubject;
526
+ }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
523
527
  };
524
- CartService.prototype.getCart = function () {
528
+ CartService.prototype.getCart = function (checkout) {
525
529
  var _this = this;
526
- this.buildCartFromCheckout().subscribe(function (cart) { return _this.cartSubject.next(cart); });
530
+ this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
527
531
  return this.cartSubject;
528
532
  };
529
533
  CartService.prototype.getDiscount = function (coupon) {
@@ -539,22 +543,31 @@
539
543
  }
540
544
  };
541
545
  CartService.prototype.getVariantPriceDiscount = function (item, shop) {
542
- return this.authService.getUser().pipe(operators.mergeMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
546
+ return this.authService.getUser().pipe(operators.concatMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
543
547
  };
544
548
  CartService.prototype.removeItem = function (item) {
545
549
  var _this = this;
546
- this.checkoutService
547
- .getCheckout()
548
- .pipe(operators.map(function (checkout) {
549
- checkout.lineItems.splice(checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; }), 1);
550
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
551
+ var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
552
+ if (index >= 0)
553
+ checkout.lineItems.splice(index, 1);
550
554
  return checkout;
551
- }), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }))
552
- .subscribe(function (cart) { return _this.cartSubject.next(cart); });
553
- return this.cartSubject;
555
+ }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
556
+ };
557
+ CartService.prototype.updateUserCart = function (user) {
558
+ var _this = this;
559
+ return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: checkout.lineItems.map(function (item) { return _this.buildLineItem({ checkout: checkout, item: item }); }) }))); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
560
+ };
561
+ CartService.prototype.clearCart = function () {
562
+ var _this = this;
563
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
564
+ _this.checkoutService.clearCheckoutFromSession();
565
+ return checkout;
566
+ }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
554
567
  };
555
- CartService.prototype.buildCartFromCheckout = function () {
568
+ CartService.prototype.buildCartFromCheckout = function (checkoutData) {
556
569
  var _this = this;
557
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.mergeMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
570
+ return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
558
571
  };
559
572
  CartService.prototype.getFinancialDiscount = function (coupon) {
560
573
  return function (subTotalPrice) {
@@ -580,6 +593,34 @@
580
593
  }] }];
581
594
  } });
582
595
 
596
+ var OrderService = /** @class */ (function () {
597
+ function OrderService(angularFirestore, orderRepository) {
598
+ this.angularFirestore = angularFirestore;
599
+ this.orderRepository = orderRepository;
600
+ this.orderSubject = new rxjs.Subject();
601
+ }
602
+ OrderService.prototype.getOrder = function (id) {
603
+ var _this = this;
604
+ this.angularFirestore
605
+ .doc(this.orderRepository.collectionName + "/" + id)
606
+ .valueChanges()
607
+ .pipe(operators.map(function (doc) { return i1$1.Order.toInstance(doc); }))
608
+ .subscribe(function (doc) { return _this.orderSubject.next(doc); });
609
+ return this.orderSubject;
610
+ };
611
+ return OrderService;
612
+ }());
613
+ OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
614
+ OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: OrderService });
615
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: OrderService, decorators: [{
616
+ type: i0.Injectable
617
+ }], ctorParameters: function () {
618
+ return [{ type: i1__namespace$2.AngularFirestore }, { type: i1__namespace$1.OrderFirestoreRepository, decorators: [{
619
+ type: i0.Inject,
620
+ args: ['OrderRepository']
621
+ }] }];
622
+ } });
623
+
583
624
  var AngularFirebaseAuthModule = /** @class */ (function () {
584
625
  function AngularFirebaseAuthModule() {
585
626
  }
@@ -671,126 +712,126 @@
671
712
  useFactory: function (firestore, userRepository) {
672
713
  return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
673
714
  },
674
- deps: [firestore.AngularFirestore, 'UserRepository'],
715
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
675
716
  },
676
717
  {
677
718
  provide: 'Buy2WinRepository',
678
719
  useFactory: function (firestore) {
679
720
  return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
680
721
  },
681
- deps: [firestore.AngularFirestore],
722
+ deps: [i1$2.AngularFirestore],
682
723
  },
683
724
  {
684
725
  provide: 'CategoryRepository',
685
726
  useFactory: function (firestore) {
686
727
  return new i1$1.CategoryFirestoreRepository(firestore.firestore);
687
728
  },
688
- deps: [firestore.AngularFirestore],
729
+ deps: [i1$2.AngularFirestore],
689
730
  },
690
731
  {
691
732
  provide: 'CheckoutRepository',
692
733
  useFactory: function (firestore) {
693
734
  return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
694
735
  },
695
- deps: [firestore.AngularFirestore],
736
+ deps: [i1$2.AngularFirestore],
696
737
  },
697
738
  {
698
739
  provide: 'CheckoutSubscriptionRepository',
699
740
  useFactory: function (firestore) {
700
741
  return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
701
742
  },
702
- deps: [firestore.AngularFirestore],
743
+ deps: [i1$2.AngularFirestore],
703
744
  },
704
745
  {
705
746
  provide: 'CouponRepository',
706
747
  useFactory: function (firestore) {
707
748
  return new i1$1.CouponFirestoreRepository(firestore.firestore);
708
749
  },
709
- deps: [firestore.AngularFirestore],
750
+ deps: [i1$2.AngularFirestore],
710
751
  },
711
752
  {
712
753
  provide: 'EditionRepository',
713
754
  useFactory: function (firestore, subscriptionRepository) {
714
755
  return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
715
756
  },
716
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
757
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
717
758
  },
718
759
  {
719
760
  provide: 'HomeRepository',
720
761
  useFactory: function (firestore) {
721
762
  return new i1$1.HomeFirestoreRepository(firestore.firestore);
722
763
  },
723
- deps: [firestore.AngularFirestore],
764
+ deps: [i1$2.AngularFirestore],
724
765
  },
725
766
  {
726
767
  provide: 'ShopMenuRepository',
727
768
  useFactory: function (firestore) {
728
769
  return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
729
770
  },
730
- deps: [firestore.AngularFirestore],
771
+ deps: [i1$2.AngularFirestore],
731
772
  },
732
773
  {
733
774
  provide: 'OrderRepository',
734
775
  useFactory: function (firestore) {
735
776
  return new i1$1.OrderFirestoreRepository(firestore.firestore);
736
777
  },
737
- deps: [firestore.AngularFirestore],
778
+ deps: [i1$2.AngularFirestore],
738
779
  },
739
780
  {
740
781
  provide: 'PaymentRepository',
741
782
  useFactory: function (firestore) {
742
783
  return new i1$1.PaymentFirestoreRepository(firestore.firestore);
743
784
  },
744
- deps: [firestore.AngularFirestore],
785
+ deps: [i1$2.AngularFirestore],
745
786
  },
746
787
  {
747
788
  provide: 'ProductRepository',
748
789
  useFactory: function (firestore) {
749
790
  return new i1$1.ProductFirestoreRepository(firestore.firestore);
750
791
  },
751
- deps: [firestore.AngularFirestore],
792
+ deps: [i1$2.AngularFirestore],
752
793
  },
753
794
  {
754
795
  provide: 'SubscriptionPaymentRepository',
755
796
  useFactory: function (firestore, subscriptionRepository) {
756
797
  return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
757
798
  },
758
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
799
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
759
800
  },
760
801
  {
761
802
  provide: 'SubscriptionPlanRepository',
762
803
  useFactory: function (firestore) {
763
804
  return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
764
805
  },
765
- deps: [firestore.AngularFirestore],
806
+ deps: [i1$2.AngularFirestore],
766
807
  },
767
808
  {
768
809
  provide: 'SubscriptionRepository',
769
810
  useFactory: function (firestore) {
770
811
  return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
771
812
  },
772
- deps: [firestore.AngularFirestore],
813
+ deps: [i1$2.AngularFirestore],
773
814
  },
774
815
  {
775
816
  provide: 'UserRepository',
776
817
  useFactory: function (firestore) {
777
818
  return new i1$1.UserFirestoreRepository(firestore.firestore);
778
819
  },
779
- deps: [firestore.AngularFirestore],
820
+ deps: [i1$2.AngularFirestore],
780
821
  },
781
822
  {
782
823
  provide: 'UserAddressRepository',
783
824
  useFactory: function (firestore, userRepository) {
784
825
  return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
785
826
  },
786
- deps: [firestore.AngularFirestore, 'UserRepository'],
827
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
787
828
  },
788
829
  {
789
830
  provide: 'VariantRepository',
790
831
  useFactory: function (firestore, productRepository) {
791
832
  return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
792
833
  },
793
- deps: [firestore.AngularFirestore, 'ProductRepository'],
834
+ deps: [i1$2.AngularFirestore, 'ProductRepository'],
794
835
  },
795
836
  ], imports: [[fire.AngularFireModule]] });
796
837
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
@@ -803,126 +844,126 @@
803
844
  useFactory: function (firestore, userRepository) {
804
845
  return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
805
846
  },
806
- deps: [firestore.AngularFirestore, 'UserRepository'],
847
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
807
848
  },
808
849
  {
809
850
  provide: 'Buy2WinRepository',
810
851
  useFactory: function (firestore) {
811
852
  return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
812
853
  },
813
- deps: [firestore.AngularFirestore],
854
+ deps: [i1$2.AngularFirestore],
814
855
  },
815
856
  {
816
857
  provide: 'CategoryRepository',
817
858
  useFactory: function (firestore) {
818
859
  return new i1$1.CategoryFirestoreRepository(firestore.firestore);
819
860
  },
820
- deps: [firestore.AngularFirestore],
861
+ deps: [i1$2.AngularFirestore],
821
862
  },
822
863
  {
823
864
  provide: 'CheckoutRepository',
824
865
  useFactory: function (firestore) {
825
866
  return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
826
867
  },
827
- deps: [firestore.AngularFirestore],
868
+ deps: [i1$2.AngularFirestore],
828
869
  },
829
870
  {
830
871
  provide: 'CheckoutSubscriptionRepository',
831
872
  useFactory: function (firestore) {
832
873
  return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
833
874
  },
834
- deps: [firestore.AngularFirestore],
875
+ deps: [i1$2.AngularFirestore],
835
876
  },
836
877
  {
837
878
  provide: 'CouponRepository',
838
879
  useFactory: function (firestore) {
839
880
  return new i1$1.CouponFirestoreRepository(firestore.firestore);
840
881
  },
841
- deps: [firestore.AngularFirestore],
882
+ deps: [i1$2.AngularFirestore],
842
883
  },
843
884
  {
844
885
  provide: 'EditionRepository',
845
886
  useFactory: function (firestore, subscriptionRepository) {
846
887
  return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
847
888
  },
848
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
889
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
849
890
  },
850
891
  {
851
892
  provide: 'HomeRepository',
852
893
  useFactory: function (firestore) {
853
894
  return new i1$1.HomeFirestoreRepository(firestore.firestore);
854
895
  },
855
- deps: [firestore.AngularFirestore],
896
+ deps: [i1$2.AngularFirestore],
856
897
  },
857
898
  {
858
899
  provide: 'ShopMenuRepository',
859
900
  useFactory: function (firestore) {
860
901
  return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
861
902
  },
862
- deps: [firestore.AngularFirestore],
903
+ deps: [i1$2.AngularFirestore],
863
904
  },
864
905
  {
865
906
  provide: 'OrderRepository',
866
907
  useFactory: function (firestore) {
867
908
  return new i1$1.OrderFirestoreRepository(firestore.firestore);
868
909
  },
869
- deps: [firestore.AngularFirestore],
910
+ deps: [i1$2.AngularFirestore],
870
911
  },
871
912
  {
872
913
  provide: 'PaymentRepository',
873
914
  useFactory: function (firestore) {
874
915
  return new i1$1.PaymentFirestoreRepository(firestore.firestore);
875
916
  },
876
- deps: [firestore.AngularFirestore],
917
+ deps: [i1$2.AngularFirestore],
877
918
  },
878
919
  {
879
920
  provide: 'ProductRepository',
880
921
  useFactory: function (firestore) {
881
922
  return new i1$1.ProductFirestoreRepository(firestore.firestore);
882
923
  },
883
- deps: [firestore.AngularFirestore],
924
+ deps: [i1$2.AngularFirestore],
884
925
  },
885
926
  {
886
927
  provide: 'SubscriptionPaymentRepository',
887
928
  useFactory: function (firestore, subscriptionRepository) {
888
929
  return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
889
930
  },
890
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
931
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
891
932
  },
892
933
  {
893
934
  provide: 'SubscriptionPlanRepository',
894
935
  useFactory: function (firestore) {
895
936
  return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
896
937
  },
897
- deps: [firestore.AngularFirestore],
938
+ deps: [i1$2.AngularFirestore],
898
939
  },
899
940
  {
900
941
  provide: 'SubscriptionRepository',
901
942
  useFactory: function (firestore) {
902
943
  return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
903
944
  },
904
- deps: [firestore.AngularFirestore],
945
+ deps: [i1$2.AngularFirestore],
905
946
  },
906
947
  {
907
948
  provide: 'UserRepository',
908
949
  useFactory: function (firestore) {
909
950
  return new i1$1.UserFirestoreRepository(firestore.firestore);
910
951
  },
911
- deps: [firestore.AngularFirestore],
952
+ deps: [i1$2.AngularFirestore],
912
953
  },
913
954
  {
914
955
  provide: 'UserAddressRepository',
915
956
  useFactory: function (firestore, userRepository) {
916
957
  return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
917
958
  },
918
- deps: [firestore.AngularFirestore, 'UserRepository'],
959
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
919
960
  },
920
961
  {
921
962
  provide: 'VariantRepository',
922
963
  useFactory: function (firestore, productRepository) {
923
964
  return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
924
965
  },
925
- deps: [firestore.AngularFirestore, 'ProductRepository'],
966
+ deps: [i1$2.AngularFirestore, 'ProductRepository'],
926
967
  },
927
968
  ],
928
969
  }]
@@ -941,12 +982,12 @@
941
982
  }());
942
983
  AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
943
984
  AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
944
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
985
+ AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, OrderService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
945
986
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
946
987
  type: i0.NgModule,
947
988
  args: [{
948
989
  imports: [fire.AngularFireModule, AngularFirestoreModule],
949
- providers: [AuthService, CartService, CheckoutService],
990
+ providers: [AuthService, CartService, CheckoutService, OrderService],
950
991
  }]
951
992
  }] });
952
993
 
@@ -960,6 +1001,7 @@
960
1001
  exports.AuthService = AuthService;
961
1002
  exports.CartService = CartService;
962
1003
  exports.CheckoutService = CheckoutService;
1004
+ exports.OrderService = OrderService;
963
1005
 
964
1006
  Object.defineProperty(exports, '__esModule', { value: true });
965
1007