@infrab4a/connect-angular 3.6.0-beta.15 → 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);
@@ -824,7 +848,7 @@
824
848
  var cart = {};
825
849
  items === null || items === void 0 ? void 0 : items.forEach(function (item) {
826
850
  var _a;
827
- 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) })));
828
852
  });
829
853
  return cart;
830
854
  };
@@ -850,7 +874,7 @@
850
874
  });
851
875
  return [2 /*return*/, {
852
876
  checkout: checkout,
853
- lineItem: i3.LineItem.toInstance({
877
+ lineItem: i1$1.LineItem.toInstance({
854
878
  id: id,
855
879
  name: name !== null && name !== void 0 ? name : product.name,
856
880
  EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
@@ -905,7 +929,7 @@
905
929
  return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
906
930
  var _a;
907
931
  var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
908
- if (!i3.isNil(checkoutItem))
932
+ if (!i1$1.isNil(checkoutItem))
909
933
  checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
910
934
  return checkout;
911
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); }));
@@ -932,15 +956,14 @@
932
956
  };
933
957
  CartService.prototype.updateUserCart = function (user) {
934
958
  var _this = this;
935
- 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 () {
936
960
  var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
937
961
  var _this = this;
938
962
  return __generator(this, function (_s) {
939
963
  switch (_s.label) {
940
964
  case 0:
941
- _j = (_h = this.checkoutService)
942
- .updateCheckoutLineItems;
943
- _l = (_k = i3.Checkout).toInstance;
965
+ _j = (_h = this.checkoutService).updateCheckoutLineItems;
966
+ _l = (_k = i1$1.Checkout).toInstance;
944
967
  _o = (_m = Object).assign;
945
968
  _p = [Object.assign({}, checkout.toPlain())];
946
969
  _q = {};
@@ -957,8 +980,7 @@
957
980
  case 2:
958
981
  _r = [];
959
982
  _s.label = 3;
960
- case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])])
961
- .toPromise()];
983
+ case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])]).toPromise()];
962
984
  }
963
985
  });
964
986
  }); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
@@ -974,305 +996,19 @@
974
996
  var _this = this;
975
997
  return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
976
998
  };
977
- CartService.prototype.checkGifts = function (checkout) {
978
- return __awaiter(this, void 0, void 0, function () {
979
- 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;
980
- var e_3, _k, e_2, _l, e_1, _m;
981
- return __generator(this, function (_o) {
982
- switch (_o.label) {
983
- case 0: return [4 /*yield*/, this.buy2WinRepository
984
- .find({
985
- filters: {
986
- active: { operator: i3.Where.EQUALS, value: true },
987
- shop: { operator: i3.Where.EQUALS, value: this.defaultShop },
988
- },
989
- })
990
- .then(function (data) { return data.data; })];
991
- case 1:
992
- campaigns = _o.sent();
993
- notGiftItems = checkout.lineItems.filter(function (item) { return !item.isGift; });
994
- if (!campaigns.length)
995
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
996
- cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
997
- elegibleCampaigns = [];
998
- _loop_1 = function (campaign) {
999
- // problemas: datas, valorcart e valor cartMin, filtros no código
1000
- var today = new Date();
1001
- if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
1002
- return "continue";
1003
- // Passo 2: Verificar se a campanha é por categorias
1004
- if (campaign.activeCategory) {
1005
- var categoriesCampaing_1 = campaign.categories.map(function (c) { return c.id; });
1006
- var filterProductsCategories = checkout.lineItems.filter(function (l) {
1007
- var _a;
1008
- if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1009
- return true;
1010
- return l.categories.some(function (c) { return categoriesCampaing_1.some(function (cat) { return cat == c; }); });
1011
- });
1012
- if (filterProductsCategories.length) {
1013
- var cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1014
- if (cartTotalCategories >= campaign.cartValueMin)
1015
- elegibleCampaigns.push(campaign);
1016
- }
1017
- }
1018
- else {
1019
- if (campaign.cartValue && campaign.cartValue > 0) {
1020
- if (campaign.cartValue <= cartTotal)
1021
- elegibleCampaigns.push(campaign);
1022
- }
1023
- }
1024
- };
1025
- try {
1026
- for (campaigns_1 = __values(campaigns), campaigns_1_1 = campaigns_1.next(); !campaigns_1_1.done; campaigns_1_1 = campaigns_1.next()) {
1027
- campaign = campaigns_1_1.value;
1028
- _loop_1(campaign);
1029
- }
1030
- }
1031
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1032
- finally {
1033
- try {
1034
- if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
1035
- }
1036
- finally { if (e_3) throw e_3.error; }
1037
- }
1038
- if (!elegibleCampaigns.length)
1039
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1040
- campaingnProducts = [];
1041
- _o.label = 2;
1042
- case 2:
1043
- _o.trys.push([2, 14, 15, 16]);
1044
- elegibleCampaigns_1 = __values(elegibleCampaigns), elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1045
- _o.label = 3;
1046
- case 3:
1047
- if (!!elegibleCampaigns_1_1.done) return [3 /*break*/, 13];
1048
- campaign = elegibleCampaigns_1_1.value;
1049
- elegibleProducts = [];
1050
- _o.label = 4;
1051
- case 4:
1052
- _o.trys.push([4, 9, 10, 11]);
1053
- _h = (e_1 = void 0, __values(campaign.products)), _j = _h.next();
1054
- _o.label = 5;
1055
- case 5:
1056
- if (!!_j.done) return [3 /*break*/, 8];
1057
- product = _j.value;
1058
- return [4 /*yield*/, this.productRepository.get({ sku: product })];
1059
- case 6:
1060
- productData = _o.sent();
1061
- if (!productData)
1062
- return [3 /*break*/, 7];
1063
- elegibleProducts.push(productData);
1064
- _o.label = 7;
1065
- case 7:
1066
- _j = _h.next();
1067
- return [3 /*break*/, 5];
1068
- case 8: return [3 /*break*/, 11];
1069
- case 9:
1070
- e_1_1 = _o.sent();
1071
- e_1 = { error: e_1_1 };
1072
- return [3 /*break*/, 11];
1073
- case 10:
1074
- try {
1075
- if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1076
- }
1077
- finally { if (e_1) throw e_1.error; }
1078
- return [7 /*endfinally*/];
1079
- case 11:
1080
- campaingnProducts.push(elegibleProducts);
1081
- _o.label = 12;
1082
- case 12:
1083
- elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1084
- return [3 /*break*/, 3];
1085
- case 13: return [3 /*break*/, 16];
1086
- case 14:
1087
- e_2_1 = _o.sent();
1088
- e_2 = { error: e_2_1 };
1089
- return [3 /*break*/, 16];
1090
- case 15:
1091
- try {
1092
- if (elegibleCampaigns_1_1 && !elegibleCampaigns_1_1.done && (_l = elegibleCampaigns_1.return)) _l.call(elegibleCampaigns_1);
1093
- }
1094
- finally { if (e_2) throw e_2.error; }
1095
- return [7 /*endfinally*/];
1096
- case 16:
1097
- if (!campaingnProducts.length)
1098
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1099
- productArray = campaingnProducts.reduce(function (acc, curr) { return acc.reduce(function (aAcc, aCurr) { return aAcc + aCurr.price.price; }, 0) >
1100
- curr.reduce(function (cAcc, cCurr) { return cAcc + cCurr.price.price; }, 0)
1101
- ? acc
1102
- : curr; });
1103
- gifts = this.giftToLineItems(productArray);
1104
- checkout.lineItems = notGiftItems.concat(gifts);
1105
- return [2 /*return*/, checkout];
1106
- }
1107
- });
1108
- });
1109
- };
1110
- CartService.prototype.getGifts = function () {
1111
- var _this = this;
1112
- return this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
1113
- 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, gifts;
1114
- var e_6, _k, e_5, _l, e_4, _m;
1115
- return __generator(this, function (_o) {
1116
- switch (_o.label) {
1117
- case 0: return [4 /*yield*/, this.buy2WinRepository
1118
- .find({
1119
- filters: {
1120
- active: { operator: i3.Where.EQUALS, value: true },
1121
- shop: { operator: i3.Where.EQUALS, value: this.defaultShop },
1122
- },
1123
- })
1124
- .then(function (data) { return data.data; })];
1125
- case 1:
1126
- campaigns = _o.sent();
1127
- notGiftItems = checkout.lineItems.filter(function (item) { return !item.isGift; });
1128
- if (!campaigns.length)
1129
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1130
- cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1131
- elegibleCampaigns = [];
1132
- _loop_2 = function (campaign) {
1133
- var today = new Date();
1134
- if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
1135
- return "continue";
1136
- if (campaign.activeCategory) {
1137
- var categoriesCampaing_2 = campaign.categories.map(function (c) { return c.id; });
1138
- var filterProductsCategories = checkout.lineItems.filter(function (l) {
1139
- var _a;
1140
- if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1141
- return true;
1142
- return l.categories.some(function (c) { return categoriesCampaing_2.some(function (cat) { return cat == c; }); });
1143
- });
1144
- if (filterProductsCategories.length) {
1145
- var cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1146
- if (cartTotalCategories >= campaign.cartValueMin)
1147
- elegibleCampaigns.push(campaign);
1148
- }
1149
- }
1150
- else {
1151
- if (campaign.cartValue && campaign.cartValue > 0) {
1152
- if (campaign.cartValue <= cartTotal)
1153
- elegibleCampaigns.push(campaign);
1154
- }
1155
- }
1156
- };
1157
- try {
1158
- for (campaigns_2 = __values(campaigns), campaigns_2_1 = campaigns_2.next(); !campaigns_2_1.done; campaigns_2_1 = campaigns_2.next()) {
1159
- campaign = campaigns_2_1.value;
1160
- _loop_2(campaign);
1161
- }
1162
- }
1163
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1164
- finally {
1165
- try {
1166
- if (campaigns_2_1 && !campaigns_2_1.done && (_k = campaigns_2.return)) _k.call(campaigns_2);
1167
- }
1168
- finally { if (e_6) throw e_6.error; }
1169
- }
1170
- if (!elegibleCampaigns.length)
1171
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1172
- campaingnProducts = [];
1173
- _o.label = 2;
1174
- case 2:
1175
- _o.trys.push([2, 14, 15, 16]);
1176
- elegibleCampaigns_2 = __values(elegibleCampaigns), elegibleCampaigns_2_1 = elegibleCampaigns_2.next();
1177
- _o.label = 3;
1178
- case 3:
1179
- if (!!elegibleCampaigns_2_1.done) return [3 /*break*/, 13];
1180
- campaign = elegibleCampaigns_2_1.value;
1181
- elegibleProducts = [];
1182
- _o.label = 4;
1183
- case 4:
1184
- _o.trys.push([4, 9, 10, 11]);
1185
- _h = (e_4 = void 0, __values(campaign.products)), _j = _h.next();
1186
- _o.label = 5;
1187
- case 5:
1188
- if (!!_j.done) return [3 /*break*/, 8];
1189
- product = _j.value;
1190
- return [4 /*yield*/, this.productRepository.get({ sku: product })];
1191
- case 6:
1192
- productData = _o.sent();
1193
- if (!productData)
1194
- return [3 /*break*/, 7];
1195
- elegibleProducts.push(productData);
1196
- _o.label = 7;
1197
- case 7:
1198
- _j = _h.next();
1199
- return [3 /*break*/, 5];
1200
- case 8: return [3 /*break*/, 11];
1201
- case 9:
1202
- e_4_1 = _o.sent();
1203
- e_4 = { error: e_4_1 };
1204
- return [3 /*break*/, 11];
1205
- case 10:
1206
- try {
1207
- if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1208
- }
1209
- finally { if (e_4) throw e_4.error; }
1210
- return [7 /*endfinally*/];
1211
- case 11:
1212
- campaingnProducts.push(elegibleProducts);
1213
- _o.label = 12;
1214
- case 12:
1215
- elegibleCampaigns_2_1 = elegibleCampaigns_2.next();
1216
- return [3 /*break*/, 3];
1217
- case 13: return [3 /*break*/, 16];
1218
- case 14:
1219
- e_5_1 = _o.sent();
1220
- e_5 = { error: e_5_1 };
1221
- return [3 /*break*/, 16];
1222
- case 15:
1223
- try {
1224
- if (elegibleCampaigns_2_1 && !elegibleCampaigns_2_1.done && (_l = elegibleCampaigns_2.return)) _l.call(elegibleCampaigns_2);
1225
- }
1226
- finally { if (e_5) throw e_5.error; }
1227
- return [7 /*endfinally*/];
1228
- case 16:
1229
- if (!campaingnProducts.length)
1230
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1231
- gifts = this.giftToLineItems([].concat.apply([], __spreadArray([], __read(campaingnProducts))));
1232
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) })];
1233
- }
1234
- });
1235
- }); }), 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); }));
1236
- };
1237
- CartService.prototype.giftToLineItems = function (items) {
1238
- return items.map(function (item) {
1239
- var _a;
1240
- 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;
1241
- 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];
1242
- return i3.LineItem.toInstance({
1243
- brand: brand,
1244
- categories: categories,
1245
- id: id.toString(),
1246
- name: name,
1247
- price: price,
1248
- sku: sku,
1249
- slug: slug,
1250
- stock: stock,
1251
- weight: weight,
1252
- EAN: EAN,
1253
- image: image,
1254
- pricePaid: 0,
1255
- quantity: 1,
1256
- isGift: true,
1257
- });
1258
- });
1259
- };
1260
999
  return CartService;
1261
1000
  }());
1262
- 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 });
1263
1002
  CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
1264
1003
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
1265
1004
  type: i0.Injectable
1266
1005
  }], ctorParameters: function () {
1267
- return [{ type: AuthService }, { type: CheckoutService }, { type: i3__namespace.Shops, decorators: [{
1006
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
1268
1007
  type: i0.Inject,
1269
1008
  args: [DEFAULT_SHOP]
1270
1009
  }] }, { type: undefined, decorators: [{
1271
1010
  type: i0.Inject,
1272
1011
  args: ['ProductRepository']
1273
- }] }, { type: i3__namespace.Buy2WinFirestoreRepository, decorators: [{
1274
- type: i0.Inject,
1275
- args: ['Buy2WinRepository']
1276
1012
  }] }];
1277
1013
  } });
1278
1014
 
@@ -1284,7 +1020,7 @@
1284
1020
  }
1285
1021
  CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
1286
1022
  var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
1287
- if (!i3.isNil(checkoutId))
1023
+ if (!i1$1.isNil(checkoutId))
1288
1024
  return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
1289
1025
  return rxjs.from(this.createCheckoutSubscription(checkoutData));
1290
1026
  };
@@ -1293,7 +1029,7 @@
1293
1029
  var checkout;
1294
1030
  return __generator(this, function (_a) {
1295
1031
  switch (_a.label) {
1296
- 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()))];
1297
1033
  case 1:
1298
1034
  checkout = _a.sent();
1299
1035
  cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
@@ -1308,7 +1044,7 @@
1308
1044
  };
1309
1045
  CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
1310
1046
  var _this = this;
1311
- 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(); }));
1312
1048
  };
1313
1049
  CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
1314
1050
  var _this = this;
@@ -1339,8 +1075,8 @@
1339
1075
  this.buildCategoryGroupWithRequiredData = function (group) {
1340
1076
  var _a, _b;
1341
1077
  return ({
1342
- 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'])),
1343
- 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()) || {}, [
1344
1080
  'id',
1345
1081
  'price',
1346
1082
  'reviews',
@@ -1361,9 +1097,9 @@
1361
1097
  }
1362
1098
  Object.defineProperty(HomeShopService.prototype, "homeId", {
1363
1099
  get: function () {
1364
- if (this.defaultShop === i3.Shops.GLAMSHOP)
1100
+ if (this.defaultShop === i1$1.Shops.GLAMSHOP)
1365
1101
  return 'glamshop';
1366
- if (this.defaultShop === i3.Shops.MENSMARKET)
1102
+ if (this.defaultShop === i1$1.Shops.MENSMARKET)
1367
1103
  return 'mens_market';
1368
1104
  return null;
1369
1105
  },
@@ -1409,7 +1145,7 @@
1409
1145
  HomeShopService.prototype.getVerticalProducts = function () {
1410
1146
  var _this = this;
1411
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({
1412
- filters: { categories: { operator: i3.Where.IN, value: [category.id] } },
1148
+ filters: { categories: { operator: i1$1.Where.IN, value: [category.id] } },
1413
1149
  limits: { limit: 12 },
1414
1150
  })).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_c) {
1415
1151
  var category = _c.category, products = _c.products;
@@ -1421,14 +1157,14 @@
1421
1157
  return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
1422
1158
  ? rxjs.of(home)
1423
1159
  : !_this.homeId
1424
- ? rxjs.throwError(new i3.RequiredArgumentError(['homeId']))
1160
+ ? rxjs.throwError(new i1$1.RequiredArgumentError(['homeId']))
1425
1161
  : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
1426
1162
  };
1427
1163
  HomeShopService.prototype.saveHomeData = function (homeData) {
1428
1164
  var _this = this;
1429
1165
  var data = {
1430
1166
  createdAt: new Date(),
1431
- expiresAt: i3.add(new Date(), { hours: 1 }),
1167
+ expiresAt: i1$1.add(new Date(), { hours: 1 }),
1432
1168
  data: homeData,
1433
1169
  };
1434
1170
  return rxjs.from(this.homeRepository.update({
@@ -1452,7 +1188,7 @@
1452
1188
  }] }, { type: undefined, decorators: [{
1453
1189
  type: i0.Inject,
1454
1190
  args: ['ProductRepository']
1455
- }] }, { type: i3__namespace.Shops, decorators: [{
1191
+ }] }, { type: i1__namespace$1.Shops, decorators: [{
1456
1192
  type: i0.Inject,
1457
1193
  args: [DEFAULT_SHOP]
1458
1194
  }] }];
@@ -1469,18 +1205,18 @@
1469
1205
  this.angularFirestore
1470
1206
  .doc(this.orderRepository.collectionName + "/" + id)
1471
1207
  .valueChanges()
1472
- .pipe(operators.map(function (doc) { return i3.Order.toInstance(doc); }))
1208
+ .pipe(operators.map(function (doc) { return i1$1.Order.toInstance(doc); }))
1473
1209
  .subscribe(function (doc) { return _this.orderSubject.next(doc); });
1474
1210
  return this.orderSubject;
1475
1211
  };
1476
1212
  return OrderService;
1477
1213
  }());
1478
- 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 });
1479
1215
  OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
1480
1216
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
1481
1217
  type: i0.Injectable
1482
1218
  }], ctorParameters: function () {
1483
- return [{ type: i1__namespace$1.AngularFirestore }, { type: i3__namespace.OrderFirestoreRepository, decorators: [{
1219
+ return [{ type: i1__namespace$2.AngularFirestore }, { type: i1__namespace$1.OrderFirestoreRepository, decorators: [{
1484
1220
  type: i0.Inject,
1485
1221
  args: ['OrderRepository']
1486
1222
  }] }];
@@ -1496,8 +1232,9 @@
1496
1232
  var _this = this;
1497
1233
  return rxjs.combineLatest([
1498
1234
  this.homeService.getHomeData(),
1499
- this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams),
1500
- ]).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) {
1501
1238
  var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
1502
1239
  var shippingMethods = shippingMethodsResponse.result;
1503
1240
  if (!shippingMethods.length)
@@ -1520,7 +1257,7 @@
1520
1257
  return s;
1521
1258
  });
1522
1259
  }
1523
- if (shop == i3.Shops.GLAMSHOP)
1260
+ if (shop == i1$1.Shops.GLAMSHOP)
1524
1261
  return shippingMethods;
1525
1262
  if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1526
1263
  shippingMethods = shippingMethods.map(function (s) {
@@ -1541,7 +1278,7 @@
1541
1278
  ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
1542
1279
  if (!subscriptionPlan)
1543
1280
  return false;
1544
- if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1281
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1545
1282
  return true;
1546
1283
  }
1547
1284
  return false;
@@ -1549,7 +1286,7 @@
1549
1286
  ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
1550
1287
  if (!subscriptionPlan)
1551
1288
  return false;
1552
- if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1289
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1553
1290
  return true;
1554
1291
  }
1555
1292
  return false;
@@ -1568,12 +1305,12 @@
1568
1305
  };
1569
1306
  return ShippingService;
1570
1307
  }());
1571
- 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 });
1572
1309
  ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
1573
1310
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
1574
1311
  type: i0.Injectable
1575
1312
  }], ctorParameters: function () {
1576
- return [{ type: i1__namespace$2.HttpClient }, { type: undefined, decorators: [{
1313
+ return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
1577
1314
  type: i0.Inject,
1578
1315
  args: [BACKEND_URL]
1579
1316
  }] }, { type: HomeShopService }];
@@ -1599,42 +1336,42 @@
1599
1336
  {
1600
1337
  provide: 'Authentication',
1601
1338
  useFactory: function (authenticationService, userRepository) {
1602
- return new i3.Authentication(authenticationService, userRepository);
1339
+ return new i1$1.Authentication(authenticationService, userRepository);
1603
1340
  },
1604
1341
  deps: ['AuthenticationService', 'UserRepository'],
1605
1342
  },
1606
1343
  {
1607
1344
  provide: 'AuthenticationService',
1608
1345
  useFactory: function (angularFireAuth) {
1609
- return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
1346
+ return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
1610
1347
  },
1611
1348
  deps: [i1.AngularFireAuth],
1612
1349
  },
1613
1350
  {
1614
1351
  provide: 'Register',
1615
1352
  useFactory: function (registerService, userRepository) {
1616
- return new i3.Register(registerService, userRepository);
1353
+ return new i1$1.Register(registerService, userRepository);
1617
1354
  },
1618
1355
  deps: ['RegisterService', 'UserRepository'],
1619
1356
  },
1620
1357
  {
1621
1358
  provide: 'RegisterService',
1622
1359
  useFactory: function (angularFireAuth) {
1623
- return new i3.RegisterFirebaseAuthService(angularFireAuth);
1360
+ return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
1624
1361
  },
1625
1362
  deps: [i1.AngularFireAuth],
1626
1363
  },
1627
1364
  {
1628
1365
  provide: 'SignOut',
1629
1366
  useFactory: function (authenticationService) {
1630
- return new i3.SignOut(authenticationService);
1367
+ return new i1$1.SignOut(authenticationService);
1631
1368
  },
1632
1369
  deps: ['AuthenticationService'],
1633
1370
  },
1634
1371
  {
1635
1372
  provide: 'RecoveryPassword',
1636
1373
  useFactory: function (authenticationService) {
1637
- return new i3.RecoveryPassword(authenticationService);
1374
+ return new i1$1.RecoveryPassword(authenticationService);
1638
1375
  },
1639
1376
  deps: ['AuthenticationService'],
1640
1377
  },
@@ -1647,42 +1384,42 @@
1647
1384
  {
1648
1385
  provide: 'Authentication',
1649
1386
  useFactory: function (authenticationService, userRepository) {
1650
- return new i3.Authentication(authenticationService, userRepository);
1387
+ return new i1$1.Authentication(authenticationService, userRepository);
1651
1388
  },
1652
1389
  deps: ['AuthenticationService', 'UserRepository'],
1653
1390
  },
1654
1391
  {
1655
1392
  provide: 'AuthenticationService',
1656
1393
  useFactory: function (angularFireAuth) {
1657
- return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
1394
+ return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
1658
1395
  },
1659
1396
  deps: [i1.AngularFireAuth],
1660
1397
  },
1661
1398
  {
1662
1399
  provide: 'Register',
1663
1400
  useFactory: function (registerService, userRepository) {
1664
- return new i3.Register(registerService, userRepository);
1401
+ return new i1$1.Register(registerService, userRepository);
1665
1402
  },
1666
1403
  deps: ['RegisterService', 'UserRepository'],
1667
1404
  },
1668
1405
  {
1669
1406
  provide: 'RegisterService',
1670
1407
  useFactory: function (angularFireAuth) {
1671
- return new i3.RegisterFirebaseAuthService(angularFireAuth);
1408
+ return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
1672
1409
  },
1673
1410
  deps: [i1.AngularFireAuth],
1674
1411
  },
1675
1412
  {
1676
1413
  provide: 'SignOut',
1677
1414
  useFactory: function (authenticationService) {
1678
- return new i3.SignOut(authenticationService);
1415
+ return new i1$1.SignOut(authenticationService);
1679
1416
  },
1680
1417
  deps: ['AuthenticationService'],
1681
1418
  },
1682
1419
  {
1683
1420
  provide: 'RecoveryPassword',
1684
1421
  useFactory: function (authenticationService) {
1685
- return new i3.RecoveryPassword(authenticationService);
1422
+ return new i1$1.RecoveryPassword(authenticationService);
1686
1423
  },
1687
1424
  deps: ['AuthenticationService'],
1688
1425
  },
@@ -1705,9 +1442,9 @@
1705
1442
  AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
1706
1443
  AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
1707
1444
  {
1708
- provide: i3.ProductsIndex,
1445
+ provide: i1$1.ProductsIndex,
1709
1446
  useFactory: function (configuration) {
1710
- return new i3.ProductsIndex(new i3.AxiosAdapter(configuration));
1447
+ return new i1$1.ProductsIndex(new i1$1.AxiosAdapter(configuration));
1711
1448
  },
1712
1449
  deps: [ES_CONFIG],
1713
1450
  },
@@ -1717,9 +1454,9 @@
1717
1454
  args: [{
1718
1455
  providers: [
1719
1456
  {
1720
- provide: i3.ProductsIndex,
1457
+ provide: i1$1.ProductsIndex,
1721
1458
  useFactory: function (configuration) {
1722
- return new i3.ProductsIndex(new i3.AxiosAdapter(configuration));
1459
+ return new i1$1.ProductsIndex(new i1$1.AxiosAdapter(configuration));
1723
1460
  },
1724
1461
  deps: [ES_CONFIG],
1725
1462
  },
@@ -1748,161 +1485,168 @@
1748
1485
  {
1749
1486
  provide: 'BeautyProfileRepository',
1750
1487
  useFactory: function (firestore, userRepository) {
1751
- return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1488
+ return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1752
1489
  },
1753
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1490
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1754
1491
  },
1755
1492
  {
1756
1493
  provide: 'Buy2WinRepository',
1757
1494
  useFactory: function (firestore) {
1758
- return new i3.Buy2WinFirestoreRepository(firestore.firestore);
1495
+ return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
1759
1496
  },
1760
- deps: [i1$1.AngularFirestore],
1497
+ deps: [i1$2.AngularFirestore],
1761
1498
  },
1762
1499
  {
1763
- provide: i3.CategoryFirestoreRepository,
1500
+ provide: i1$1.CategoryFirestoreRepository,
1764
1501
  useFactory: function (firestore) {
1765
- return new i3.CategoryFirestoreRepository(firestore.firestore);
1502
+ return new i1$1.CategoryFirestoreRepository(firestore.firestore);
1766
1503
  },
1767
- deps: [i1$1.AngularFirestore],
1504
+ deps: [i1$2.AngularFirestore],
1768
1505
  },
1769
1506
  {
1770
1507
  provide: 'CheckoutRepository',
1771
1508
  useFactory: function (firestore) {
1772
- return new i3.CheckoutFirestoreRepository(firestore.firestore);
1509
+ return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
1773
1510
  },
1774
- deps: [i1$1.AngularFirestore],
1511
+ deps: [i1$2.AngularFirestore],
1775
1512
  },
1776
1513
  {
1777
1514
  provide: 'CheckoutSubscriptionRepository',
1778
1515
  useFactory: function (firestore) {
1779
- return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1516
+ return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1780
1517
  },
1781
- deps: [i1$1.AngularFirestore],
1518
+ deps: [i1$2.AngularFirestore],
1782
1519
  },
1783
1520
  {
1784
1521
  provide: 'CouponRepository',
1785
1522
  useFactory: function (firestore) {
1786
- return new i3.CouponFirestoreRepository(firestore.firestore);
1523
+ return new i1$1.CouponFirestoreRepository(firestore.firestore);
1787
1524
  },
1788
- deps: [i1$1.AngularFirestore],
1525
+ deps: [i1$2.AngularFirestore],
1789
1526
  },
1790
1527
  {
1791
1528
  provide: 'EditionRepository',
1792
1529
  useFactory: function (firestore, subscriptionRepository) {
1793
- return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1530
+ return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1794
1531
  },
1795
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1532
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1796
1533
  },
1797
1534
  {
1798
1535
  provide: 'HomeRepository',
1799
1536
  useFactory: function (firestore) {
1800
- return new i3.HomeFirestoreRepository(firestore.firestore);
1537
+ return new i1$1.HomeFirestoreRepository(firestore.firestore);
1801
1538
  },
1802
- deps: [i1$1.AngularFirestore],
1539
+ deps: [i1$2.AngularFirestore],
1803
1540
  },
1804
1541
  {
1805
1542
  provide: 'LeadRepository',
1806
1543
  useFactory: function (firestore) {
1807
- return new i3.LeadFirestoreRepository(firestore.firestore);
1544
+ return new i1$1.LeadFirestoreRepository(firestore.firestore);
1808
1545
  },
1809
- deps: [i1$1.AngularFirestore],
1546
+ deps: [i1$2.AngularFirestore],
1810
1547
  },
1811
1548
  {
1812
1549
  provide: 'LegacyOrderRepository',
1813
1550
  useFactory: function (firestore) {
1814
- return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
1551
+ return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
1815
1552
  },
1816
- deps: [i1$1.AngularFirestore],
1553
+ deps: [i1$2.AngularFirestore],
1817
1554
  },
1818
1555
  {
1819
1556
  provide: 'ShopMenuRepository',
1820
1557
  useFactory: function (firestore) {
1821
- return new i3.ShopMenuFirestoreRepository(firestore.firestore);
1558
+ return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
1822
1559
  },
1823
- deps: [i1$1.AngularFirestore],
1560
+ deps: [i1$2.AngularFirestore],
1824
1561
  },
1825
1562
  {
1826
1563
  provide: 'OrderRepository',
1827
1564
  useFactory: function (firestore) {
1828
- return new i3.OrderFirestoreRepository(firestore.firestore);
1565
+ return new i1$1.OrderFirestoreRepository(firestore.firestore);
1829
1566
  },
1830
- deps: [i1$1.AngularFirestore],
1567
+ deps: [i1$2.AngularFirestore],
1831
1568
  },
1832
1569
  {
1833
1570
  provide: 'PaymentRepository',
1834
1571
  useFactory: function (firestore) {
1835
- return new i3.PaymentFirestoreRepository(firestore.firestore);
1572
+ return new i1$1.PaymentFirestoreRepository(firestore.firestore);
1836
1573
  },
1837
- deps: [i1$1.AngularFirestore],
1574
+ deps: [i1$2.AngularFirestore],
1838
1575
  },
1839
1576
  {
1840
- provide: i3.ProductFirestoreRepository,
1577
+ provide: i1$1.ProductFirestoreRepository,
1841
1578
  useFactory: function (firestore) {
1842
- return new i3.ProductFirestoreRepository(firestore.firestore);
1579
+ return new i1$1.ProductFirestoreRepository(firestore.firestore);
1843
1580
  },
1844
- deps: [i1$1.AngularFirestore],
1581
+ deps: [i1$2.AngularFirestore],
1582
+ },
1583
+ {
1584
+ provide: 'ShopSettingsRepository',
1585
+ useFactory: function (firestore) {
1586
+ return new i1$1.ShopSettingsFirestoreRepository(firestore.firestore);
1587
+ },
1588
+ deps: [i1$2.AngularFirestore],
1845
1589
  },
1846
1590
  {
1847
1591
  provide: 'SubscriptionPaymentRepository',
1848
1592
  useFactory: function (firestore, subscriptionRepository) {
1849
- return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1593
+ return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1850
1594
  },
1851
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1595
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1852
1596
  },
1853
1597
  {
1854
1598
  provide: 'SubscriptionPlanRepository',
1855
1599
  useFactory: function (firestore) {
1856
- return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
1600
+ return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
1857
1601
  },
1858
- deps: [i1$1.AngularFirestore],
1602
+ deps: [i1$2.AngularFirestore],
1859
1603
  },
1860
1604
  {
1861
1605
  provide: 'SubscriptionProductRepository',
1862
1606
  useFactory: function (firestore) {
1863
- return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
1607
+ return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
1864
1608
  },
1865
- deps: [i1$1.AngularFirestore],
1609
+ deps: [i1$2.AngularFirestore],
1866
1610
  },
1867
1611
  {
1868
1612
  provide: 'SubscriptionRepository',
1869
1613
  useFactory: function (firestore) {
1870
- return new i3.SubscriptionFirestoreRepository(firestore.firestore);
1614
+ return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
1871
1615
  },
1872
- deps: [i1$1.AngularFirestore],
1616
+ deps: [i1$2.AngularFirestore],
1873
1617
  },
1874
1618
  {
1875
1619
  provide: 'UserRepository',
1876
1620
  useFactory: function (firestore) {
1877
- return new i3.UserFirestoreRepository(firestore.firestore);
1621
+ return new i1$1.UserFirestoreRepository(firestore.firestore);
1878
1622
  },
1879
- deps: [i1$1.AngularFirestore],
1623
+ deps: [i1$2.AngularFirestore],
1880
1624
  },
1881
1625
  {
1882
1626
  provide: 'UserAddressRepository',
1883
1627
  useFactory: function (firestore, userRepository) {
1884
- return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1628
+ return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1885
1629
  },
1886
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1630
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1887
1631
  },
1888
1632
  {
1889
1633
  provide: 'UserPaymentMethodRepository',
1890
1634
  useFactory: function (firestore, userRepository) {
1891
- return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1635
+ return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1892
1636
  },
1893
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1637
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1894
1638
  },
1895
1639
  {
1896
- provide: i3.ProductVariantFirestoreRepository,
1640
+ provide: i1$1.ProductVariantFirestoreRepository,
1897
1641
  useFactory: function (firestore, productRepository) {
1898
- return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1642
+ return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1899
1643
  },
1900
- deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
1644
+ deps: [i1$2.AngularFirestore, i1$1.ProductFirestoreRepository],
1901
1645
  },
1902
1646
  {
1903
1647
  provide: i0.APP_INITIALIZER,
1904
1648
  useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
1905
- deps: [i1$1.AngularFirestore],
1649
+ deps: [i1$2.AngularFirestore],
1906
1650
  multi: true,
1907
1651
  },
1908
1652
  ], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
@@ -1914,161 +1658,168 @@
1914
1658
  {
1915
1659
  provide: 'BeautyProfileRepository',
1916
1660
  useFactory: function (firestore, userRepository) {
1917
- return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1661
+ return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1918
1662
  },
1919
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1663
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
1920
1664
  },
1921
1665
  {
1922
1666
  provide: 'Buy2WinRepository',
1923
1667
  useFactory: function (firestore) {
1924
- return new i3.Buy2WinFirestoreRepository(firestore.firestore);
1668
+ return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
1925
1669
  },
1926
- deps: [i1$1.AngularFirestore],
1670
+ deps: [i1$2.AngularFirestore],
1927
1671
  },
1928
1672
  {
1929
- provide: i3.CategoryFirestoreRepository,
1673
+ provide: i1$1.CategoryFirestoreRepository,
1930
1674
  useFactory: function (firestore) {
1931
- return new i3.CategoryFirestoreRepository(firestore.firestore);
1675
+ return new i1$1.CategoryFirestoreRepository(firestore.firestore);
1932
1676
  },
1933
- deps: [i1$1.AngularFirestore],
1677
+ deps: [i1$2.AngularFirestore],
1934
1678
  },
1935
1679
  {
1936
1680
  provide: 'CheckoutRepository',
1937
1681
  useFactory: function (firestore) {
1938
- return new i3.CheckoutFirestoreRepository(firestore.firestore);
1682
+ return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
1939
1683
  },
1940
- deps: [i1$1.AngularFirestore],
1684
+ deps: [i1$2.AngularFirestore],
1941
1685
  },
1942
1686
  {
1943
1687
  provide: 'CheckoutSubscriptionRepository',
1944
1688
  useFactory: function (firestore) {
1945
- return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1689
+ return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1946
1690
  },
1947
- deps: [i1$1.AngularFirestore],
1691
+ deps: [i1$2.AngularFirestore],
1948
1692
  },
1949
1693
  {
1950
1694
  provide: 'CouponRepository',
1951
1695
  useFactory: function (firestore) {
1952
- return new i3.CouponFirestoreRepository(firestore.firestore);
1696
+ return new i1$1.CouponFirestoreRepository(firestore.firestore);
1953
1697
  },
1954
- deps: [i1$1.AngularFirestore],
1698
+ deps: [i1$2.AngularFirestore],
1955
1699
  },
1956
1700
  {
1957
1701
  provide: 'EditionRepository',
1958
1702
  useFactory: function (firestore, subscriptionRepository) {
1959
- return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1703
+ return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1960
1704
  },
1961
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1705
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1962
1706
  },
1963
1707
  {
1964
1708
  provide: 'HomeRepository',
1965
1709
  useFactory: function (firestore) {
1966
- return new i3.HomeFirestoreRepository(firestore.firestore);
1710
+ return new i1$1.HomeFirestoreRepository(firestore.firestore);
1967
1711
  },
1968
- deps: [i1$1.AngularFirestore],
1712
+ deps: [i1$2.AngularFirestore],
1969
1713
  },
1970
1714
  {
1971
1715
  provide: 'LeadRepository',
1972
1716
  useFactory: function (firestore) {
1973
- return new i3.LeadFirestoreRepository(firestore.firestore);
1717
+ return new i1$1.LeadFirestoreRepository(firestore.firestore);
1974
1718
  },
1975
- deps: [i1$1.AngularFirestore],
1719
+ deps: [i1$2.AngularFirestore],
1976
1720
  },
1977
1721
  {
1978
1722
  provide: 'LegacyOrderRepository',
1979
1723
  useFactory: function (firestore) {
1980
- return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
1724
+ return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
1981
1725
  },
1982
- deps: [i1$1.AngularFirestore],
1726
+ deps: [i1$2.AngularFirestore],
1983
1727
  },
1984
1728
  {
1985
1729
  provide: 'ShopMenuRepository',
1986
1730
  useFactory: function (firestore) {
1987
- return new i3.ShopMenuFirestoreRepository(firestore.firestore);
1731
+ return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
1988
1732
  },
1989
- deps: [i1$1.AngularFirestore],
1733
+ deps: [i1$2.AngularFirestore],
1990
1734
  },
1991
1735
  {
1992
1736
  provide: 'OrderRepository',
1993
1737
  useFactory: function (firestore) {
1994
- return new i3.OrderFirestoreRepository(firestore.firestore);
1738
+ return new i1$1.OrderFirestoreRepository(firestore.firestore);
1995
1739
  },
1996
- deps: [i1$1.AngularFirestore],
1740
+ deps: [i1$2.AngularFirestore],
1997
1741
  },
1998
1742
  {
1999
1743
  provide: 'PaymentRepository',
2000
1744
  useFactory: function (firestore) {
2001
- return new i3.PaymentFirestoreRepository(firestore.firestore);
1745
+ return new i1$1.PaymentFirestoreRepository(firestore.firestore);
2002
1746
  },
2003
- deps: [i1$1.AngularFirestore],
1747
+ deps: [i1$2.AngularFirestore],
2004
1748
  },
2005
1749
  {
2006
- provide: i3.ProductFirestoreRepository,
1750
+ provide: i1$1.ProductFirestoreRepository,
2007
1751
  useFactory: function (firestore) {
2008
- return new i3.ProductFirestoreRepository(firestore.firestore);
1752
+ return new i1$1.ProductFirestoreRepository(firestore.firestore);
2009
1753
  },
2010
- deps: [i1$1.AngularFirestore],
1754
+ deps: [i1$2.AngularFirestore],
1755
+ },
1756
+ {
1757
+ provide: 'ShopSettingsRepository',
1758
+ useFactory: function (firestore) {
1759
+ return new i1$1.ShopSettingsFirestoreRepository(firestore.firestore);
1760
+ },
1761
+ deps: [i1$2.AngularFirestore],
2011
1762
  },
2012
1763
  {
2013
1764
  provide: 'SubscriptionPaymentRepository',
2014
1765
  useFactory: function (firestore, subscriptionRepository) {
2015
- return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1766
+ return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
2016
1767
  },
2017
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1768
+ deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
2018
1769
  },
2019
1770
  {
2020
1771
  provide: 'SubscriptionPlanRepository',
2021
1772
  useFactory: function (firestore) {
2022
- return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
1773
+ return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
2023
1774
  },
2024
- deps: [i1$1.AngularFirestore],
1775
+ deps: [i1$2.AngularFirestore],
2025
1776
  },
2026
1777
  {
2027
1778
  provide: 'SubscriptionProductRepository',
2028
1779
  useFactory: function (firestore) {
2029
- return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
1780
+ return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
2030
1781
  },
2031
- deps: [i1$1.AngularFirestore],
1782
+ deps: [i1$2.AngularFirestore],
2032
1783
  },
2033
1784
  {
2034
1785
  provide: 'SubscriptionRepository',
2035
1786
  useFactory: function (firestore) {
2036
- return new i3.SubscriptionFirestoreRepository(firestore.firestore);
1787
+ return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
2037
1788
  },
2038
- deps: [i1$1.AngularFirestore],
1789
+ deps: [i1$2.AngularFirestore],
2039
1790
  },
2040
1791
  {
2041
1792
  provide: 'UserRepository',
2042
1793
  useFactory: function (firestore) {
2043
- return new i3.UserFirestoreRepository(firestore.firestore);
1794
+ return new i1$1.UserFirestoreRepository(firestore.firestore);
2044
1795
  },
2045
- deps: [i1$1.AngularFirestore],
1796
+ deps: [i1$2.AngularFirestore],
2046
1797
  },
2047
1798
  {
2048
1799
  provide: 'UserAddressRepository',
2049
1800
  useFactory: function (firestore, userRepository) {
2050
- return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1801
+ return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
2051
1802
  },
2052
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1803
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
2053
1804
  },
2054
1805
  {
2055
1806
  provide: 'UserPaymentMethodRepository',
2056
1807
  useFactory: function (firestore, userRepository) {
2057
- return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1808
+ return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
2058
1809
  },
2059
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1810
+ deps: [i1$2.AngularFirestore, 'UserRepository'],
2060
1811
  },
2061
1812
  {
2062
- provide: i3.ProductVariantFirestoreRepository,
1813
+ provide: i1$1.ProductVariantFirestoreRepository,
2063
1814
  useFactory: function (firestore, productRepository) {
2064
- return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1815
+ return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
2065
1816
  },
2066
- deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
1817
+ deps: [i1$2.AngularFirestore, i1$1.ProductFirestoreRepository],
2067
1818
  },
2068
1819
  {
2069
1820
  provide: i0.APP_INITIALIZER,
2070
1821
  useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
2071
- deps: [i1$1.AngularFirestore],
1822
+ deps: [i1$2.AngularFirestore],
2072
1823
  multi: true,
2073
1824
  },
2074
1825
  ],
@@ -2091,70 +1842,37 @@
2091
1842
  AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
2092
1843
  {
2093
1844
  provide: 'CategoryRepository',
2094
- useExisting: i3.CategoryHasuraGraphQLRepository,
1845
+ useExisting: i1$1.CategoryHasuraGraphQLRepository,
2095
1846
  },
2096
1847
  {
2097
- provide: i3.CategoryHasuraGraphQLRepository,
2098
- useFactory: function (options, productRepository, categoryFilterRepository) {
2099
- 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);
2100
1851
  },
2101
- deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
1852
+ deps: [HASURA_OPTIONS, i1$1.ProductHasuraGraphQLRepository],
2102
1853
  },
2103
1854
  {
2104
1855
  provide: 'ProductRepository',
2105
- useExisting: i3.ProductHasuraGraphQLRepository,
1856
+ useExisting: i1$1.ProductHasuraGraphQLRepository,
2106
1857
  },
2107
1858
  {
2108
- provide: i3.ProductHasuraGraphQLRepository,
1859
+ provide: i1$1.ProductHasuraGraphQLRepository,
2109
1860
  useFactory: function (options) {
2110
- return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1861
+ return new i1$1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
2111
1862
  },
2112
1863
  deps: [HASURA_OPTIONS],
2113
1864
  },
2114
1865
  {
2115
1866
  provide: 'VariantRepository',
2116
- useExisting: i3.VariantHasuraGraphQLRepository,
1867
+ useExisting: i1$1.VariantHasuraGraphQLRepository,
2117
1868
  },
2118
1869
  {
2119
- provide: i3.VariantHasuraGraphQLRepository,
1870
+ provide: i1$1.VariantHasuraGraphQLRepository,
2120
1871
  useFactory: function (options) {
2121
- return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1872
+ return new i1$1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
2122
1873
  },
2123
1874
  deps: [HASURA_OPTIONS],
2124
1875
  },
2125
- {
2126
- provide: 'CategoryFilterRepository',
2127
- useExisting: i3.CategoryFilterHasuraGraphQLRepository,
2128
- },
2129
- {
2130
- provide: i3.CategoryFilterHasuraGraphQLRepository,
2131
- useFactory: function (options) {
2132
- return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
2133
- },
2134
- deps: [HASURA_OPTIONS],
2135
- },
2136
- {
2137
- provide: 'FilterOptionRepository',
2138
- useExisting: i3.FilterOptionHasuraGraphQLRepository,
2139
- },
2140
- {
2141
- provide: i3.FilterOptionHasuraGraphQLRepository,
2142
- useFactory: function (options) {
2143
- return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
2144
- },
2145
- deps: [HASURA_OPTIONS],
2146
- },
2147
- {
2148
- provide: 'FilterRepository',
2149
- useExisting: i3.FilterHasuraGraphQLRepository,
2150
- },
2151
- {
2152
- provide: i3.FilterHasuraGraphQLRepository,
2153
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
2154
- return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
2155
- },
2156
- deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
2157
- },
2158
1876
  ] });
2159
1877
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
2160
1878
  type: i0.NgModule,
@@ -2162,70 +1880,37 @@
2162
1880
  providers: [
2163
1881
  {
2164
1882
  provide: 'CategoryRepository',
2165
- useExisting: i3.CategoryHasuraGraphQLRepository,
1883
+ useExisting: i1$1.CategoryHasuraGraphQLRepository,
2166
1884
  },
2167
1885
  {
2168
- provide: i3.CategoryHasuraGraphQLRepository,
2169
- useFactory: function (options, productRepository, categoryFilterRepository) {
2170
- 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);
2171
1889
  },
2172
- deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
1890
+ deps: [HASURA_OPTIONS, i1$1.ProductHasuraGraphQLRepository],
2173
1891
  },
2174
1892
  {
2175
1893
  provide: 'ProductRepository',
2176
- useExisting: i3.ProductHasuraGraphQLRepository,
1894
+ useExisting: i1$1.ProductHasuraGraphQLRepository,
2177
1895
  },
2178
1896
  {
2179
- provide: i3.ProductHasuraGraphQLRepository,
1897
+ provide: i1$1.ProductHasuraGraphQLRepository,
2180
1898
  useFactory: function (options) {
2181
- return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1899
+ return new i1$1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
2182
1900
  },
2183
1901
  deps: [HASURA_OPTIONS],
2184
1902
  },
2185
1903
  {
2186
1904
  provide: 'VariantRepository',
2187
- useExisting: i3.VariantHasuraGraphQLRepository,
2188
- },
2189
- {
2190
- provide: i3.VariantHasuraGraphQLRepository,
2191
- useFactory: function (options) {
2192
- return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
2193
- },
2194
- deps: [HASURA_OPTIONS],
2195
- },
2196
- {
2197
- provide: 'CategoryFilterRepository',
2198
- useExisting: i3.CategoryFilterHasuraGraphQLRepository,
1905
+ useExisting: i1$1.VariantHasuraGraphQLRepository,
2199
1906
  },
2200
1907
  {
2201
- provide: i3.CategoryFilterHasuraGraphQLRepository,
1908
+ provide: i1$1.VariantHasuraGraphQLRepository,
2202
1909
  useFactory: function (options) {
2203
- return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
1910
+ return new i1$1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
2204
1911
  },
2205
1912
  deps: [HASURA_OPTIONS],
2206
1913
  },
2207
- {
2208
- provide: 'FilterOptionRepository',
2209
- useExisting: i3.FilterOptionHasuraGraphQLRepository,
2210
- },
2211
- {
2212
- provide: i3.FilterOptionHasuraGraphQLRepository,
2213
- useFactory: function (options) {
2214
- return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
2215
- },
2216
- deps: [HASURA_OPTIONS],
2217
- },
2218
- {
2219
- provide: 'FilterRepository',
2220
- useExisting: i3.FilterHasuraGraphQLRepository,
2221
- },
2222
- {
2223
- provide: i3.FilterHasuraGraphQLRepository,
2224
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
2225
- return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
2226
- },
2227
- deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
2228
- },
2229
1914
  ],
2230
1915
  }]
2231
1916
  }] });
@@ -2236,7 +1921,7 @@
2236
1921
  AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
2237
1922
  return {
2238
1923
  ngModule: AngularConnectModule,
2239
- 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 }]))),
2240
1925
  };
2241
1926
  };
2242
1927
  return AngularConnectModule;
@@ -2251,7 +1936,7 @@
2251
1936
  CouponService,
2252
1937
  HomeShopService,
2253
1938
  OrderService,
2254
- ShippingService,
1939
+ ShippingService
2255
1940
  ], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
2256
1941
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
2257
1942
  type: i0.NgModule,
@@ -2265,7 +1950,7 @@
2265
1950
  CouponService,
2266
1951
  HomeShopService,
2267
1952
  OrderService,
2268
- ShippingService,
1953
+ ShippingService
2269
1954
  ],
2270
1955
  }]
2271
1956
  }] });