@infrab4a/connect 5.3.10-beta.0 → 5.3.10-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.
package/index.cjs.js CHANGED
@@ -758,6 +758,24 @@ tslib.__decorate([
758
758
  registerClass('Category', Category);
759
759
 
760
760
  class BrandCategory extends BaseModel {
761
+ get glamImages() {
762
+ return this.images?.[exports.Shops.GLAMSHOP]
763
+ ? this.images[exports.Shops.GLAMSHOP]
764
+ : {
765
+ brandBanner: null,
766
+ brandBannerMobile: null,
767
+ image: null,
768
+ };
769
+ }
770
+ get mensImages() {
771
+ return this.images?.[exports.Shops.MENSMARKET]
772
+ ? this.images[exports.Shops.MENSMARKET]
773
+ : {
774
+ brandBanner: null,
775
+ brandBannerMobile: null,
776
+ image: null,
777
+ };
778
+ }
761
779
  static get identifiersFields() {
762
780
  return ['id'];
763
781
  }
@@ -1780,38 +1798,39 @@ class AntifraudCardService {
1780
1798
  subscriber: {
1781
1799
  cpf: 4,
1782
1800
  email: 4,
1783
- telefone: 4,
1801
+ phone: 4,
1784
1802
  card: 4,
1785
- cep: 4,
1803
+ zip: 4,
1786
1804
  },
1787
1805
  nonSubscriber: {
1788
1806
  cpf: 2,
1789
1807
  email: 2,
1790
- telefone: 2,
1808
+ phone: 2,
1791
1809
  card: 2,
1792
- cep: 2,
1810
+ zip: 2,
1793
1811
  },
1794
1812
  };
1795
1813
  this.LIMIT_ORDERS_WEEK = {
1796
1814
  subscriber: {
1797
1815
  cpf: 12,
1798
1816
  email: 12,
1799
- telefone: 12,
1817
+ phone: 12,
1800
1818
  card: 12,
1801
- cep: Infinity,
1819
+ zip: Infinity,
1802
1820
  },
1803
1821
  nonSubscriber: {
1804
1822
  cpf: 7,
1805
1823
  email: 7,
1806
- telefone: 7,
1824
+ phone: 7,
1807
1825
  card: 7,
1808
- cep: 7,
1826
+ zip: Infinity,
1809
1827
  },
1810
1828
  };
1811
1829
  this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1812
1830
  }
1813
- getLimitsByUserType(isSubscriber) {
1814
- return isSubscriber ? this.LIMIT_ORDERS_DAY['subscriber'] : this.LIMIT_ORDERS_DAY['nonSubscriber'];
1831
+ getLimitsByUserType(type, isSubscriber) {
1832
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1833
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1815
1834
  }
1816
1835
  async validateBlockedOrderAttempts(checkout, card) {
1817
1836
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
@@ -1970,7 +1989,7 @@ class AntifraudCardService {
1970
1989
  }
1971
1990
  async validateDayOrderLimits(checkout, params) {
1972
1991
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
1973
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1992
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1974
1993
  return this.checkOrderLimitsAndBlock({
1975
1994
  checkout,
1976
1995
  orderCounts: ordersPerDay,
@@ -1980,7 +1999,7 @@ class AntifraudCardService {
1980
1999
  }
1981
2000
  async validateWeekOrderLimits(checkout, params) {
1982
2001
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
1983
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
2002
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
1984
2003
  return this.checkOrderLimitsAndBlock({
1985
2004
  checkout,
1986
2005
  orderCounts: ordersPerWeek,
package/index.esm.js CHANGED
@@ -734,6 +734,24 @@ __decorate([
734
734
  registerClass('Category', Category);
735
735
 
736
736
  class BrandCategory extends BaseModel {
737
+ get glamImages() {
738
+ return this.images?.[Shops.GLAMSHOP]
739
+ ? this.images[Shops.GLAMSHOP]
740
+ : {
741
+ brandBanner: null,
742
+ brandBannerMobile: null,
743
+ image: null,
744
+ };
745
+ }
746
+ get mensImages() {
747
+ return this.images?.[Shops.MENSMARKET]
748
+ ? this.images[Shops.MENSMARKET]
749
+ : {
750
+ brandBanner: null,
751
+ brandBannerMobile: null,
752
+ image: null,
753
+ };
754
+ }
737
755
  static get identifiersFields() {
738
756
  return ['id'];
739
757
  }
@@ -1756,38 +1774,39 @@ class AntifraudCardService {
1756
1774
  subscriber: {
1757
1775
  cpf: 4,
1758
1776
  email: 4,
1759
- telefone: 4,
1777
+ phone: 4,
1760
1778
  card: 4,
1761
- cep: 4,
1779
+ zip: 4,
1762
1780
  },
1763
1781
  nonSubscriber: {
1764
1782
  cpf: 2,
1765
1783
  email: 2,
1766
- telefone: 2,
1784
+ phone: 2,
1767
1785
  card: 2,
1768
- cep: 2,
1786
+ zip: 2,
1769
1787
  },
1770
1788
  };
1771
1789
  this.LIMIT_ORDERS_WEEK = {
1772
1790
  subscriber: {
1773
1791
  cpf: 12,
1774
1792
  email: 12,
1775
- telefone: 12,
1793
+ phone: 12,
1776
1794
  card: 12,
1777
- cep: Infinity,
1795
+ zip: Infinity,
1778
1796
  },
1779
1797
  nonSubscriber: {
1780
1798
  cpf: 7,
1781
1799
  email: 7,
1782
- telefone: 7,
1800
+ phone: 7,
1783
1801
  card: 7,
1784
- cep: 7,
1802
+ zip: Infinity,
1785
1803
  },
1786
1804
  };
1787
1805
  this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1788
1806
  }
1789
- getLimitsByUserType(isSubscriber) {
1790
- return isSubscriber ? this.LIMIT_ORDERS_DAY['subscriber'] : this.LIMIT_ORDERS_DAY['nonSubscriber'];
1807
+ getLimitsByUserType(type, isSubscriber) {
1808
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1809
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1791
1810
  }
1792
1811
  async validateBlockedOrderAttempts(checkout, card) {
1793
1812
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
@@ -1946,7 +1965,7 @@ class AntifraudCardService {
1946
1965
  }
1947
1966
  async validateDayOrderLimits(checkout, params) {
1948
1967
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
1949
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1968
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1950
1969
  return this.checkOrderLimitsAndBlock({
1951
1970
  checkout,
1952
1971
  orderCounts: ordersPerDay,
@@ -1956,7 +1975,7 @@ class AntifraudCardService {
1956
1975
  }
1957
1976
  async validateWeekOrderLimits(checkout, params) {
1958
1977
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
1959
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1978
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
1960
1979
  return this.checkOrderLimitsAndBlock({
1961
1980
  checkout,
1962
1981
  orderCounts: ordersPerWeek,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.3.10-beta.0",
3
+ "version": "5.3.10-beta.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -11,5 +11,7 @@ export declare class BrandCategory extends BaseModel<BrandCategory> {
11
11
  brand_banner?: string;
12
12
  brand_banner_mobile?: string;
13
13
  shops: Shops[];
14
+ get glamImages(): any;
15
+ get mensImages(): any;
14
16
  static get identifiersFields(): GenericIdentifier[];
15
17
  }