@infrab4a/connect-angular 3.6.0-beta.14 → 3.6.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
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('ts-custom-error'), require('@angular/fire/firestore'), require('@angular/common/http'), require('@angular/fire')) :
3
3
  typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', 'ts-custom-error', '@angular/fire/firestore', '@angular/common/http', '@angular/fire'], factory) :
4
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["ts-custom-error"], global.ng.fire.firestore, global.ng.common.http, global.ng.fire));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i3, cookie, tsCustomError, i1$1, i1$2, fire) { 'use strict';
5
+ })(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, tsCustomError, i1$2, i1$3, fire) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,10 +26,10 @@
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
30
- var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
29
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
30
+ var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
32
31
  var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
32
+ var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
33
33
 
34
34
  /*! *****************************************************************************
35
35
  Copyright (c) Microsoft Corporation.
@@ -430,7 +430,7 @@
430
430
  this.separateValidCoupons = function (coupons, userEmail) { return coupons
431
431
  .map(function (coupon) {
432
432
  try {
433
- if (!(coupon instanceof i3.Coupon))
433
+ if (!(coupon instanceof i1$1.Coupon))
434
434
  throw new InvalidCouponError('Cupom inválido.');
435
435
  if (_this.isValidCoupon(coupon, userEmail))
436
436
  return coupon;
@@ -439,7 +439,7 @@
439
439
  return error;
440
440
  }
441
441
  })
442
- .reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (coupon instanceof i3.Coupon
442
+ .reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (coupon instanceof i1$1.Coupon
443
443
  ? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
444
444
  : { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
445
445
  valids: [],
@@ -450,8 +450,8 @@
450
450
  var _this = this;
451
451
  return rxjs.from(this.couponRepository.find({
452
452
  filters: {
453
- nickname: { operator: i3.Where.EQUALS, value: nickname },
454
- active: { operator: i3.Where.EQUALS, value: true },
453
+ nickname: { operator: i1$1.Where.EQUALS, value: nickname },
454
+ active: { operator: i1$1.Where.EQUALS, value: true },
455
455
  },
456
456
  })).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return _this.checkCouponUseAndLimit(coupon, userEmail, checkout); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
457
457
  };
@@ -463,17 +463,17 @@
463
463
  // Get Primeiro Cupom (o find do repository retorna um array)
464
464
  var coupon = coupons.data.shift();
465
465
  // Verifica se o cupom é aplicavel na loja
466
- var isInShop = coupon.shopAvailability === i3.Shops.ALL || coupon.shopAvailability === this.defaultShop;
466
+ var isInShop = coupon.shopAvailability === i1$1.Shops.ALL || coupon.shopAvailability === this.defaultShop;
467
467
  // Cupon não aplicavel a loja retorna erro
468
468
  if (!isInShop)
469
469
  return rxjs.throwError('Cupom inválido para loja.');
470
470
  // Verifica se o coupon é aplicado no checkout que está sendo realizado
471
- var isCheckoutType = coupon.checkoutType === i3.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
471
+ var isCheckoutType = coupon.checkoutType === i1$1.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
472
472
  // Cupon não aplicavel ao checkout retorna erro
473
473
  if (!isCheckoutType)
474
474
  return rxjs.throwError('Cupom inválido. Erro de checkout.');
475
475
  // Verifica se o cupom é ou pode ser aplicado para subscription
476
- if (checkoutType === i3.CheckoutTypes.ALL || checkoutType === i3.CheckoutTypes.SUBSCRIPTION) {
476
+ if (checkoutType === i1$1.CheckoutTypes.ALL || checkoutType === i1$1.CheckoutTypes.SUBSCRIPTION) {
477
477
  // Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
478
478
  if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
479
479
  return rxjs.throwError('Cupom inválido para sua assinatura.');
@@ -516,11 +516,13 @@
516
516
  // Verifica o limite de uso geral por usuario
517
517
  if (coupon.useLimit && orders.data.length >= coupon.useLimit)
518
518
  throw new InvalidCouponError('Limite de uso atingido.');
519
- validUser = this.userValidationAndSubscriptionStatus(coupon, checkout.user);
519
+ return [4 /*yield*/, this.userValidationAndSubscriptionStatus(coupon, userEmail)];
520
+ case 2:
521
+ validUser = _d.sent();
520
522
  if (!validUser)
521
523
  throw new InvalidCouponError('Usuário não elegível.');
522
524
  return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
523
- case 2:
525
+ case 3:
524
526
  hasProductCategories = _d.sent();
525
527
  if (!hasProductCategories)
526
528
  throw 'Seu carrinho não possui produtos elegíveis para desconto.';
@@ -532,9 +534,9 @@
532
534
  CouponService.prototype.calcDiscountSubscription = function (coupon, checkout) {
533
535
  //
534
536
  var discount = 0;
535
- if (coupon.type === i3.CouponTypes.ABSOLUTE)
537
+ if (coupon.type === i1$1.CouponTypes.ABSOLUTE)
536
538
  discount = coupon.discount;
537
- else if (coupon.type === i3.CouponTypes.PERCENTAGE)
539
+ else if (coupon.type === i1$1.CouponTypes.PERCENTAGE)
538
540
  discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount / 100);
539
541
  return rxjs.of(discount);
540
542
  };
@@ -547,8 +549,8 @@
547
549
  discount = 0;
548
550
  _d = coupon.type;
549
551
  switch (_d) {
550
- case i3.CouponTypes.ABSOLUTE: return [3 /*break*/, 1];
551
- case i3.CouponTypes.PERCENTAGE: return [3 /*break*/, 2];
552
+ case i1$1.CouponTypes.ABSOLUTE: return [3 /*break*/, 1];
553
+ case i1$1.CouponTypes.PERCENTAGE: return [3 /*break*/, 2];
552
554
  }
553
555
  return [3 /*break*/, 4];
554
556
  case 1:
@@ -583,7 +585,7 @@
583
585
  lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
584
586
  var _a;
585
587
  if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
586
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
588
+ return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
587
589
  }
588
590
  return true;
589
591
  });
@@ -635,31 +637,56 @@
635
637
  var _a;
636
638
  if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
637
639
  return true;
638
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
640
+ return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
639
641
  });
640
642
  return [2 /*return*/, hasCategories.length ? true : false];
641
643
  }
642
644
  });
643
645
  });
644
646
  };
645
- CouponService.prototype.userValidationAndSubscriptionStatus = function (coupon, user) {
646
- if (coupon.exclusivityType === i3.Exclusivities.ALL_USERS)
647
- return true;
648
- // Verifica se o email do usuário é coorporativo
649
- if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === i3.Exclusivities.COLLABORATORS)
650
- throw new InvalidCouponError('Você não é colaborador.');
651
- // Verifica se o email do usuário é associado ao cupom de uso por usuario
652
- if (coupon.exclusivityType === i3.Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
653
- throw new InvalidCouponError('Cupom não é válido para este usuário.');
654
- switch (coupon.exclusivityType) {
655
- case i3.Exclusivities.ACTIVE_SUBSCRIBER:
656
- return user.isSubscriber ? true : false;
657
- case i3.Exclusivities.INACTIVE_SUBSCRIBER:
658
- return user.isSubscriber ? false : true;
659
- case i3.Exclusivities.NON_SUBSCRIBER:
660
- return user.isSubscriber ? false : true;
661
- }
662
- return true;
647
+ CouponService.prototype.userValidationAndSubscriptionStatus = function (coupon, userEmail) {
648
+ return __awaiter(this, void 0, void 0, function () {
649
+ var couponRuleSubscription, sub, activeSubs;
650
+ return __generator(this, function (_d) {
651
+ switch (_d.label) {
652
+ case 0:
653
+ // Verifica se o email do usuário é coorporativo
654
+ if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i1$1.Exclusivities.COLLABORATORS)
655
+ throw new InvalidCouponError('Você não é colaborador.');
656
+ // Verifica se o email do usuário é associado ao cupom de uso por usuario
657
+ if (coupon.exclusivityType === i1$1.Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
658
+ throw new InvalidCouponError('Cupom não é válido para este usuário.');
659
+ couponRuleSubscription = coupon.exclusivityType === i1$1.Exclusivities.ACTIVE_SUBSCRIBER ||
660
+ coupon.exclusivityType === i1$1.Exclusivities.INACTIVE_SUBSCRIBER ||
661
+ coupon.exclusivityType === i1$1.Exclusivities.NON_SUBSCRIBER;
662
+ if (!(couponRuleSubscription && userEmail)) return [3 /*break*/, 2];
663
+ return [4 /*yield*/, this.subscriptionRepository
664
+ .find({
665
+ filters: {
666
+ user: {
667
+ email: { operator: i1$1.Where.EQUALS, value: userEmail },
668
+ },
669
+ },
670
+ })
671
+ .then(function (sub) { return sub.data; })];
672
+ case 1:
673
+ sub = _d.sent();
674
+ activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter(function (s) { return s.status === i1$1.Status.ACTIVE; });
675
+ switch (coupon.exclusivityType) {
676
+ case i1$1.Exclusivities.ACTIVE_SUBSCRIBER:
677
+ return [2 /*return*/, activeSubs.length > 0];
678
+ case i1$1.Exclusivities.INACTIVE_SUBSCRIBER:
679
+ return [2 /*return*/, activeSubs.length === 0];
680
+ case i1$1.Exclusivities.NON_SUBSCRIBER:
681
+ return [2 /*return*/, sub.length === 0];
682
+ default:
683
+ return [2 /*return*/, false];
684
+ }
685
+ _d.label = 2;
686
+ case 2: return [2 /*return*/, true];
687
+ }
688
+ });
689
+ });
663
690
  };
664
691
  CouponService.prototype.getCouponCategoriesId = function (coupon) {
665
692
  return __awaiter(this, void 0, void 0, function () {
@@ -672,9 +699,7 @@
672
699
  _d.label = 1;
673
700
  case 1:
674
701
  if (!(index < coupon.productsCategories.length)) return [3 /*break*/, 4];
675
- return [4 /*yield*/, this.categoryRepository.get({
676
- id: coupon.productsCategories[index],
677
- })];
702
+ return [4 /*yield*/, this.categoryRepository.get({ id: coupon.productsCategories[index] })];
678
703
  case 2:
679
704
  c = _d.sent();
680
705
  couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
@@ -700,7 +725,7 @@
700
725
  return [{ type: undefined, decorators: [{
701
726
  type: i0.Inject,
702
727
  args: ['CouponRepository']
703
- }] }, { type: i3__namespace.Shops, decorators: [{
728
+ }] }, { type: i1__namespace$1.Shops, decorators: [{
704
729
  type: i0.Inject,
705
730
  args: [DEFAULT_SHOP]
706
731
  }] }, { type: undefined, decorators: [{
@@ -725,19 +750,19 @@
725
750
  }
726
751
  CheckoutService.prototype.getCheckout = function (checkoutData) {
727
752
  var checkoutId = cookie__default["default"].get('checkoutId');
728
- if (!i3.isNil(checkoutId))
753
+ if (!i1$1.isNil(checkoutId))
729
754
  return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
730
755
  return rxjs.from(this.createCheckout(checkoutData));
731
756
  };
732
757
  CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
733
758
  var _this = this;
734
- 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 i3.NotFoundError('User is not found'); }); }));
759
+ 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'); }); }));
735
760
  };
736
761
  CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
737
- return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
762
+ return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
738
763
  };
739
764
  CheckoutService.prototype.updateCheckoutUser = function (checkout) {
740
- return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
765
+ return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
741
766
  };
742
767
  CheckoutService.prototype.clearCheckoutFromSession = function () {
743
768
  cookie__default["default"].remove('checkoutId');
@@ -757,7 +782,7 @@
757
782
  return this.getCheckout().pipe(operators.concatMap(function (checkout) {
758
783
  var _a;
759
784
  return _this.couponService
760
- .checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i3.CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
785
+ .checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i1$1.CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
761
786
  .pipe();
762
787
  }));
763
788
  };
@@ -766,7 +791,7 @@
766
791
  var checkout;
767
792
  return __generator(this, function (_b) {
768
793
  switch (_b.label) {
769
- case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i3.Checkout.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
794
+ 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 }))];
770
795
  case 1:
771
796
  checkout = _b.sent();
772
797
  cookie__default["default"].set('checkoutId', checkout.id);
@@ -791,22 +816,21 @@
791
816
  }] }, { type: undefined, decorators: [{
792
817
  type: i0.Inject,
793
818
  args: ['UserRepository']
794
- }] }, { type: i3__namespace.Shops, decorators: [{
819
+ }] }, { type: i1__namespace$1.Shops, decorators: [{
795
820
  type: i0.Inject,
796
821
  args: [DEFAULT_SHOP]
797
822
  }] }];
798
823
  } });
799
824
 
800
825
  var CartService = /** @class */ (function () {
801
- function CartService(authService, checkoutService, defaultShop, productRepository, buy2WinRepository) {
826
+ function CartService(authService, checkoutService, defaultShop, productRepository) {
802
827
  var _this = this;
803
828
  this.authService = authService;
804
829
  this.checkoutService = checkoutService;
805
830
  this.defaultShop = defaultShop;
806
831
  this.productRepository = productRepository;
807
- this.buy2WinRepository = buy2WinRepository;
808
832
  this.cartSubject = new rxjs.Subject();
809
- this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i3.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
833
+ this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i1$1.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
810
834
  var _a;
811
835
  var items = [];
812
836
  var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
@@ -820,26 +844,11 @@
820
844
  .updateCheckoutLineItems(checkoutLoaded)
821
845
  .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
822
846
  })); };
823
- this.updateLineItemInCartNew = function (lineItem, quantity, checkout) { return (i3.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
824
- var _a;
825
- var items = [];
826
- var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
827
- if (index > -1) {
828
- checkoutLoaded.lineItems[index].quantity += quantity;
829
- checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
830
- }
831
- else
832
- checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
833
- return rxjs.of(checkoutLoaded);
834
- // return this.checkoutService
835
- // .updateCheckoutLineItems(checkoutLoaded)
836
- // .pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)))
837
- })); };
838
847
  this.generateCartObject = function (items) {
839
848
  var cart = {};
840
849
  items === null || items === void 0 ? void 0 : items.forEach(function (item) {
841
850
  var _a;
842
- return (cart[item.sku] = i3.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
851
+ return (cart[item.sku] = i1$1.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
843
852
  });
844
853
  return cart;
845
854
  };
@@ -865,7 +874,7 @@
865
874
  });
866
875
  return [2 /*return*/, {
867
876
  checkout: checkout,
868
- lineItem: i3.LineItem.toInstance({
877
+ lineItem: i1$1.LineItem.toInstance({
869
878
  id: id,
870
879
  name: name !== null && name !== void 0 ? name : product.name,
871
880
  EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
@@ -913,23 +922,17 @@
913
922
  }); }); }), operators.mergeMap(function (_h) {
914
923
  var checkout = _h.checkout, lineItem = _h.lineItem;
915
924
  return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
916
- }),
917
- // concatMap(async (updatedCheckout) => await this.checkGifts(updatedCheckout)),
918
- // concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)),
919
- // map((checkout) => this.generateCartObject(checkout.lineItems)),
920
- operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
925
+ }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
921
926
  };
922
927
  CartService.prototype.decreaseItem = function (item) {
923
928
  var _this = this;
924
929
  return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
925
930
  var _a;
926
931
  var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
927
- if (!i3.isNil(checkoutItem))
932
+ if (!i1$1.isNil(checkoutItem))
928
933
  checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
929
934
  return checkout;
930
- }),
931
- // concatMap(async (updatedCheckout) => await this.checkGifts(updatedCheckout)),
932
- 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); }));
935
+ }), 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); }));
933
936
  };
934
937
  CartService.prototype.getCart = function (checkout) {
935
938
  var _this = this;
@@ -953,15 +956,14 @@
953
956
  };
954
957
  CartService.prototype.updateUserCart = function (user) {
955
958
  var _this = this;
956
- return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i3.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
959
+ 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 __awaiter(_this, void 0, void 0, function () {
957
960
  var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
958
961
  var _this = this;
959
962
  return __generator(this, function (_s) {
960
963
  switch (_s.label) {
961
964
  case 0:
962
- _j = (_h = this.checkoutService)
963
- .updateCheckoutLineItems;
964
- _l = (_k = i3.Checkout).toInstance;
965
+ _j = (_h = this.checkoutService).updateCheckoutLineItems;
966
+ _l = (_k = i1$1.Checkout).toInstance;
965
967
  _o = (_m = Object).assign;
966
968
  _p = [Object.assign({}, checkout.toPlain())];
967
969
  _q = {};
@@ -978,8 +980,7 @@
978
980
  case 2:
979
981
  _r = [];
980
982
  _s.label = 3;
981
- case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])])
982
- .toPromise()];
983
+ case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])]).toPromise()];
983
984
  }
984
985
  });
985
986
  }); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
@@ -995,311 +996,19 @@
995
996
  var _this = this;
996
997
  return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
997
998
  };
998
- CartService.prototype.checkGifts = function (checkout) {
999
- return __awaiter(this, void 0, void 0, function () {
1000
- var campaigns, notGiftItems, cartTotal, elegibleCampaigns, _loop_1, campaigns_1, campaigns_1_1, campaign, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, e_1_1, e_2_1, productArray, gifts;
1001
- var e_3, _k, e_2, _l, e_1, _m;
1002
- return __generator(this, function (_o) {
1003
- switch (_o.label) {
1004
- case 0: return [4 /*yield*/, this.buy2WinRepository
1005
- .find({
1006
- filters: {
1007
- active: { operator: i3.Where.EQUALS, value: true },
1008
- shop: { operator: i3.Where.EQUALS, value: this.defaultShop },
1009
- },
1010
- })
1011
- .then(function (data) { return data.data; })];
1012
- case 1:
1013
- campaigns = _o.sent();
1014
- notGiftItems = checkout.lineItems.filter(function (item) { return !item.isGift; });
1015
- if (!campaigns.length)
1016
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1017
- cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1018
- elegibleCampaigns = [];
1019
- _loop_1 = function (campaign) {
1020
- // problemas: datas, valorcart e valor cartMin, filtros no código
1021
- var today = new Date();
1022
- if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
1023
- return "continue";
1024
- // Passo 2: Verificar se a campanha é por categorias
1025
- if (campaign.activeCategory) {
1026
- var categoriesCampaing_1 = campaign.categories.map(function (c) { return c.id; });
1027
- var filterProductsCategories = checkout.lineItems.filter(function (l) {
1028
- var _a;
1029
- if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1030
- return true;
1031
- return l.categories.some(function (c) { return categoriesCampaing_1.some(function (cat) { return cat == c; }); });
1032
- });
1033
- if (filterProductsCategories.length) {
1034
- var cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1035
- if (cartTotalCategories >= campaign.cartValueMin)
1036
- elegibleCampaigns.push(campaign);
1037
- }
1038
- }
1039
- else {
1040
- if (campaign.cartValue && campaign.cartValue > 0) {
1041
- if (campaign.cartValue <= cartTotal)
1042
- elegibleCampaigns.push(campaign);
1043
- }
1044
- }
1045
- };
1046
- try {
1047
- for (campaigns_1 = __values(campaigns), campaigns_1_1 = campaigns_1.next(); !campaigns_1_1.done; campaigns_1_1 = campaigns_1.next()) {
1048
- campaign = campaigns_1_1.value;
1049
- _loop_1(campaign);
1050
- }
1051
- }
1052
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1053
- finally {
1054
- try {
1055
- if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
1056
- }
1057
- finally { if (e_3) throw e_3.error; }
1058
- }
1059
- if (!elegibleCampaigns.length)
1060
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1061
- campaingnProducts = [];
1062
- _o.label = 2;
1063
- case 2:
1064
- _o.trys.push([2, 14, 15, 16]);
1065
- elegibleCampaigns_1 = __values(elegibleCampaigns), elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1066
- _o.label = 3;
1067
- case 3:
1068
- if (!!elegibleCampaigns_1_1.done) return [3 /*break*/, 13];
1069
- campaign = elegibleCampaigns_1_1.value;
1070
- elegibleProducts = [];
1071
- _o.label = 4;
1072
- case 4:
1073
- _o.trys.push([4, 9, 10, 11]);
1074
- _h = (e_1 = void 0, __values(campaign.products)), _j = _h.next();
1075
- _o.label = 5;
1076
- case 5:
1077
- if (!!_j.done) return [3 /*break*/, 8];
1078
- product = _j.value;
1079
- return [4 /*yield*/, this.productRepository.get({ sku: product })];
1080
- case 6:
1081
- productData = _o.sent();
1082
- if (!productData)
1083
- return [3 /*break*/, 7];
1084
- elegibleProducts.push(productData);
1085
- _o.label = 7;
1086
- case 7:
1087
- _j = _h.next();
1088
- return [3 /*break*/, 5];
1089
- case 8: return [3 /*break*/, 11];
1090
- case 9:
1091
- e_1_1 = _o.sent();
1092
- e_1 = { error: e_1_1 };
1093
- return [3 /*break*/, 11];
1094
- case 10:
1095
- try {
1096
- if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1097
- }
1098
- finally { if (e_1) throw e_1.error; }
1099
- return [7 /*endfinally*/];
1100
- case 11:
1101
- campaingnProducts.push(elegibleProducts);
1102
- _o.label = 12;
1103
- case 12:
1104
- elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1105
- return [3 /*break*/, 3];
1106
- case 13: return [3 /*break*/, 16];
1107
- case 14:
1108
- e_2_1 = _o.sent();
1109
- e_2 = { error: e_2_1 };
1110
- return [3 /*break*/, 16];
1111
- case 15:
1112
- try {
1113
- if (elegibleCampaigns_1_1 && !elegibleCampaigns_1_1.done && (_l = elegibleCampaigns_1.return)) _l.call(elegibleCampaigns_1);
1114
- }
1115
- finally { if (e_2) throw e_2.error; }
1116
- return [7 /*endfinally*/];
1117
- case 16:
1118
- if (!campaingnProducts.length)
1119
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1120
- productArray = campaingnProducts.reduce(function (acc, curr) { return acc.reduce(function (aAcc, aCurr) { return aAcc + aCurr.price.price; }, 0) >
1121
- curr.reduce(function (cAcc, cCurr) { return cAcc + cCurr.price.price; }, 0)
1122
- ? acc
1123
- : curr; });
1124
- gifts = this.giftToLineItems(productArray);
1125
- checkout.lineItems = notGiftItems.concat(gifts);
1126
- return [2 /*return*/, checkout];
1127
- }
1128
- });
1129
- });
1130
- };
1131
- CartService.prototype.getGifts = function () {
1132
- var _this = this;
1133
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
1134
- var campaigns, notGiftItems, cartTotal, elegibleCampaigns, _loop_2, campaigns_2, campaigns_2_1, campaign, campaingnProducts, elegibleCampaigns_2, elegibleCampaigns_2_1, campaign, elegibleProducts, _h, _j, product, productData, e_4_1, e_5_1, productArray, gifts;
1135
- var e_6, _k, e_5, _l, e_4, _m;
1136
- return __generator(this, function (_o) {
1137
- switch (_o.label) {
1138
- case 0: return [4 /*yield*/, this.buy2WinRepository
1139
- .find({
1140
- filters: {
1141
- active: { operator: i3.Where.EQUALS, value: true },
1142
- shop: { operator: i3.Where.EQUALS, value: this.defaultShop },
1143
- },
1144
- })
1145
- .then(function (data) { return data.data; })];
1146
- case 1:
1147
- campaigns = _o.sent();
1148
- notGiftItems = checkout.lineItems.filter(function (item) { return !item.isGift; });
1149
- if (!campaigns.length)
1150
- return [2 /*return*/, notGiftItems];
1151
- cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1152
- elegibleCampaigns = [];
1153
- _loop_2 = function (campaign) {
1154
- // problemas: datas, valorcart e valor cartMin, filtros no código
1155
- var today = new Date();
1156
- if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
1157
- return "continue";
1158
- // Passo 2: Verificar se a campanha é por categorias
1159
- if (campaign.activeCategory) {
1160
- var categoriesCampaing_2 = campaign.categories.map(function (c) { return c.id; });
1161
- var filterProductsCategories = checkout.lineItems.filter(function (l) {
1162
- var _a;
1163
- if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1164
- return true;
1165
- return l.categories.some(function (c) { return categoriesCampaing_2.some(function (cat) { return cat == c; }); });
1166
- });
1167
- if (filterProductsCategories.length) {
1168
- var cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1169
- if (cartTotalCategories >= campaign.cartValueMin)
1170
- elegibleCampaigns.push(campaign);
1171
- }
1172
- }
1173
- else {
1174
- if (campaign.cartValue && campaign.cartValue > 0) {
1175
- if (campaign.cartValue <= cartTotal)
1176
- elegibleCampaigns.push(campaign);
1177
- }
1178
- }
1179
- };
1180
- try {
1181
- for (campaigns_2 = __values(campaigns), campaigns_2_1 = campaigns_2.next(); !campaigns_2_1.done; campaigns_2_1 = campaigns_2.next()) {
1182
- campaign = campaigns_2_1.value;
1183
- _loop_2(campaign);
1184
- }
1185
- }
1186
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1187
- finally {
1188
- try {
1189
- if (campaigns_2_1 && !campaigns_2_1.done && (_k = campaigns_2.return)) _k.call(campaigns_2);
1190
- }
1191
- finally { if (e_6) throw e_6.error; }
1192
- }
1193
- if (!elegibleCampaigns.length)
1194
- return [2 /*return*/, notGiftItems];
1195
- campaingnProducts = [];
1196
- _o.label = 2;
1197
- case 2:
1198
- _o.trys.push([2, 14, 15, 16]);
1199
- elegibleCampaigns_2 = __values(elegibleCampaigns), elegibleCampaigns_2_1 = elegibleCampaigns_2.next();
1200
- _o.label = 3;
1201
- case 3:
1202
- if (!!elegibleCampaigns_2_1.done) return [3 /*break*/, 13];
1203
- campaign = elegibleCampaigns_2_1.value;
1204
- elegibleProducts = [];
1205
- _o.label = 4;
1206
- case 4:
1207
- _o.trys.push([4, 9, 10, 11]);
1208
- _h = (e_4 = void 0, __values(campaign.products)), _j = _h.next();
1209
- _o.label = 5;
1210
- case 5:
1211
- if (!!_j.done) return [3 /*break*/, 8];
1212
- product = _j.value;
1213
- return [4 /*yield*/, this.productRepository.get({ sku: product })];
1214
- case 6:
1215
- productData = _o.sent();
1216
- if (!productData)
1217
- return [3 /*break*/, 7];
1218
- elegibleProducts.push(productData);
1219
- _o.label = 7;
1220
- case 7:
1221
- _j = _h.next();
1222
- return [3 /*break*/, 5];
1223
- case 8: return [3 /*break*/, 11];
1224
- case 9:
1225
- e_4_1 = _o.sent();
1226
- e_4 = { error: e_4_1 };
1227
- return [3 /*break*/, 11];
1228
- case 10:
1229
- try {
1230
- if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1231
- }
1232
- finally { if (e_4) throw e_4.error; }
1233
- return [7 /*endfinally*/];
1234
- case 11:
1235
- campaingnProducts.push(elegibleProducts);
1236
- _o.label = 12;
1237
- case 12:
1238
- elegibleCampaigns_2_1 = elegibleCampaigns_2.next();
1239
- return [3 /*break*/, 3];
1240
- case 13: return [3 /*break*/, 16];
1241
- case 14:
1242
- e_5_1 = _o.sent();
1243
- e_5 = { error: e_5_1 };
1244
- return [3 /*break*/, 16];
1245
- case 15:
1246
- try {
1247
- if (elegibleCampaigns_2_1 && !elegibleCampaigns_2_1.done && (_l = elegibleCampaigns_2.return)) _l.call(elegibleCampaigns_2);
1248
- }
1249
- finally { if (e_5) throw e_5.error; }
1250
- return [7 /*endfinally*/];
1251
- case 16:
1252
- if (!campaingnProducts.length)
1253
- return [2 /*return*/, notGiftItems];
1254
- productArray = campaingnProducts.reduce(function (acc, curr) { return acc.reduce(function (aAcc, aCurr) { return aAcc + aCurr.price.price; }, 0) >
1255
- curr.reduce(function (cAcc, cCurr) { return cAcc + cCurr.price.price; }, 0)
1256
- ? acc
1257
- : curr; });
1258
- gifts = this.giftToLineItems(productArray);
1259
- return [2 /*return*/, notGiftItems.concat(gifts)];
1260
- }
1261
- });
1262
- }); }));
1263
- };
1264
- CartService.prototype.giftToLineItems = function (items) {
1265
- return items.map(function (item) {
1266
- var _a;
1267
- var brand = item.brand, categories = item.categories, id = item.id, name = item.name, price = item.price, sku = item.sku, slug = item.slug, stock = item.stock, weight = item.weight, EAN = item.EAN;
1268
- var image = ((_a = item === null || item === void 0 ? void 0 : item.miniatures) === null || _a === void 0 ? void 0 : _a.length) ? item.miniatures[0] : item.images[0];
1269
- return i3.LineItem.toInstance({
1270
- brand: brand,
1271
- categories: categories,
1272
- id: id.toString(),
1273
- name: name,
1274
- price: price,
1275
- sku: sku,
1276
- slug: slug,
1277
- stock: stock,
1278
- weight: weight,
1279
- EAN: EAN,
1280
- image: image,
1281
- pricePaid: 0,
1282
- quantity: 1,
1283
- isGift: true,
1284
- });
1285
- });
1286
- };
1287
999
  return CartService;
1288
1000
  }());
1289
- CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1001
+ CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1290
1002
  CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
1291
1003
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
1292
1004
  type: i0.Injectable
1293
1005
  }], ctorParameters: function () {
1294
- return [{ type: AuthService }, { type: CheckoutService }, { type: i3__namespace.Shops, decorators: [{
1006
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
1295
1007
  type: i0.Inject,
1296
1008
  args: [DEFAULT_SHOP]
1297
1009
  }] }, { type: undefined, decorators: [{
1298
1010
  type: i0.Inject,
1299
1011
  args: ['ProductRepository']
1300
- }] }, { type: i3__namespace.Buy2WinFirestoreRepository, decorators: [{
1301
- type: i0.Inject,
1302
- args: ['Buy2WinRepository']
1303
1012
  }] }];
1304
1013
  } });
1305
1014
 
@@ -1311,7 +1020,7 @@
1311
1020
  }
1312
1021
  CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
1313
1022
  var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
1314
- if (!i3.isNil(checkoutId))
1023
+ if (!i1$1.isNil(checkoutId))
1315
1024
  return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
1316
1025
  return rxjs.from(this.createCheckoutSubscription(checkoutData));
1317
1026
  };
@@ -1320,7 +1029,7 @@
1320
1029
  var checkout;
1321
1030
  return __generator(this, function (_a) {
1322
1031
  switch (_a.label) {
1323
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i3.CheckoutSubscription.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()))];
1032
+ case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i1$1.CheckoutSubscription.toInstance(i1$1.pick(checkoutData, ['user', 'shop'])).toPlain()))];
1324
1033
  case 1:
1325
1034
  checkout = _a.sent();
1326
1035
  cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
@@ -1335,7 +1044,7 @@
1335
1044
  };
1336
1045
  CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
1337
1046
  var _this = this;
1338
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i3.CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe(); }));
1047
+ return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i1$1.CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe(); }));
1339
1048
  };
1340
1049
  CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
1341
1050
  var _this = this;
@@ -1366,8 +1075,8 @@
1366
1075
  this.buildCategoryGroupWithRequiredData = function (group) {
1367
1076
  var _a, _b;
1368
1077
  return ({
1369
- category: i3.Category.toInstance(i3.pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
1370
- products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map(function (product) { return i3.Product.toInstance(i3.pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
1078
+ category: i1$1.Category.toInstance(i1$1.pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
1079
+ products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map(function (product) { return i1$1.Product.toInstance(i1$1.pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
1371
1080
  'id',
1372
1081
  'price',
1373
1082
  'reviews',
@@ -1388,9 +1097,9 @@
1388
1097
  }
1389
1098
  Object.defineProperty(HomeShopService.prototype, "homeId", {
1390
1099
  get: function () {
1391
- if (this.defaultShop === i3.Shops.GLAMSHOP)
1100
+ if (this.defaultShop === i1$1.Shops.GLAMSHOP)
1392
1101
  return 'glamshop';
1393
- if (this.defaultShop === i3.Shops.MENSMARKET)
1102
+ if (this.defaultShop === i1$1.Shops.MENSMARKET)
1394
1103
  return 'mens_market';
1395
1104
  return null;
1396
1105
  },
@@ -1436,7 +1145,7 @@
1436
1145
  HomeShopService.prototype.getVerticalProducts = function () {
1437
1146
  var _this = this;
1438
1147
  return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.filter(Boolean).map(function (id) { return rxjs.from(_this.categoryRepository.get({ id: id })).pipe(operators.concatMap(function (category) { return rxjs.from(_this.productRepository.find({
1439
- filters: { categories: { operator: i3.Where.IN, value: [category.id] } },
1148
+ filters: { categories: { operator: i1$1.Where.IN, value: [category.id] } },
1440
1149
  limits: { limit: 12 },
1441
1150
  })).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_c) {
1442
1151
  var category = _c.category, products = _c.products;
@@ -1448,14 +1157,14 @@
1448
1157
  return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
1449
1158
  ? rxjs.of(home)
1450
1159
  : !_this.homeId
1451
- ? rxjs.throwError(new i3.RequiredArgumentError(['homeId']))
1160
+ ? rxjs.throwError(new i1$1.RequiredArgumentError(['homeId']))
1452
1161
  : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
1453
1162
  };
1454
1163
  HomeShopService.prototype.saveHomeData = function (homeData) {
1455
1164
  var _this = this;
1456
1165
  var data = {
1457
1166
  createdAt: new Date(),
1458
- expiresAt: i3.add(new Date(), { hours: 1 }),
1167
+ expiresAt: i1$1.add(new Date(), { hours: 1 }),
1459
1168
  data: homeData,
1460
1169
  };
1461
1170
  return rxjs.from(this.homeRepository.update({
@@ -1479,7 +1188,7 @@
1479
1188
  }] }, { type: undefined, decorators: [{
1480
1189
  type: i0.Inject,
1481
1190
  args: ['ProductRepository']
1482
- }] }, { type: i3__namespace.Shops, decorators: [{
1191
+ }] }, { type: i1__namespace$1.Shops, decorators: [{
1483
1192
  type: i0.Inject,
1484
1193
  args: [DEFAULT_SHOP]
1485
1194
  }] }];
@@ -1496,18 +1205,18 @@
1496
1205
  this.angularFirestore
1497
1206
  .doc(this.orderRepository.collectionName + "/" + id)
1498
1207
  .valueChanges()
1499
- .pipe(operators.map(function (doc) { return i3.Order.toInstance(doc); }))
1208
+ .pipe(operators.map(function (doc) { return i1$1.Order.toInstance(doc); }))
1500
1209
  .subscribe(function (doc) { return _this.orderSubject.next(doc); });
1501
1210
  return this.orderSubject;
1502
1211
  };
1503
1212
  return OrderService;
1504
1213
  }());
1505
- 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 });
1214
+ OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1506
1215
  OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
1507
1216
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
1508
1217
  type: i0.Injectable
1509
1218
  }], ctorParameters: function () {
1510
- return [{ type: i1__namespace$1.AngularFirestore }, { type: i3__namespace.OrderFirestoreRepository, decorators: [{
1219
+ return [{ type: i1__namespace$2.AngularFirestore }, { type: i1__namespace$1.OrderFirestoreRepository, decorators: [{
1511
1220
  type: i0.Inject,
1512
1221
  args: ['OrderRepository']
1513
1222
  }] }];
@@ -1523,8 +1232,9 @@
1523
1232
  var _this = this;
1524
1233
  return rxjs.combineLatest([
1525
1234
  this.homeService.getHomeData(),
1526
- this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams),
1527
- ]).pipe(operators.map(function (_a) {
1235
+ this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams)
1236
+ ])
1237
+ .pipe(operators.map(function (_a) {
1528
1238
  var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
1529
1239
  var shippingMethods = shippingMethodsResponse.result;
1530
1240
  if (!shippingMethods.length)
@@ -1547,7 +1257,7 @@
1547
1257
  return s;
1548
1258
  });
1549
1259
  }
1550
- if (shop == i3.Shops.GLAMSHOP)
1260
+ if (shop == i1$1.Shops.GLAMSHOP)
1551
1261
  return shippingMethods;
1552
1262
  if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1553
1263
  shippingMethods = shippingMethods.map(function (s) {
@@ -1568,7 +1278,7 @@
1568
1278
  ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
1569
1279
  if (!subscriptionPlan)
1570
1280
  return false;
1571
- if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1281
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1572
1282
  return true;
1573
1283
  }
1574
1284
  return false;
@@ -1576,7 +1286,7 @@
1576
1286
  ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
1577
1287
  if (!subscriptionPlan)
1578
1288
  return false;
1579
- if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1289
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1580
1290
  return true;
1581
1291
  }
1582
1292
  return false;
@@ -1595,12 +1305,12 @@
1595
1305
  };
1596
1306
  return ShippingService;
1597
1307
  }());
1598
- ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$2.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1308
+ ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$3.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1599
1309
  ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
1600
1310
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
1601
1311
  type: i0.Injectable
1602
1312
  }], ctorParameters: function () {
1603
- return [{ type: i1__namespace$2.HttpClient }, { type: undefined, decorators: [{
1313
+ return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
1604
1314
  type: i0.Inject,
1605
1315
  args: [BACKEND_URL]
1606
1316
  }] }, { type: HomeShopService }];
@@ -1626,42 +1336,42 @@
1626
1336
  {
1627
1337
  provide: 'Authentication',
1628
1338
  useFactory: function (authenticationService, userRepository) {
1629
- return new i3.Authentication(authenticationService, userRepository);
1339
+ return new i1$1.Authentication(authenticationService, userRepository);
1630
1340
  },
1631
1341
  deps: ['AuthenticationService', 'UserRepository'],
1632
1342
  },
1633
1343
  {
1634
1344
  provide: 'AuthenticationService',
1635
1345
  useFactory: function (angularFireAuth) {
1636
- return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
1346
+ return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
1637
1347
  },
1638
1348
  deps: [i1.AngularFireAuth],
1639
1349
  },
1640
1350
  {
1641
1351
  provide: 'Register',
1642
1352
  useFactory: function (registerService, userRepository) {
1643
- return new i3.Register(registerService, userRepository);
1353
+ return new i1$1.Register(registerService, userRepository);
1644
1354
  },
1645
1355
  deps: ['RegisterService', 'UserRepository'],
1646
1356
  },
1647
1357
  {
1648
1358
  provide: 'RegisterService',
1649
1359
  useFactory: function (angularFireAuth) {
1650
- return new i3.RegisterFirebaseAuthService(angularFireAuth);
1360
+ return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
1651
1361
  },
1652
1362
  deps: [i1.AngularFireAuth],
1653
1363
  },
1654
1364
  {
1655
1365
  provide: 'SignOut',
1656
1366
  useFactory: function (authenticationService) {
1657
- return new i3.SignOut(authenticationService);
1367
+ return new i1$1.SignOut(authenticationService);
1658
1368
  },
1659
1369
  deps: ['AuthenticationService'],
1660
1370
  },
1661
1371
  {
1662
1372
  provide: 'RecoveryPassword',
1663
1373
  useFactory: function (authenticationService) {
1664
- return new i3.RecoveryPassword(authenticationService);
1374
+ return new i1$1.RecoveryPassword(authenticationService);
1665
1375
  },
1666
1376
  deps: ['AuthenticationService'],
1667
1377
  },
@@ -1674,42 +1384,42 @@
1674
1384
  {
1675
1385
  provide: 'Authentication',
1676
1386
  useFactory: function (authenticationService, userRepository) {
1677
- return new i3.Authentication(authenticationService, userRepository);
1387
+ return new i1$1.Authentication(authenticationService, userRepository);
1678
1388
  },
1679
1389
  deps: ['AuthenticationService', 'UserRepository'],
1680
1390
  },
1681
1391
  {
1682
1392
  provide: 'AuthenticationService',
1683
1393
  useFactory: function (angularFireAuth) {
1684
- return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
1394
+ return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
1685
1395
  },
1686
1396
  deps: [i1.AngularFireAuth],
1687
1397
  },
1688
1398
  {
1689
1399
  provide: 'Register',
1690
1400
  useFactory: function (registerService, userRepository) {
1691
- return new i3.Register(registerService, userRepository);
1401
+ return new i1$1.Register(registerService, userRepository);
1692
1402
  },
1693
1403
  deps: ['RegisterService', 'UserRepository'],
1694
1404
  },
1695
1405
  {
1696
1406
  provide: 'RegisterService',
1697
1407
  useFactory: function (angularFireAuth) {
1698
- return new i3.RegisterFirebaseAuthService(angularFireAuth);
1408
+ return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
1699
1409
  },
1700
1410
  deps: [i1.AngularFireAuth],
1701
1411
  },
1702
1412
  {
1703
1413
  provide: 'SignOut',
1704
1414
  useFactory: function (authenticationService) {
1705
- return new i3.SignOut(authenticationService);
1415
+ return new i1$1.SignOut(authenticationService);
1706
1416
  },
1707
1417
  deps: ['AuthenticationService'],
1708
1418
  },
1709
1419
  {
1710
1420
  provide: 'RecoveryPassword',
1711
1421
  useFactory: function (authenticationService) {
1712
- return new i3.RecoveryPassword(authenticationService);
1422
+ return new i1$1.RecoveryPassword(authenticationService);
1713
1423
  },
1714
1424
  deps: ['AuthenticationService'],
1715
1425
  },
@@ -1732,9 +1442,9 @@
1732
1442
  AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
1733
1443
  AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
1734
1444
  {
1735
- provide: i3.ProductsIndex,
1445
+ provide: i1$1.ProductsIndex,
1736
1446
  useFactory: function (configuration) {
1737
- return new i3.ProductsIndex(new i3.AxiosAdapter(configuration));
1447
+ return new i1$1.ProductsIndex(new i1$1.AxiosAdapter(configuration));
1738
1448
  },
1739
1449
  deps: [ES_CONFIG],
1740
1450
  },
@@ -1744,9 +1454,9 @@
1744
1454
  args: [{
1745
1455
  providers: [
1746
1456
  {
1747
- provide: i3.ProductsIndex,
1457
+ provide: i1$1.ProductsIndex,
1748
1458
  useFactory: function (configuration) {
1749
- return new i3.ProductsIndex(new i3.AxiosAdapter(configuration));
1459
+ return new i1$1.ProductsIndex(new i1$1.AxiosAdapter(configuration));
1750
1460
  },
1751
1461
  deps: [ES_CONFIG],
1752
1462
  },
@@ -1775,161 +1485,168 @@
1775
1485
  {
1776
1486
  provide: 'BeautyProfileRepository',
1777
1487
  useFactory: function (firestore, userRepository) {
1778
- return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1488
+ return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1779
1489
  },
1780
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1490
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1781
1491
  },
1782
1492
  {
1783
1493
  provide: 'Buy2WinRepository',
1784
1494
  useFactory: function (firestore) {
1785
- return new i3.Buy2WinFirestoreRepository(firestore.firestore);
1495
+ return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
1786
1496
  },
1787
- deps: [i1$1.AngularFirestore],
1497
+ deps: [i1$2.AngularFirestore],
1788
1498
  },
1789
1499
  {
1790
- provide: i3.CategoryFirestoreRepository,
1500
+ provide: i1$1.CategoryFirestoreRepository,
1791
1501
  useFactory: function (firestore) {
1792
- return new i3.CategoryFirestoreRepository(firestore.firestore);
1502
+ return new i1$1.CategoryFirestoreRepository(firestore.firestore);
1793
1503
  },
1794
- deps: [i1$1.AngularFirestore],
1504
+ deps: [i1$2.AngularFirestore],
1795
1505
  },
1796
1506
  {
1797
1507
  provide: 'CheckoutRepository',
1798
1508
  useFactory: function (firestore) {
1799
- return new i3.CheckoutFirestoreRepository(firestore.firestore);
1509
+ return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
1800
1510
  },
1801
- deps: [i1$1.AngularFirestore],
1511
+ deps: [i1$2.AngularFirestore],
1802
1512
  },
1803
1513
  {
1804
1514
  provide: 'CheckoutSubscriptionRepository',
1805
1515
  useFactory: function (firestore) {
1806
- return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1516
+ return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1807
1517
  },
1808
- deps: [i1$1.AngularFirestore],
1518
+ deps: [i1$2.AngularFirestore],
1809
1519
  },
1810
1520
  {
1811
1521
  provide: 'CouponRepository',
1812
1522
  useFactory: function (firestore) {
1813
- return new i3.CouponFirestoreRepository(firestore.firestore);
1523
+ return new i1$1.CouponFirestoreRepository(firestore.firestore);
1814
1524
  },
1815
- deps: [i1$1.AngularFirestore],
1525
+ deps: [i1$2.AngularFirestore],
1816
1526
  },
1817
1527
  {
1818
1528
  provide: 'EditionRepository',
1819
1529
  useFactory: function (firestore, subscriptionRepository) {
1820
- return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1530
+ return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1821
1531
  },
1822
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1532
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1823
1533
  },
1824
1534
  {
1825
1535
  provide: 'HomeRepository',
1826
1536
  useFactory: function (firestore) {
1827
- return new i3.HomeFirestoreRepository(firestore.firestore);
1537
+ return new i1$1.HomeFirestoreRepository(firestore.firestore);
1828
1538
  },
1829
- deps: [i1$1.AngularFirestore],
1539
+ deps: [i1$2.AngularFirestore],
1830
1540
  },
1831
1541
  {
1832
1542
  provide: 'LeadRepository',
1833
1543
  useFactory: function (firestore) {
1834
- return new i3.LeadFirestoreRepository(firestore.firestore);
1544
+ return new i1$1.LeadFirestoreRepository(firestore.firestore);
1835
1545
  },
1836
- deps: [i1$1.AngularFirestore],
1546
+ deps: [i1$2.AngularFirestore],
1837
1547
  },
1838
1548
  {
1839
1549
  provide: 'LegacyOrderRepository',
1840
1550
  useFactory: function (firestore) {
1841
- return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
1551
+ return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
1842
1552
  },
1843
- deps: [i1$1.AngularFirestore],
1553
+ deps: [i1$2.AngularFirestore],
1844
1554
  },
1845
1555
  {
1846
1556
  provide: 'ShopMenuRepository',
1847
1557
  useFactory: function (firestore) {
1848
- return new i3.ShopMenuFirestoreRepository(firestore.firestore);
1558
+ return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
1849
1559
  },
1850
- deps: [i1$1.AngularFirestore],
1560
+ deps: [i1$2.AngularFirestore],
1851
1561
  },
1852
1562
  {
1853
1563
  provide: 'OrderRepository',
1854
1564
  useFactory: function (firestore) {
1855
- return new i3.OrderFirestoreRepository(firestore.firestore);
1565
+ return new i1$1.OrderFirestoreRepository(firestore.firestore);
1856
1566
  },
1857
- deps: [i1$1.AngularFirestore],
1567
+ deps: [i1$2.AngularFirestore],
1858
1568
  },
1859
1569
  {
1860
1570
  provide: 'PaymentRepository',
1861
1571
  useFactory: function (firestore) {
1862
- return new i3.PaymentFirestoreRepository(firestore.firestore);
1572
+ return new i1$1.PaymentFirestoreRepository(firestore.firestore);
1573
+ },
1574
+ deps: [i1$2.AngularFirestore],
1575
+ },
1576
+ {
1577
+ provide: i1$1.ProductFirestoreRepository,
1578
+ useFactory: function (firestore) {
1579
+ return new i1$1.ProductFirestoreRepository(firestore.firestore);
1863
1580
  },
1864
- deps: [i1$1.AngularFirestore],
1581
+ deps: [i1$2.AngularFirestore],
1865
1582
  },
1866
1583
  {
1867
- provide: i3.ProductFirestoreRepository,
1584
+ provide: 'ShopSettingsRepository',
1868
1585
  useFactory: function (firestore) {
1869
- return new i3.ProductFirestoreRepository(firestore.firestore);
1586
+ return new i1$1.ShopSettingsFirestoreRepository(firestore.firestore);
1870
1587
  },
1871
- deps: [i1$1.AngularFirestore],
1588
+ deps: [i1$2.AngularFirestore],
1872
1589
  },
1873
1590
  {
1874
1591
  provide: 'SubscriptionPaymentRepository',
1875
1592
  useFactory: function (firestore, subscriptionRepository) {
1876
- return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1593
+ return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1877
1594
  },
1878
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1595
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1879
1596
  },
1880
1597
  {
1881
1598
  provide: 'SubscriptionPlanRepository',
1882
1599
  useFactory: function (firestore) {
1883
- return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
1600
+ return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
1884
1601
  },
1885
- deps: [i1$1.AngularFirestore],
1602
+ deps: [i1$2.AngularFirestore],
1886
1603
  },
1887
1604
  {
1888
1605
  provide: 'SubscriptionProductRepository',
1889
1606
  useFactory: function (firestore) {
1890
- return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
1607
+ return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
1891
1608
  },
1892
- deps: [i1$1.AngularFirestore],
1609
+ deps: [i1$2.AngularFirestore],
1893
1610
  },
1894
1611
  {
1895
1612
  provide: 'SubscriptionRepository',
1896
1613
  useFactory: function (firestore) {
1897
- return new i3.SubscriptionFirestoreRepository(firestore.firestore);
1614
+ return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
1898
1615
  },
1899
- deps: [i1$1.AngularFirestore],
1616
+ deps: [i1$2.AngularFirestore],
1900
1617
  },
1901
1618
  {
1902
1619
  provide: 'UserRepository',
1903
1620
  useFactory: function (firestore) {
1904
- return new i3.UserFirestoreRepository(firestore.firestore);
1621
+ return new i1$1.UserFirestoreRepository(firestore.firestore);
1905
1622
  },
1906
- deps: [i1$1.AngularFirestore],
1623
+ deps: [i1$2.AngularFirestore],
1907
1624
  },
1908
1625
  {
1909
1626
  provide: 'UserAddressRepository',
1910
1627
  useFactory: function (firestore, userRepository) {
1911
- return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1628
+ return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1912
1629
  },
1913
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1630
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1914
1631
  },
1915
1632
  {
1916
1633
  provide: 'UserPaymentMethodRepository',
1917
1634
  useFactory: function (firestore, userRepository) {
1918
- return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1635
+ return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1919
1636
  },
1920
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1637
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1921
1638
  },
1922
1639
  {
1923
- provide: i3.ProductVariantFirestoreRepository,
1640
+ provide: i1$1.ProductVariantFirestoreRepository,
1924
1641
  useFactory: function (firestore, productRepository) {
1925
- return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1642
+ return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1926
1643
  },
1927
- deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
1644
+ deps: [i1$2.AngularFirestore, i1$1.ProductFirestoreRepository],
1928
1645
  },
1929
1646
  {
1930
1647
  provide: i0.APP_INITIALIZER,
1931
1648
  useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
1932
- deps: [i1$1.AngularFirestore],
1649
+ deps: [i1$2.AngularFirestore],
1933
1650
  multi: true,
1934
1651
  },
1935
1652
  ], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
@@ -1941,161 +1658,168 @@
1941
1658
  {
1942
1659
  provide: 'BeautyProfileRepository',
1943
1660
  useFactory: function (firestore, userRepository) {
1944
- return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1661
+ return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1945
1662
  },
1946
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1663
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1947
1664
  },
1948
1665
  {
1949
1666
  provide: 'Buy2WinRepository',
1950
1667
  useFactory: function (firestore) {
1951
- return new i3.Buy2WinFirestoreRepository(firestore.firestore);
1668
+ return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
1952
1669
  },
1953
- deps: [i1$1.AngularFirestore],
1670
+ deps: [i1$2.AngularFirestore],
1954
1671
  },
1955
1672
  {
1956
- provide: i3.CategoryFirestoreRepository,
1673
+ provide: i1$1.CategoryFirestoreRepository,
1957
1674
  useFactory: function (firestore) {
1958
- return new i3.CategoryFirestoreRepository(firestore.firestore);
1675
+ return new i1$1.CategoryFirestoreRepository(firestore.firestore);
1959
1676
  },
1960
- deps: [i1$1.AngularFirestore],
1677
+ deps: [i1$2.AngularFirestore],
1961
1678
  },
1962
1679
  {
1963
1680
  provide: 'CheckoutRepository',
1964
1681
  useFactory: function (firestore) {
1965
- return new i3.CheckoutFirestoreRepository(firestore.firestore);
1682
+ return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
1966
1683
  },
1967
- deps: [i1$1.AngularFirestore],
1684
+ deps: [i1$2.AngularFirestore],
1968
1685
  },
1969
1686
  {
1970
1687
  provide: 'CheckoutSubscriptionRepository',
1971
1688
  useFactory: function (firestore) {
1972
- return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1689
+ return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1973
1690
  },
1974
- deps: [i1$1.AngularFirestore],
1691
+ deps: [i1$2.AngularFirestore],
1975
1692
  },
1976
1693
  {
1977
1694
  provide: 'CouponRepository',
1978
1695
  useFactory: function (firestore) {
1979
- return new i3.CouponFirestoreRepository(firestore.firestore);
1696
+ return new i1$1.CouponFirestoreRepository(firestore.firestore);
1980
1697
  },
1981
- deps: [i1$1.AngularFirestore],
1698
+ deps: [i1$2.AngularFirestore],
1982
1699
  },
1983
1700
  {
1984
1701
  provide: 'EditionRepository',
1985
1702
  useFactory: function (firestore, subscriptionRepository) {
1986
- return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1703
+ return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1987
1704
  },
1988
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1705
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1989
1706
  },
1990
1707
  {
1991
1708
  provide: 'HomeRepository',
1992
1709
  useFactory: function (firestore) {
1993
- return new i3.HomeFirestoreRepository(firestore.firestore);
1710
+ return new i1$1.HomeFirestoreRepository(firestore.firestore);
1994
1711
  },
1995
- deps: [i1$1.AngularFirestore],
1712
+ deps: [i1$2.AngularFirestore],
1996
1713
  },
1997
1714
  {
1998
1715
  provide: 'LeadRepository',
1999
1716
  useFactory: function (firestore) {
2000
- return new i3.LeadFirestoreRepository(firestore.firestore);
1717
+ return new i1$1.LeadFirestoreRepository(firestore.firestore);
2001
1718
  },
2002
- deps: [i1$1.AngularFirestore],
1719
+ deps: [i1$2.AngularFirestore],
2003
1720
  },
2004
1721
  {
2005
1722
  provide: 'LegacyOrderRepository',
2006
1723
  useFactory: function (firestore) {
2007
- return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
1724
+ return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
2008
1725
  },
2009
- deps: [i1$1.AngularFirestore],
1726
+ deps: [i1$2.AngularFirestore],
2010
1727
  },
2011
1728
  {
2012
1729
  provide: 'ShopMenuRepository',
2013
1730
  useFactory: function (firestore) {
2014
- return new i3.ShopMenuFirestoreRepository(firestore.firestore);
1731
+ return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
2015
1732
  },
2016
- deps: [i1$1.AngularFirestore],
1733
+ deps: [i1$2.AngularFirestore],
2017
1734
  },
2018
1735
  {
2019
1736
  provide: 'OrderRepository',
2020
1737
  useFactory: function (firestore) {
2021
- return new i3.OrderFirestoreRepository(firestore.firestore);
1738
+ return new i1$1.OrderFirestoreRepository(firestore.firestore);
2022
1739
  },
2023
- deps: [i1$1.AngularFirestore],
1740
+ deps: [i1$2.AngularFirestore],
2024
1741
  },
2025
1742
  {
2026
1743
  provide: 'PaymentRepository',
2027
1744
  useFactory: function (firestore) {
2028
- return new i3.PaymentFirestoreRepository(firestore.firestore);
1745
+ return new i1$1.PaymentFirestoreRepository(firestore.firestore);
1746
+ },
1747
+ deps: [i1$2.AngularFirestore],
1748
+ },
1749
+ {
1750
+ provide: i1$1.ProductFirestoreRepository,
1751
+ useFactory: function (firestore) {
1752
+ return new i1$1.ProductFirestoreRepository(firestore.firestore);
2029
1753
  },
2030
- deps: [i1$1.AngularFirestore],
1754
+ deps: [i1$2.AngularFirestore],
2031
1755
  },
2032
1756
  {
2033
- provide: i3.ProductFirestoreRepository,
1757
+ provide: 'ShopSettingsRepository',
2034
1758
  useFactory: function (firestore) {
2035
- return new i3.ProductFirestoreRepository(firestore.firestore);
1759
+ return new i1$1.ShopSettingsFirestoreRepository(firestore.firestore);
2036
1760
  },
2037
- deps: [i1$1.AngularFirestore],
1761
+ deps: [i1$2.AngularFirestore],
2038
1762
  },
2039
1763
  {
2040
1764
  provide: 'SubscriptionPaymentRepository',
2041
1765
  useFactory: function (firestore, subscriptionRepository) {
2042
- return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1766
+ return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
2043
1767
  },
2044
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1768
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
2045
1769
  },
2046
1770
  {
2047
1771
  provide: 'SubscriptionPlanRepository',
2048
1772
  useFactory: function (firestore) {
2049
- return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
1773
+ return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
2050
1774
  },
2051
- deps: [i1$1.AngularFirestore],
1775
+ deps: [i1$2.AngularFirestore],
2052
1776
  },
2053
1777
  {
2054
1778
  provide: 'SubscriptionProductRepository',
2055
1779
  useFactory: function (firestore) {
2056
- return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
1780
+ return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
2057
1781
  },
2058
- deps: [i1$1.AngularFirestore],
1782
+ deps: [i1$2.AngularFirestore],
2059
1783
  },
2060
1784
  {
2061
1785
  provide: 'SubscriptionRepository',
2062
1786
  useFactory: function (firestore) {
2063
- return new i3.SubscriptionFirestoreRepository(firestore.firestore);
1787
+ return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
2064
1788
  },
2065
- deps: [i1$1.AngularFirestore],
1789
+ deps: [i1$2.AngularFirestore],
2066
1790
  },
2067
1791
  {
2068
1792
  provide: 'UserRepository',
2069
1793
  useFactory: function (firestore) {
2070
- return new i3.UserFirestoreRepository(firestore.firestore);
1794
+ return new i1$1.UserFirestoreRepository(firestore.firestore);
2071
1795
  },
2072
- deps: [i1$1.AngularFirestore],
1796
+ deps: [i1$2.AngularFirestore],
2073
1797
  },
2074
1798
  {
2075
1799
  provide: 'UserAddressRepository',
2076
1800
  useFactory: function (firestore, userRepository) {
2077
- return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1801
+ return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
2078
1802
  },
2079
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1803
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
2080
1804
  },
2081
1805
  {
2082
1806
  provide: 'UserPaymentMethodRepository',
2083
1807
  useFactory: function (firestore, userRepository) {
2084
- return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1808
+ return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
2085
1809
  },
2086
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1810
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
2087
1811
  },
2088
1812
  {
2089
- provide: i3.ProductVariantFirestoreRepository,
1813
+ provide: i1$1.ProductVariantFirestoreRepository,
2090
1814
  useFactory: function (firestore, productRepository) {
2091
- return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1815
+ return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
2092
1816
  },
2093
- deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
1817
+ deps: [i1$2.AngularFirestore, i1$1.ProductFirestoreRepository],
2094
1818
  },
2095
1819
  {
2096
1820
  provide: i0.APP_INITIALIZER,
2097
1821
  useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
2098
- deps: [i1$1.AngularFirestore],
1822
+ deps: [i1$2.AngularFirestore],
2099
1823
  multi: true,
2100
1824
  },
2101
1825
  ],
@@ -2118,70 +1842,37 @@
2118
1842
  AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
2119
1843
  {
2120
1844
  provide: 'CategoryRepository',
2121
- useExisting: i3.CategoryHasuraGraphQLRepository,
1845
+ useExisting: i1$1.CategoryHasuraGraphQLRepository,
2122
1846
  },
2123
1847
  {
2124
- provide: i3.CategoryHasuraGraphQLRepository,
2125
- useFactory: function (options, productRepository, categoryFilterRepository) {
2126
- return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
1848
+ provide: i1$1.CategoryHasuraGraphQLRepository,
1849
+ useFactory: function (options, productRepository) {
1850
+ return new i1$1.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
2127
1851
  },
2128
- deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
1852
+ deps: [HASURA_OPTIONS, i1$1.ProductHasuraGraphQLRepository],
2129
1853
  },
2130
1854
  {
2131
1855
  provide: 'ProductRepository',
2132
- useExisting: i3.ProductHasuraGraphQLRepository,
1856
+ useExisting: i1$1.ProductHasuraGraphQLRepository,
2133
1857
  },
2134
1858
  {
2135
- provide: i3.ProductHasuraGraphQLRepository,
1859
+ provide: i1$1.ProductHasuraGraphQLRepository,
2136
1860
  useFactory: function (options) {
2137
- return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1861
+ return new i1$1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
2138
1862
  },
2139
1863
  deps: [HASURA_OPTIONS],
2140
1864
  },
2141
1865
  {
2142
1866
  provide: 'VariantRepository',
2143
- useExisting: i3.VariantHasuraGraphQLRepository,
1867
+ useExisting: i1$1.VariantHasuraGraphQLRepository,
2144
1868
  },
2145
1869
  {
2146
- provide: i3.VariantHasuraGraphQLRepository,
1870
+ provide: i1$1.VariantHasuraGraphQLRepository,
2147
1871
  useFactory: function (options) {
2148
- return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1872
+ return new i1$1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
2149
1873
  },
2150
1874
  deps: [HASURA_OPTIONS],
2151
1875
  },
2152
- {
2153
- provide: 'CategoryFilterRepository',
2154
- useExisting: i3.CategoryFilterHasuraGraphQLRepository,
2155
- },
2156
- {
2157
- provide: i3.CategoryFilterHasuraGraphQLRepository,
2158
- useFactory: function (options) {
2159
- return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
2160
- },
2161
- deps: [HASURA_OPTIONS],
2162
- },
2163
- {
2164
- provide: 'FilterOptionRepository',
2165
- useExisting: i3.FilterOptionHasuraGraphQLRepository,
2166
- },
2167
- {
2168
- provide: i3.FilterOptionHasuraGraphQLRepository,
2169
- useFactory: function (options) {
2170
- return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
2171
- },
2172
- deps: [HASURA_OPTIONS],
2173
- },
2174
- {
2175
- provide: 'FilterRepository',
2176
- useExisting: i3.FilterHasuraGraphQLRepository,
2177
- },
2178
- {
2179
- provide: i3.FilterHasuraGraphQLRepository,
2180
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
2181
- return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
2182
- },
2183
- deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
2184
- },
2185
1876
  ] });
2186
1877
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
2187
1878
  type: i0.NgModule,
@@ -2189,70 +1880,37 @@
2189
1880
  providers: [
2190
1881
  {
2191
1882
  provide: 'CategoryRepository',
2192
- useExisting: i3.CategoryHasuraGraphQLRepository,
1883
+ useExisting: i1$1.CategoryHasuraGraphQLRepository,
2193
1884
  },
2194
1885
  {
2195
- provide: i3.CategoryHasuraGraphQLRepository,
2196
- useFactory: function (options, productRepository, categoryFilterRepository) {
2197
- return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
1886
+ provide: i1$1.CategoryHasuraGraphQLRepository,
1887
+ useFactory: function (options, productRepository) {
1888
+ return new i1$1.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
2198
1889
  },
2199
- deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
1890
+ deps: [HASURA_OPTIONS, i1$1.ProductHasuraGraphQLRepository],
2200
1891
  },
2201
1892
  {
2202
1893
  provide: 'ProductRepository',
2203
- useExisting: i3.ProductHasuraGraphQLRepository,
1894
+ useExisting: i1$1.ProductHasuraGraphQLRepository,
2204
1895
  },
2205
1896
  {
2206
- provide: i3.ProductHasuraGraphQLRepository,
1897
+ provide: i1$1.ProductHasuraGraphQLRepository,
2207
1898
  useFactory: function (options) {
2208
- return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1899
+ return new i1$1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
2209
1900
  },
2210
1901
  deps: [HASURA_OPTIONS],
2211
1902
  },
2212
1903
  {
2213
1904
  provide: 'VariantRepository',
2214
- useExisting: i3.VariantHasuraGraphQLRepository,
1905
+ useExisting: i1$1.VariantHasuraGraphQLRepository,
2215
1906
  },
2216
1907
  {
2217
- provide: i3.VariantHasuraGraphQLRepository,
1908
+ provide: i1$1.VariantHasuraGraphQLRepository,
2218
1909
  useFactory: function (options) {
2219
- return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1910
+ return new i1$1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
2220
1911
  },
2221
1912
  deps: [HASURA_OPTIONS],
2222
1913
  },
2223
- {
2224
- provide: 'CategoryFilterRepository',
2225
- useExisting: i3.CategoryFilterHasuraGraphQLRepository,
2226
- },
2227
- {
2228
- provide: i3.CategoryFilterHasuraGraphQLRepository,
2229
- useFactory: function (options) {
2230
- return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
2231
- },
2232
- deps: [HASURA_OPTIONS],
2233
- },
2234
- {
2235
- provide: 'FilterOptionRepository',
2236
- useExisting: i3.FilterOptionHasuraGraphQLRepository,
2237
- },
2238
- {
2239
- provide: i3.FilterOptionHasuraGraphQLRepository,
2240
- useFactory: function (options) {
2241
- return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
2242
- },
2243
- deps: [HASURA_OPTIONS],
2244
- },
2245
- {
2246
- provide: 'FilterRepository',
2247
- useExisting: i3.FilterHasuraGraphQLRepository,
2248
- },
2249
- {
2250
- provide: i3.FilterHasuraGraphQLRepository,
2251
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
2252
- return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
2253
- },
2254
- deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
2255
- },
2256
1914
  ],
2257
1915
  }]
2258
1916
  }] });
@@ -2263,7 +1921,7 @@
2263
1921
  AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
2264
1922
  return {
2265
1923
  ngModule: AngularConnectModule,
2266
- providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i3.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
1924
+ providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i1$1.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
2267
1925
  };
2268
1926
  };
2269
1927
  return AngularConnectModule;
@@ -2278,7 +1936,7 @@
2278
1936
  CouponService,
2279
1937
  HomeShopService,
2280
1938
  OrderService,
2281
- ShippingService,
1939
+ ShippingService
2282
1940
  ], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
2283
1941
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
2284
1942
  type: i0.NgModule,
@@ -2292,7 +1950,7 @@
2292
1950
  CouponService,
2293
1951
  HomeShopService,
2294
1952
  OrderService,
2295
- ShippingService,
1953
+ ShippingService
2296
1954
  ],
2297
1955
  }]
2298
1956
  }] });