@infrab4a/connect 5.4.0-beta.8 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/index.cjs.js +671 -623
  2. package/index.esm.js +670 -621
  3. package/package.json +3 -3
  4. package/src/domain/catalog/models/category-brand.d.ts +17 -0
  5. package/src/domain/catalog/models/index.d.ts +1 -0
  6. package/src/domain/catalog/models/product-base.d.ts +0 -1
  7. package/src/domain/catalog/models/product.d.ts +0 -1
  8. package/src/domain/catalog/repositories/category-brand.repository.d.ts +4 -0
  9. package/src/domain/catalog/repositories/index.d.ts +1 -1
  10. package/src/domain/shopping/enums/index.d.ts +1 -0
  11. package/src/domain/shopping/enums/order-payment-status.enum.d.ts +10 -0
  12. package/src/domain/shopping/enums/payment-providers.enum.d.ts +2 -1
  13. package/src/domain/shopping/factories/index.d.ts +1 -0
  14. package/src/domain/shopping/factories/mercado-pago-payment-method.factory.d.ts +11 -0
  15. package/src/domain/shopping/factories/payment-provider.factory.d.ts +2 -0
  16. package/src/domain/shopping/models/order.d.ts +7 -1
  17. package/src/domain/shopping/models/payment-transaction.d.ts +2 -0
  18. package/src/domain/shopping/models/payment.d.ts +1 -0
  19. package/src/domain/shopping/services/antifraud-card.service.d.ts +2 -0
  20. package/src/domain/shopping/types/checkout-paylod-request.type.d.ts +2 -7
  21. package/src/domain/shopping/types/index.d.ts +2 -0
  22. package/src/domain/shopping/types/mercado-pago-card.type.d.ts +14 -0
  23. package/src/domain/shopping/types/mercado-pago-credentials.type.d.ts +5 -0
  24. package/src/domain/shopping/types/payment-card-info.type.d.ts +3 -0
  25. package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
  26. package/src/infra/firebase/firestore/repositories/catalog/category-brand-firestore.repository.d.ts +7 -0
  27. package/src/infra/firebase/firestore/repositories/catalog/index.d.ts +1 -0
  28. package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -1
  29. package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +0 -1
  30. package/src/infra/index.d.ts +1 -0
  31. package/src/infra/mercado-pago/adapters/index.d.ts +3 -0
  32. package/src/infra/mercado-pago/adapters/mercado-pago-boleto-payment-axios.adapter.d.ts +8 -0
  33. package/src/infra/mercado-pago/adapters/mercado-pago-card-payment-axios.adapter.d.ts +20 -0
  34. package/src/infra/mercado-pago/adapters/mercado-pago-pix-payment-axios.adapter.d.ts +7 -0
  35. package/src/infra/mercado-pago/enums/index.d.ts +2 -0
  36. package/src/infra/mercado-pago/enums/mercado-pago-status-detail.enum.d.ts +33 -0
  37. package/src/infra/mercado-pago/enums/mercado-pago-status.enum.d.ts +10 -0
  38. package/src/infra/mercado-pago/helpers/index.d.ts +2 -0
  39. package/src/infra/mercado-pago/helpers/mercado-pago-request.helper.d.ts +60 -0
  40. package/src/infra/mercado-pago/helpers/mercado-pago-response.helper.d.ts +10 -0
  41. package/src/infra/mercado-pago/index.d.ts +4 -0
  42. package/src/infra/mercado-pago/types/index.d.ts +3 -0
  43. package/src/infra/mercado-pago/types/mercado-pago-request.type.d.ts +1 -0
  44. package/src/infra/mercado-pago/types/mercado-pago-response.type.d.ts +188 -0
  45. package/src/infra/mercado-pago/types/mercado-pago-status-detail.type.d.ts +2 -0
  46. package/src/infra/mercado-pago/types/mercado-pago-status.type.d.ts +2 -0
  47. package/src/infra/pagarme/adapters/helpers/pagarme-v5-request.helper.d.ts +1 -0
  48. package/src/infra/pagarme/types/v5/pagarmev5-order-request-payload.type.d.ts +1 -0
  49. package/src/utils/index.d.ts +2 -2
  50. package/src/domain/catalog/repositories/product-catalog.repository.d.ts +0 -17
  51. package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts +0 -20
package/index.cjs.js CHANGED
@@ -62,6 +62,18 @@ exports.OrderBlockedType = void 0;
62
62
  OrderBlockedType["Boleto"] = "Boleto";
63
63
  })(exports.OrderBlockedType || (exports.OrderBlockedType = {}));
64
64
 
65
+ exports.OrderPaymentStatus = void 0;
66
+ (function (OrderPaymentStatus) {
67
+ OrderPaymentStatus["Em processamento"] = "processing";
68
+ OrderPaymentStatus["Autorizada"] = "authorized";
69
+ OrderPaymentStatus["Pago"] = "paid";
70
+ OrderPaymentStatus["Estornada"] = "refunded";
71
+ OrderPaymentStatus["Aguardando pagamento"] = "waiting_payment";
72
+ OrderPaymentStatus["Aguardando estorno"] = "pending_refund";
73
+ OrderPaymentStatus["Recusada/N\u00E3o autorizada"] = "refused";
74
+ OrderPaymentStatus["Chargedback"] = "chargedback";
75
+ })(exports.OrderPaymentStatus || (exports.OrderPaymentStatus = {}));
76
+
65
77
  exports.PagarmePaymentStatus = void 0;
66
78
  (function (PagarmePaymentStatus) {
67
79
  PagarmePaymentStatus["Em processamento"] = "processing";
@@ -114,6 +126,7 @@ exports.PaymentProviders = void 0;
114
126
  PaymentProviders["PAGARME"] = "pagarMe";
115
127
  PaymentProviders["ADYEN"] = "adyen";
116
128
  PaymentProviders["GLAMPOINTS"] = "glampoints";
129
+ PaymentProviders["MERCADOPAGO"] = "mercadoPago";
117
130
  })(exports.PaymentProviders || (exports.PaymentProviders = {}));
118
131
 
119
132
  exports.TransactionPaymentMethods = void 0;
@@ -147,6 +160,9 @@ class AntifraudProviderFactory {
147
160
  class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
148
161
  }
149
162
 
163
+ class MercadoPagoPaymentMethodFactory extends BasePaymentMethodFactory {
164
+ }
165
+
150
166
  class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
151
167
  }
152
168
 
@@ -757,6 +773,30 @@ tslib.__decorate([
757
773
  ], Category.prototype, "filters", void 0);
758
774
  registerClass('Category', Category);
759
775
 
776
+ class BrandCategory extends BaseModel {
777
+ get glamImages() {
778
+ return this.images?.[exports.Shops.GLAMSHOP]
779
+ ? this.images[exports.Shops.GLAMSHOP]
780
+ : {
781
+ brandBanner: null,
782
+ brandBannerMobile: null,
783
+ image: null,
784
+ };
785
+ }
786
+ get mensImages() {
787
+ return this.images?.[exports.Shops.MENSMARKET]
788
+ ? this.images[exports.Shops.MENSMARKET]
789
+ : {
790
+ brandBanner: null,
791
+ brandBannerMobile: null,
792
+ image: null,
793
+ };
794
+ }
795
+ static get identifiersFields() {
796
+ return ['id'];
797
+ }
798
+ }
799
+
760
800
  class CategoryCollectionChildren extends BaseModel {
761
801
  static get identifiersFields() {
762
802
  return ['collectionId', 'categoryId'];
@@ -1760,19 +1800,58 @@ class AntifraudCardService {
1760
1800
  constructor(orderRepository, orderBlockedRepository) {
1761
1801
  this.orderRepository = orderRepository;
1762
1802
  this.orderBlockedRepository = orderBlockedRepository;
1763
- this.LIMIT_ORDERS_DAY = 2;
1764
- this.LIMIT_ORDERS_WEEK = 7;
1765
- this.LIMIT_BLOCKED_ORDERS_DAY = 5;
1803
+ this.LIMIT_ORDERS_DAY = null;
1804
+ this.LIMIT_ORDERS_WEEK = null;
1766
1805
  }
1767
1806
  async validate(checkout, card) {
1807
+ this.setLimitsByUserType(checkout.user.isSubscriber);
1768
1808
  await this.validateBlockedOrderAttempts(checkout, card);
1769
1809
  await this.validateDayAndWeekOrderLimits(checkout, card);
1770
1810
  return true;
1771
1811
  }
1812
+ setLimitsByUserType(isSubscriber) {
1813
+ this.LIMIT_ORDERS_DAY = {
1814
+ subscriber: {
1815
+ cpf: 4,
1816
+ email: 4,
1817
+ phone: 4,
1818
+ card: 4,
1819
+ zip: 4,
1820
+ },
1821
+ nonSubscriber: {
1822
+ cpf: 2,
1823
+ email: 2,
1824
+ phone: 2,
1825
+ card: 2,
1826
+ zip: 2,
1827
+ },
1828
+ };
1829
+ this.LIMIT_ORDERS_WEEK = {
1830
+ subscriber: {
1831
+ cpf: 12,
1832
+ email: 12,
1833
+ phone: 12,
1834
+ card: 12,
1835
+ zip: Infinity,
1836
+ },
1837
+ nonSubscriber: {
1838
+ cpf: 7,
1839
+ email: 7,
1840
+ phone: 7,
1841
+ card: 7,
1842
+ zip: Infinity,
1843
+ },
1844
+ };
1845
+ this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1846
+ }
1847
+ getLimitsByUserType(type, isSubscriber) {
1848
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1849
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1850
+ }
1772
1851
  async validateBlockedOrderAttempts(checkout, card) {
1773
1852
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
1774
1853
  if (!isValid) {
1775
- throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
1854
+ throw new FraudValidationError(`Cliente com mais de ${this.LIMIT_BLOCKED_ORDERS_DAY} compras negadas/bloqueadas no dia`, {
1776
1855
  checkoutId: checkout.id,
1777
1856
  userEmail: checkout.user.email,
1778
1857
  info: {
@@ -1786,7 +1865,7 @@ class AntifraudCardService {
1786
1865
  async validateDayAndWeekOrderLimits(checkout, card) {
1787
1866
  const isValid = await this.verifyDayAndWeekOrders(checkout, card);
1788
1867
  if (!isValid) {
1789
- throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
1868
+ throw new FraudValidationError('Cliente tentando comprar mais do que o permitido no dia/semana', {
1790
1869
  checkoutId: checkout.id,
1791
1870
  userEmail: checkout.user.email,
1792
1871
  info: {
@@ -1805,7 +1884,7 @@ class AntifraudCardService {
1805
1884
  await this.createBlockedOrderRecord({
1806
1885
  checkout,
1807
1886
  card,
1808
- reason: 'More than 5 attempts have failed',
1887
+ reason: `More than ${this.LIMIT_BLOCKED_ORDERS_DAY} attempts have failed`,
1809
1888
  key: 'Failed attempts',
1810
1889
  period: 'day',
1811
1890
  });
@@ -1815,7 +1894,7 @@ class AntifraudCardService {
1815
1894
  }
1816
1895
  getTodayDateRange() {
1817
1896
  const timeZone = 'America/Sao_Paulo';
1818
- const today = dateFnsTz.toZonedTime(new Date(), timeZone);
1897
+ const today = dateFnsTz.utcToZonedTime(new Date(), timeZone);
1819
1898
  const day = dateFns.startOfDay(today);
1820
1899
  const endOfDay = dateFns.endOfDay(today);
1821
1900
  return { day: dateFns.addHours(day, 3), endOfDay: dateFns.addHours(endOfDay, 3) };
@@ -1926,26 +2005,28 @@ class AntifraudCardService {
1926
2005
  }
1927
2006
  async validateDayOrderLimits(checkout, params) {
1928
2007
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
2008
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1929
2009
  return this.checkOrderLimitsAndBlock({
1930
2010
  checkout,
1931
2011
  orderCounts: ordersPerDay,
1932
- limit: this.LIMIT_ORDERS_DAY,
2012
+ limit: limits,
1933
2013
  period: 'day',
1934
2014
  });
1935
2015
  }
1936
2016
  async validateWeekOrderLimits(checkout, params) {
1937
2017
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
2018
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
1938
2019
  return this.checkOrderLimitsAndBlock({
1939
2020
  checkout,
1940
2021
  orderCounts: ordersPerWeek,
1941
- limit: this.LIMIT_ORDERS_WEEK,
2022
+ limit: limits,
1942
2023
  period: 'week',
1943
2024
  });
1944
2025
  }
1945
2026
  async checkOrderLimitsAndBlock(params) {
1946
2027
  const { checkout, orderCounts, limit, period } = params;
1947
2028
  for (const key in orderCounts) {
1948
- if (orderCounts[key] >= limit) {
2029
+ if (orderCounts[key] >= limit[key]) {
1949
2030
  await this.createBlockedOrderRecord({
1950
2031
  checkout,
1951
2032
  card: null,
@@ -4763,6 +4844,17 @@ const withCrudFirestore = (MixinBase) => {
4763
4844
  };
4764
4845
  };
4765
4846
 
4847
+ class BrandCategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4848
+ constructor({ firestore, interceptors, }) {
4849
+ super({
4850
+ firestore,
4851
+ collectionName: 'brandsCategory',
4852
+ model: BrandCategory,
4853
+ interceptors,
4854
+ });
4855
+ }
4856
+ }
4857
+
4766
4858
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4767
4859
  constructor({ firestore, interceptors }) {
4768
4860
  super({
@@ -7216,7 +7308,83 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
7216
7308
  }
7217
7309
  }
7218
7310
 
7219
- const commonFields$1 = [
7311
+ class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7312
+ constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7313
+ super({
7314
+ tableName: 'product_errors',
7315
+ model: ProductErrorsHasuraGraphQL,
7316
+ endpoint,
7317
+ authOptions,
7318
+ interceptors,
7319
+ cache,
7320
+ fields: [
7321
+ {
7322
+ productId: {
7323
+ columnName: 'product_id',
7324
+ to: (value) => +value,
7325
+ from: (value) => value.toString(),
7326
+ },
7327
+ },
7328
+ 'source',
7329
+ 'error',
7330
+ { createdAt: { columnName: 'created_at' } },
7331
+ { updatedAt: { columnName: 'updated_at' } },
7332
+ {
7333
+ product: {
7334
+ columnName: 'product',
7335
+ foreignKeyColumn: { id: 'productId' },
7336
+ fields: [
7337
+ { id: { columnName: 'id', from: (value) => value.toString() } },
7338
+ { productId: { columnName: 'main_product_id' } },
7339
+ 'name',
7340
+ 'published',
7341
+ 'group',
7342
+ 'validity',
7343
+ { createdAt: { columnName: 'created_at' } },
7344
+ { updatedAt: { columnName: 'updated_at' } },
7345
+ ],
7346
+ },
7347
+ },
7348
+ ],
7349
+ });
7350
+ this.productRepository = productRepository;
7351
+ }
7352
+ async get(params) {
7353
+ const result = await super.get(params);
7354
+ if (result instanceof VariantHasuraGraphQL) {
7355
+ const product = await this.productRepository.get({ id: result.productId.toString() });
7356
+ result.product.name = product.name;
7357
+ result.product.group = product.group;
7358
+ }
7359
+ return result;
7360
+ }
7361
+ async find(params) {
7362
+ const result = await super.find(params);
7363
+ const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7364
+ (lodash.isEmpty(item.product.name) || lodash.isEmpty(item.product.group) || lodash.isEmpty(item.product)));
7365
+ if (variantsWithNoData.length > 0) {
7366
+ const { data: products } = await this.productRepository.find({
7367
+ filters: {
7368
+ id: {
7369
+ operator: exports.Where.IN,
7370
+ value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7371
+ },
7372
+ },
7373
+ });
7374
+ products.forEach((product) => {
7375
+ result.data
7376
+ .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7377
+ .forEach((variant) => {
7378
+ variant.product.name = product.name;
7379
+ variant.product.group = product.group;
7380
+ });
7381
+ });
7382
+ }
7383
+ return result;
7384
+ }
7385
+ }
7386
+
7387
+ const commonFields = [
7220
7388
  {
7221
7389
  id: {
7222
7390
  columnName: 'id',
@@ -7383,388 +7551,36 @@ const commonFields$1 = [
7383
7551
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7384
7552
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7385
7553
  { daysOfUse: { columnName: 'days_of_use' } },
7386
- { showVariants: { columnName: 'show_variants' } },
7387
- { variantSlug: { columnName: 'variant_slug' } },
7388
7554
  ];
7389
- class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
7390
- constructor({ endpoint, authOptions, interceptors, cache, }) {
7391
- super({
7392
- tableName: 'product_catalog',
7393
- model: ProductHasuraGraphQL,
7394
- endpoint,
7395
- authOptions,
7396
- interceptors,
7397
- fields: commonFields$1,
7398
- cache,
7399
- });
7400
- }
7401
- async get({ id }) {
7402
- return super
7403
- .find({
7404
- filters: {
7405
- id,
7406
- },
7407
- limits: {
7408
- limit: 1,
7409
- },
7410
- })
7411
- .then((res) => res.data.at(0));
7412
- }
7413
- async getByEAN(EAN, options) {
7414
- if (this.cache?.cacheAdapter && options?.cache?.enabled) {
7415
- const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
7416
- const cachedData = await this.cache.cacheAdapter.get(cacheKey);
7417
- if (cachedData) {
7418
- this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
7419
- return this.model.toInstance(deserialize(cachedData));
7420
- }
7421
- }
7422
- const product = await super
7423
- .find({
7424
- filters: {
7425
- EAN,
7426
- },
7427
- limits: {
7428
- limit: 1,
7429
- },
7430
- })
7431
- .then((res) => res.data.at(0));
7432
- if (!product)
7433
- return null;
7434
- RoundProductPricesHelper.roundProductPrices(product);
7435
- if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
7436
- const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
7437
- await this.cache.cacheAdapter.set({
7438
- key: cacheKey,
7439
- data: serialize(product),
7440
- expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
7441
- });
7442
- this.logger.log(`Dados salvos no cache: ${cacheKey}`);
7443
- }
7444
- return product;
7445
- }
7446
- async find(params, optionsParams) {
7447
- const { filters, fields, ...options } = params || {};
7448
- const bindFields = fields ||
7449
- this.fields
7450
- .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
7451
- .filter((field) => field !== 'reviews' && field !== 'categories');
7452
- if (options.options?.minimal?.includes('price'))
7453
- options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
7454
- if (options.options?.maximum?.includes('price'))
7455
- options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
7456
- options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
7457
- options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
7458
- return super.find({
7459
- ...options,
7460
- filters: { ...filters },
7555
+ const fieldsConfiguration$2 = [
7556
+ ...commonFields,
7557
+ {
7558
+ categories: {
7559
+ columnName: 'categories',
7560
+ fields: ['category_id'],
7561
+ bindPersistData: (value) => ({
7562
+ categories: { data: value.map((category) => ({ category_id: +category })) },
7563
+ }),
7564
+ to: (categories) => categories.map((categoryId) => +categoryId),
7565
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7566
+ },
7567
+ },
7568
+ {
7569
+ kitProducts: {
7570
+ columnName: 'kit_products',
7571
+ foreignKeyColumn: { productId: 'id' },
7461
7572
  fields: [
7462
- ...bindFields,
7463
- ...(bindFields.includes('price')
7464
- ? [
7465
- 'subscriberPrice',
7466
- 'subscriberDiscountPercentage',
7467
- 'fullPrice',
7468
- ]
7469
- : []),
7573
+ { productId: { columnName: 'product_id' } },
7574
+ { kitProductId: { columnName: 'kit_product_id' } },
7575
+ 'quantity',
7576
+ { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7470
7577
  ],
7471
- }, optionsParams);
7472
- }
7473
- async findCatalog(params, mainGender, options) {
7474
- const result = await this.find({
7475
- ...params,
7476
- filters: { ...params.filters, published: true },
7477
- orderBy: {
7478
- hasStock: 'desc',
7479
- ...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
7480
- ...lodash.omit(params.orderBy, ['hasStock', 'intGender']),
7481
- },
7482
- }, options);
7483
- return result;
7484
- }
7485
- }
7486
- tslib.__decorate([
7487
- Log(),
7488
- tslib.__metadata("design:type", Function),
7489
- tslib.__metadata("design:paramtypes", [Object, Object, Object]),
7490
- tslib.__metadata("design:returntype", Promise)
7491
- ], ProductCatalogHasuraGraphQLRepository.prototype, "findCatalog", null);
7492
-
7493
- class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7494
- constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7495
- super({
7496
- tableName: 'product_errors',
7497
- model: ProductErrorsHasuraGraphQL,
7498
- endpoint,
7499
- authOptions,
7500
- interceptors,
7501
- cache,
7502
- fields: [
7503
- {
7504
- productId: {
7505
- columnName: 'product_id',
7506
- to: (value) => +value,
7507
- from: (value) => value.toString(),
7508
- },
7509
- },
7510
- 'source',
7511
- 'error',
7512
- { createdAt: { columnName: 'created_at' } },
7513
- { updatedAt: { columnName: 'updated_at' } },
7514
- {
7515
- product: {
7516
- columnName: 'product',
7517
- foreignKeyColumn: { id: 'productId' },
7518
- fields: [
7519
- { id: { columnName: 'id', from: (value) => value.toString() } },
7520
- { productId: { columnName: 'main_product_id' } },
7521
- 'name',
7522
- 'published',
7523
- 'group',
7524
- 'validity',
7525
- { createdAt: { columnName: 'created_at' } },
7526
- { updatedAt: { columnName: 'updated_at' } },
7527
- ],
7528
- },
7529
- },
7530
- ],
7531
- });
7532
- this.productRepository = productRepository;
7533
- }
7534
- async get(params) {
7535
- const result = await super.get(params);
7536
- if (result instanceof VariantHasuraGraphQL) {
7537
- const product = await this.productRepository.get({ id: result.productId.toString() });
7538
- result.product.name = product.name;
7539
- result.product.group = product.group;
7540
- }
7541
- return result;
7542
- }
7543
- async find(params) {
7544
- const result = await super.find(params);
7545
- const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7546
- (lodash.isEmpty(item.product.name) || lodash.isEmpty(item.product.group) || lodash.isEmpty(item.product)));
7547
- if (variantsWithNoData.length > 0) {
7548
- const { data: products } = await this.productRepository.find({
7549
- filters: {
7550
- id: {
7551
- operator: exports.Where.IN,
7552
- value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7553
- },
7554
- },
7555
- });
7556
- products.forEach((product) => {
7557
- result.data
7558
- .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7559
- .forEach((variant) => {
7560
- variant.product.name = product.name;
7561
- variant.product.group = product.group;
7562
- });
7563
- });
7564
- }
7565
- return result;
7566
- }
7567
- }
7568
-
7569
- const commonFields = [
7570
- {
7571
- id: {
7572
- columnName: 'id',
7573
- to: (value) => +value,
7574
- from: (value) => value.toString(),
7575
- },
7576
- },
7577
- { firestoreId: { columnName: 'firestore_id' } },
7578
- { productId: { columnName: 'main_product_id' } },
7579
- { CEST: { columnName: 'cest' } },
7580
- { EAN: { columnName: 'ean' } },
7581
- { NCM: { columnName: 'ncm' } },
7582
- 'brand',
7583
- { costPrice: { columnName: 'cost_price' } },
7584
- {
7585
- description: {
7586
- columnName: 'description',
7587
- from: (description, data) => ({
7588
- description,
7589
- differentials: data.differentials,
7590
- whoMustUse: data.who_must_use,
7591
- howToUse: data.how_to_use,
7592
- brand: data.brand_description,
7593
- ingredients: data.ingredients,
7594
- purpose: data.purpose,
7595
- }),
7596
- bindFindFilter: (filters) => {
7597
- return {
7598
- ...(filters?.description && { description: filters.description }),
7599
- ...(filters.differentials && { differentials: filters.differentials }),
7600
- ...(filters.whoMustUse && {
7601
- who_must_use: filters.whoMustUse,
7602
- }),
7603
- ...(filters.howToUse && {
7604
- how_to_use: filters.howToUse,
7605
- }),
7606
- ...(filters.brand && {
7607
- brand_description: filters.brand,
7608
- }),
7609
- ...(filters.ingredients && {
7610
- ingredients: filters.ingredients,
7611
- }),
7612
- ...(filters.purpose && {
7613
- purpose: filters.purpose,
7614
- }),
7615
- };
7616
- },
7617
- bindPersistData: (descriptionData) => ({
7618
- ...(descriptionData?.description && { description: descriptionData.description }),
7619
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7620
- ...(descriptionData.whoMustUse && {
7621
- who_must_use: descriptionData.whoMustUse,
7622
- }),
7623
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7624
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7625
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7626
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7627
- }),
7628
- },
7629
- },
7630
- { differentials: { columnName: 'differentials' } },
7631
- { whoMustUse: { columnName: 'who_must_use' } },
7632
- { howToUse: { columnName: 'how_to_use' } },
7633
- { brandDescription: { columnName: 'brand_description' } },
7634
- { ingredients: { columnName: 'ingredients' } },
7635
- { purpose: { columnName: 'purpose' } },
7636
- { hasVariants: { columnName: 'has_variants' } },
7637
- {
7638
- images: {
7639
- columnName: 'images',
7640
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7641
- },
7642
- },
7643
- {
7644
- miniatures: {
7645
- columnName: 'miniatures',
7646
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7647
- },
7648
- },
7649
- {
7650
- imagesCard: {
7651
- columnName: 'images_card',
7652
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7653
- },
7654
- },
7655
- 'name',
7656
- {
7657
- price: {
7658
- columnName: 'price',
7659
- from: (price, data) => ({
7660
- price,
7661
- fullPrice: data.full_price,
7662
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
7663
- fullPriceDiscountPercentage: data.full_price_discount_percentage,
7664
- subscriberPrice: data.subscriber_price,
7665
- }),
7666
- bindFindFilter: (filters) => {
7667
- return {
7668
- ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7669
- ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7670
- ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7671
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7672
- }),
7673
- ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7674
- subscriber_price: filters.subscriberPrice,
7675
- }),
7676
- ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7677
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7678
- }),
7679
- };
7680
- },
7681
- bindPersistData: (priceData) => ({
7682
- ...(priceData?.price >= 0 && { price: priceData.price }),
7683
- ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
7684
- ...(priceData.subscriberDiscountPercentage >= 0 && {
7685
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
7686
- }),
7687
- ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
7688
- ...(priceData.fullPriceDiscountPercentage >= 0 && {
7689
- full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
7690
- }),
7691
- }),
7692
- },
7693
- },
7694
- { fullPrice: { columnName: 'full_price' } },
7695
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7696
- { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7697
- { subscriberPrice: { columnName: 'subscriber_price' } },
7698
- 'published',
7699
- 'outlet',
7700
- 'label',
7701
- 'sku',
7702
- {
7703
- stock: {
7704
- columnName: 'stock',
7705
- from: (quantity) => ({ quantity }),
7706
- to: (value) => (lodash.isNil(value?.quantity) ? value : value?.quantity),
7707
- },
7708
- },
7709
- { hasStock: { columnName: 'has_stock' } },
7710
- 'slug',
7711
- 'type',
7712
- 'video',
7713
- 'weight',
7714
- 'gender',
7715
- { intGender: { columnName: 'int_gender' } },
7716
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
7717
- { isKit: { columnName: 'is_kit' } },
7718
- { createdAt: { columnName: 'created_at' } },
7719
- { updatedAt: { columnName: 'updated_at' } },
7720
- { rate: { columnName: 'rating' } },
7721
- { reviewsTotal: { columnName: 'reviews_total' } },
7722
- { shoppingCount: { columnName: 'shopping_count' } },
7723
- { categoryId: { columnName: 'category_id' } },
7724
- {
7725
- category: {
7726
- columnName: 'category',
7727
- foreignKeyColumn: { id: 'categoryId' },
7728
- fields: ['id', 'name', 'reference', 'slug'],
7729
- },
7730
- },
7731
- 'group',
7732
- 'validity',
7733
- { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7734
- { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7735
- { daysOfUse: { columnName: 'days_of_use' } },
7736
- { showVariants: { columnName: 'show_variants' } },
7737
- { variantSlug: { columnName: 'variant_slug' } },
7738
- ];
7739
- const fieldsConfiguration$2 = [
7740
- ...commonFields,
7741
- {
7742
- categories: {
7743
- columnName: 'categories',
7744
- fields: ['category_id'],
7745
- bindPersistData: (value) => ({
7746
- categories: { data: value.map((category) => ({ category_id: +category })) },
7747
- }),
7748
- to: (categories) => categories.map((categoryId) => +categoryId),
7749
- from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7750
- },
7751
- },
7752
- {
7753
- kitProducts: {
7754
- columnName: 'kit_products',
7755
- foreignKeyColumn: { productId: 'id' },
7756
- fields: [
7757
- { productId: { columnName: 'product_id' } },
7758
- { kitProductId: { columnName: 'kit_product_id' } },
7759
- 'quantity',
7760
- { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7761
- ],
7762
- },
7763
- },
7764
- {
7765
- reviews: {
7766
- columnName: 'reviews',
7767
- foreignKeyColumn: { product_id: 'id' },
7578
+ },
7579
+ },
7580
+ {
7581
+ reviews: {
7582
+ columnName: 'reviews',
7583
+ foreignKeyColumn: { product_id: 'id' },
7768
7584
  fields: [
7769
7585
  'id',
7770
7586
  'shop',
@@ -7798,61 +7614,9 @@ const fieldsConfiguration$2 = [
7798
7614
  foreignKeyColumn: { product_id: 'id' },
7799
7615
  fields: [
7800
7616
  'id',
7801
- 'name',
7802
7617
  'ean',
7803
7618
  'sku',
7804
- {
7805
- description: {
7806
- columnName: 'description',
7807
- from: (description, data) => ({
7808
- description,
7809
- differentials: data.differentials,
7810
- whoMustUse: data.who_must_use,
7811
- howToUse: data.how_to_use,
7812
- brand: data.brand_description,
7813
- ingredients: data.ingredients,
7814
- purpose: data.purpose,
7815
- }),
7816
- bindFindFilter: (filters) => {
7817
- return {
7818
- ...(filters?.description && { description: filters.description }),
7819
- ...(filters.differentials && { differentials: filters.differentials }),
7820
- ...(filters.whoMustUse && {
7821
- who_must_use: filters.whoMustUse,
7822
- }),
7823
- ...(filters.howToUse && {
7824
- how_to_use: filters.howToUse,
7825
- }),
7826
- ...(filters.brand && {
7827
- brand_description: filters.brand,
7828
- }),
7829
- ...(filters.ingredients && {
7830
- ingredients: filters.ingredients,
7831
- }),
7832
- ...(filters.purpose && {
7833
- purpose: filters.purpose,
7834
- }),
7835
- };
7836
- },
7837
- bindPersistData: (descriptionData) => ({
7838
- ...(descriptionData?.description && { description: descriptionData.description }),
7839
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7840
- ...(descriptionData.whoMustUse && {
7841
- who_must_use: descriptionData.whoMustUse,
7842
- }),
7843
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7844
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7845
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7846
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7847
- }),
7848
- },
7849
- },
7850
- { differentials: { columnName: 'differentials' } },
7851
- { whoMustUse: { columnName: 'who_must_use' } },
7852
- { howToUse: { columnName: 'how_to_use' } },
7853
- { brandDescription: { columnName: 'brand_description' } },
7854
- { ingredients: { columnName: 'ingredients' } },
7855
- { purpose: { columnName: 'purpose' } },
7619
+ 'description',
7856
7620
  {
7857
7621
  grade: {
7858
7622
  columnName: 'grade',
@@ -7898,6 +7662,10 @@ const fieldsConfiguration$2 = [
7898
7662
  }),
7899
7663
  },
7900
7664
  },
7665
+ { fullPrice: { columnName: 'full_price' } },
7666
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7667
+ { subscriberPrice: { columnName: 'subscriber_price' } },
7668
+ { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7901
7669
  'published',
7902
7670
  {
7903
7671
  stock: {
@@ -7926,29 +7694,6 @@ const fieldsConfiguration$2 = [
7926
7694
  },
7927
7695
  { tagsProfile: { columnName: 'tags_profile' } },
7928
7696
  { tagsCollection: { columnName: 'tags_collection' } },
7929
- { variantSlug: { columnName: 'variant_slug' } },
7930
- {
7931
- reviews: {
7932
- columnName: 'reviews',
7933
- foreignKeyColumn: { product_id: 'id' },
7934
- fields: [
7935
- 'id',
7936
- 'shop',
7937
- 'rate',
7938
- 'author',
7939
- 'email',
7940
- 'location',
7941
- 'review',
7942
- 'status',
7943
- 'title',
7944
- { personId: { columnName: 'person_id' } },
7945
- 'points',
7946
- { orderId: { columnName: 'order_id' } },
7947
- { createdAt: { columnName: 'created_at' } },
7948
- { updatedAt: { columnName: 'updated_at' } },
7949
- ],
7950
- },
7951
- },
7952
7697
  ],
7953
7698
  },
7954
7699
  },
@@ -8014,12 +7759,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8014
7759
  : await super.get(identifiers, options);
8015
7760
  if (product.productId)
8016
7761
  throw new NotFoundError('Product not found, it is a variant');
8017
- product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, false, options));
8018
- if (!product.variants?.length) {
8019
- for (const [index, variant] of product.variants.entries()) {
8020
- product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
8021
- }
8022
- }
7762
+ product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, options));
8023
7763
  return product;
8024
7764
  }
8025
7765
  async find(params, optionsParams) {
@@ -8036,7 +7776,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8036
7776
  options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
8037
7777
  return super.find({
8038
7778
  ...options,
8039
- filters: { ...filters },
7779
+ filters: { ...filters, productId: { operator: exports.Where.ISNULL } },
8040
7780
  fields: [
8041
7781
  ...bindFields,
8042
7782
  ...(bindFields.includes('price')
@@ -8061,9 +7801,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8061
7801
  const result = await this.find({
8062
7802
  filters: {
8063
7803
  slug,
8064
- productId: {
8065
- operator: exports.Where.ISNULL,
8066
- },
8067
7804
  },
8068
7805
  fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
8069
7806
  options: {
@@ -8073,11 +7810,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8073
7810
  if (!result.data.length)
8074
7811
  return null;
8075
7812
  const product = result?.data?.shift();
8076
- if (!product.variants?.length) {
8077
- for (const [index, variant] of product.variants.entries()) {
8078
- product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
8079
- }
8080
- }
8081
7813
  RoundProductPricesHelper.roundProductPrices(product);
8082
7814
  if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
8083
7815
  const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
@@ -8279,7 +8011,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8279
8011
  return data?.[0]?.id;
8280
8012
  throw new NotFoundError(`Product with id ${id} not found`);
8281
8013
  }
8282
- async findReviewsByProduct(productId, onlyApproved, options) {
8014
+ async findReviewsByProduct(productId, options) {
8283
8015
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8284
8016
  const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
8285
8017
  const cachedData = await this.cache.cacheAdapter.get(cacheKey);
@@ -8292,16 +8024,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8292
8024
  where: {
8293
8025
  value: {
8294
8026
  product_id: { _eq: productId },
8295
- ...(onlyApproved && { status: { _eq: true } }),
8296
8027
  },
8297
8028
  type: 'product_review_bool_exp',
8298
8029
  required: true,
8299
8030
  },
8300
- order_by: {
8301
- type: '[product_review_order_by]',
8302
- value: [{ createdAt: 'desc' }],
8303
- required: true,
8304
- },
8305
8031
  });
8306
8032
  const reviews = data?.map((review) => this.bindReviewToModel(review));
8307
8033
  if (this.cache?.cacheAdapter && options?.cache?.enabled && reviews) {
@@ -8406,7 +8132,7 @@ tslib.__decorate([
8406
8132
  tslib.__decorate([
8407
8133
  Log(),
8408
8134
  tslib.__metadata("design:type", Function),
8409
- tslib.__metadata("design:paramtypes", [Number, Boolean, Object]),
8135
+ tslib.__metadata("design:paramtypes", [Number, Object]),
8410
8136
  tslib.__metadata("design:returntype", Promise)
8411
8137
  ], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
8412
8138
 
@@ -8645,115 +8371,15 @@ const fieldsConfiguration$1 = [
8645
8371
  {
8646
8372
  miniatures: {
8647
8373
  columnName: 'miniatures',
8648
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8649
- },
8650
- },
8651
- {
8652
- imagesCard: {
8653
- columnName: 'images_card',
8654
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8655
- },
8656
- },
8657
- 'slug',
8658
- 'brand',
8659
- 'name',
8660
- 'sku',
8661
- { NCM: { columnName: 'ncm' } },
8662
- { CEST: { columnName: 'cest' } },
8663
- {
8664
- description: {
8665
- columnName: 'description',
8666
- from: (description, data) => ({
8667
- description,
8668
- differentials: data.differentials,
8669
- whoMustUse: data.who_must_use,
8670
- howToUse: data.how_to_use,
8671
- brand: data.brand_description,
8672
- ingredients: data.ingredients,
8673
- purpose: data.purpose,
8674
- }),
8675
- bindFindFilter: (filters) => {
8676
- return {
8677
- ...(filters?.description && { description: filters.description }),
8678
- ...(filters.differentials && { differentials: filters.differentials }),
8679
- ...(filters.whoMustUse && {
8680
- who_must_use: filters.whoMustUse,
8681
- }),
8682
- ...(filters.howToUse && {
8683
- how_to_use: filters.howToUse,
8684
- }),
8685
- ...(filters.brand && {
8686
- brand_description: filters.brand,
8687
- }),
8688
- ...(filters.ingredients && {
8689
- ingredients: filters.ingredients,
8690
- }),
8691
- ...(filters.purpose && {
8692
- purpose: filters.purpose,
8693
- }),
8694
- };
8695
- },
8696
- bindPersistData: (descriptionData) => ({
8697
- ...(descriptionData?.description && { description: descriptionData.description }),
8698
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
8699
- ...(descriptionData.whoMustUse && {
8700
- who_must_use: descriptionData.whoMustUse,
8701
- }),
8702
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
8703
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
8704
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
8705
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
8706
- }),
8707
- },
8708
- },
8709
- { differentials: { columnName: 'differentials' } },
8710
- { whoMustUse: { columnName: 'who_must_use' } },
8711
- { howToUse: { columnName: 'how_to_use' } },
8712
- { brandDescription: { columnName: 'brand_description' } },
8713
- { ingredients: { columnName: 'ingredients' } },
8714
- { purpose: { columnName: 'purpose' } },
8715
- 'gender',
8716
- { intGender: { columnName: 'int_gender' } },
8717
- 'label',
8718
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
8719
- { rate: { columnName: 'rating' } },
8720
- { reviewsTotal: { columnName: 'reviews_total' } },
8721
- { shoppingCount: { columnName: 'shopping_count' } },
8722
- { categoryId: { columnName: 'category_id' } },
8723
- {
8724
- metadata: {
8725
- columnName: 'metadata',
8726
- fields: ['title', 'description'],
8727
- bindPersistData: (value) => ({
8728
- metadata: { data: value },
8729
- }),
8374
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8730
8375
  },
8731
8376
  },
8732
8377
  {
8733
- reviews: {
8734
- columnName: 'reviews',
8735
- foreignKeyColumn: { product_id: 'id' },
8736
- fields: [
8737
- 'id',
8738
- 'shop',
8739
- 'rate',
8740
- 'author',
8741
- 'email',
8742
- 'location',
8743
- 'review',
8744
- 'status',
8745
- 'title',
8746
- { personId: { columnName: 'person_id' } },
8747
- 'points',
8748
- { orderId: { columnName: 'order_id' } },
8749
- { createdAt: { columnName: 'created_at' } },
8750
- { updatedAt: { columnName: 'updated_at' } },
8751
- ],
8378
+ imagesCard: {
8379
+ columnName: 'images_card',
8380
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8752
8381
  },
8753
8382
  },
8754
- { variantSlug: { columnName: 'variant_slug' } },
8755
- { createdAt: { columnName: 'created_at' } },
8756
- { updatedAt: { columnName: 'updated_at' } },
8757
8383
  ];
8758
8384
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
8759
8385
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -8794,37 +8420,18 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8794
8420
  return data.at(0);
8795
8421
  }
8796
8422
  async update(params) {
8797
- const { productId, id: checkId, metadata, ...data } = params;
8423
+ const { productId, id: checkId, ...data } = params;
8798
8424
  const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
8799
8425
  if (!dataWithProductId.id) {
8800
8426
  throw new NotFoundError('Variant ID is required for update');
8801
8427
  }
8802
8428
  const id = await this.getId(dataWithProductId.id);
8803
8429
  const product = await super.update({ id, ...data });
8804
- product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
8805
8430
  if (dataWithProductId.productId) {
8806
8431
  product.productId = dataWithProductId.productId;
8807
8432
  }
8808
8433
  return product;
8809
8434
  }
8810
- async updateMetadata(productId, { metadata }) {
8811
- const plainData = this.paramsToPlain({ metadata });
8812
- if (!plainData.metadata)
8813
- return null;
8814
- await this.mutation('update_product_metadata_by_pk', ['product_id'], {
8815
- pk_columns: {
8816
- value: { product_id: productId },
8817
- type: 'product_metadata_pk_columns_input',
8818
- required: true,
8819
- },
8820
- _set: {
8821
- value: lodash.omit(metadata, ['product_id']),
8822
- type: 'product_metadata_set_input',
8823
- required: true,
8824
- },
8825
- });
8826
- return plainData.metadata;
8827
- }
8828
8435
  async getId(id) {
8829
8436
  if (!Number.isNaN(+id))
8830
8437
  return id;
@@ -9168,6 +8775,438 @@ tslib.__decorate([
9168
8775
  tslib.__metadata("design:returntype", Promise)
9169
8776
  ], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
9170
8777
 
8778
+ class MercadoPagoRequestHelper {
8779
+ static build(data) {
8780
+ const { checkout, method, postback, card } = data;
8781
+ return {
8782
+ transaction_amount: +checkout.totalPrice.toFixed(2),
8783
+ notification_url: postback,
8784
+ metadata: {
8785
+ checkoutId: checkout.id,
8786
+ },
8787
+ payer: this.buildPayer(checkout, card),
8788
+ statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
8789
+ additional_info: {
8790
+ items: this.buildItems(checkout),
8791
+ },
8792
+ ...(method === 'credit_card' && this.buildCardPayment(card)),
8793
+ ...(method === 'pix' && this.buildPixPayment()),
8794
+ ...(method === 'boleto' && this.buildBoletoPayment(checkout)),
8795
+ };
8796
+ }
8797
+ static buildItems(checkout) {
8798
+ return checkout.lineItems
8799
+ .filter((item) => !item.isGift)
8800
+ .map((item) => {
8801
+ return {
8802
+ id: item.EAN,
8803
+ title: item.name,
8804
+ description: item.name,
8805
+ picture_url: item.image ?? null,
8806
+ category_id: item.category?.id ?? null,
8807
+ quantity: item.quantity,
8808
+ unit_price: +item.pricePaid.toFixed(2),
8809
+ };
8810
+ });
8811
+ }
8812
+ static buildPayer(checkout, card) {
8813
+ return {
8814
+ ...(card && { id: card.customerId }),
8815
+ first_name: checkout.user.firstName,
8816
+ last_name: checkout.user.lastName,
8817
+ email: checkout.user.email,
8818
+ identification: {
8819
+ type: 'CPF',
8820
+ number: checkout.user.cpf.replace(/\D/g, ''),
8821
+ },
8822
+ };
8823
+ }
8824
+ static buildFullPayer(checkout) {
8825
+ return {
8826
+ first_name: checkout.user.firstName,
8827
+ last_name: checkout.user.lastName,
8828
+ phone: {
8829
+ area_code: checkout.user.phone.substring(0, 2),
8830
+ number: checkout.user.phone.substring(2),
8831
+ },
8832
+ address: {
8833
+ zip_code: checkout.shippingAddress.zip,
8834
+ street_name: `${checkout.shippingAddress.street}, ${checkout.shippingAddress.district}`,
8835
+ street_number: checkout.shippingAddress.number,
8836
+ neighborhood: checkout.shippingAddress.district,
8837
+ city: checkout.shippingAddress.city,
8838
+ federal_unit: checkout.shippingAddress.state,
8839
+ },
8840
+ };
8841
+ }
8842
+ static buildCardPayment(card) {
8843
+ return {
8844
+ installments: card.installments,
8845
+ token: card.cardId,
8846
+ binary_mode: true,
8847
+ capture: true,
8848
+ };
8849
+ }
8850
+ static buildPixPayment() {
8851
+ return {
8852
+ payment_method_id: 'pix',
8853
+ date_of_expiration: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd') + 'T23:59:59.999-03:00',
8854
+ };
8855
+ }
8856
+ static buildBoletoPayment(checkout) {
8857
+ return {
8858
+ payment_method_id: 'bolbradesco',
8859
+ date_of_expiration: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd') + 'T23:59:59.999-03:00',
8860
+ payer: {
8861
+ first_name: checkout.user.firstName,
8862
+ last_name: checkout.user.lastName,
8863
+ email: checkout.user.email,
8864
+ identification: {
8865
+ type: 'CPF',
8866
+ number: checkout.user.cpf.replace(/\D/g, ''),
8867
+ },
8868
+ phone: {
8869
+ area_code: checkout.user.phone.substring(0, 2),
8870
+ number: checkout.user.phone.substring(2),
8871
+ },
8872
+ address: {
8873
+ zip_code: checkout.shippingAddress.zip.replace(/\D/g, ''),
8874
+ street_name: `${checkout.shippingAddress.street}, ${checkout.shippingAddress.district}`,
8875
+ street_number: checkout.shippingAddress.number,
8876
+ neighborhood: checkout.shippingAddress.district,
8877
+ city: checkout.shippingAddress.city,
8878
+ federal_unit: checkout.shippingAddress.state,
8879
+ },
8880
+ },
8881
+ };
8882
+ }
8883
+ }
8884
+
8885
+ class MercadoPagoResponseHelper {
8886
+ static build(method, checkout, response) {
8887
+ return Payment.toInstance({
8888
+ createdAt: new Date(),
8889
+ updatedAt: new Date(),
8890
+ userId: checkout.user.id,
8891
+ checkoutId: checkout.id,
8892
+ totalPrice: checkout.totalPrice,
8893
+ paymentProvider: exports.PaymentProviders.MERCADOPAGO,
8894
+ mercadoPagoId: response.id,
8895
+ transaction: this.buildPaymentTransaction(method, response),
8896
+ });
8897
+ }
8898
+ static buildPaymentTransaction(method, response) {
8899
+ return PaymentTransaction.toInstance({
8900
+ id: response.id.toString(),
8901
+ acquirer_name: exports.PaymentProviders.MERCADOPAGO,
8902
+ amount: response.transaction_amount,
8903
+ status: this.statusMapping(response.status),
8904
+ status_reason: response.status_detail?.toString(),
8905
+ payment_method: method,
8906
+ currency: response.currency_id?.toString(),
8907
+ paid_amount: response.transaction_details?.total_paid_amount ?? null,
8908
+ paid_at: response.date_approved ?? null,
8909
+ charger_id: response.charges_details?.at(0)?.id?.toString() ?? null,
8910
+ ...(method == exports.TransactionPaymentMethods.PIX && this.getPixReponse(response)),
8911
+ ...(method == exports.TransactionPaymentMethods.CARD && this.getCardReponse(response)),
8912
+ ...(method == exports.TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(response)),
8913
+ });
8914
+ }
8915
+ static getBoletoReponse(response) {
8916
+ return {
8917
+ boleto_url: response.transaction_details?.external_resource_url?.toString(),
8918
+ boleto_barcode: response.transaction_details?.barcode?.content?.toString(),
8919
+ boleto_line: response.transaction_details?.digitable_line?.toString(),
8920
+ boleto_expiration_date: response.date_of_expiration?.toString(),
8921
+ boleto_document_number: response.transaction_details?.verification_code?.toString(),
8922
+ };
8923
+ }
8924
+ static getPixReponse(response) {
8925
+ return {
8926
+ pix_qr_code: response.point_of_interaction?.transaction_data?.qr_code,
8927
+ pix_expiration_date: response.date_of_expiration?.toString(),
8928
+ };
8929
+ }
8930
+ static getCardReponse(response) {
8931
+ return {
8932
+ soft_descriptor: response.statement_descriptor?.toString(),
8933
+ installments: response.installments,
8934
+ card_brand: response.payment_method_id?.toString(),
8935
+ card_first_digits: response.card?.first_six_digits?.toString(),
8936
+ card_last_digits: response.card?.last_four_digits?.toString(),
8937
+ card_id: response.card?.id?.toString(),
8938
+ card_holder_name: response.card?.cardholder?.name?.toString(),
8939
+ card_expiration_month: response.card?.expiration_month?.toString(),
8940
+ card_expiration_year: response.card?.expiration_year?.toString(),
8941
+ capture_method: response.payment_type_id?.toString(),
8942
+ authorization_code: response.authorization_code?.toString(),
8943
+ paid_amount: this.statusMapping(response.status) == 'paid' ? response.transaction_details?.total_paid_amount : null,
8944
+ paid_at: this.statusMapping(response.status) == 'paid' ? response.date_approved : null,
8945
+ };
8946
+ }
8947
+ static statusMapping(status) {
8948
+ const statusMap = {
8949
+ approved: 'paid',
8950
+ pending: 'waiting_payment',
8951
+ in_process: 'processing',
8952
+ rejected: 'refused',
8953
+ cancelled: 'refused',
8954
+ refunded: 'refunded',
8955
+ charged_back: 'chargedback',
8956
+ };
8957
+ return statusMap[status] || status;
8958
+ }
8959
+ }
8960
+
8961
+ class MercadoPagoBankSlipAxiosAdapter {
8962
+ constructor(credentials, paymentRepository) {
8963
+ this.credentials = credentials;
8964
+ this.paymentRepository = paymentRepository;
8965
+ }
8966
+ async pay(checkout) {
8967
+ try {
8968
+ const payload = MercadoPagoRequestHelper.build({
8969
+ checkout,
8970
+ method: 'boleto',
8971
+ postback: this.credentials.postback,
8972
+ });
8973
+ console.warn('[MERCADO PAGO BOLETO DATA TO SEND]', JSON.stringify(payload));
8974
+ const { data } = await axios__default["default"]({
8975
+ method: 'POST',
8976
+ url: `${this.credentials.url}/v1/payments`,
8977
+ headers: {
8978
+ 'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
8979
+ Authorization: `Bearer ${this.credentials.api_key}`,
8980
+ 'Content-Type': 'application/json',
8981
+ },
8982
+ data: payload,
8983
+ });
8984
+ console.warn('[MERCADO PAGO RESPONSE BOLETO DATA]', JSON.stringify(data));
8985
+ const payment = await this.paymentRepository.create(MercadoPagoResponseHelper.build(exports.TransactionPaymentMethods.BANKSLIP, checkout, data));
8986
+ return payment;
8987
+ }
8988
+ catch (error) {
8989
+ if (error instanceof axios.AxiosError) {
8990
+ console.warn(JSON.stringify(error.response.data.message));
8991
+ }
8992
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
8993
+ checkoutId: checkout.id,
8994
+ userEmail: checkout.user.email,
8995
+ info: error.response.data?.message || error.message?.toString(),
8996
+ });
8997
+ }
8998
+ }
8999
+ getBoletoTransaction(paymentId) {
9000
+ throw new Error('Method not implemented.');
9001
+ }
9002
+ }
9003
+
9004
+ class MercadoPagoCardAxiosAdapter {
9005
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
9006
+ this.credentials = credentials;
9007
+ this.paymentRepository = paymentRepository;
9008
+ this.orderBlockedRepository = orderBlockedRepository;
9009
+ }
9010
+ async pay(checkout, card) {
9011
+ try {
9012
+ const payload = await this.getPaymentPayload(checkout, card);
9013
+ console.warn('[MERCADO PAGO CARD DATA TO SEND]', JSON.stringify(payload));
9014
+ const { data } = await axios__default["default"]({
9015
+ method: 'POST',
9016
+ url: `${this.credentials.url}/v1/payments`,
9017
+ headers: {
9018
+ 'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
9019
+ Authorization: `Bearer ${this.credentials.api_key}`,
9020
+ 'Content-Type': 'application/json',
9021
+ },
9022
+ data: payload,
9023
+ });
9024
+ console.warn('[MERCADO PAGO RESPONSE CARD DATA]', JSON.stringify(data));
9025
+ if (data.status == exports.MercadoPagoStatusEnum.rejected) {
9026
+ await this.orderBlockedRepository.createBlockedOrderOrPayment({
9027
+ checkout,
9028
+ blockType: 'Card not authorized',
9029
+ type: 'Card',
9030
+ limiteRange: 'day',
9031
+ card,
9032
+ });
9033
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
9034
+ checkoutId: checkout.id,
9035
+ userEmail: checkout.user.email,
9036
+ info: data,
9037
+ });
9038
+ }
9039
+ const payment = await this.paymentRepository.create(MercadoPagoResponseHelper.build(exports.TransactionPaymentMethods.CARD, checkout, data));
9040
+ return payment;
9041
+ }
9042
+ catch (error) {
9043
+ if (error instanceof axios.AxiosError) {
9044
+ console.warn(JSON.stringify(error.response.data.message));
9045
+ }
9046
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
9047
+ checkoutId: checkout.id,
9048
+ userEmail: checkout.user.email,
9049
+ info: error.response.data?.message || error.message?.toString(),
9050
+ });
9051
+ }
9052
+ }
9053
+ async getPaymentPayload(checkout, card) {
9054
+ const cardResponse = await this.getCardByToken(card.customerId, card.cardId, card.cardCvv);
9055
+ const payload = MercadoPagoRequestHelper.build({
9056
+ checkout,
9057
+ method: 'credit_card',
9058
+ postback: this.credentials.postback,
9059
+ card: {
9060
+ ...card,
9061
+ cardId: cardResponse.id,
9062
+ },
9063
+ });
9064
+ return payload;
9065
+ }
9066
+ async addCard(card, customer) {
9067
+ return;
9068
+ }
9069
+ async getCardByToken(customerId, token, cardCvv) {
9070
+ try {
9071
+ const payload = { cardId: token, customerId: customerId, securityCode: cardCvv };
9072
+ console.warn('payload getCardByToken', payload);
9073
+ const { data } = await axios__default["default"]({
9074
+ method: 'POST',
9075
+ url: `${this.credentials.url}/v1/card_tokens`,
9076
+ headers: {
9077
+ Authorization: `Bearer ${this.credentials.api_key}`,
9078
+ 'Content-Type': 'application/json',
9079
+ },
9080
+ data: payload,
9081
+ });
9082
+ return data;
9083
+ }
9084
+ catch (error) {
9085
+ if (error instanceof axios.AxiosError) {
9086
+ console.warn(JSON.stringify(error.response.data.cause));
9087
+ }
9088
+ throw error;
9089
+ }
9090
+ }
9091
+ createCardHash(bu, shop, card) {
9092
+ return;
9093
+ }
9094
+ createTransaction(info) {
9095
+ return;
9096
+ }
9097
+ async createOrUpdateCustomer(customer) {
9098
+ const { data } = await axios__default["default"]({
9099
+ method: 'POST',
9100
+ url: `${this.credentials.url}/v1/customers`,
9101
+ headers: {
9102
+ Authorization: `Bearer ${this.credentials.api_key}`,
9103
+ 'Content-Type': 'application/json',
9104
+ },
9105
+ data: {
9106
+ email: customer.email,
9107
+ first_name: customer.firstName,
9108
+ last_name: customer.lastName,
9109
+ phone: {
9110
+ area_code: customer.phone.substring(0, 2),
9111
+ number: customer.phone.substring(2),
9112
+ },
9113
+ identification: {
9114
+ type: 'CPF',
9115
+ number: customer.cpf.replace(/\D/g, ''),
9116
+ },
9117
+ },
9118
+ });
9119
+ return data;
9120
+ }
9121
+ }
9122
+
9123
+ class MercadoPagoPixAxiosAdapter {
9124
+ constructor(credentials, paymentRepository) {
9125
+ this.credentials = credentials;
9126
+ this.paymentRepository = paymentRepository;
9127
+ }
9128
+ async pay(checkout) {
9129
+ try {
9130
+ const payload = MercadoPagoRequestHelper.build({
9131
+ checkout,
9132
+ method: 'pix',
9133
+ postback: this.credentials.postback,
9134
+ });
9135
+ console.warn('[MERCADO PAGO PIX DATA TO SEND]', JSON.stringify(payload));
9136
+ const { data } = await axios__default["default"]({
9137
+ method: 'POST',
9138
+ url: `${this.credentials.url}/v1/payments`,
9139
+ headers: {
9140
+ 'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
9141
+ Authorization: `Bearer ${this.credentials.api_key}`,
9142
+ 'Content-Type': 'application/json',
9143
+ },
9144
+ data: payload,
9145
+ });
9146
+ console.warn('[MERCADO PAGO RESPONSE PIX DATA]', JSON.stringify(data));
9147
+ const payment = await this.paymentRepository.create(MercadoPagoResponseHelper.build(exports.TransactionPaymentMethods.PIX, checkout, data));
9148
+ return payment;
9149
+ }
9150
+ catch (error) {
9151
+ if (error instanceof axios.AxiosError) {
9152
+ console.warn(JSON.stringify(error.response.data.message));
9153
+ }
9154
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
9155
+ checkoutId: checkout.id,
9156
+ userEmail: checkout.user.email,
9157
+ info: error.response.data?.message || error.message?.toString(),
9158
+ });
9159
+ }
9160
+ }
9161
+ }
9162
+
9163
+ exports.MercadoPagoStatusDetailEnum = void 0;
9164
+ (function (MercadoPagoStatusDetailEnum) {
9165
+ MercadoPagoStatusDetailEnum["accredited"] = "accredited";
9166
+ MercadoPagoStatusDetailEnum["partially_refunded"] = "partially_refunded";
9167
+ MercadoPagoStatusDetailEnum["pending_capture"] = "pending_capture";
9168
+ MercadoPagoStatusDetailEnum["offline_process"] = "offline_process";
9169
+ MercadoPagoStatusDetailEnum["pending_contingency"] = "pending_contingency";
9170
+ MercadoPagoStatusDetailEnum["pending_review_manual"] = "pending_review_manual";
9171
+ MercadoPagoStatusDetailEnum["pending_waiting_transfer"] = "pending_waiting_transfer";
9172
+ MercadoPagoStatusDetailEnum["pending_waiting_payment"] = "pending_waiting_payment";
9173
+ MercadoPagoStatusDetailEnum["pending_challenge"] = "pending_challenge";
9174
+ MercadoPagoStatusDetailEnum["bank_error"] = "bank_error";
9175
+ MercadoPagoStatusDetailEnum["cc_rejected_3ds_mandatory"] = "cc_rejected_3ds_mandatory";
9176
+ MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_card_number"] = "cc_rejected_bad_filled_card_number";
9177
+ MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_date"] = "cc_rejected_bad_filled_date";
9178
+ MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_other"] = "cc_rejected_bad_filled_other";
9179
+ MercadoPagoStatusDetailEnum["cc_rejected_bad_filled_security_code"] = "cc_rejected_bad_filled_security_code";
9180
+ MercadoPagoStatusDetailEnum["cc_rejected_blacklist"] = "cc_rejected_blacklist";
9181
+ MercadoPagoStatusDetailEnum["cc_rejected_call_for_authorize"] = "cc_rejected_call_for_authorize";
9182
+ MercadoPagoStatusDetailEnum["cc_rejected_card_disabled"] = "cc_rejected_card_disabled";
9183
+ MercadoPagoStatusDetailEnum["cc_rejected_card_error"] = "cc_rejected_card_error";
9184
+ MercadoPagoStatusDetailEnum["cc_rejected_duplicated_payment"] = "cc_rejected_duplicated_payment";
9185
+ MercadoPagoStatusDetailEnum["cc_rejected_high_risk"] = "cc_rejected_high_risk";
9186
+ MercadoPagoStatusDetailEnum["cc_rejected_insufficient_amount"] = "cc_rejected_insufficient_amount";
9187
+ MercadoPagoStatusDetailEnum["cc_rejected_invalid_installments"] = "cc_rejected_invalid_installments";
9188
+ MercadoPagoStatusDetailEnum["cc_rejected_max_attempts"] = "cc_rejected_max_attempts";
9189
+ MercadoPagoStatusDetailEnum["cc_rejected_other_reason"] = "cc_rejected_other_reason";
9190
+ MercadoPagoStatusDetailEnum["cc_amount_rate_limit_exceeded"] = "cc_amount_rate_limit_exceeded";
9191
+ MercadoPagoStatusDetailEnum["rejected_insufficient_data"] = "rejected_insufficient_data";
9192
+ MercadoPagoStatusDetailEnum["rejected_by_bank"] = "rejected_by_bank";
9193
+ MercadoPagoStatusDetailEnum["rejected_by_regulations"] = "rejected_by_regulations";
9194
+ MercadoPagoStatusDetailEnum["insufficient_amount"] = "insufficient_amount";
9195
+ MercadoPagoStatusDetailEnum["cc_rejected_card_type_not_allowed"] = "cc_rejected_card_type_not_allowed";
9196
+ })(exports.MercadoPagoStatusDetailEnum || (exports.MercadoPagoStatusDetailEnum = {}));
9197
+
9198
+ exports.MercadoPagoStatusEnum = void 0;
9199
+ (function (MercadoPagoStatusEnum) {
9200
+ MercadoPagoStatusEnum["approved"] = "approved";
9201
+ MercadoPagoStatusEnum["authorized"] = "authorized";
9202
+ MercadoPagoStatusEnum["pending"] = "pending";
9203
+ MercadoPagoStatusEnum["in_process"] = "in_process";
9204
+ MercadoPagoStatusEnum["rejected"] = "rejected";
9205
+ MercadoPagoStatusEnum["cancelled"] = "cancelled";
9206
+ MercadoPagoStatusEnum["refunded"] = "refunded";
9207
+ MercadoPagoStatusEnum["charged_back"] = "charged_back";
9208
+ })(exports.MercadoPagoStatusEnum || (exports.MercadoPagoStatusEnum = {}));
9209
+
9171
9210
  class PagarmeBankSlipAxiosAdapter {
9172
9211
  constructor(credentials, paymentRepository) {
9173
9212
  this.credentials = credentials;
@@ -9315,15 +9354,17 @@ class PagarMeV5RequestHelper {
9315
9354
  customer: this.buildCustomer(checkout),
9316
9355
  shipping: this.buildShipping(checkout),
9317
9356
  payments: this.buildPayment(checkout, method, card),
9357
+ ...this.buildAdditionalInfo(checkout),
9318
9358
  };
9319
9359
  }
9320
9360
  static buildItems(checkout) {
9361
+ const isSubscriber = checkout.user?.isSubscriber ?? false;
9321
9362
  return checkout.lineItems
9322
9363
  .filter((item) => !item.isGift)
9323
9364
  .map((item) => {
9324
9365
  return {
9325
9366
  amount: Math.floor(item.pricePaid * 100),
9326
- description: item.name,
9367
+ description: isSubscriber ? `${item.name} - ASSINANTE` : item.name,
9327
9368
  quantity: item.quantity,
9328
9369
  code: item.EAN,
9329
9370
  };
@@ -9420,6 +9461,14 @@ class PagarMeV5RequestHelper {
9420
9461
  },
9421
9462
  };
9422
9463
  }
9464
+ static buildAdditionalInfo(checkout) {
9465
+ const isSubscriber = checkout.user?.isSubscriber ?? false;
9466
+ if (isSubscriber)
9467
+ return {
9468
+ antifraude_enabled: false,
9469
+ };
9470
+ return {};
9471
+ }
9423
9472
  }
9424
9473
 
9425
9474
  class PagarMeV5ResponseHelper {
@@ -10204,14 +10253,6 @@ Object.defineProperty(exports, 'formatInTimeZone', {
10204
10253
  enumerable: true,
10205
10254
  get: function () { return dateFnsTz.formatInTimeZone; }
10206
10255
  });
10207
- Object.defineProperty(exports, 'fromZonedTime', {
10208
- enumerable: true,
10209
- get: function () { return dateFnsTz.fromZonedTime; }
10210
- });
10211
- Object.defineProperty(exports, 'toZonedTime', {
10212
- enumerable: true,
10213
- get: function () { return dateFnsTz.toZonedTime; }
10214
- });
10215
10256
  Object.defineProperty(exports, 'chunk', {
10216
10257
  enumerable: true,
10217
10258
  get: function () { return lodash.chunk; }
@@ -10299,6 +10340,8 @@ exports.Base = Base;
10299
10340
  exports.BaseModel = BaseModel;
10300
10341
  exports.BeautyProfile = BeautyProfile;
10301
10342
  exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
10343
+ exports.BrandCategory = BrandCategory;
10344
+ exports.BrandCategoryFirestoreRepository = BrandCategoryFirestoreRepository;
10302
10345
  exports.BusinessError = BusinessError;
10303
10346
  exports.Buy2Win = Buy2Win;
10304
10347
  exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
@@ -10357,6 +10400,12 @@ exports.Log = Log;
10357
10400
  exports.LogDocument = LogDocument;
10358
10401
  exports.LogFirestoreRepository = LogFirestoreRepository;
10359
10402
  exports.Logger = Logger;
10403
+ exports.MercadoPagoBankSlipAxiosAdapter = MercadoPagoBankSlipAxiosAdapter;
10404
+ exports.MercadoPagoCardAxiosAdapter = MercadoPagoCardAxiosAdapter;
10405
+ exports.MercadoPagoPaymentMethodFactory = MercadoPagoPaymentMethodFactory;
10406
+ exports.MercadoPagoPixAxiosAdapter = MercadoPagoPixAxiosAdapter;
10407
+ exports.MercadoPagoRequestHelper = MercadoPagoRequestHelper;
10408
+ exports.MercadoPagoResponseHelper = MercadoPagoResponseHelper;
10360
10409
  exports.NotFoundError = NotFoundError;
10361
10410
  exports.ObsEmitter = ObsEmitter;
10362
10411
  exports.Order = Order;
@@ -10376,7 +10425,6 @@ exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
10376
10425
  exports.PaymentProviderFactory = PaymentProviderFactory;
10377
10426
  exports.PaymentTransaction = PaymentTransaction;
10378
10427
  exports.Product = Product;
10379
- exports.ProductCatalogHasuraGraphQLRepository = ProductCatalogHasuraGraphQLRepository;
10380
10428
  exports.ProductErrors = ProductErrors;
10381
10429
  exports.ProductErrorsHasuraGraphQL = ProductErrorsHasuraGraphQL;
10382
10430
  exports.ProductErrorsHasuraGraphQLRepository = ProductErrorsHasuraGraphQLRepository;