@infrab4a/connect 5.4.0-beta.2 → 5.4.0-beta.20

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 (43) hide show
  1. package/index.cjs.js +530 -582
  2. package/index.esm.js +531 -580
  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.d.ts +0 -1
  7. package/src/domain/catalog/models/variant.d.ts +0 -2
  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/payment-providers.enum.d.ts +2 -1
  11. package/src/domain/shopping/factories/mercado-pago-payment-method.factory.d.ts +9 -0
  12. package/src/domain/shopping/factories/payment-provider.factory.d.ts +2 -0
  13. package/src/domain/shopping/models/order.d.ts +7 -0
  14. package/src/domain/shopping/models/payment-transaction.d.ts +2 -0
  15. package/src/domain/shopping/models/payment.d.ts +1 -0
  16. package/src/domain/shopping/services/antifraud-card.service.d.ts +2 -0
  17. package/src/domain/shopping/types/checkout-paylod-request.type.d.ts +2 -7
  18. package/src/domain/shopping/types/index.d.ts +2 -0
  19. package/src/domain/shopping/types/mercado-pago-card.type.d.ts +3 -0
  20. package/src/domain/shopping/types/mercado-pago-credentials.type.d.ts +5 -0
  21. package/src/domain/shopping/types/payment-card-info.type.d.ts +2 -0
  22. package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
  23. package/src/infra/firebase/firestore/repositories/catalog/category-brand-firestore.repository.d.ts +7 -0
  24. package/src/infra/firebase/firestore/repositories/catalog/index.d.ts +1 -0
  25. package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -1
  26. package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -1
  27. package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +0 -1
  28. package/src/infra/index.d.ts +1 -0
  29. package/src/infra/mercado-pago/adapters/index.d.ts +2 -0
  30. package/src/infra/mercado-pago/adapters/mercado-pago-card-payment-axios.adapter.d.ts +19 -0
  31. package/src/infra/mercado-pago/adapters/mercado-pago-pix-payment-axios.adapter.d.ts +7 -0
  32. package/src/infra/mercado-pago/helpers/index.d.ts +2 -0
  33. package/src/infra/mercado-pago/helpers/mercado-pago-request.helper.d.ts +58 -0
  34. package/src/infra/mercado-pago/helpers/mercado-pago-response.helper.d.ts +8 -0
  35. package/src/infra/mercado-pago/index.d.ts +3 -0
  36. package/src/infra/mercado-pago/types/index.d.ts +2 -0
  37. package/src/infra/mercado-pago/types/mercado-pago-request.type.d.ts +1 -0
  38. package/src/infra/mercado-pago/types/mercado-pago-response.type.d.ts +180 -0
  39. package/src/infra/pagarme/adapters/helpers/pagarme-v5-request.helper.d.ts +1 -0
  40. package/src/infra/pagarme/types/v5/pagarmev5-order-request-payload.type.d.ts +1 -0
  41. package/src/utils/index.d.ts +2 -2
  42. package/src/domain/catalog/repositories/product-catalog.repository.d.ts +0 -13
  43. package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts +0 -20
package/index.esm.js CHANGED
@@ -3,8 +3,8 @@ import { __decorate, __metadata } from 'tslib';
3
3
  import { plainToInstance, instanceToPlain, Type } from 'class-transformer';
4
4
  import { parseISO, startOfDay, endOfDay, addHours, subDays, format, addDays } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
6
- import { toZonedTime } from 'date-fns-tz';
7
- export { formatInTimeZone, fromZonedTime, toZonedTime } from 'date-fns-tz';
6
+ import { utcToZonedTime } from 'date-fns-tz';
7
+ export { formatInTimeZone } from 'date-fns-tz';
8
8
  import { compact, get, isNil, isArray, first, last, flatten, isString, omit, each, unset, isObject, isEmpty, isDate, isBoolean, isInteger, isNumber, isNaN as isNaN$1, set, chunk, sortBy } from 'lodash';
9
9
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
10
10
  import { debug } from 'debug';
@@ -90,6 +90,7 @@ var PaymentProviders;
90
90
  PaymentProviders["PAGARME"] = "pagarMe";
91
91
  PaymentProviders["ADYEN"] = "adyen";
92
92
  PaymentProviders["GLAMPOINTS"] = "glampoints";
93
+ PaymentProviders["MERCADOPAGO"] = "mercadoPago";
93
94
  })(PaymentProviders || (PaymentProviders = {}));
94
95
 
95
96
  var TransactionPaymentMethods;
@@ -733,6 +734,30 @@ __decorate([
733
734
  ], Category.prototype, "filters", void 0);
734
735
  registerClass('Category', Category);
735
736
 
737
+ class BrandCategory extends BaseModel {
738
+ get glamImages() {
739
+ return this.images?.[Shops.GLAMSHOP]
740
+ ? this.images[Shops.GLAMSHOP]
741
+ : {
742
+ brandBanner: null,
743
+ brandBannerMobile: null,
744
+ image: null,
745
+ };
746
+ }
747
+ get mensImages() {
748
+ return this.images?.[Shops.MENSMARKET]
749
+ ? this.images[Shops.MENSMARKET]
750
+ : {
751
+ brandBanner: null,
752
+ brandBannerMobile: null,
753
+ image: null,
754
+ };
755
+ }
756
+ static get identifiersFields() {
757
+ return ['id'];
758
+ }
759
+ }
760
+
736
761
  class CategoryCollectionChildren extends BaseModel {
737
762
  static get identifiersFields() {
738
763
  return ['collectionId', 'categoryId'];
@@ -847,12 +872,7 @@ class Variant extends ProductBase {
847
872
  static get identifiersFields() {
848
873
  return ['id', 'productId'];
849
874
  }
850
- }
851
- __decorate([
852
- Type(() => Product),
853
- __metadata("design:type", Product)
854
- ], Variant.prototype, "product", void 0);
855
- registerClass('Product', Product);
875
+ }
856
876
 
857
877
  class Product extends ProductBase {
858
878
  }
@@ -1741,19 +1761,58 @@ class AntifraudCardService {
1741
1761
  constructor(orderRepository, orderBlockedRepository) {
1742
1762
  this.orderRepository = orderRepository;
1743
1763
  this.orderBlockedRepository = orderBlockedRepository;
1744
- this.LIMIT_ORDERS_DAY = 2;
1745
- this.LIMIT_ORDERS_WEEK = 7;
1746
- this.LIMIT_BLOCKED_ORDERS_DAY = 5;
1764
+ this.LIMIT_ORDERS_DAY = null;
1765
+ this.LIMIT_ORDERS_WEEK = null;
1747
1766
  }
1748
1767
  async validate(checkout, card) {
1768
+ this.setLimitsByUserType(checkout.user.isSubscriber);
1749
1769
  await this.validateBlockedOrderAttempts(checkout, card);
1750
1770
  await this.validateDayAndWeekOrderLimits(checkout, card);
1751
1771
  return true;
1752
1772
  }
1773
+ setLimitsByUserType(isSubscriber) {
1774
+ this.LIMIT_ORDERS_DAY = {
1775
+ subscriber: {
1776
+ cpf: 4,
1777
+ email: 4,
1778
+ phone: 4,
1779
+ card: 4,
1780
+ zip: 4,
1781
+ },
1782
+ nonSubscriber: {
1783
+ cpf: 2,
1784
+ email: 2,
1785
+ phone: 2,
1786
+ card: 2,
1787
+ zip: 2,
1788
+ },
1789
+ };
1790
+ this.LIMIT_ORDERS_WEEK = {
1791
+ subscriber: {
1792
+ cpf: 12,
1793
+ email: 12,
1794
+ phone: 12,
1795
+ card: 12,
1796
+ zip: Infinity,
1797
+ },
1798
+ nonSubscriber: {
1799
+ cpf: 7,
1800
+ email: 7,
1801
+ phone: 7,
1802
+ card: 7,
1803
+ zip: Infinity,
1804
+ },
1805
+ };
1806
+ this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1807
+ }
1808
+ getLimitsByUserType(type, isSubscriber) {
1809
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1810
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1811
+ }
1753
1812
  async validateBlockedOrderAttempts(checkout, card) {
1754
1813
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
1755
1814
  if (!isValid) {
1756
- throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
1815
+ throw new FraudValidationError(`Cliente com mais de ${this.LIMIT_BLOCKED_ORDERS_DAY} compras negadas/bloqueadas no dia`, {
1757
1816
  checkoutId: checkout.id,
1758
1817
  userEmail: checkout.user.email,
1759
1818
  info: {
@@ -1767,7 +1826,7 @@ class AntifraudCardService {
1767
1826
  async validateDayAndWeekOrderLimits(checkout, card) {
1768
1827
  const isValid = await this.verifyDayAndWeekOrders(checkout, card);
1769
1828
  if (!isValid) {
1770
- throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
1829
+ throw new FraudValidationError('Cliente tentando comprar mais do que o permitido no dia/semana', {
1771
1830
  checkoutId: checkout.id,
1772
1831
  userEmail: checkout.user.email,
1773
1832
  info: {
@@ -1786,7 +1845,7 @@ class AntifraudCardService {
1786
1845
  await this.createBlockedOrderRecord({
1787
1846
  checkout,
1788
1847
  card,
1789
- reason: 'More than 5 attempts have failed',
1848
+ reason: `More than ${this.LIMIT_BLOCKED_ORDERS_DAY} attempts have failed`,
1790
1849
  key: 'Failed attempts',
1791
1850
  period: 'day',
1792
1851
  });
@@ -1796,7 +1855,7 @@ class AntifraudCardService {
1796
1855
  }
1797
1856
  getTodayDateRange() {
1798
1857
  const timeZone = 'America/Sao_Paulo';
1799
- const today = toZonedTime(new Date(), timeZone);
1858
+ const today = utcToZonedTime(new Date(), timeZone);
1800
1859
  const day = startOfDay(today);
1801
1860
  const endOfDay$1 = endOfDay(today);
1802
1861
  return { day: addHours(day, 3), endOfDay: addHours(endOfDay$1, 3) };
@@ -1907,26 +1966,28 @@ class AntifraudCardService {
1907
1966
  }
1908
1967
  async validateDayOrderLimits(checkout, params) {
1909
1968
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
1969
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1910
1970
  return this.checkOrderLimitsAndBlock({
1911
1971
  checkout,
1912
1972
  orderCounts: ordersPerDay,
1913
- limit: this.LIMIT_ORDERS_DAY,
1973
+ limit: limits,
1914
1974
  period: 'day',
1915
1975
  });
1916
1976
  }
1917
1977
  async validateWeekOrderLimits(checkout, params) {
1918
1978
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
1979
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
1919
1980
  return this.checkOrderLimitsAndBlock({
1920
1981
  checkout,
1921
1982
  orderCounts: ordersPerWeek,
1922
- limit: this.LIMIT_ORDERS_WEEK,
1983
+ limit: limits,
1923
1984
  period: 'week',
1924
1985
  });
1925
1986
  }
1926
1987
  async checkOrderLimitsAndBlock(params) {
1927
1988
  const { checkout, orderCounts, limit, period } = params;
1928
1989
  for (const key in orderCounts) {
1929
- if (orderCounts[key] >= limit) {
1990
+ if (orderCounts[key] >= limit[key]) {
1930
1991
  await this.createBlockedOrderRecord({
1931
1992
  checkout,
1932
1993
  card: null,
@@ -3373,8 +3434,6 @@ class HasuraQueryBuilderHelper {
3373
3434
  class HasuraRequestHelper {
3374
3435
  static async fetch(params) {
3375
3436
  const { variables, query, endpoint, headers, logger } = params;
3376
- console.warn('variables', variables);
3377
- console.warn('query', query);
3378
3437
  const request = {
3379
3438
  url: endpoint,
3380
3439
  method: 'POST',
@@ -4746,6 +4805,17 @@ const withCrudFirestore = (MixinBase) => {
4746
4805
  };
4747
4806
  };
4748
4807
 
4808
+ class BrandCategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4809
+ constructor({ firestore, interceptors, }) {
4810
+ super({
4811
+ firestore,
4812
+ collectionName: 'brandsCategory',
4813
+ model: BrandCategory,
4814
+ interceptors,
4815
+ });
4816
+ }
4817
+ }
4818
+
4749
4819
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4750
4820
  constructor({ firestore, interceptors }) {
4751
4821
  super({
@@ -7199,7 +7269,83 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
7199
7269
  }
7200
7270
  }
7201
7271
 
7202
- const commonFields$1 = [
7272
+ class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7273
+ constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7274
+ super({
7275
+ tableName: 'product_errors',
7276
+ model: ProductErrorsHasuraGraphQL,
7277
+ endpoint,
7278
+ authOptions,
7279
+ interceptors,
7280
+ cache,
7281
+ fields: [
7282
+ {
7283
+ productId: {
7284
+ columnName: 'product_id',
7285
+ to: (value) => +value,
7286
+ from: (value) => value.toString(),
7287
+ },
7288
+ },
7289
+ 'source',
7290
+ 'error',
7291
+ { createdAt: { columnName: 'created_at' } },
7292
+ { updatedAt: { columnName: 'updated_at' } },
7293
+ {
7294
+ product: {
7295
+ columnName: 'product',
7296
+ foreignKeyColumn: { id: 'productId' },
7297
+ fields: [
7298
+ { id: { columnName: 'id', from: (value) => value.toString() } },
7299
+ { productId: { columnName: 'main_product_id' } },
7300
+ 'name',
7301
+ 'published',
7302
+ 'group',
7303
+ 'validity',
7304
+ { createdAt: { columnName: 'created_at' } },
7305
+ { updatedAt: { columnName: 'updated_at' } },
7306
+ ],
7307
+ },
7308
+ },
7309
+ ],
7310
+ });
7311
+ this.productRepository = productRepository;
7312
+ }
7313
+ async get(params) {
7314
+ const result = await super.get(params);
7315
+ if (result instanceof VariantHasuraGraphQL) {
7316
+ const product = await this.productRepository.get({ id: result.productId.toString() });
7317
+ result.product.name = product.name;
7318
+ result.product.group = product.group;
7319
+ }
7320
+ return result;
7321
+ }
7322
+ async find(params) {
7323
+ const result = await super.find(params);
7324
+ const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7325
+ (isEmpty(item.product.name) || isEmpty(item.product.group) || isEmpty(item.product)));
7326
+ if (variantsWithNoData.length > 0) {
7327
+ const { data: products } = await this.productRepository.find({
7328
+ filters: {
7329
+ id: {
7330
+ operator: Where.IN,
7331
+ value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7332
+ },
7333
+ },
7334
+ });
7335
+ products.forEach((product) => {
7336
+ result.data
7337
+ .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7338
+ .forEach((variant) => {
7339
+ variant.product.name = product.name;
7340
+ variant.product.group = product.group;
7341
+ });
7342
+ });
7343
+ }
7344
+ return result;
7345
+ }
7346
+ }
7347
+
7348
+ const commonFields = [
7203
7349
  {
7204
7350
  id: {
7205
7351
  columnName: 'id',
@@ -7354,383 +7500,61 @@ const commonFields$1 = [
7354
7500
  { reviewsTotal: { columnName: 'reviews_total' } },
7355
7501
  { shoppingCount: { columnName: 'shopping_count' } },
7356
7502
  { categoryId: { columnName: 'category_id' } },
7503
+ {
7504
+ category: {
7505
+ columnName: 'category',
7506
+ foreignKeyColumn: { id: 'categoryId' },
7507
+ fields: ['id', 'name', 'reference', 'slug'],
7508
+ },
7509
+ },
7357
7510
  'group',
7358
7511
  'validity',
7359
7512
  { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7360
7513
  { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7361
7514
  { daysOfUse: { columnName: 'days_of_use' } },
7362
- { showVariants: { columnName: 'show_variants' } },
7363
7515
  ];
7364
- class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
7365
- constructor({ endpoint, authOptions, interceptors, cache, }) {
7366
- super({
7367
- tableName: 'product_catalog',
7368
- model: ProductHasuraGraphQL,
7369
- endpoint,
7370
- authOptions,
7371
- interceptors,
7372
- fields: commonFields$1,
7373
- cache,
7374
- });
7375
- }
7376
- async get({ id }) {
7377
- return super
7378
- .find({
7379
- filters: {
7380
- id,
7381
- },
7382
- limits: {
7383
- limit: 1,
7384
- },
7385
- })
7386
- .then((res) => res.data.at(0));
7387
- }
7388
- async getByEAN(EAN, options) {
7389
- return super
7390
- .find({
7391
- filters: {
7392
- EAN,
7393
- },
7394
- limits: {
7395
- limit: 1,
7396
- },
7397
- })
7398
- .then((res) => res.data.at(0));
7399
- }
7400
- async find(params, optionsParams) {
7401
- const { filters, fields, ...options } = params || {};
7402
- const bindFields = fields ||
7403
- this.fields
7404
- .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
7405
- .filter((field) => field !== 'reviews' && field !== 'categories');
7406
- if (options.options?.minimal?.includes('price'))
7407
- options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
7408
- if (options.options?.maximum?.includes('price'))
7409
- options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
7410
- options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
7411
- options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
7412
- return super.find({
7413
- ...options,
7414
- filters: { ...filters },
7516
+ const fieldsConfiguration$2 = [
7517
+ ...commonFields,
7518
+ {
7519
+ categories: {
7520
+ columnName: 'categories',
7521
+ fields: ['category_id'],
7522
+ bindPersistData: (value) => ({
7523
+ categories: { data: value.map((category) => ({ category_id: +category })) },
7524
+ }),
7525
+ to: (categories) => categories.map((categoryId) => +categoryId),
7526
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7527
+ },
7528
+ },
7529
+ {
7530
+ kitProducts: {
7531
+ columnName: 'kit_products',
7532
+ foreignKeyColumn: { productId: 'id' },
7415
7533
  fields: [
7416
- ...bindFields,
7417
- ...(bindFields.includes('price')
7418
- ? [
7419
- 'subscriberPrice',
7420
- 'subscriberDiscountPercentage',
7421
- 'fullPrice',
7422
- ]
7423
- : []),
7534
+ { productId: { columnName: 'product_id' } },
7535
+ { kitProductId: { columnName: 'kit_product_id' } },
7536
+ 'quantity',
7537
+ { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7424
7538
  ],
7425
- }, optionsParams);
7426
- }
7427
- async findCatalog(params, mainGender, options) {
7428
- const result = await this.find({
7429
- ...params,
7430
- filters: { ...params.filters, published: true },
7431
- orderBy: {
7432
- hasStock: 'desc',
7433
- ...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
7434
- ...omit(params.orderBy, ['hasStock', 'intGender']),
7435
- },
7436
- }, options);
7437
- return result;
7438
- }
7439
- }
7440
- __decorate([
7441
- Log(),
7442
- __metadata("design:type", Function),
7443
- __metadata("design:paramtypes", [Object, Object, Object]),
7444
- __metadata("design:returntype", Promise)
7445
- ], ProductCatalogHasuraGraphQLRepository.prototype, "findCatalog", null);
7446
-
7447
- class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7448
- constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7449
- super({
7450
- tableName: 'product_errors',
7451
- model: ProductErrorsHasuraGraphQL,
7452
- endpoint,
7453
- authOptions,
7454
- interceptors,
7455
- cache,
7539
+ },
7540
+ },
7541
+ {
7542
+ reviews: {
7543
+ columnName: 'reviews',
7544
+ foreignKeyColumn: { product_id: 'id' },
7456
7545
  fields: [
7457
- {
7458
- productId: {
7459
- columnName: 'product_id',
7460
- to: (value) => +value,
7461
- from: (value) => value.toString(),
7462
- },
7463
- },
7464
- 'source',
7465
- 'error',
7466
- { createdAt: { columnName: 'created_at' } },
7467
- { updatedAt: { columnName: 'updated_at' } },
7468
- {
7469
- product: {
7470
- columnName: 'product',
7471
- foreignKeyColumn: { id: 'productId' },
7472
- fields: [
7473
- { id: { columnName: 'id', from: (value) => value.toString() } },
7474
- { productId: { columnName: 'main_product_id' } },
7475
- 'name',
7476
- 'published',
7477
- 'group',
7478
- 'validity',
7479
- { createdAt: { columnName: 'created_at' } },
7480
- { updatedAt: { columnName: 'updated_at' } },
7481
- ],
7482
- },
7483
- },
7484
- ],
7485
- });
7486
- this.productRepository = productRepository;
7487
- }
7488
- async get(params) {
7489
- const result = await super.get(params);
7490
- if (result instanceof VariantHasuraGraphQL) {
7491
- const product = await this.productRepository.get({ id: result.productId.toString() });
7492
- result.product.name = product.name;
7493
- result.product.group = product.group;
7494
- }
7495
- return result;
7496
- }
7497
- async find(params) {
7498
- const result = await super.find(params);
7499
- const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7500
- (isEmpty(item.product.name) || isEmpty(item.product.group) || isEmpty(item.product)));
7501
- if (variantsWithNoData.length > 0) {
7502
- const { data: products } = await this.productRepository.find({
7503
- filters: {
7504
- id: {
7505
- operator: Where.IN,
7506
- value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7507
- },
7508
- },
7509
- });
7510
- products.forEach((product) => {
7511
- result.data
7512
- .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7513
- .forEach((variant) => {
7514
- variant.product.name = product.name;
7515
- variant.product.group = product.group;
7516
- });
7517
- });
7518
- }
7519
- return result;
7520
- }
7521
- }
7522
-
7523
- const commonFields = [
7524
- {
7525
- id: {
7526
- columnName: 'id',
7527
- to: (value) => +value,
7528
- from: (value) => value.toString(),
7529
- },
7530
- },
7531
- { firestoreId: { columnName: 'firestore_id' } },
7532
- { productId: { columnName: 'main_product_id' } },
7533
- { CEST: { columnName: 'cest' } },
7534
- { EAN: { columnName: 'ean' } },
7535
- { NCM: { columnName: 'ncm' } },
7536
- 'brand',
7537
- { costPrice: { columnName: 'cost_price' } },
7538
- {
7539
- description: {
7540
- columnName: 'description',
7541
- from: (description, data) => ({
7542
- description,
7543
- differentials: data.differentials,
7544
- whoMustUse: data.who_must_use,
7545
- howToUse: data.how_to_use,
7546
- brand: data.brand_description,
7547
- ingredients: data.ingredients,
7548
- purpose: data.purpose,
7549
- }),
7550
- bindFindFilter: (filters) => {
7551
- return {
7552
- ...(filters?.description && { description: filters.description }),
7553
- ...(filters.differentials && { differentials: filters.differentials }),
7554
- ...(filters.whoMustUse && {
7555
- who_must_use: filters.whoMustUse,
7556
- }),
7557
- ...(filters.howToUse && {
7558
- how_to_use: filters.howToUse,
7559
- }),
7560
- ...(filters.brand && {
7561
- brand_description: filters.brand,
7562
- }),
7563
- ...(filters.ingredients && {
7564
- ingredients: filters.ingredients,
7565
- }),
7566
- ...(filters.purpose && {
7567
- purpose: filters.purpose,
7568
- }),
7569
- };
7570
- },
7571
- bindPersistData: (descriptionData) => ({
7572
- ...(descriptionData?.description && { description: descriptionData.description }),
7573
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7574
- ...(descriptionData.whoMustUse && {
7575
- who_must_use: descriptionData.whoMustUse,
7576
- }),
7577
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7578
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7579
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7580
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7581
- }),
7582
- },
7583
- },
7584
- { differentials: { columnName: 'differentials' } },
7585
- { whoMustUse: { columnName: 'who_must_use' } },
7586
- { howToUse: { columnName: 'how_to_use' } },
7587
- { brandDescription: { columnName: 'brand_description' } },
7588
- { ingredients: { columnName: 'ingredients' } },
7589
- { purpose: { columnName: 'purpose' } },
7590
- { hasVariants: { columnName: 'has_variants' } },
7591
- {
7592
- images: {
7593
- columnName: 'images',
7594
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7595
- },
7596
- },
7597
- {
7598
- miniatures: {
7599
- columnName: 'miniatures',
7600
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7601
- },
7602
- },
7603
- {
7604
- imagesCard: {
7605
- columnName: 'images_card',
7606
- to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7607
- },
7608
- },
7609
- 'name',
7610
- {
7611
- price: {
7612
- columnName: 'price',
7613
- from: (price, data) => ({
7614
- price,
7615
- fullPrice: data.full_price,
7616
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
7617
- fullPriceDiscountPercentage: data.full_price_discount_percentage,
7618
- subscriberPrice: data.subscriber_price,
7619
- }),
7620
- bindFindFilter: (filters) => {
7621
- return {
7622
- ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7623
- ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7624
- ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7625
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7626
- }),
7627
- ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7628
- subscriber_price: filters.subscriberPrice,
7629
- }),
7630
- ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7631
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7632
- }),
7633
- };
7634
- },
7635
- bindPersistData: (priceData) => ({
7636
- ...(priceData?.price >= 0 && { price: priceData.price }),
7637
- ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
7638
- ...(priceData.subscriberDiscountPercentage >= 0 && {
7639
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
7640
- }),
7641
- ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
7642
- ...(priceData.fullPriceDiscountPercentage >= 0 && {
7643
- full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
7644
- }),
7645
- }),
7646
- },
7647
- },
7648
- { fullPrice: { columnName: 'full_price' } },
7649
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7650
- { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7651
- { subscriberPrice: { columnName: 'subscriber_price' } },
7652
- 'published',
7653
- 'outlet',
7654
- 'label',
7655
- 'sku',
7656
- {
7657
- stock: {
7658
- columnName: 'stock',
7659
- from: (quantity) => ({ quantity }),
7660
- to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
7661
- },
7662
- },
7663
- { hasStock: { columnName: 'has_stock' } },
7664
- 'slug',
7665
- 'type',
7666
- 'video',
7667
- 'weight',
7668
- 'gender',
7669
- { intGender: { columnName: 'int_gender' } },
7670
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
7671
- { isKit: { columnName: 'is_kit' } },
7672
- { createdAt: { columnName: 'created_at' } },
7673
- { updatedAt: { columnName: 'updated_at' } },
7674
- { rate: { columnName: 'rating' } },
7675
- { reviewsTotal: { columnName: 'reviews_total' } },
7676
- { shoppingCount: { columnName: 'shopping_count' } },
7677
- { categoryId: { columnName: 'category_id' } },
7678
- {
7679
- category: {
7680
- columnName: 'category',
7681
- foreignKeyColumn: { id: 'categoryId' },
7682
- fields: ['id', 'name', 'reference', 'slug'],
7683
- },
7684
- },
7685
- 'group',
7686
- 'validity',
7687
- { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7688
- { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7689
- { daysOfUse: { columnName: 'days_of_use' } },
7690
- { showVariants: { columnName: 'show_variants' } },
7691
- ];
7692
- const fieldsConfiguration$2 = [
7693
- ...commonFields,
7694
- {
7695
- categories: {
7696
- columnName: 'categories',
7697
- fields: ['category_id'],
7698
- bindPersistData: (value) => ({
7699
- categories: { data: value.map((category) => ({ category_id: +category })) },
7700
- }),
7701
- to: (categories) => categories.map((categoryId) => +categoryId),
7702
- from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7703
- },
7704
- },
7705
- {
7706
- kitProducts: {
7707
- columnName: 'kit_products',
7708
- foreignKeyColumn: { productId: 'id' },
7709
- fields: [
7710
- { productId: { columnName: 'product_id' } },
7711
- { kitProductId: { columnName: 'kit_product_id' } },
7712
- 'quantity',
7713
- { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7714
- ],
7715
- },
7716
- },
7717
- {
7718
- reviews: {
7719
- columnName: 'reviews',
7720
- foreignKeyColumn: { product_id: 'id' },
7721
- fields: [
7722
- 'id',
7723
- 'shop',
7724
- 'rate',
7725
- 'author',
7726
- 'email',
7727
- 'location',
7728
- 'review',
7729
- 'status',
7730
- 'title',
7731
- { personId: { columnName: 'person_id' } },
7732
- 'points',
7733
- { orderId: { columnName: 'order_id' } },
7546
+ 'id',
7547
+ 'shop',
7548
+ 'rate',
7549
+ 'author',
7550
+ 'email',
7551
+ 'location',
7552
+ 'review',
7553
+ 'status',
7554
+ 'title',
7555
+ { personId: { columnName: 'person_id' } },
7556
+ 'points',
7557
+ { orderId: { columnName: 'order_id' } },
7734
7558
  { createdAt: { columnName: 'created_at' } },
7735
7559
  { updatedAt: { columnName: 'updated_at' } },
7736
7560
  ],
@@ -7743,69 +7567,17 @@ const fieldsConfiguration$2 = [
7743
7567
  bindPersistData: (value) => ({
7744
7568
  metadata: { data: value },
7745
7569
  }),
7746
- },
7747
- },
7748
- {
7749
- variants: {
7750
- columnName: 'variants',
7751
- foreignKeyColumn: { product_id: 'id' },
7752
- fields: [
7753
- 'id',
7754
- 'name',
7755
- 'ean',
7756
- 'sku',
7757
- {
7758
- description: {
7759
- columnName: 'description',
7760
- from: (description, data) => ({
7761
- description,
7762
- differentials: data.differentials,
7763
- whoMustUse: data.who_must_use,
7764
- howToUse: data.how_to_use,
7765
- brand: data.brand_description,
7766
- ingredients: data.ingredients,
7767
- purpose: data.purpose,
7768
- }),
7769
- bindFindFilter: (filters) => {
7770
- return {
7771
- ...(filters?.description && { description: filters.description }),
7772
- ...(filters.differentials && { differentials: filters.differentials }),
7773
- ...(filters.whoMustUse && {
7774
- who_must_use: filters.whoMustUse,
7775
- }),
7776
- ...(filters.howToUse && {
7777
- how_to_use: filters.howToUse,
7778
- }),
7779
- ...(filters.brand && {
7780
- brand_description: filters.brand,
7781
- }),
7782
- ...(filters.ingredients && {
7783
- ingredients: filters.ingredients,
7784
- }),
7785
- ...(filters.purpose && {
7786
- purpose: filters.purpose,
7787
- }),
7788
- };
7789
- },
7790
- bindPersistData: (descriptionData) => ({
7791
- ...(descriptionData?.description && { description: descriptionData.description }),
7792
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7793
- ...(descriptionData.whoMustUse && {
7794
- who_must_use: descriptionData.whoMustUse,
7795
- }),
7796
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7797
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7798
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7799
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7800
- }),
7801
- },
7802
- },
7803
- { differentials: { columnName: 'differentials' } },
7804
- { whoMustUse: { columnName: 'who_must_use' } },
7805
- { howToUse: { columnName: 'how_to_use' } },
7806
- { brandDescription: { columnName: 'brand_description' } },
7807
- { ingredients: { columnName: 'ingredients' } },
7808
- { purpose: { columnName: 'purpose' } },
7570
+ },
7571
+ },
7572
+ {
7573
+ variants: {
7574
+ columnName: 'variants',
7575
+ foreignKeyColumn: { product_id: 'id' },
7576
+ fields: [
7577
+ 'id',
7578
+ 'ean',
7579
+ 'sku',
7580
+ 'description',
7809
7581
  {
7810
7582
  grade: {
7811
7583
  columnName: 'grade',
@@ -7851,6 +7623,10 @@ const fieldsConfiguration$2 = [
7851
7623
  }),
7852
7624
  },
7853
7625
  },
7626
+ { fullPrice: { columnName: 'full_price' } },
7627
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7628
+ { subscriberPrice: { columnName: 'subscriber_price' } },
7629
+ { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7854
7630
  'published',
7855
7631
  {
7856
7632
  stock: {
@@ -7942,10 +7718,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7942
7718
  ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
7943
7719
  .data?.[0]
7944
7720
  : await super.get(identifiers, options);
7945
- // if (product.productId) throw new NotFoundError('Product not found, it is a variant')
7946
- product.reviews =
7947
- product.reviews ||
7948
- (await this.findReviewsByProduct(product.productId ? +product.productId : +product.id, false, options));
7721
+ if (product.productId)
7722
+ throw new NotFoundError('Product not found, it is a variant');
7723
+ product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, options));
7949
7724
  return product;
7950
7725
  }
7951
7726
  async find(params, optionsParams) {
@@ -7962,9 +7737,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7962
7737
  options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
7963
7738
  return super.find({
7964
7739
  ...options,
7965
- filters: { ...filters },
7966
- // filters: { ...filters, hasVariants: { operator: Where.EQUALS, value: false } },
7967
- // filters: { ...filters, productId: { operator: Where.ISNULL } },
7740
+ filters: { ...filters, productId: { operator: Where.ISNULL } },
7968
7741
  fields: [
7969
7742
  ...bindFields,
7970
7743
  ...(bindFields.includes('price')
@@ -7998,13 +7771,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7998
7771
  if (!result.data.length)
7999
7772
  return null;
8000
7773
  const product = result?.data?.shift();
8001
- if (product.productId) ;
8002
- console.warn('product getBySlug', product);
8003
- console.warn('vai entrar', !product.reviews.length && product.rate > 0);
8004
- if (!product.reviews.length && product.rate > 0) {
8005
- console.warn('entrou');
8006
- product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
8007
- }
8008
7774
  RoundProductPricesHelper.roundProductPrices(product);
8009
7775
  if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
8010
7776
  const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
@@ -8017,18 +7783,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8017
7783
  }
8018
7784
  return product;
8019
7785
  }
8020
- async getBySlugVariantData(product) {
8021
- if (!product.reviews.length && product.rate > 0) {
8022
- product.reviews = await this.findReviewsByProduct((product.productId ? product.productId : product.id), true);
8023
- }
8024
- // if (!product.metadata) {
8025
- // product.metadata = await this.findReviewsByProduct(
8026
- // (product.productId ? product.productId : product.id) as number,
8027
- // true,
8028
- // )
8029
- // }
8030
- return product;
8031
- }
8032
7786
  async getByEAN(EAN, options) {
8033
7787
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8034
7788
  const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
@@ -8218,7 +7972,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8218
7972
  return data?.[0]?.id;
8219
7973
  throw new NotFoundError(`Product with id ${id} not found`);
8220
7974
  }
8221
- async findReviewsByProduct(productId, onlyApproved, options) {
7975
+ async findReviewsByProduct(productId, options) {
8222
7976
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8223
7977
  const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
8224
7978
  const cachedData = await this.cache.cacheAdapter.get(cacheKey);
@@ -8231,7 +7985,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8231
7985
  where: {
8232
7986
  value: {
8233
7987
  product_id: { _eq: productId },
8234
- ...(onlyApproved && { status: { _eq: true } }),
8235
7988
  },
8236
7989
  type: 'product_review_bool_exp',
8237
7990
  required: true,
@@ -8340,7 +8093,7 @@ __decorate([
8340
8093
  __decorate([
8341
8094
  Log(),
8342
8095
  __metadata("design:type", Function),
8343
- __metadata("design:paramtypes", [Number, Boolean, Object]),
8096
+ __metadata("design:paramtypes", [Number, Object]),
8344
8097
  __metadata("design:returntype", Promise)
8345
8098
  ], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
8346
8099
 
@@ -8588,83 +8341,6 @@ const fieldsConfiguration$1 = [
8588
8341
  to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8589
8342
  },
8590
8343
  },
8591
- 'slug',
8592
- 'brand',
8593
- 'name',
8594
- 'sku',
8595
- { NCM: { columnName: 'ncm' } },
8596
- { CEST: { columnName: 'cest' } },
8597
- {
8598
- description: {
8599
- columnName: 'description',
8600
- from: (description, data) => ({
8601
- description,
8602
- differentials: data.differentials,
8603
- whoMustUse: data.who_must_use,
8604
- howToUse: data.how_to_use,
8605
- brand: data.brand_description,
8606
- ingredients: data.ingredients,
8607
- purpose: data.purpose,
8608
- }),
8609
- bindFindFilter: (filters) => {
8610
- return {
8611
- ...(filters?.description && { description: filters.description }),
8612
- ...(filters.differentials && { differentials: filters.differentials }),
8613
- ...(filters.whoMustUse && {
8614
- who_must_use: filters.whoMustUse,
8615
- }),
8616
- ...(filters.howToUse && {
8617
- how_to_use: filters.howToUse,
8618
- }),
8619
- ...(filters.brand && {
8620
- brand_description: filters.brand,
8621
- }),
8622
- ...(filters.ingredients && {
8623
- ingredients: filters.ingredients,
8624
- }),
8625
- ...(filters.purpose && {
8626
- purpose: filters.purpose,
8627
- }),
8628
- };
8629
- },
8630
- bindPersistData: (descriptionData) => ({
8631
- ...(descriptionData?.description && { description: descriptionData.description }),
8632
- ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
8633
- ...(descriptionData.whoMustUse && {
8634
- who_must_use: descriptionData.whoMustUse,
8635
- }),
8636
- ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
8637
- ...(descriptionData.brand && { brand_description: descriptionData.brand }),
8638
- ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
8639
- ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
8640
- }),
8641
- },
8642
- },
8643
- { differentials: { columnName: 'differentials' } },
8644
- { whoMustUse: { columnName: 'who_must_use' } },
8645
- { howToUse: { columnName: 'how_to_use' } },
8646
- { brandDescription: { columnName: 'brand_description' } },
8647
- { ingredients: { columnName: 'ingredients' } },
8648
- { purpose: { columnName: 'purpose' } },
8649
- 'gender',
8650
- { intGender: { columnName: 'int_gender' } },
8651
- 'label',
8652
- { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
8653
- { rate: { columnName: 'rating' } },
8654
- { reviewsTotal: { columnName: 'reviews_total' } },
8655
- { shoppingCount: { columnName: 'shopping_count' } },
8656
- { categoryId: { columnName: 'category_id' } },
8657
- {
8658
- metadata: {
8659
- columnName: 'metadata',
8660
- fields: ['title', 'description'],
8661
- bindPersistData: (value) => ({
8662
- metadata: { data: value },
8663
- }),
8664
- },
8665
- },
8666
- { createdAt: { columnName: 'created_at' } },
8667
- { updatedAt: { columnName: 'updated_at' } },
8668
8344
  ];
8669
8345
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
8670
8346
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -8705,37 +8381,18 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8705
8381
  return data.at(0);
8706
8382
  }
8707
8383
  async update(params) {
8708
- const { productId, id: checkId, metadata, ...data } = params;
8384
+ const { productId, id: checkId, ...data } = params;
8709
8385
  const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
8710
8386
  if (!dataWithProductId.id) {
8711
8387
  throw new NotFoundError('Variant ID is required for update');
8712
8388
  }
8713
8389
  const id = await this.getId(dataWithProductId.id);
8714
8390
  const product = await super.update({ id, ...data });
8715
- product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
8716
8391
  if (dataWithProductId.productId) {
8717
8392
  product.productId = dataWithProductId.productId;
8718
8393
  }
8719
8394
  return product;
8720
8395
  }
8721
- async updateMetadata(productId, { metadata }) {
8722
- const plainData = this.paramsToPlain({ metadata });
8723
- if (!plainData.metadata)
8724
- return null;
8725
- await this.mutation('update_product_metadata_by_pk', ['product_id'], {
8726
- pk_columns: {
8727
- value: { product_id: productId },
8728
- type: 'product_metadata_pk_columns_input',
8729
- required: true,
8730
- },
8731
- _set: {
8732
- value: omit(metadata, ['product_id']),
8733
- type: 'product_metadata_set_input',
8734
- required: true,
8735
- },
8736
- });
8737
- return plainData.metadata;
8738
- }
8739
8396
  async getId(id) {
8740
8397
  if (!Number.isNaN(+id))
8741
8398
  return id;
@@ -9079,6 +8736,290 @@ __decorate([
9079
8736
  __metadata("design:returntype", Promise)
9080
8737
  ], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
9081
8738
 
8739
+ class MercadoPagoRequestHelper {
8740
+ static build(data) {
8741
+ const { checkout, method, postback, card } = data;
8742
+ return {
8743
+ transaction_amount: +checkout.totalPrice.toFixed(2),
8744
+ notification_url: postback,
8745
+ metadata: {
8746
+ checkoutId: checkout.id,
8747
+ },
8748
+ payer: this.buildPayer(checkout),
8749
+ statement_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
8750
+ additional_info: {
8751
+ items: this.buildItems(checkout),
8752
+ payer: this.buildFullPayer(checkout),
8753
+ },
8754
+ ...(method === 'credit_card' && this.buildCardPayment(card)),
8755
+ ...(method === 'pix' && this.buildPixPayment()),
8756
+ };
8757
+ }
8758
+ static buildItems(checkout) {
8759
+ return checkout.lineItems
8760
+ .filter((item) => !item.isGift)
8761
+ .map((item) => {
8762
+ return {
8763
+ id: item.EAN,
8764
+ title: item.name,
8765
+ description: item.name,
8766
+ picture_url: item.image ?? null,
8767
+ category_id: item.category?.id ?? null,
8768
+ quantity: item.quantity,
8769
+ unit_price: +item.pricePaid.toFixed(2),
8770
+ };
8771
+ });
8772
+ }
8773
+ static buildPayer(checkout) {
8774
+ return {
8775
+ first_name: checkout.user.firstName,
8776
+ last_name: checkout.user.lastName,
8777
+ email: checkout.user.email,
8778
+ identification: {
8779
+ type: 'CPF',
8780
+ number: checkout.user.cpf.replace(/\D/g, ''),
8781
+ },
8782
+ };
8783
+ }
8784
+ static buildFullPayer(checkout) {
8785
+ return {
8786
+ first_name: checkout.user.firstName,
8787
+ last_name: checkout.user.lastName,
8788
+ phone: {
8789
+ area_code: checkout.user.phone.substring(0, 2),
8790
+ number: checkout.user.phone.substring(2),
8791
+ },
8792
+ address: {
8793
+ zip_code: checkout.shippingAddress.zip,
8794
+ street_name: `${checkout.shippingAddress.street}, ${checkout.shippingAddress.district}`,
8795
+ street_number: checkout.shippingAddress.number,
8796
+ },
8797
+ };
8798
+ }
8799
+ static buildCardPayment(card) {
8800
+ return {
8801
+ installments: card.installments,
8802
+ token: card.cardId,
8803
+ };
8804
+ }
8805
+ static buildPixPayment() {
8806
+ return {
8807
+ payment_method_id: 'pix',
8808
+ date_of_expiration: format(addDays(new Date(), 1), 'yyyy-MM-dd') + 'T23:59:59.999-03:00',
8809
+ };
8810
+ }
8811
+ }
8812
+
8813
+ class MercadoPagoResponseHelper {
8814
+ static build(method, checkout, response) {
8815
+ return Payment.toInstance({
8816
+ createdAt: new Date(),
8817
+ updatedAt: new Date(),
8818
+ userId: checkout.user.id,
8819
+ checkoutId: checkout.id,
8820
+ totalPrice: checkout.totalPrice,
8821
+ paymentProvider: PaymentProviders.MERCADOPAGO,
8822
+ mercadoPagoId: response.id,
8823
+ transaction: this.buildPaymentTransaction(method, response),
8824
+ });
8825
+ }
8826
+ static buildPaymentTransaction(method, response) {
8827
+ return PaymentTransaction.toInstance({
8828
+ id: response.id.toString(),
8829
+ acquirer_name: PaymentProviders.MERCADOPAGO,
8830
+ amount: response.transaction_amount,
8831
+ status: response.status,
8832
+ status_reason: response.status_detail?.toString(),
8833
+ payment_method: method,
8834
+ currency: response.currency_id?.toString(),
8835
+ paid_amount: response.transaction_details?.total_paid_amount ?? null,
8836
+ paid_at: response.date_approved ?? null,
8837
+ charger_id: response.charges_details?.at(0)?.id?.toString() ?? null,
8838
+ ...(method == TransactionPaymentMethods.PIX && this.getPixReponse(response)),
8839
+ ...(method == TransactionPaymentMethods.CARD && this.getCardReponse(response)),
8840
+ });
8841
+ }
8842
+ // private static getBoletoReponse(transaction: MercadoPagoResponse): Partial<PaymentTransaction> {
8843
+ // return {
8844
+ // boleto_url: transaction.url?.toString(),
8845
+ // boleto_barcode: transaction.line?.toString(),
8846
+ // boleto_qr_code: transaction.qr_code?.toString(),
8847
+ // boleto_expiration_date: transaction.due_at?.toString(),
8848
+ // boleto_instructions: transaction.instructions?.toString(),
8849
+ // boleto_nosso_numero: transaction.nosso_numero?.toString(),
8850
+ // boleto_type: transaction.type?.toString(),
8851
+ // boleto_document_number: transaction.document_number?.toString(),
8852
+ // }
8853
+ // }
8854
+ static getPixReponse(response) {
8855
+ return {
8856
+ pix_qr_code: response.point_of_interaction?.transaction_data?.qr_code,
8857
+ pix_expiration_date: response.date_of_expiration?.toString(),
8858
+ };
8859
+ }
8860
+ static getCardReponse(response) {
8861
+ return {
8862
+ soft_descriptor: response.statement_descriptor?.toString(),
8863
+ installments: response.installments,
8864
+ card_brand: response.payment_method_id?.toString(),
8865
+ card_first_digits: response.card?.first_six_digits?.toString(),
8866
+ card_last_digits: response.card?.last_four_digits?.toString(),
8867
+ card_id: response.card?.id?.toString(),
8868
+ card_holder_name: response.card?.cardholder?.name?.toString(),
8869
+ card_expiration_month: response.card?.expiration_month?.toString(),
8870
+ card_expiration_year: response.card?.expiration_year?.toString(),
8871
+ capture_method: response.payment_type_id?.toString(),
8872
+ authorization_code: response.authorization_code?.toString(),
8873
+ };
8874
+ }
8875
+ }
8876
+
8877
+ class MercadoPagoCardAxiosAdapter {
8878
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
8879
+ this.credentials = credentials;
8880
+ this.paymentRepository = paymentRepository;
8881
+ this.orderBlockedRepository = orderBlockedRepository;
8882
+ }
8883
+ async pay(checkout, card) {
8884
+ const payload = MercadoPagoRequestHelper.build({
8885
+ checkout,
8886
+ method: 'credit_card',
8887
+ postback: this.credentials.postback,
8888
+ card,
8889
+ });
8890
+ console.warn('[MERCADO PAGO CARD DATA TO SEND]', JSON.stringify(payload));
8891
+ const { data } = await axios({
8892
+ method: 'POST',
8893
+ url: `${this.credentials.url}/v1/payments`,
8894
+ headers: {
8895
+ 'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
8896
+ Authorization: `Bearer ${this.credentials.api_key}`,
8897
+ 'Content-Type': 'application/json',
8898
+ },
8899
+ data: payload,
8900
+ });
8901
+ console.warn('[MERCADO PAGO RESPONSE CARD DATA]', JSON.stringify(data));
8902
+ if ((data.status !== 'approved' && data.status_detail !== 'accredited') || data.status !== 'authorized') {
8903
+ await this.orderBlockedRepository.createBlockedOrderOrPayment({
8904
+ checkout,
8905
+ blockType: 'Card not authorized',
8906
+ type: 'Card',
8907
+ limiteRange: 'day',
8908
+ card,
8909
+ });
8910
+ 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', {
8911
+ checkoutId: checkout.id,
8912
+ userEmail: checkout.user.email,
8913
+ info: data,
8914
+ });
8915
+ }
8916
+ const payment = await this.paymentRepository.create(MercadoPagoResponseHelper.build(TransactionPaymentMethods.CARD, checkout, data));
8917
+ return payment;
8918
+ }
8919
+ async addCard(card, customer) {
8920
+ const { data } = await axios({
8921
+ method: 'POST',
8922
+ url: `${this.credentials.url}/v1/payments`,
8923
+ headers: {
8924
+ Authorization: `Bearer ${this.credentials.api_key}`,
8925
+ 'Content-Type': 'application/json',
8926
+ },
8927
+ data: {
8928
+ email: customer.email,
8929
+ first_name: customer.firstName,
8930
+ last_name: customer.lastName,
8931
+ phone: {
8932
+ area_code: '55',
8933
+ number: '991234567',
8934
+ },
8935
+ identification: {
8936
+ type: 'CPF',
8937
+ number: '12345678900',
8938
+ },
8939
+ default_address: 'Home',
8940
+ address: {
8941
+ id: '123123',
8942
+ zip_code: '01234567',
8943
+ street_name: 'Rua Exemplo',
8944
+ street_number: 123,
8945
+ city: {},
8946
+ },
8947
+ },
8948
+ });
8949
+ return data;
8950
+ }
8951
+ getCardByToken(customerId, token) {
8952
+ return;
8953
+ }
8954
+ createCardHash(bu, shop, card) {
8955
+ return;
8956
+ }
8957
+ createTransaction(info) {
8958
+ return;
8959
+ }
8960
+ async createOrUpdateCustomer(customer) {
8961
+ const { data } = await axios({
8962
+ method: 'POST',
8963
+ url: `${this.credentials.url}/v1/customers`,
8964
+ headers: {
8965
+ Authorization: `Bearer ${this.credentials.api_key}`,
8966
+ 'Content-Type': 'application/json',
8967
+ },
8968
+ data: {
8969
+ email: customer.email,
8970
+ first_name: customer.firstName,
8971
+ last_name: customer.lastName,
8972
+ phone: {
8973
+ area_code: customer.phone.substring(0, 2),
8974
+ number: customer.phone.substring(2),
8975
+ },
8976
+ identification: {
8977
+ type: 'CPF',
8978
+ number: customer.cpf.replace(/\D/g, ''),
8979
+ },
8980
+ },
8981
+ });
8982
+ return data;
8983
+ }
8984
+ }
8985
+
8986
+ class MercadoPagoPixAxiosAdapter {
8987
+ constructor(credentials, paymentRepository) {
8988
+ this.credentials = credentials;
8989
+ this.paymentRepository = paymentRepository;
8990
+ }
8991
+ async pay(checkout) {
8992
+ try {
8993
+ const payload = MercadoPagoRequestHelper.build({
8994
+ checkout,
8995
+ method: 'pix',
8996
+ postback: this.credentials.postback,
8997
+ });
8998
+ console.warn('[MERCADO PAGO PIX DATA TO SEND]', JSON.stringify(payload));
8999
+ const { data } = await axios({
9000
+ method: 'POST',
9001
+ url: `${this.credentials.url}/v1/payments`,
9002
+ headers: {
9003
+ 'X-Idempotency-Key': checkout.id,
9004
+ Authorization: `Bearer ${this.credentials.api_key}`,
9005
+ 'Content-Type': 'application/json',
9006
+ },
9007
+ data: payload,
9008
+ });
9009
+ console.warn('[MERCADO PAGO RESPONSE PIX DATA]', JSON.stringify(data));
9010
+ const payment = await this.paymentRepository.create(MercadoPagoResponseHelper.build(TransactionPaymentMethods.PIX, checkout, data));
9011
+ return payment;
9012
+ }
9013
+ catch (error) {
9014
+ if (error instanceof AxiosError) {
9015
+ console.warn(error.response);
9016
+ console.warn(error.response.data);
9017
+ console.warn(error.response.data.cause);
9018
+ }
9019
+ }
9020
+ }
9021
+ }
9022
+
9082
9023
  class PagarmeBankSlipAxiosAdapter {
9083
9024
  constructor(credentials, paymentRepository) {
9084
9025
  this.credentials = credentials;
@@ -9226,15 +9167,17 @@ class PagarMeV5RequestHelper {
9226
9167
  customer: this.buildCustomer(checkout),
9227
9168
  shipping: this.buildShipping(checkout),
9228
9169
  payments: this.buildPayment(checkout, method, card),
9170
+ ...this.buildAdditionalInfo(checkout),
9229
9171
  };
9230
9172
  }
9231
9173
  static buildItems(checkout) {
9174
+ const isSubscriber = checkout.user?.isSubscriber ?? false;
9232
9175
  return checkout.lineItems
9233
9176
  .filter((item) => !item.isGift)
9234
9177
  .map((item) => {
9235
9178
  return {
9236
9179
  amount: Math.floor(item.pricePaid * 100),
9237
- description: item.name,
9180
+ description: isSubscriber ? `${item.name} - ASSINANTE` : item.name,
9238
9181
  quantity: item.quantity,
9239
9182
  code: item.EAN,
9240
9183
  };
@@ -9331,6 +9274,14 @@ class PagarMeV5RequestHelper {
9331
9274
  },
9332
9275
  };
9333
9276
  }
9277
+ static buildAdditionalInfo(checkout) {
9278
+ const isSubscriber = checkout.user?.isSubscriber ?? false;
9279
+ if (isSubscriber)
9280
+ return {
9281
+ antifraude_enabled: false,
9282
+ };
9283
+ return {};
9284
+ }
9334
9285
  }
9335
9286
 
9336
9287
  class PagarMeV5ResponseHelper {
@@ -10063,4 +10014,4 @@ class ProductsVertexSearch {
10063
10014
  }
10064
10015
  }
10065
10016
 
10066
- export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductCatalogHasuraGraphQLRepository, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
10017
+ export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandCategory, BrandCategoryFirestoreRepository, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, MercadoPagoCardAxiosAdapter, MercadoPagoPixAxiosAdapter, MercadoPagoRequestHelper, MercadoPagoResponseHelper, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };