@infrab4a/connect 5.3.0-beta.0 → 5.3.0-beta.10

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 (58) hide show
  1. package/index.cjs.js +1475 -211
  2. package/index.esm.js +1469 -213
  3. package/package.json +3 -2
  4. package/src/domain/catalog/models/product-base.d.ts +5 -1
  5. package/src/domain/catalog/models/product.d.ts +1 -0
  6. package/src/domain/catalog/models/types/brands-shop-menu.type.d.ts +13 -0
  7. package/src/domain/catalog/models/types/index.d.ts +1 -0
  8. package/src/domain/catalog/repositories/category.repository.d.ts +1 -0
  9. package/src/domain/catalog/repositories/index.d.ts +1 -0
  10. package/src/domain/catalog/repositories/product-catalog.repository.d.ts +17 -0
  11. package/src/domain/catalog/repositories/product.repository.d.ts +3 -0
  12. package/src/domain/catalog/repositories/variant.repository.d.ts +1 -0
  13. package/src/domain/shopping/enums/index.d.ts +2 -0
  14. package/src/domain/shopping/enums/pagarme-v5-payment-status.enum.d.ts +24 -0
  15. package/src/domain/shopping/enums/transaction-payment-methods.enum.d.ts +5 -0
  16. package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +10 -2
  17. package/src/domain/shopping/models/enums/order-status.enum.d.ts +1 -1
  18. package/src/domain/shopping/models/order.d.ts +4 -0
  19. package/src/domain/shopping/models/payment-transaction.d.ts +17 -2
  20. package/src/domain/shopping/models/payment.d.ts +2 -1
  21. package/src/domain/shopping/types/card-info.type.d.ts +1 -0
  22. package/src/domain/shopping/types/index.d.ts +1 -0
  23. package/src/domain/shopping/types/pagarme-card.type.d.ts +9 -3
  24. package/src/domain/shopping/types/pagarme-credentials-v5.type.d.ts +4 -0
  25. package/src/domain/shopping/types/pagarme-credentials.type.d.ts +9 -3
  26. package/src/domain/users/models/user-payment-method.d.ts +2 -0
  27. package/src/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -0
  28. package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +4 -1
  29. package/src/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +1 -0
  30. package/src/infra/hasura-graphql/models/index.d.ts +1 -0
  31. package/src/infra/hasura-graphql/models/product-catalog-hasura-graphql.d.ts +16 -0
  32. package/src/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +7 -0
  33. package/src/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -0
  34. package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
  35. package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts +22 -0
  36. package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +3 -0
  37. package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +2 -0
  38. package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +1 -0
  39. package/src/infra/pagarme/adapters/helpers/index.d.ts +2 -0
  40. package/src/infra/pagarme/adapters/helpers/pagarme-v5-request.helper.d.ts +12 -0
  41. package/src/infra/pagarme/adapters/helpers/pagarme-v5-response.helper.d.ts +10 -0
  42. package/src/infra/pagarme/adapters/index.d.ts +2 -3
  43. package/src/infra/pagarme/adapters/v4/index.d.ts +3 -0
  44. package/src/infra/pagarme/adapters/{pagarme-bank-slip-payment-axios.adapter.d.ts → v4/pagarme-bank-slip-payment-axios.adapter.d.ts} +4 -4
  45. package/src/infra/pagarme/adapters/{pagarme-card-payment-axios.adapter.d.ts → v4/pagarme-card-payment-axios.adapter.d.ts} +7 -6
  46. package/src/infra/pagarme/adapters/{pagarme-pix-payment-axios.adapter.d.ts → v4/pagarme-pix-payment-axios.adapter.d.ts} +4 -4
  47. package/src/infra/pagarme/adapters/v5/index.d.ts +3 -0
  48. package/src/infra/pagarme/adapters/v5/pagarmev5-bank-slip-payment-axios.adapter.d.ts +11 -0
  49. package/src/infra/pagarme/adapters/v5/pagarmev5-card-payment-axios.adapter.d.ts +24 -0
  50. package/src/infra/pagarme/adapters/v5/pagarmev5-pix-payment-axios.adapter.d.ts +10 -0
  51. package/src/infra/pagarme/index.d.ts +1 -0
  52. package/src/infra/pagarme/types/index.d.ts +1 -0
  53. package/src/infra/pagarme/types/v5/index.d.ts +4 -0
  54. package/src/infra/pagarme/types/v5/pagarmev5-customer.type.d.ts +19 -0
  55. package/src/infra/pagarme/types/v5/pagarmev5-order-request-payload.type.d.ts +89 -0
  56. package/src/infra/pagarme/types/v5/pagarmev5-order-response.type.d.ts +126 -0
  57. package/src/infra/pagarme/types/v5/pagarmev5-postback-response.type.d.ts +11 -0
  58. package/src/utils/index.d.ts +2 -1
package/index.esm.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import 'reflect-metadata';
2
2
  import { __decorate, __metadata } from 'tslib';
3
3
  import { plainToInstance, instanceToPlain, Type } from 'class-transformer';
4
- import { parseISO, format, startOfDay, endOfDay, subDays, addDays } from 'date-fns';
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 { utcToZonedTime } from 'date-fns-tz';
7
+ export { formatInTimeZone } from 'date-fns-tz';
6
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';
7
9
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
8
10
  import { debug } from 'debug';
@@ -48,6 +50,33 @@ var PagarmePaymentStatus;
48
50
  PagarmePaymentStatus["Chargedback"] = "chargedback";
49
51
  })(PagarmePaymentStatus || (PagarmePaymentStatus = {}));
50
52
 
53
+ var PagarMeV5PaymentStatus;
54
+ (function (PagarMeV5PaymentStatus) {
55
+ PagarMeV5PaymentStatus["Em processamento"] = "processing";
56
+ PagarMeV5PaymentStatus["Gerado"] = "generated";
57
+ PagarMeV5PaymentStatus["Visualizado"] = "viewed";
58
+ PagarMeV5PaymentStatus["Pago a menor"] = "underpaid";
59
+ PagarMeV5PaymentStatus["Pago a maior"] = "overpaid";
60
+ PagarMeV5PaymentStatus["Aguardando pagamento"] = "waiting_payment";
61
+ PagarMeV5PaymentStatus["Pago"] = "paid";
62
+ PagarMeV5PaymentStatus["Aguardando estorno"] = "pending_refund";
63
+ PagarMeV5PaymentStatus["Autorizada pendente de captura"] = "authorized_pending_capture";
64
+ PagarMeV5PaymentStatus["N\u00E3o autorizada"] = "not_authorized";
65
+ PagarMeV5PaymentStatus["Capturada"] = "captured";
66
+ PagarMeV5PaymentStatus["Aguardando captura"] = "waiting_capture";
67
+ PagarMeV5PaymentStatus["Com erro"] = "with_error";
68
+ PagarMeV5PaymentStatus["Estornado"] = "refunded";
69
+ PagarMeV5PaymentStatus["Cancelado"] = "voided";
70
+ PagarMeV5PaymentStatus["Falha"] = "failed";
71
+ })(PagarMeV5PaymentStatus || (PagarMeV5PaymentStatus = {}));
72
+ var PagarMeV5OrderStatus;
73
+ (function (PagarMeV5OrderStatus) {
74
+ PagarMeV5OrderStatus["Pendente"] = "pending";
75
+ PagarMeV5OrderStatus["Pago"] = "paid";
76
+ PagarMeV5OrderStatus["Cancelado"] = "canceled";
77
+ PagarMeV5OrderStatus["Falha"] = "failed";
78
+ })(PagarMeV5OrderStatus || (PagarMeV5OrderStatus = {}));
79
+
51
80
  var PaymentMethods;
52
81
  (function (PaymentMethods) {
53
82
  PaymentMethods["CARD"] = "card";
@@ -63,6 +92,13 @@ var PaymentProviders;
63
92
  PaymentProviders["GLAMPOINTS"] = "glampoints";
64
93
  })(PaymentProviders || (PaymentProviders = {}));
65
94
 
95
+ var TransactionPaymentMethods;
96
+ (function (TransactionPaymentMethods) {
97
+ TransactionPaymentMethods["CARD"] = "credit_card";
98
+ TransactionPaymentMethods["BANKSLIP"] = "boleto";
99
+ TransactionPaymentMethods["PIX"] = "pix";
100
+ })(TransactionPaymentMethods || (TransactionPaymentMethods = {}));
101
+
66
102
  class BasePaymentMethodFactory {
67
103
  constructor(methods) {
68
104
  this.methods = methods;
@@ -1567,7 +1603,7 @@ var OrderStatus;
1567
1603
  OrderStatus["ENVIADO"] = "Enviado";
1568
1604
  OrderStatus["ENTREGUE"] = "Entregue";
1569
1605
  OrderStatus["CANCELADO"] = "Cancelado";
1570
- OrderStatus["CREDIT_CARD"] = "credit_card";
1606
+ OrderStatus["PENDENTE_REENVIO"] = "Pendente reenvio";
1571
1607
  })(OrderStatus || (OrderStatus = {}));
1572
1608
 
1573
1609
  class Order extends Checkout {
@@ -1754,15 +1790,17 @@ class AntifraudCardService {
1754
1790
  return true;
1755
1791
  }
1756
1792
  getTodayDateRange() {
1757
- const day = `${format(new Date(), 'yyyy-MM-dd')}T00:00:00`;
1758
- const endOfDay = `${format(new Date(), 'yyyy-MM-dd')}T23:59:59`;
1759
- return { day, endOfDay };
1793
+ const timeZone = 'America/Sao_Paulo';
1794
+ const today = utcToZonedTime(new Date(), timeZone);
1795
+ const day = startOfDay(today);
1796
+ const endOfDay$1 = endOfDay(today);
1797
+ return { day: addHours(day, 3), endOfDay: addHours(endOfDay$1, 3) };
1760
1798
  }
1761
1799
  async getBlockedOrdersByMultipleCriteria(checkout, dateRange) {
1762
1800
  const { day, endOfDay } = dateRange;
1763
1801
  const dateFilter = [
1764
- { operator: Where.GTE, value: new Date(day) },
1765
- { operator: Where.LTE, value: new Date(endOfDay) },
1802
+ { operator: Where.GTE, value: day },
1803
+ { operator: Where.LTE, value: endOfDay },
1766
1804
  ];
1767
1805
  const [ordersBlockedWithCpf, ordersBlockedWithEmail, ordersBlockedWithCep, ordersBlockedWithPhone] = await Promise.all([
1768
1806
  this.getBlockedOrdersByCpf(checkout.user?.cpf, dateFilter),
@@ -4776,6 +4814,9 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
4776
4814
  isChild(_id, _parentId) {
4777
4815
  return;
4778
4816
  }
4817
+ async getBrandsWithProducts() {
4818
+ return;
4819
+ }
4779
4820
  }
4780
4821
  __decorate([
4781
4822
  Log(),
@@ -4866,6 +4907,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
4866
4907
  productVariantFullReport() {
4867
4908
  return;
4868
4909
  }
4910
+ getByEAN(EAN, options) {
4911
+ return;
4912
+ }
4869
4913
  }
4870
4914
  __decorate([
4871
4915
  Log(),
@@ -4891,6 +4935,9 @@ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirest
4891
4935
  });
4892
4936
  this.parentRepository = parentRepository;
4893
4937
  }
4938
+ getByEAN(EAN) {
4939
+ return;
4940
+ }
4894
4941
  }
4895
4942
 
4896
4943
  class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
@@ -5780,6 +5827,9 @@ __decorate([
5780
5827
  __metadata("design:type", Product)
5781
5828
  ], KitProductHasuraGraphQL.prototype, "product", void 0);
5782
5829
 
5830
+ class ProductCatalogHasuraGraphQL extends Product {
5831
+ }
5832
+
5783
5833
  class ProductHasuraGraphQL extends Product {
5784
5834
  }
5785
5835
  __decorate([
@@ -6127,7 +6177,8 @@ class CategoryProductOperationsHelper {
6127
6177
  'isKit',
6128
6178
  'sku',
6129
6179
  'rate',
6130
- 'tags',
6180
+ 'tagsProfile',
6181
+ 'tagsCollection',
6131
6182
  'type',
6132
6183
  'shoppingCount',
6133
6184
  'gender',
@@ -6867,6 +6918,19 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
6867
6918
  categoryFilterRepository: this.categoryFilterRepository,
6868
6919
  });
6869
6920
  }
6921
+ async getBrandsWithProducts() {
6922
+ const fields = ['id', 'name', 'slug', 'brand_category', 'published', 'images'];
6923
+ const { brands_with_products_query: data, } = await this.query('brands_with_products_query', fields);
6924
+ return data.map((brand) => Category.toInstance({
6925
+ id: brand.id,
6926
+ name: brand.name,
6927
+ slug: brand.slug,
6928
+ brandCategory: brand.brand_category,
6929
+ shops: brand.shops,
6930
+ published: brand.published,
6931
+ images: brand.images,
6932
+ }));
6933
+ }
6870
6934
  }
6871
6935
  __decorate([
6872
6936
  Log(),
@@ -7131,83 +7195,7 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
7131
7195
  }
7132
7196
  }
7133
7197
 
7134
- class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7135
- constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7136
- super({
7137
- tableName: 'product_errors',
7138
- model: ProductErrorsHasuraGraphQL,
7139
- endpoint,
7140
- authOptions,
7141
- interceptors,
7142
- cache,
7143
- fields: [
7144
- {
7145
- productId: {
7146
- columnName: 'product_id',
7147
- to: (value) => +value,
7148
- from: (value) => value.toString(),
7149
- },
7150
- },
7151
- 'source',
7152
- 'error',
7153
- { createdAt: { columnName: 'created_at' } },
7154
- { updatedAt: { columnName: 'updated_at' } },
7155
- {
7156
- product: {
7157
- columnName: 'product',
7158
- foreignKeyColumn: { id: 'productId' },
7159
- fields: [
7160
- { id: { columnName: 'id', from: (value) => value.toString() } },
7161
- { productId: { columnName: 'main_product_id' } },
7162
- 'name',
7163
- 'published',
7164
- 'group',
7165
- 'validity',
7166
- { createdAt: { columnName: 'created_at' } },
7167
- { updatedAt: { columnName: 'updated_at' } },
7168
- ],
7169
- },
7170
- },
7171
- ],
7172
- });
7173
- this.productRepository = productRepository;
7174
- }
7175
- async get(params) {
7176
- const result = await super.get(params);
7177
- if (result instanceof VariantHasuraGraphQL) {
7178
- const product = await this.productRepository.get({ id: result.productId.toString() });
7179
- result.product.name = product.name;
7180
- result.product.group = product.group;
7181
- }
7182
- return result;
7183
- }
7184
- async find(params) {
7185
- const result = await super.find(params);
7186
- const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7187
- (isEmpty(item.product.name) || isEmpty(item.product.group) || isEmpty(item.product)));
7188
- if (variantsWithNoData.length > 0) {
7189
- const { data: products } = await this.productRepository.find({
7190
- filters: {
7191
- id: {
7192
- operator: Where.IN,
7193
- value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7194
- },
7195
- },
7196
- });
7197
- products.forEach((product) => {
7198
- result.data
7199
- .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7200
- .forEach((variant) => {
7201
- variant.product.name = product.name;
7202
- variant.product.group = product.group;
7203
- });
7204
- });
7205
- }
7206
- return result;
7207
- }
7208
- }
7209
-
7210
- const commonFields = [
7198
+ const commonFields$1 = [
7211
7199
  {
7212
7200
  id: {
7213
7201
  columnName: 'id',
@@ -7287,6 +7275,12 @@ const commonFields = [
7287
7275
  to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7288
7276
  },
7289
7277
  },
7278
+ {
7279
+ imagesCard: {
7280
+ columnName: 'images_card',
7281
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7282
+ },
7283
+ },
7290
7284
  'name',
7291
7285
  {
7292
7286
  price: {
@@ -7348,7 +7342,6 @@ const commonFields = [
7348
7342
  'weight',
7349
7343
  'gender',
7350
7344
  { intGender: { columnName: 'int_gender' } },
7351
- { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
7352
7345
  { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
7353
7346
  { isKit: { columnName: 'is_kit' } },
7354
7347
  { createdAt: { columnName: 'created_at' } },
@@ -7366,126 +7359,87 @@ const commonFields = [
7366
7359
  },
7367
7360
  'group',
7368
7361
  'validity',
7362
+ { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7363
+ { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7364
+ { daysOfUse: { columnName: 'days_of_use' } },
7365
+ { showVariants: { columnName: 'show_variants' } },
7366
+ { variantSlug: { columnName: 'variant_slug' } },
7369
7367
  ];
7370
- const fieldsConfiguration$2 = [
7371
- ...commonFields,
7372
- {
7373
- categories: {
7374
- columnName: 'categories',
7375
- fields: ['category_id'],
7376
- bindPersistData: (value) => ({
7377
- categories: { data: value.map((category) => ({ category_id: +category })) },
7378
- }),
7379
- to: (categories) => categories.map((categoryId) => +categoryId),
7380
- from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7381
- },
7382
- },
7383
- {
7384
- kitProducts: {
7385
- columnName: 'kit_products',
7386
- foreignKeyColumn: { productId: 'id' },
7387
- fields: [
7388
- { productId: { columnName: 'product_id' } },
7389
- { kitProductId: { columnName: 'kit_product_id' } },
7390
- 'quantity',
7391
- { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7392
- ],
7393
- },
7394
- },
7395
- {
7396
- reviews: {
7397
- columnName: 'reviews',
7398
- foreignKeyColumn: { product_id: 'id' },
7399
- fields: [
7400
- 'id',
7401
- 'shop',
7402
- 'rate',
7403
- 'author',
7404
- 'email',
7405
- 'location',
7406
- 'review',
7407
- 'status',
7408
- 'title',
7409
- { personId: { columnName: 'person_id' } },
7410
- 'points',
7411
- { orderId: { columnName: 'order_id' } },
7412
- { createdAt: { columnName: 'created_at' } },
7413
- { updatedAt: { columnName: 'updated_at' } },
7414
- ],
7415
- },
7416
- },
7417
- {
7418
- metadata: {
7419
- columnName: 'metadata',
7420
- fields: ['title', 'description'],
7421
- bindPersistData: (value) => ({
7422
- metadata: { data: value },
7423
- }),
7424
- },
7425
- },
7426
- ];
7427
- class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7428
- get reviewsFields() {
7429
- return [
7430
- 'id',
7431
- 'shop',
7432
- 'rate',
7433
- 'author',
7434
- 'email',
7435
- 'location',
7436
- 'review',
7437
- 'status',
7438
- 'title',
7439
- { personId: { columnName: 'person_id' } },
7440
- 'points',
7441
- { orderId: { columnName: 'order_id' } },
7442
- { createdAt: { columnName: 'created_at' } },
7443
- { updatedAt: { columnName: 'updated_at' } },
7444
- ];
7445
- }
7368
+ class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
7446
7369
  constructor({ endpoint, authOptions, interceptors, cache, }) {
7447
7370
  super({
7448
- tableName: 'product',
7449
- model: ProductHasuraGraphQL,
7371
+ tableName: 'product_catalog',
7372
+ model: ProductCatalogHasuraGraphQL,
7450
7373
  endpoint,
7451
7374
  authOptions,
7452
7375
  interceptors,
7453
- fields: fieldsConfiguration$2,
7376
+ fields: commonFields$1,
7454
7377
  cache,
7455
7378
  });
7456
- this.bindReviewToModel = (plain) => ProductReview.toInstance({
7457
- ...is(omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])),
7458
- createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at,
7459
- updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at,
7460
- personId: plain.person_id,
7461
- orderId: plain.order_id,
7462
- });
7463
- this.bindReviewToHasura = (review) => ({
7464
- ...is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])),
7465
- person_id: review.personId,
7466
- order_id: review.orderId,
7467
- });
7468
7379
  }
7469
- async create(params) {
7470
- const { metadata, ...data } = params;
7471
- const product = await super.create(omit({ ...data, metadata: metadata || { description: null, title: null } }, ['reviews']));
7472
- try {
7473
- product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
7380
+ async get({ id }, options) {
7381
+ if (this.cache?.cacheAdapter && options?.cache?.enabled) {
7382
+ const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
7383
+ const cachedData = await this.cache.cacheAdapter.get(cacheKey);
7384
+ if (cachedData) {
7385
+ this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
7386
+ return this.model.toInstance(deserialize(cachedData));
7387
+ }
7474
7388
  }
7475
- catch (error) {
7476
- await this.delete({ id: product.id });
7477
- throw error;
7389
+ const product = await super
7390
+ .find({
7391
+ filters: {
7392
+ id,
7393
+ },
7394
+ limits: {
7395
+ limit: 1,
7396
+ },
7397
+ })
7398
+ .then((res) => res.data.at(0));
7399
+ if (!product)
7400
+ throw new NotFoundError(`Product not found`);
7401
+ if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
7402
+ const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
7403
+ await this.cache.cacheAdapter.set({
7404
+ key: cacheKey,
7405
+ data: serialize(product),
7406
+ expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
7407
+ });
7408
+ this.logger.log(`Dados salvos no cache: ${cacheKey}`);
7478
7409
  }
7479
7410
  return product;
7480
7411
  }
7481
- async get(identifiers, options) {
7482
- const product = Number.isNaN(+identifiers.id)
7483
- ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
7484
- .data?.[0]
7485
- : await super.get(identifiers, options);
7486
- if (product.productId)
7487
- throw new NotFoundError('Product not found, it is a variant');
7488
- product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, options));
7412
+ async getByEAN(EAN, options) {
7413
+ if (this.cache?.cacheAdapter && options?.cache?.enabled) {
7414
+ const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
7415
+ const cachedData = await this.cache.cacheAdapter.get(cacheKey);
7416
+ if (cachedData) {
7417
+ this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
7418
+ return this.model.toInstance(deserialize(cachedData));
7419
+ }
7420
+ }
7421
+ const product = await super
7422
+ .find({
7423
+ filters: {
7424
+ EAN,
7425
+ },
7426
+ limits: {
7427
+ limit: 1,
7428
+ },
7429
+ })
7430
+ .then((res) => res.data.at(0));
7431
+ if (!product)
7432
+ return null;
7433
+ RoundProductPricesHelper.roundProductPrices(product);
7434
+ if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
7435
+ const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
7436
+ await this.cache.cacheAdapter.set({
7437
+ key: cacheKey,
7438
+ data: serialize(product),
7439
+ expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
7440
+ });
7441
+ this.logger.log(`Dados salvos no cache: ${cacheKey}`);
7442
+ }
7489
7443
  return product;
7490
7444
  }
7491
7445
  async find(params, optionsParams) {
@@ -7502,7 +7456,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7502
7456
  options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
7503
7457
  return super.find({
7504
7458
  ...options,
7505
- filters: { ...filters, productId: { operator: Where.ISNULL } },
7459
+ filters: { ...filters },
7506
7460
  fields: [
7507
7461
  ...bindFields,
7508
7462
  ...(bindFields.includes('price')
@@ -7515,18 +7469,614 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7515
7469
  ],
7516
7470
  }, optionsParams);
7517
7471
  }
7518
- async getBySlug(slug, options) {
7519
- if (this.cache?.cacheAdapter && options?.cache?.enabled) {
7520
- const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
7521
- const cachedData = await this.cache.cacheAdapter.get(cacheKey);
7522
- if (cachedData) {
7523
- this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
7524
- return this.model.toInstance(deserialize(cachedData));
7525
- }
7526
- }
7472
+ async findCatalog(params, mainGender, options) {
7527
7473
  const result = await this.find({
7528
- filters: {
7474
+ ...params,
7475
+ filters: { ...params.filters, published: true },
7476
+ orderBy: {
7477
+ hasStock: 'desc',
7478
+ ...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
7479
+ ...omit(params.orderBy, ['hasStock', 'intGender']),
7480
+ },
7481
+ }, options);
7482
+ return result;
7483
+ }
7484
+ }
7485
+ __decorate([
7486
+ Log(),
7487
+ __metadata("design:type", Function),
7488
+ __metadata("design:paramtypes", [Object, Object, Object]),
7489
+ __metadata("design:returntype", Promise)
7490
+ ], ProductCatalogHasuraGraphQLRepository.prototype, "findCatalog", null);
7491
+
7492
+ class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7493
+ constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
7494
+ super({
7495
+ tableName: 'product_errors',
7496
+ model: ProductErrorsHasuraGraphQL,
7497
+ endpoint,
7498
+ authOptions,
7499
+ interceptors,
7500
+ cache,
7501
+ fields: [
7502
+ {
7503
+ productId: {
7504
+ columnName: 'product_id',
7505
+ to: (value) => +value,
7506
+ from: (value) => value.toString(),
7507
+ },
7508
+ },
7509
+ 'source',
7510
+ 'error',
7511
+ { createdAt: { columnName: 'created_at' } },
7512
+ { updatedAt: { columnName: 'updated_at' } },
7513
+ {
7514
+ product: {
7515
+ columnName: 'product',
7516
+ foreignKeyColumn: { id: 'productId' },
7517
+ fields: [
7518
+ { id: { columnName: 'id', from: (value) => value.toString() } },
7519
+ { productId: { columnName: 'main_product_id' } },
7520
+ 'name',
7521
+ 'published',
7522
+ 'group',
7523
+ 'validity',
7524
+ { createdAt: { columnName: 'created_at' } },
7525
+ { updatedAt: { columnName: 'updated_at' } },
7526
+ ],
7527
+ },
7528
+ },
7529
+ ],
7530
+ });
7531
+ this.productRepository = productRepository;
7532
+ }
7533
+ async get(params) {
7534
+ const result = await super.get(params);
7535
+ if (result instanceof VariantHasuraGraphQL) {
7536
+ const product = await this.productRepository.get({ id: result.productId.toString() });
7537
+ result.product.name = product.name;
7538
+ result.product.group = product.group;
7539
+ }
7540
+ return result;
7541
+ }
7542
+ async find(params) {
7543
+ const result = await super.find(params);
7544
+ const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
7545
+ (isEmpty(item.product.name) || isEmpty(item.product.group) || isEmpty(item.product)));
7546
+ if (variantsWithNoData.length > 0) {
7547
+ const { data: products } = await this.productRepository.find({
7548
+ filters: {
7549
+ id: {
7550
+ operator: Where.IN,
7551
+ value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
7552
+ },
7553
+ },
7554
+ });
7555
+ products.forEach((product) => {
7556
+ result.data
7557
+ .filter((variant) => variant.product.productId?.toString() === product.id.toString())
7558
+ .forEach((variant) => {
7559
+ variant.product.name = product.name;
7560
+ variant.product.group = product.group;
7561
+ });
7562
+ });
7563
+ }
7564
+ return result;
7565
+ }
7566
+ }
7567
+
7568
+ const commonFields = [
7569
+ {
7570
+ id: {
7571
+ columnName: 'id',
7572
+ to: (value) => +value,
7573
+ from: (value) => value.toString(),
7574
+ },
7575
+ },
7576
+ { firestoreId: { columnName: 'firestore_id' } },
7577
+ { productId: { columnName: 'main_product_id' } },
7578
+ { CEST: { columnName: 'cest' } },
7579
+ { EAN: { columnName: 'ean' } },
7580
+ { NCM: { columnName: 'ncm' } },
7581
+ 'brand',
7582
+ { costPrice: { columnName: 'cost_price' } },
7583
+ {
7584
+ description: {
7585
+ columnName: 'description',
7586
+ from: (description, data) => ({
7587
+ description,
7588
+ differentials: data.differentials,
7589
+ whoMustUse: data.who_must_use,
7590
+ howToUse: data.how_to_use,
7591
+ brand: data.brand_description,
7592
+ ingredients: data.ingredients,
7593
+ purpose: data.purpose,
7594
+ }),
7595
+ bindFindFilter: (filters) => {
7596
+ return {
7597
+ ...(filters?.description && { description: filters.description }),
7598
+ ...(filters.differentials && { differentials: filters.differentials }),
7599
+ ...(filters.whoMustUse && {
7600
+ who_must_use: filters.whoMustUse,
7601
+ }),
7602
+ ...(filters.howToUse && {
7603
+ how_to_use: filters.howToUse,
7604
+ }),
7605
+ ...(filters.brand && {
7606
+ brand_description: filters.brand,
7607
+ }),
7608
+ ...(filters.ingredients && {
7609
+ ingredients: filters.ingredients,
7610
+ }),
7611
+ ...(filters.purpose && {
7612
+ purpose: filters.purpose,
7613
+ }),
7614
+ };
7615
+ },
7616
+ bindPersistData: (descriptionData) => ({
7617
+ ...(descriptionData?.description && { description: descriptionData.description }),
7618
+ ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7619
+ ...(descriptionData.whoMustUse && {
7620
+ who_must_use: descriptionData.whoMustUse,
7621
+ }),
7622
+ ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7623
+ ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7624
+ ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7625
+ ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7626
+ }),
7627
+ },
7628
+ },
7629
+ { differentials: { columnName: 'differentials' } },
7630
+ { whoMustUse: { columnName: 'who_must_use' } },
7631
+ { howToUse: { columnName: 'how_to_use' } },
7632
+ { brandDescription: { columnName: 'brand_description' } },
7633
+ { ingredients: { columnName: 'ingredients' } },
7634
+ { purpose: { columnName: 'purpose' } },
7635
+ { hasVariants: { columnName: 'has_variants' } },
7636
+ {
7637
+ images: {
7638
+ columnName: 'images',
7639
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7640
+ },
7641
+ },
7642
+ {
7643
+ miniatures: {
7644
+ columnName: 'miniatures',
7645
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7646
+ },
7647
+ },
7648
+ {
7649
+ imagesCard: {
7650
+ columnName: 'images_card',
7651
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7652
+ },
7653
+ },
7654
+ 'name',
7655
+ {
7656
+ price: {
7657
+ columnName: 'price',
7658
+ from: (price, data) => ({
7659
+ price,
7660
+ fullPrice: data.full_price,
7661
+ subscriberDiscountPercentage: data.subscriber_discount_percentage,
7662
+ fullPriceDiscountPercentage: data.full_price_discount_percentage,
7663
+ subscriberPrice: data.subscriber_price,
7664
+ }),
7665
+ bindFindFilter: (filters) => {
7666
+ return {
7667
+ ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7668
+ ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7669
+ ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7670
+ subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7671
+ }),
7672
+ ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7673
+ subscriber_price: filters.subscriberPrice,
7674
+ }),
7675
+ ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7676
+ full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7677
+ }),
7678
+ };
7679
+ },
7680
+ bindPersistData: (priceData) => ({
7681
+ ...(priceData?.price >= 0 && { price: priceData.price }),
7682
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
7683
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
7684
+ subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
7685
+ }),
7686
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
7687
+ ...(priceData.fullPriceDiscountPercentage >= 0 && {
7688
+ full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
7689
+ }),
7690
+ }),
7691
+ },
7692
+ },
7693
+ { fullPrice: { columnName: 'full_price' } },
7694
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7695
+ { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7696
+ { subscriberPrice: { columnName: 'subscriber_price' } },
7697
+ 'published',
7698
+ 'outlet',
7699
+ 'label',
7700
+ 'sku',
7701
+ {
7702
+ stock: {
7703
+ columnName: 'stock',
7704
+ from: (quantity) => ({ quantity }),
7705
+ to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
7706
+ },
7707
+ },
7708
+ { hasStock: { columnName: 'has_stock' } },
7709
+ 'slug',
7710
+ 'type',
7711
+ 'video',
7712
+ 'weight',
7713
+ 'gender',
7714
+ { intGender: { columnName: 'int_gender' } },
7715
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
7716
+ { isKit: { columnName: 'is_kit' } },
7717
+ { createdAt: { columnName: 'created_at' } },
7718
+ { updatedAt: { columnName: 'updated_at' } },
7719
+ { rate: { columnName: 'rating' } },
7720
+ { reviewsTotal: { columnName: 'reviews_total' } },
7721
+ { shoppingCount: { columnName: 'shopping_count' } },
7722
+ { categoryId: { columnName: 'category_id' } },
7723
+ {
7724
+ category: {
7725
+ columnName: 'category',
7726
+ foreignKeyColumn: { id: 'categoryId' },
7727
+ fields: ['id', 'name', 'reference', 'slug'],
7728
+ },
7729
+ },
7730
+ 'group',
7731
+ 'validity',
7732
+ { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
7733
+ { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
7734
+ { daysOfUse: { columnName: 'days_of_use' } },
7735
+ { showVariants: { columnName: 'show_variants' } },
7736
+ { variantSlug: { columnName: 'variant_slug' } },
7737
+ ];
7738
+ const fieldsConfiguration$2 = [
7739
+ ...commonFields,
7740
+ {
7741
+ categories: {
7742
+ columnName: 'categories',
7743
+ fields: ['category_id'],
7744
+ bindPersistData: (value) => ({
7745
+ categories: { data: value.map((category) => ({ category_id: +category })) },
7746
+ }),
7747
+ to: (categories) => categories.map((categoryId) => +categoryId),
7748
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
7749
+ },
7750
+ },
7751
+ {
7752
+ kitProducts: {
7753
+ columnName: 'kit_products',
7754
+ foreignKeyColumn: { productId: 'id' },
7755
+ fields: [
7756
+ { productId: { columnName: 'product_id' } },
7757
+ { kitProductId: { columnName: 'kit_product_id' } },
7758
+ 'quantity',
7759
+ { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
7760
+ ],
7761
+ },
7762
+ },
7763
+ {
7764
+ reviews: {
7765
+ columnName: 'reviews',
7766
+ foreignKeyColumn: { product_id: 'id' },
7767
+ fields: [
7768
+ 'id',
7769
+ 'shop',
7770
+ 'rate',
7771
+ 'author',
7772
+ 'email',
7773
+ 'location',
7774
+ 'review',
7775
+ 'status',
7776
+ 'title',
7777
+ { personId: { columnName: 'person_id' } },
7778
+ 'points',
7779
+ { orderId: { columnName: 'order_id' } },
7780
+ { createdAt: { columnName: 'created_at' } },
7781
+ { updatedAt: { columnName: 'updated_at' } },
7782
+ ],
7783
+ },
7784
+ },
7785
+ {
7786
+ metadata: {
7787
+ columnName: 'metadata',
7788
+ fields: ['title', 'description'],
7789
+ bindPersistData: (value) => ({
7790
+ metadata: { data: value },
7791
+ }),
7792
+ },
7793
+ },
7794
+ {
7795
+ variants: {
7796
+ columnName: 'variants',
7797
+ foreignKeyColumn: { product_id: 'id' },
7798
+ fields: [
7799
+ 'id',
7800
+ 'name',
7801
+ 'ean',
7802
+ 'sku',
7803
+ {
7804
+ description: {
7805
+ columnName: 'description',
7806
+ from: (description, data) => ({
7807
+ description,
7808
+ differentials: data.differentials,
7809
+ whoMustUse: data.who_must_use,
7810
+ howToUse: data.how_to_use,
7811
+ brand: data.brand_description,
7812
+ ingredients: data.ingredients,
7813
+ purpose: data.purpose,
7814
+ }),
7815
+ bindFindFilter: (filters) => {
7816
+ return {
7817
+ ...(filters?.description && { description: filters.description }),
7818
+ ...(filters.differentials && { differentials: filters.differentials }),
7819
+ ...(filters.whoMustUse && {
7820
+ who_must_use: filters.whoMustUse,
7821
+ }),
7822
+ ...(filters.howToUse && {
7823
+ how_to_use: filters.howToUse,
7824
+ }),
7825
+ ...(filters.brand && {
7826
+ brand_description: filters.brand,
7827
+ }),
7828
+ ...(filters.ingredients && {
7829
+ ingredients: filters.ingredients,
7830
+ }),
7831
+ ...(filters.purpose && {
7832
+ purpose: filters.purpose,
7833
+ }),
7834
+ };
7835
+ },
7836
+ bindPersistData: (descriptionData) => ({
7837
+ ...(descriptionData?.description && { description: descriptionData.description }),
7838
+ ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
7839
+ ...(descriptionData.whoMustUse && {
7840
+ who_must_use: descriptionData.whoMustUse,
7841
+ }),
7842
+ ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
7843
+ ...(descriptionData.brand && { brand_description: descriptionData.brand }),
7844
+ ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
7845
+ ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
7846
+ }),
7847
+ },
7848
+ },
7849
+ { differentials: { columnName: 'differentials' } },
7850
+ { whoMustUse: { columnName: 'who_must_use' } },
7851
+ { howToUse: { columnName: 'how_to_use' } },
7852
+ { brandDescription: { columnName: 'brand_description' } },
7853
+ { ingredients: { columnName: 'ingredients' } },
7854
+ { purpose: { columnName: 'purpose' } },
7855
+ {
7856
+ grade: {
7857
+ columnName: 'grade',
7858
+ type: HasuraGraphQLColumnType.Jsonb,
7859
+ },
7860
+ },
7861
+ {
7862
+ price: {
7863
+ columnName: 'price',
7864
+ from: (price, data) => ({
7865
+ price,
7866
+ fullPrice: data.full_price,
7867
+ subscriberDiscountPercentage: data.subscriber_discount_percentage,
7868
+ subscriberPrice: data.subscriber_price,
7869
+ fullPriceDiscountPercentage: data.full_price_discount_percentage,
7870
+ }),
7871
+ bindFindFilter: (sentence) => {
7872
+ const filters = Object.values(sentence).shift();
7873
+ return {
7874
+ ...((filters?.price || filters?.price === 0) && { price: filters.price }),
7875
+ ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
7876
+ ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
7877
+ subscriber_discount_percentage: filters.subscriberDiscountPercentage,
7878
+ }),
7879
+ ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
7880
+ subscriber_price: filters.subscriberPrice,
7881
+ }),
7882
+ ...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
7883
+ full_price_discount_percentage: filters.fullPriceDiscountPercentage,
7884
+ }),
7885
+ };
7886
+ },
7887
+ bindPersistData: (priceData) => ({
7888
+ ...((priceData?.price || 0) >= 0 && { price: priceData.price }),
7889
+ ...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
7890
+ ...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
7891
+ subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
7892
+ }),
7893
+ ...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
7894
+ ...(priceData.fullPriceDiscountPercentage >= 0 && {
7895
+ full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
7896
+ }),
7897
+ }),
7898
+ },
7899
+ },
7900
+ { fullPrice: { columnName: 'full_price' } },
7901
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
7902
+ { subscriberPrice: { columnName: 'subscriber_price' } },
7903
+ { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
7904
+ 'published',
7905
+ {
7906
+ stock: {
7907
+ columnName: 'stock',
7908
+ from: (quantity) => ({ quantity }),
7909
+ to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
7910
+ },
7911
+ },
7912
+ {
7913
+ images: {
7914
+ columnName: 'images',
7915
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7916
+ },
7917
+ },
7918
+ {
7919
+ miniatures: {
7920
+ columnName: 'miniatures',
7921
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7922
+ },
7923
+ },
7924
+ {
7925
+ imagesCard: {
7926
+ columnName: 'images_card',
7927
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
7928
+ },
7929
+ },
7930
+ { tagsProfile: { columnName: 'tags_profile' } },
7931
+ { tagsCollection: { columnName: 'tags_collection' } },
7932
+ { variantSlug: { columnName: 'variant_slug' } },
7933
+ {
7934
+ reviews: {
7935
+ columnName: 'reviews',
7936
+ foreignKeyColumn: { product_id: 'id' },
7937
+ fields: [
7938
+ 'id',
7939
+ 'shop',
7940
+ 'rate',
7941
+ 'author',
7942
+ 'email',
7943
+ 'location',
7944
+ 'review',
7945
+ 'status',
7946
+ 'title',
7947
+ { personId: { columnName: 'person_id' } },
7948
+ 'points',
7949
+ { orderId: { columnName: 'order_id' } },
7950
+ { createdAt: { columnName: 'created_at' } },
7951
+ { updatedAt: { columnName: 'updated_at' } },
7952
+ ],
7953
+ },
7954
+ },
7955
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
7956
+ {
7957
+ metadata: {
7958
+ columnName: 'metadata',
7959
+ fields: ['title', 'description'],
7960
+ bindPersistData: (value) => ({
7961
+ metadata: { data: value },
7962
+ }),
7963
+ },
7964
+ },
7965
+ ],
7966
+ },
7967
+ },
7968
+ ];
7969
+ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
7970
+ get reviewsFields() {
7971
+ return [
7972
+ 'id',
7973
+ 'shop',
7974
+ 'rate',
7975
+ 'author',
7976
+ 'email',
7977
+ 'location',
7978
+ 'review',
7979
+ 'status',
7980
+ 'title',
7981
+ { personId: { columnName: 'person_id' } },
7982
+ 'points',
7983
+ { orderId: { columnName: 'order_id' } },
7984
+ { createdAt: { columnName: 'created_at' } },
7985
+ { updatedAt: { columnName: 'updated_at' } },
7986
+ ];
7987
+ }
7988
+ constructor({ endpoint, authOptions, interceptors, cache, }) {
7989
+ super({
7990
+ tableName: 'product',
7991
+ model: ProductHasuraGraphQL,
7992
+ endpoint,
7993
+ authOptions,
7994
+ interceptors,
7995
+ fields: fieldsConfiguration$2,
7996
+ cache,
7997
+ });
7998
+ this.bindReviewToModel = (plain) => ProductReview.toInstance({
7999
+ ...is(omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])),
8000
+ createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at,
8001
+ updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at,
8002
+ personId: plain.person_id,
8003
+ orderId: plain.order_id,
8004
+ });
8005
+ this.bindReviewToHasura = (review) => ({
8006
+ ...is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])),
8007
+ person_id: review.personId,
8008
+ order_id: review.orderId,
8009
+ });
8010
+ }
8011
+ async create(params) {
8012
+ const { metadata, ...data } = params;
8013
+ const product = await super.create(omit({ ...data, metadata: metadata || { description: null, title: null } }, ['reviews']));
8014
+ try {
8015
+ product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
8016
+ }
8017
+ catch (error) {
8018
+ await this.delete({ id: product.id });
8019
+ throw error;
8020
+ }
8021
+ return product;
8022
+ }
8023
+ async get(identifiers, options) {
8024
+ const product = Number.isNaN(+identifiers.id)
8025
+ ? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
8026
+ .data?.[0]
8027
+ : await super.get(identifiers, options);
8028
+ if (product.productId)
8029
+ throw new NotFoundError('Product not found, it is a variant');
8030
+ product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, false, options));
8031
+ if (!product.variants?.length) {
8032
+ for (const [index, variant] of product.variants.entries()) {
8033
+ product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
8034
+ }
8035
+ }
8036
+ return product;
8037
+ }
8038
+ async find(params, optionsParams) {
8039
+ const { filters, fields, ...options } = params || {};
8040
+ const bindFields = fields ||
8041
+ this.fields
8042
+ .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
8043
+ .filter((field) => field !== 'reviews' && field !== 'categories');
8044
+ if (options.options?.minimal?.includes('price'))
8045
+ options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
8046
+ if (options.options?.maximum?.includes('price'))
8047
+ options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
8048
+ options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
8049
+ options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
8050
+ return super.find({
8051
+ ...options,
8052
+ filters: { ...filters, productId: { operator: Where.ISNULL } },
8053
+ fields: [
8054
+ ...bindFields,
8055
+ ...(bindFields.includes('price')
8056
+ ? [
8057
+ 'subscriberPrice',
8058
+ 'subscriberDiscountPercentage',
8059
+ 'fullPrice',
8060
+ ]
8061
+ : []),
8062
+ ],
8063
+ }, optionsParams);
8064
+ }
8065
+ async getBySlug(slug, options) {
8066
+ if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8067
+ const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
8068
+ const cachedData = await this.cache.cacheAdapter.get(cacheKey);
8069
+ if (cachedData) {
8070
+ this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
8071
+ return this.model.toInstance(deserialize(cachedData));
8072
+ }
8073
+ }
8074
+ const result = await this.find({
8075
+ filters: {
7529
8076
  slug,
8077
+ productId: {
8078
+ operator: Where.ISNULL,
8079
+ },
7530
8080
  },
7531
8081
  fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
7532
8082
  options: {
@@ -7536,6 +8086,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7536
8086
  if (!result.data.length)
7537
8087
  return null;
7538
8088
  const product = result?.data?.shift();
8089
+ if (!product.variants?.length) {
8090
+ for (const [index, variant] of product.variants.entries()) {
8091
+ product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
8092
+ }
8093
+ }
7539
8094
  RoundProductPricesHelper.roundProductPrices(product);
7540
8095
  if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
7541
8096
  const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
@@ -7548,6 +8103,39 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7548
8103
  }
7549
8104
  return product;
7550
8105
  }
8106
+ async getByEAN(EAN, options) {
8107
+ if (this.cache?.cacheAdapter && options?.cache?.enabled) {
8108
+ const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
8109
+ const cachedData = await this.cache.cacheAdapter.get(cacheKey);
8110
+ if (cachedData) {
8111
+ this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
8112
+ return this.model.toInstance(deserialize(cachedData));
8113
+ }
8114
+ }
8115
+ const result = await this.find({
8116
+ filters: {
8117
+ EAN,
8118
+ },
8119
+ fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
8120
+ options: {
8121
+ enableCount: false,
8122
+ },
8123
+ });
8124
+ if (!result.data.length)
8125
+ return null;
8126
+ const product = result?.data?.shift();
8127
+ RoundProductPricesHelper.roundProductPrices(product);
8128
+ if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
8129
+ const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
8130
+ await this.cache.cacheAdapter.set({
8131
+ key: cacheKey,
8132
+ data: serialize(product),
8133
+ expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
8134
+ });
8135
+ this.logger.log(`Dados salvos no cache: ${cacheKey}`);
8136
+ }
8137
+ return product;
8138
+ }
7551
8139
  async update(params) {
7552
8140
  const { kitProducts, reviews, id: checkId, metadata, ...data } = omit(params, ['categories', 'rate']);
7553
8141
  const plainData = this.paramsToPlain({ id: checkId });
@@ -7682,7 +8270,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7682
8270
  const plainData = this.paramsToPlain({ metadata });
7683
8271
  if (!plainData.metadata)
7684
8272
  return null;
7685
- await this.mutation('update_product_metadata_by_pk', ['product_id'], {
8273
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8274
+ const { update_product_metadata_by_pk } = await this.mutation('update_product_metadata_by_pk', ['product_id'], {
7686
8275
  pk_columns: {
7687
8276
  value: { product_id: productId },
7688
8277
  type: 'product_metadata_pk_columns_input',
@@ -7694,6 +8283,14 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7694
8283
  required: true,
7695
8284
  },
7696
8285
  });
8286
+ if (!update_product_metadata_by_pk) {
8287
+ await this.mutation('insert_product_metadata', ['affected_rows'], {
8288
+ objects: {
8289
+ type: '[product_metadata_insert_input!]!',
8290
+ value: [{ product_id: productId, ...metadata }],
8291
+ },
8292
+ });
8293
+ }
7697
8294
  return plainData.metadata;
7698
8295
  }
7699
8296
  async getId(id) {
@@ -7704,7 +8301,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7704
8301
  return data?.[0]?.id;
7705
8302
  throw new NotFoundError(`Product with id ${id} not found`);
7706
8303
  }
7707
- async findReviewsByProduct(productId, options) {
8304
+ async findReviewsByProduct(productId, onlyApproved, options) {
7708
8305
  if (this.cache?.cacheAdapter && options?.cache?.enabled) {
7709
8306
  const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
7710
8307
  const cachedData = await this.cache.cacheAdapter.get(cacheKey);
@@ -7717,10 +8314,16 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
7717
8314
  where: {
7718
8315
  value: {
7719
8316
  product_id: { _eq: productId },
8317
+ ...(onlyApproved && { status: { _eq: true } }),
7720
8318
  },
7721
8319
  type: 'product_review_bool_exp',
7722
8320
  required: true,
7723
8321
  },
8322
+ order_by: {
8323
+ type: '[product_review_order_by]',
8324
+ value: [{ createdAt: 'desc' }],
8325
+ required: true,
8326
+ },
7724
8327
  });
7725
8328
  const reviews = data?.map((review) => this.bindReviewToModel(review));
7726
8329
  if (this.cache?.cacheAdapter && options?.cache?.enabled && reviews) {
@@ -7792,6 +8395,12 @@ __decorate([
7792
8395
  __metadata("design:paramtypes", [String, Object]),
7793
8396
  __metadata("design:returntype", Promise)
7794
8397
  ], ProductHasuraGraphQLRepository.prototype, "getBySlug", null);
8398
+ __decorate([
8399
+ Log(),
8400
+ __metadata("design:type", Function),
8401
+ __metadata("design:paramtypes", [String, Object]),
8402
+ __metadata("design:returntype", Promise)
8403
+ ], ProductHasuraGraphQLRepository.prototype, "getByEAN", null);
7795
8404
  __decorate([
7796
8405
  Log(),
7797
8406
  __metadata("design:type", Function),
@@ -7819,7 +8428,7 @@ __decorate([
7819
8428
  __decorate([
7820
8429
  Log(),
7821
8430
  __metadata("design:type", Function),
7822
- __metadata("design:paramtypes", [Number, Object]),
8431
+ __metadata("design:paramtypes", [Number, Boolean, Object]),
7823
8432
  __metadata("design:returntype", Promise)
7824
8433
  ], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
7825
8434
 
@@ -7847,6 +8456,13 @@ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
7847
8456
  { orderId: { columnName: 'order_id' } },
7848
8457
  { createdAt: { columnName: 'created_at' } },
7849
8458
  { updatedAt: { columnName: 'updated_at' } },
8459
+ {
8460
+ product: {
8461
+ columnName: 'product',
8462
+ foreignKeyColumn: { id: 'productId' },
8463
+ fields: ['id', 'ean', 'sku', 'name', 'brand', 'slug', 'images', 'grade', 'gender'],
8464
+ },
8465
+ },
7850
8466
  ],
7851
8467
  cache,
7852
8468
  });
@@ -8038,8 +8654,135 @@ const fieldsConfiguration$1 = [
8038
8654
  },
8039
8655
  'group',
8040
8656
  'validity',
8041
- { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
8042
8657
  'published',
8658
+ { tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
8659
+ { tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
8660
+ { daysOfUse: { columnName: 'days_of_use' } },
8661
+ {
8662
+ images: {
8663
+ columnName: 'images',
8664
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8665
+ },
8666
+ },
8667
+ {
8668
+ miniatures: {
8669
+ columnName: 'miniatures',
8670
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8671
+ },
8672
+ },
8673
+ {
8674
+ imagesCard: {
8675
+ columnName: 'images_card',
8676
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
8677
+ },
8678
+ },
8679
+ 'slug',
8680
+ 'brand',
8681
+ 'name',
8682
+ 'sku',
8683
+ { NCM: { columnName: 'ncm' } },
8684
+ { CEST: { columnName: 'cest' } },
8685
+ {
8686
+ description: {
8687
+ columnName: 'description',
8688
+ from: (description, data) => ({
8689
+ description,
8690
+ differentials: data.differentials,
8691
+ whoMustUse: data.who_must_use,
8692
+ howToUse: data.how_to_use,
8693
+ brand: data.brand_description,
8694
+ ingredients: data.ingredients,
8695
+ purpose: data.purpose,
8696
+ }),
8697
+ bindFindFilter: (filters) => {
8698
+ return {
8699
+ ...(filters?.description && { description: filters.description }),
8700
+ ...(filters.differentials && { differentials: filters.differentials }),
8701
+ ...(filters.whoMustUse && {
8702
+ who_must_use: filters.whoMustUse,
8703
+ }),
8704
+ ...(filters.howToUse && {
8705
+ how_to_use: filters.howToUse,
8706
+ }),
8707
+ ...(filters.brand && {
8708
+ brand_description: filters.brand,
8709
+ }),
8710
+ ...(filters.ingredients && {
8711
+ ingredients: filters.ingredients,
8712
+ }),
8713
+ ...(filters.purpose && {
8714
+ purpose: filters.purpose,
8715
+ }),
8716
+ };
8717
+ },
8718
+ bindPersistData: (descriptionData) => ({
8719
+ ...(descriptionData?.description && { description: descriptionData.description }),
8720
+ ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
8721
+ ...(descriptionData.whoMustUse && {
8722
+ who_must_use: descriptionData.whoMustUse,
8723
+ }),
8724
+ ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
8725
+ ...(descriptionData.brand && { brand_description: descriptionData.brand }),
8726
+ ...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
8727
+ ...(descriptionData.purpose && { purpose: descriptionData.purpose }),
8728
+ }),
8729
+ },
8730
+ },
8731
+ { differentials: { columnName: 'differentials' } },
8732
+ { whoMustUse: { columnName: 'who_must_use' } },
8733
+ { howToUse: { columnName: 'how_to_use' } },
8734
+ { brandDescription: { columnName: 'brand_description' } },
8735
+ { ingredients: { columnName: 'ingredients' } },
8736
+ { purpose: { columnName: 'purpose' } },
8737
+ 'gender',
8738
+ { intGender: { columnName: 'int_gender' } },
8739
+ 'label',
8740
+ { filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
8741
+ { rate: { columnName: 'rating' } },
8742
+ { reviewsTotal: { columnName: 'reviews_total' } },
8743
+ { shoppingCount: { columnName: 'shopping_count' } },
8744
+ { categoryId: { columnName: 'category_id' } },
8745
+ {
8746
+ category: {
8747
+ columnName: 'category',
8748
+ foreignKeyColumn: { id: 'categoryId' },
8749
+ fields: ['id', 'name', 'reference', 'slug'],
8750
+ },
8751
+ },
8752
+ {
8753
+ metadata: {
8754
+ columnName: 'metadata',
8755
+ fields: ['title', 'description'],
8756
+ bindPersistData: (value) => ({
8757
+ metadata: { data: value },
8758
+ }),
8759
+ },
8760
+ },
8761
+ {
8762
+ reviews: {
8763
+ columnName: 'reviews',
8764
+ foreignKeyColumn: { product_id: 'id' },
8765
+ fields: [
8766
+ 'id',
8767
+ 'shop',
8768
+ 'rate',
8769
+ 'author',
8770
+ 'email',
8771
+ 'location',
8772
+ 'review',
8773
+ 'status',
8774
+ 'title',
8775
+ { personId: { columnName: 'person_id' } },
8776
+ 'points',
8777
+ { orderId: { columnName: 'order_id' } },
8778
+ { createdAt: { columnName: 'created_at' } },
8779
+ { updatedAt: { columnName: 'updated_at' } },
8780
+ ],
8781
+ },
8782
+ },
8783
+ { variantSlug: { columnName: 'variant_slug' } },
8784
+ { createdAt: { columnName: 'created_at' } },
8785
+ { updatedAt: { columnName: 'updated_at' } },
8043
8786
  ];
8044
8787
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
8045
8788
  constructor({ endpoint, authOptions, interceptors, cache, }) {
@@ -8068,18 +8811,57 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
8068
8811
  const { filters, ...options } = params || {};
8069
8812
  return super.find({ ...options, filters: { productId: { operator: Where.ISNOTNULL }, ...filters } });
8070
8813
  }
8814
+ async getByEAN(EAN) {
8815
+ const { data } = await this.find({
8816
+ filters: {
8817
+ EAN,
8818
+ },
8819
+ options: {
8820
+ enableCount: false,
8821
+ },
8822
+ });
8823
+ return data.at(0);
8824
+ }
8071
8825
  async update(params) {
8072
- const { productId, id: checkId, ...data } = params;
8826
+ const { productId, id: checkId, metadata, ...data } = params;
8073
8827
  const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
8074
8828
  if (!dataWithProductId.id) {
8075
8829
  throw new NotFoundError('Variant ID is required for update');
8076
8830
  }
8077
8831
  const id = await this.getId(dataWithProductId.id);
8078
8832
  const product = await super.update({ id, ...data });
8833
+ product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
8079
8834
  if (dataWithProductId.productId) {
8080
8835
  product.productId = dataWithProductId.productId;
8081
8836
  }
8082
- return product;
8837
+ return product;
8838
+ }
8839
+ async updateMetadata(productId, { metadata }) {
8840
+ const plainData = this.paramsToPlain({ metadata });
8841
+ if (!plainData.metadata)
8842
+ return null;
8843
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8844
+ const { update_product_metadata_by_pk } = await this.mutation('update_product_metadata_by_pk', ['product_id'], {
8845
+ pk_columns: {
8846
+ value: { product_id: productId },
8847
+ type: 'product_metadata_pk_columns_input',
8848
+ required: true,
8849
+ },
8850
+ _set: {
8851
+ value: omit(metadata, ['product_id']),
8852
+ type: 'product_metadata_set_input',
8853
+ required: true,
8854
+ },
8855
+ });
8856
+ if (!update_product_metadata_by_pk) {
8857
+ await this.mutation('insert_product_metadata', ['affected_rows'], {
8858
+ objects: {
8859
+ type: '[product_metadata_insert_input!]!',
8860
+ value: [{ product_id: productId, ...metadata }],
8861
+ },
8862
+ });
8863
+ }
8864
+ return plainData.metadata;
8083
8865
  }
8084
8866
  async getId(id) {
8085
8867
  if (!Number.isNaN(+id))
@@ -8395,6 +9177,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
8395
9177
  productId: +productId,
8396
9178
  });
8397
9179
  }
9180
+ async getBrandsWithProducts() {
9181
+ return;
9182
+ }
8398
9183
  }
8399
9184
  __decorate([
8400
9185
  Log(),
@@ -8561,6 +9346,201 @@ class PagarmePaymentOperationsHelper {
8561
9346
  }
8562
9347
  }
8563
9348
 
9349
+ class PagarMeV5RequestHelper {
9350
+ static build(checkout, method, card) {
9351
+ return {
9352
+ items: this.buildItems(checkout),
9353
+ customer: this.buildCustomer(checkout),
9354
+ shipping: this.buildShipping(checkout),
9355
+ payments: this.buildPayment(checkout, method, card),
9356
+ };
9357
+ }
9358
+ static buildItems(checkout) {
9359
+ return checkout.lineItems
9360
+ .filter((item) => !item.isGift)
9361
+ .map((item) => {
9362
+ return {
9363
+ amount: Math.floor(item.pricePaid * 100),
9364
+ description: item.name,
9365
+ quantity: item.quantity,
9366
+ code: item.EAN,
9367
+ };
9368
+ });
9369
+ }
9370
+ static buildCustomer(checkout) {
9371
+ return {
9372
+ name: checkout.user.displayName,
9373
+ email: checkout.user.email,
9374
+ type: 'individual',
9375
+ document: checkout.user.cpf,
9376
+ phones: {
9377
+ home_phone: {
9378
+ country_code: '55',
9379
+ number: checkout.user.phone.slice(2),
9380
+ area_code: checkout.user.phone.slice(0, 2),
9381
+ },
9382
+ mobile_phone: {
9383
+ country_code: '55',
9384
+ number: checkout.user.phone.slice(2),
9385
+ area_code: checkout.user.phone.slice(0, 2),
9386
+ },
9387
+ },
9388
+ address: {
9389
+ line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
9390
+ line_2: `${checkout.billingAddress.extension}`,
9391
+ zip_code: checkout.shippingAddress.zip,
9392
+ city: checkout.billingAddress.city,
9393
+ state: checkout.billingAddress.state,
9394
+ country: 'BR',
9395
+ },
9396
+ };
9397
+ }
9398
+ static buildShipping(checkout) {
9399
+ return {
9400
+ amount: Math.floor(checkout.shipping.ShippingPrice * 100),
9401
+ description: `${checkout.shipping.ShippingCompanyName} - ${checkout.shipping.description}`,
9402
+ recipient_name: checkout.shippingAddress.recipient,
9403
+ recipient_phone: checkout.user.phone,
9404
+ address: {
9405
+ line_1: `${checkout.shippingAddress.number}, ${checkout.shippingAddress.street}, ${checkout.shippingAddress.district}`,
9406
+ line_2: `${checkout.shippingAddress.extension}`,
9407
+ zip_code: checkout.shippingAddress.zip,
9408
+ city: checkout.shippingAddress.city,
9409
+ state: checkout.shippingAddress.state,
9410
+ country: 'BR',
9411
+ },
9412
+ };
9413
+ }
9414
+ static buildPayment(checkout, method, card) {
9415
+ return [
9416
+ {
9417
+ payment_method: method,
9418
+ amount: Math.floor(checkout.totalPrice * 100),
9419
+ ...(method === 'pix' && {
9420
+ pix: this.getPixOrder(),
9421
+ }),
9422
+ ...(method === 'boleto' && {
9423
+ boleto: this.getBoletoOrder(),
9424
+ }),
9425
+ ...(method === 'credit_card' && {
9426
+ credit_card: this.getCardOrder(checkout, card),
9427
+ }),
9428
+ },
9429
+ ];
9430
+ }
9431
+ static getPixOrder() {
9432
+ return {
9433
+ expires_at: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
9434
+ };
9435
+ }
9436
+ static getBoletoOrder() {
9437
+ return {
9438
+ due_at: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
9439
+ instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
9440
+ type: 'DM',
9441
+ document_number: new Date().getTime().toString(),
9442
+ };
9443
+ }
9444
+ static getCardOrder(checkout, card) {
9445
+ return {
9446
+ installments: card.installments,
9447
+ statement_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
9448
+ card_id: card.cardId,
9449
+ card: {
9450
+ cvv: card.cardCvv,
9451
+ billing_address: {
9452
+ line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
9453
+ zip_code: checkout.billingAddress.zip,
9454
+ city: checkout.billingAddress.city,
9455
+ state: checkout.billingAddress.state,
9456
+ country: 'BR',
9457
+ },
9458
+ },
9459
+ };
9460
+ }
9461
+ }
9462
+
9463
+ class PagarMeV5ResponseHelper {
9464
+ static build(method, checkout, response) {
9465
+ return Payment.toInstance({
9466
+ createdAt: new Date(),
9467
+ updatedAt: new Date(),
9468
+ userId: checkout.user.id,
9469
+ checkoutId: checkout.id,
9470
+ totalPrice: checkout.totalPrice,
9471
+ paymentProvider: PaymentProviders.PAGARME,
9472
+ pagarMeOrderId: response.id,
9473
+ transaction: this.buildPaymentTransaction(method, response),
9474
+ });
9475
+ }
9476
+ static buildPaymentTransaction(method, response) {
9477
+ const charger = response.charges.at(0);
9478
+ const transaction = charger.last_transaction;
9479
+ return PaymentTransaction.toInstance({
9480
+ acquirer_name: 'pagar_me',
9481
+ amount: charger.amount,
9482
+ currency: charger.currency,
9483
+ gateway_id: charger.gateway_id,
9484
+ status: this.getPaymentStatus(transaction.status),
9485
+ payment_method: charger.payment_method,
9486
+ date_created: charger.created_at,
9487
+ date_updated: charger.updated_at,
9488
+ paid_amount: charger.paid_amount,
9489
+ paid_at: charger.paid_at,
9490
+ order_id: response.id,
9491
+ charger_id: charger.id,
9492
+ tid: charger.id,
9493
+ id: charger.id,
9494
+ ...(method == TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
9495
+ ...(method == TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
9496
+ ...(method == TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
9497
+ });
9498
+ }
9499
+ static getPaymentStatus(status) {
9500
+ if (status == PagarMeV5PaymentStatus.Gerado)
9501
+ return PagarMeV5PaymentStatus['Aguardando pagamento'];
9502
+ if (status == PagarMeV5PaymentStatus.Capturada)
9503
+ return PagarMeV5PaymentStatus.Pago;
9504
+ return status;
9505
+ }
9506
+ static getBoletoReponse(transaction) {
9507
+ return {
9508
+ boleto_url: transaction.url?.toString(),
9509
+ boleto_barcode: transaction.line?.toString(),
9510
+ boleto_qr_code: transaction.qr_code?.toString(),
9511
+ boleto_expiration_date: transaction.due_at?.toString(),
9512
+ boleto_instructions: transaction.instructions?.toString(),
9513
+ boleto_nosso_numero: transaction.nosso_numero?.toString(),
9514
+ boleto_type: transaction.type?.toString(),
9515
+ boleto_document_number: transaction.document_number?.toString(),
9516
+ };
9517
+ }
9518
+ static getPixReponse(transaction) {
9519
+ return {
9520
+ pix_qr_code: transaction.qr_code?.toString(),
9521
+ pix_qr_code_url: transaction.qr_code_url?.toString(),
9522
+ pix_expiration_date: transaction.expires_at?.toString(),
9523
+ };
9524
+ }
9525
+ static getCardReponse(transaction) {
9526
+ return {
9527
+ soft_descriptor: transaction.statement_descriptor?.toString(),
9528
+ acquirer_name: transaction.acquirer_name?.toString(),
9529
+ acquirer_id: transaction.acquirer_tid?.toString(),
9530
+ acquirer_nsu: transaction.acquirer_nsu?.toString(),
9531
+ acquirer_auth_code: transaction.acquirer_auth_code?.toString(),
9532
+ acquirer_message: transaction.acquirer_message?.toString(),
9533
+ acquirer_return_code: transaction.acquirer_return_code?.toString(),
9534
+ installments: transaction.installments ?? null,
9535
+ card_holder_name: transaction.card?.holder_name?.toString(),
9536
+ card_last_digits: transaction.card?.last_four_digits?.toString(),
9537
+ card_first_digits: transaction.card?.first_six_digits?.toString(),
9538
+ card_brand: transaction.card?.brand?.toString(),
9539
+ card_id: transaction.card?.id?.toString(),
9540
+ };
9541
+ }
9542
+ }
9543
+
8564
9544
  class PagarmeCardAxiosAdapter {
8565
9545
  constructor(credentials, paymentRepository, orderBlockedRepository) {
8566
9546
  this.credentials = credentials;
@@ -8617,8 +9597,9 @@ class PagarmeCardAxiosAdapter {
8617
9597
  });
8618
9598
  }
8619
9599
  }
8620
- async createCardHash(bu) {
8621
- const key = bu === BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
9600
+ async createCardHash(bu, shop) {
9601
+ const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
9602
+ const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
8622
9603
  try {
8623
9604
  const { data } = await axios({
8624
9605
  method: 'GET',
@@ -8781,6 +9762,281 @@ class PagarmePixAxiosAdapter {
8781
9762
  }
8782
9763
  }
8783
9764
 
9765
+ class PagarmeV5BankSlipAxiosAdapter {
9766
+ constructor(credentials, paymentRepository) {
9767
+ this.credentials = credentials;
9768
+ this.paymentRepository = paymentRepository;
9769
+ }
9770
+ async pay(checkout) {
9771
+ try {
9772
+ const payload = PagarMeV5RequestHelper.build(checkout, 'boleto');
9773
+ console.warn('[PAGARME BOLETO DATA TO SEND]', JSON.stringify(payload));
9774
+ const { data } = await axios({
9775
+ method: 'POST',
9776
+ url: `${this.credentials.URL}/orders`,
9777
+ headers: {
9778
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9779
+ 'Content-Type': 'application/json',
9780
+ },
9781
+ data: payload,
9782
+ });
9783
+ console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
9784
+ if (data.status === PagarMeV5OrderStatus.Falha ||
9785
+ data.charges.at(0).status === PagarMeV5OrderStatus.Falha ||
9786
+ (data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Gerado &&
9787
+ data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus['Em processamento'])) {
9788
+ return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9789
+ checkoutId: checkout.id,
9790
+ userEmail: checkout.user.email,
9791
+ info: data.charges.at(0).last_transaction?.gateway_response,
9792
+ }));
9793
+ }
9794
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.BANKSLIP, checkout, data));
9795
+ return payment;
9796
+ }
9797
+ catch (error) {
9798
+ if (error instanceof AxiosError) {
9799
+ console.error('error data: ', JSON.stringify(error.response?.data));
9800
+ }
9801
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
9802
+ checkoutId: checkout.id,
9803
+ userEmail: checkout.user.email,
9804
+ info: error.response?.data,
9805
+ });
9806
+ }
9807
+ }
9808
+ async getBoletoTransaction(paymentId) {
9809
+ try {
9810
+ const { data } = await axios({
9811
+ method: 'GET',
9812
+ url: `${this.credentials.URL}/charges/${paymentId}`,
9813
+ headers: {
9814
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9815
+ 'Content-Type': 'application/json',
9816
+ },
9817
+ });
9818
+ const payment = await this.paymentRepository.get({
9819
+ id: data.id,
9820
+ });
9821
+ return payment.transaction;
9822
+ }
9823
+ catch (error) {
9824
+ throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
9825
+ paymentId,
9826
+ info: error.response.data,
9827
+ });
9828
+ }
9829
+ }
9830
+ }
9831
+
9832
+ class PagarmeV5CardAxiosAdapter {
9833
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
9834
+ this.credentials = credentials;
9835
+ this.paymentRepository = paymentRepository;
9836
+ this.orderBlockedRepository = orderBlockedRepository;
9837
+ }
9838
+ async pay(checkout, card) {
9839
+ try {
9840
+ const payload = PagarMeV5RequestHelper.build(checkout, 'credit_card', card);
9841
+ console.warn('[PAGARME CARD DATA TO SEND]', JSON.stringify(payload));
9842
+ const { data } = await axios({
9843
+ method: 'POST',
9844
+ url: `${this.credentials.URL}/orders`,
9845
+ headers: {
9846
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9847
+ 'Content-Type': 'application/json',
9848
+ },
9849
+ data: payload,
9850
+ });
9851
+ console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
9852
+ if (data.status == PagarMeV5OrderStatus.Falha ||
9853
+ data.charges.at(0).status !== PagarMeV5OrderStatus.Pago ||
9854
+ data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
9855
+ await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
9856
+ checkout,
9857
+ card,
9858
+ orderBlockedRepository: this.orderBlockedRepository,
9859
+ });
9860
+ throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
9861
+ }
9862
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.CARD, checkout, data));
9863
+ return payment;
9864
+ }
9865
+ catch (error) {
9866
+ if (error instanceof PaymentError) {
9867
+ throw error;
9868
+ }
9869
+ if (error instanceof AxiosError) {
9870
+ console.error('error data: ', JSON.stringify(error.response?.data));
9871
+ }
9872
+ throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
9873
+ }
9874
+ }
9875
+ async addCard(card, customer) {
9876
+ try {
9877
+ const { id } = await this.createOrUpdateCustomer(customer);
9878
+ const { data } = await axios({
9879
+ method: 'POST',
9880
+ url: `${this.credentials.URL}/customers/${id}/cards`,
9881
+ headers: {
9882
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9883
+ 'Content-Type': 'application/json',
9884
+ },
9885
+ data: {
9886
+ number: card.number,
9887
+ holder_name: card.name,
9888
+ holder_document: card.cpf,
9889
+ exp_month: card.expirationDate.split('/').at(0),
9890
+ exp_year: card.expirationDate.split('/').at(1),
9891
+ cvv: card.cvv,
9892
+ billing_address: {
9893
+ line_1: `${customer.billingAddress.number}, ${customer.billingAddress.street}, ${customer.billingAddress.district}`,
9894
+ line_2: `${customer.billingAddress.extension}`,
9895
+ zip_code: customer.billingAddress.zip,
9896
+ city: customer.billingAddress.city,
9897
+ state: customer.billingAddress.state,
9898
+ country: 'BR',
9899
+ },
9900
+ },
9901
+ });
9902
+ return data;
9903
+ }
9904
+ catch (error) {
9905
+ console.warn(JSON.stringify(error));
9906
+ throw error;
9907
+ }
9908
+ }
9909
+ async createCardHash(bu, shop) {
9910
+ const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
9911
+ const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
9912
+ try {
9913
+ const { data } = await axios({
9914
+ method: 'GET',
9915
+ headers: {
9916
+ 'content-type': 'application/json',
9917
+ },
9918
+ url: `${this.credentials.URL}/transactions/card_hash_key`,
9919
+ data: JSON.stringify({
9920
+ api_key: key,
9921
+ }),
9922
+ });
9923
+ return data;
9924
+ }
9925
+ catch (error) {
9926
+ throw new BusinessError('Houve uma falha gerar o hash', {
9927
+ info: error.response.data,
9928
+ });
9929
+ }
9930
+ }
9931
+ async getCardByToken(customerId, token) {
9932
+ try {
9933
+ const { data } = await axios({
9934
+ method: 'GET',
9935
+ url: `${this.credentials.URL}/cards/${token}`,
9936
+ data: {
9937
+ api_key: this.credentials.API_KEY,
9938
+ },
9939
+ });
9940
+ return data;
9941
+ }
9942
+ catch (error) {
9943
+ throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
9944
+ info: error.response.data,
9945
+ });
9946
+ }
9947
+ }
9948
+ async createTransaction(info) {
9949
+ return info;
9950
+ }
9951
+ async createOrUpdateCustomer(customer) {
9952
+ try {
9953
+ const { data } = await axios({
9954
+ method: 'POST',
9955
+ url: `${this.credentials.URL}/customers`,
9956
+ headers: {
9957
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9958
+ 'Content-Type': 'application/json',
9959
+ },
9960
+ data: {
9961
+ name: customer.displayName,
9962
+ email: customer.email,
9963
+ document: customer.cpf,
9964
+ type: 'individual',
9965
+ document_type: 'CPF',
9966
+ address: {
9967
+ line_1: `${customer.billingAddress.number}, ${customer.billingAddress.street}, ${customer.billingAddress.district}`,
9968
+ line_2: `${customer.billingAddress.extension}`,
9969
+ zip_code: customer.billingAddress.zip,
9970
+ city: customer.billingAddress.city,
9971
+ state: customer.billingAddress.state,
9972
+ country: 'BR',
9973
+ },
9974
+ birthdate: format(new Date(customer.birthday), 'MM/dd/yyyy'),
9975
+ phones: {
9976
+ home_phone: {
9977
+ country_code: '55',
9978
+ number: customer.phone.slice(2),
9979
+ area_code: customer.phone.slice(0, 2),
9980
+ },
9981
+ mobile_phone: {
9982
+ country_code: '55',
9983
+ number: customer.phone.slice(2),
9984
+ area_code: customer.phone.slice(0, 2),
9985
+ },
9986
+ },
9987
+ },
9988
+ });
9989
+ return data;
9990
+ }
9991
+ catch (error) {
9992
+ console.warn(error);
9993
+ throw error;
9994
+ }
9995
+ }
9996
+ }
9997
+
9998
+ class PagarmeV5PixAxiosAdapter {
9999
+ constructor(credentials, paymentRepository) {
10000
+ this.credentials = credentials;
10001
+ this.paymentRepository = paymentRepository;
10002
+ }
10003
+ async pay(checkout) {
10004
+ try {
10005
+ const payload = PagarMeV5RequestHelper.build(checkout, 'pix');
10006
+ console.warn('[PAGARME PIX DATA TO SEND]', JSON.stringify(payload));
10007
+ const { data } = await axios({
10008
+ method: 'POST',
10009
+ url: `${this.credentials.URL}/orders`,
10010
+ headers: {
10011
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
10012
+ 'Content-Type': 'application/json',
10013
+ },
10014
+ data: payload,
10015
+ });
10016
+ console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
10017
+ if (data.status == PagarMeV5OrderStatus.Falha || data.status == PagarMeV5OrderStatus.Cancelado) {
10018
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
10019
+ checkoutId: checkout.id,
10020
+ userEmail: checkout.user.email,
10021
+ info: data.charges.at(0).last_transaction?.gateway_response,
10022
+ });
10023
+ }
10024
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.PIX, checkout, data));
10025
+ return payment;
10026
+ }
10027
+ catch (error) {
10028
+ if (error instanceof AxiosError) {
10029
+ console.error('error data: ', JSON.stringify(error.response?.data));
10030
+ }
10031
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
10032
+ checkoutId: checkout.id,
10033
+ userEmail: checkout.user.email,
10034
+ info: error.response?.data,
10035
+ });
10036
+ }
10037
+ }
10038
+ }
10039
+
8784
10040
  class VertexAxiosAdapter {
8785
10041
  constructor(config) {
8786
10042
  this.config = config;
@@ -8934,4 +10190,4 @@ class ProductsVertexSearch {
8934
10190
  }
8935
10191
  }
8936
10192
 
8937
- 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, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, 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, 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 };
10193
+ 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, ProductCatalogHasuraGraphQL, 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 };