@infrab4a/connect 5.3.0-beta.1 → 5.3.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1490 -208
- package/index.esm.js +1484 -210
- package/package.json +3 -2
- package/src/domain/catalog/models/product-base.d.ts +5 -1
- package/src/domain/catalog/models/product-review.d.ts +2 -0
- package/src/domain/catalog/models/product.d.ts +1 -0
- package/src/domain/catalog/models/types/brands-shop-menu.type.d.ts +13 -0
- package/src/domain/catalog/models/types/index.d.ts +1 -0
- package/src/domain/catalog/repositories/category.repository.d.ts +1 -0
- package/src/domain/catalog/repositories/index.d.ts +1 -0
- package/src/domain/catalog/repositories/product-catalog.repository.d.ts +17 -0
- package/src/domain/catalog/repositories/product.repository.d.ts +3 -0
- package/src/domain/catalog/repositories/variant.repository.d.ts +1 -0
- package/src/domain/shopping/enums/index.d.ts +2 -0
- package/src/domain/shopping/enums/pagarme-v5-payment-status.enum.d.ts +24 -0
- package/src/domain/shopping/enums/transaction-payment-methods.enum.d.ts +5 -0
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +10 -2
- package/src/domain/shopping/models/order.d.ts +7 -0
- package/src/domain/shopping/models/payment-transaction.d.ts +17 -2
- package/src/domain/shopping/models/payment.d.ts +2 -1
- package/src/domain/shopping/types/card-info.type.d.ts +1 -0
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/pagarme-card.type.d.ts +9 -3
- package/src/domain/shopping/types/pagarme-credentials-v5.type.d.ts +4 -0
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +9 -3
- package/src/domain/users/models/user-payment-method.d.ts +2 -0
- package/src/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +4 -1
- package/src/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +1 -0
- package/src/infra/hasura-graphql/models/index.d.ts +1 -0
- package/src/infra/hasura-graphql/models/product-catalog-hasura-graphql.d.ts +16 -0
- package/src/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +7 -0
- package/src/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-catalog-hasura-graphql.repository.d.ts +22 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +3 -0
- package/src/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +2 -0
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +1 -0
- package/src/infra/pagarme/adapters/helpers/index.d.ts +2 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-v5-request.helper.d.ts +12 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-v5-response.helper.d.ts +10 -0
- package/src/infra/pagarme/adapters/index.d.ts +2 -3
- package/src/infra/pagarme/adapters/v4/index.d.ts +3 -0
- package/src/infra/pagarme/adapters/{pagarme-bank-slip-payment-axios.adapter.d.ts → v4/pagarme-bank-slip-payment-axios.adapter.d.ts} +4 -4
- package/src/infra/pagarme/adapters/{pagarme-card-payment-axios.adapter.d.ts → v4/pagarme-card-payment-axios.adapter.d.ts} +7 -6
- package/src/infra/pagarme/adapters/{pagarme-pix-payment-axios.adapter.d.ts → v4/pagarme-pix-payment-axios.adapter.d.ts} +4 -4
- package/src/infra/pagarme/adapters/v5/index.d.ts +3 -0
- package/src/infra/pagarme/adapters/v5/pagarmev5-bank-slip-payment-axios.adapter.d.ts +11 -0
- package/src/infra/pagarme/adapters/v5/pagarmev5-card-payment-axios.adapter.d.ts +24 -0
- package/src/infra/pagarme/adapters/v5/pagarmev5-pix-payment-axios.adapter.d.ts +10 -0
- package/src/infra/pagarme/index.d.ts +1 -0
- package/src/infra/pagarme/types/index.d.ts +1 -0
- package/src/infra/pagarme/types/v5/index.d.ts +4 -0
- package/src/infra/pagarme/types/v5/pagarmev5-customer.type.d.ts +19 -0
- package/src/infra/pagarme/types/v5/pagarmev5-order-request-payload.type.d.ts +89 -0
- package/src/infra/pagarme/types/v5/pagarmev5-order-response.type.d.ts +126 -0
- package/src/infra/pagarme/types/v5/pagarmev5-postback-response.type.d.ts +11 -0
- 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,
|
|
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;
|
|
@@ -770,6 +806,10 @@ class ProductReview extends BaseModel {
|
|
|
770
806
|
return ['id'];
|
|
771
807
|
}
|
|
772
808
|
}
|
|
809
|
+
__decorate([
|
|
810
|
+
Type(() => Product),
|
|
811
|
+
__metadata("design:type", Array)
|
|
812
|
+
], ProductReview.prototype, "product", void 0);
|
|
773
813
|
|
|
774
814
|
class ProductBase extends BaseModel {
|
|
775
815
|
get evaluation() {
|
|
@@ -1754,15 +1794,17 @@ class AntifraudCardService {
|
|
|
1754
1794
|
return true;
|
|
1755
1795
|
}
|
|
1756
1796
|
getTodayDateRange() {
|
|
1757
|
-
const
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1797
|
+
const timeZone = 'America/Sao_Paulo';
|
|
1798
|
+
const today = utcToZonedTime(new Date(), timeZone);
|
|
1799
|
+
const day = startOfDay(today);
|
|
1800
|
+
const endOfDay$1 = endOfDay(today);
|
|
1801
|
+
return { day: addHours(day, 3), endOfDay: addHours(endOfDay$1, 3) };
|
|
1760
1802
|
}
|
|
1761
1803
|
async getBlockedOrdersByMultipleCriteria(checkout, dateRange) {
|
|
1762
1804
|
const { day, endOfDay } = dateRange;
|
|
1763
1805
|
const dateFilter = [
|
|
1764
|
-
{ operator: Where.GTE, value:
|
|
1765
|
-
{ operator: Where.LTE, value:
|
|
1806
|
+
{ operator: Where.GTE, value: day },
|
|
1807
|
+
{ operator: Where.LTE, value: endOfDay },
|
|
1766
1808
|
];
|
|
1767
1809
|
const [ordersBlockedWithCpf, ordersBlockedWithEmail, ordersBlockedWithCep, ordersBlockedWithPhone] = await Promise.all([
|
|
1768
1810
|
this.getBlockedOrdersByCpf(checkout.user?.cpf, dateFilter),
|
|
@@ -4776,6 +4818,9 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
4776
4818
|
isChild(_id, _parentId) {
|
|
4777
4819
|
return;
|
|
4778
4820
|
}
|
|
4821
|
+
async getBrandsWithProducts() {
|
|
4822
|
+
return;
|
|
4823
|
+
}
|
|
4779
4824
|
}
|
|
4780
4825
|
__decorate([
|
|
4781
4826
|
Log(),
|
|
@@ -4866,6 +4911,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
4866
4911
|
productVariantFullReport() {
|
|
4867
4912
|
return;
|
|
4868
4913
|
}
|
|
4914
|
+
getByEAN(EAN, options) {
|
|
4915
|
+
return;
|
|
4916
|
+
}
|
|
4869
4917
|
}
|
|
4870
4918
|
__decorate([
|
|
4871
4919
|
Log(),
|
|
@@ -4891,6 +4939,9 @@ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirest
|
|
|
4891
4939
|
});
|
|
4892
4940
|
this.parentRepository = parentRepository;
|
|
4893
4941
|
}
|
|
4942
|
+
getByEAN(EAN) {
|
|
4943
|
+
return;
|
|
4944
|
+
}
|
|
4894
4945
|
}
|
|
4895
4946
|
|
|
4896
4947
|
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
@@ -5780,6 +5831,9 @@ __decorate([
|
|
|
5780
5831
|
__metadata("design:type", Product)
|
|
5781
5832
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
5782
5833
|
|
|
5834
|
+
class ProductCatalogHasuraGraphQL extends Product {
|
|
5835
|
+
}
|
|
5836
|
+
|
|
5783
5837
|
class ProductHasuraGraphQL extends Product {
|
|
5784
5838
|
}
|
|
5785
5839
|
__decorate([
|
|
@@ -6127,7 +6181,8 @@ class CategoryProductOperationsHelper {
|
|
|
6127
6181
|
'isKit',
|
|
6128
6182
|
'sku',
|
|
6129
6183
|
'rate',
|
|
6130
|
-
'
|
|
6184
|
+
'tagsProfile',
|
|
6185
|
+
'tagsCollection',
|
|
6131
6186
|
'type',
|
|
6132
6187
|
'shoppingCount',
|
|
6133
6188
|
'gender',
|
|
@@ -6867,6 +6922,19 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6867
6922
|
categoryFilterRepository: this.categoryFilterRepository,
|
|
6868
6923
|
});
|
|
6869
6924
|
}
|
|
6925
|
+
async getBrandsWithProducts() {
|
|
6926
|
+
const fields = ['id', 'name', 'slug', 'brand_category', 'published', 'images'];
|
|
6927
|
+
const { brands_with_products_query: data, } = await this.query('brands_with_products_query', fields);
|
|
6928
|
+
return data.map((brand) => Category.toInstance({
|
|
6929
|
+
id: brand.id,
|
|
6930
|
+
name: brand.name,
|
|
6931
|
+
slug: brand.slug,
|
|
6932
|
+
brandCategory: brand.brand_category,
|
|
6933
|
+
shops: brand.shops,
|
|
6934
|
+
published: brand.published,
|
|
6935
|
+
images: brand.images,
|
|
6936
|
+
}));
|
|
6937
|
+
}
|
|
6870
6938
|
}
|
|
6871
6939
|
__decorate([
|
|
6872
6940
|
Log(),
|
|
@@ -7131,83 +7199,7 @@ class FilterOptionHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasu
|
|
|
7131
7199
|
}
|
|
7132
7200
|
}
|
|
7133
7201
|
|
|
7134
|
-
|
|
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 = [
|
|
7202
|
+
const commonFields$1 = [
|
|
7211
7203
|
{
|
|
7212
7204
|
id: {
|
|
7213
7205
|
columnName: 'id',
|
|
@@ -7287,6 +7279,12 @@ const commonFields = [
|
|
|
7287
7279
|
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7288
7280
|
},
|
|
7289
7281
|
},
|
|
7282
|
+
{
|
|
7283
|
+
imagesCard: {
|
|
7284
|
+
columnName: 'images_card',
|
|
7285
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7286
|
+
},
|
|
7287
|
+
},
|
|
7290
7288
|
'name',
|
|
7291
7289
|
{
|
|
7292
7290
|
price: {
|
|
@@ -7348,7 +7346,6 @@ const commonFields = [
|
|
|
7348
7346
|
'weight',
|
|
7349
7347
|
'gender',
|
|
7350
7348
|
{ intGender: { columnName: 'int_gender' } },
|
|
7351
|
-
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7352
7349
|
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7353
7350
|
{ isKit: { columnName: 'is_kit' } },
|
|
7354
7351
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -7366,126 +7363,87 @@ const commonFields = [
|
|
|
7366
7363
|
},
|
|
7367
7364
|
'group',
|
|
7368
7365
|
'validity',
|
|
7366
|
+
{ tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7367
|
+
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7368
|
+
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7369
|
+
{ showVariants: { columnName: 'show_variants' } },
|
|
7370
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7369
7371
|
];
|
|
7370
|
-
|
|
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
|
-
}
|
|
7372
|
+
class ProductCatalogHasuraGraphQLRepository extends withFindHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7446
7373
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
7447
7374
|
super({
|
|
7448
|
-
tableName: '
|
|
7449
|
-
model:
|
|
7375
|
+
tableName: 'product_catalog',
|
|
7376
|
+
model: ProductCatalogHasuraGraphQL,
|
|
7450
7377
|
endpoint,
|
|
7451
7378
|
authOptions,
|
|
7452
7379
|
interceptors,
|
|
7453
|
-
fields:
|
|
7380
|
+
fields: commonFields$1,
|
|
7454
7381
|
cache,
|
|
7455
7382
|
});
|
|
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
7383
|
}
|
|
7469
|
-
async
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7384
|
+
async get({ id }, options) {
|
|
7385
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
7386
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7387
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
7388
|
+
if (cachedData) {
|
|
7389
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
7390
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
7391
|
+
}
|
|
7474
7392
|
}
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7393
|
+
const product = await super
|
|
7394
|
+
.find({
|
|
7395
|
+
filters: {
|
|
7396
|
+
id,
|
|
7397
|
+
},
|
|
7398
|
+
limits: {
|
|
7399
|
+
limit: 1,
|
|
7400
|
+
},
|
|
7401
|
+
})
|
|
7402
|
+
.then((res) => res.data.at(0));
|
|
7403
|
+
if (!product)
|
|
7404
|
+
throw new NotFoundError(`Product not found`);
|
|
7405
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
7406
|
+
const cacheKey = `${this.model.name.toLowerCase()}:id:${id}`;
|
|
7407
|
+
await this.cache.cacheAdapter.set({
|
|
7408
|
+
key: cacheKey,
|
|
7409
|
+
data: serialize(product),
|
|
7410
|
+
expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
|
|
7411
|
+
});
|
|
7412
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
7478
7413
|
}
|
|
7479
7414
|
return product;
|
|
7480
7415
|
}
|
|
7481
|
-
async
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7416
|
+
async getByEAN(EAN, options) {
|
|
7417
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
7418
|
+
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
|
7419
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
7420
|
+
if (cachedData) {
|
|
7421
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
7422
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
7423
|
+
}
|
|
7424
|
+
}
|
|
7425
|
+
const product = await super
|
|
7426
|
+
.find({
|
|
7427
|
+
filters: {
|
|
7428
|
+
EAN,
|
|
7429
|
+
},
|
|
7430
|
+
limits: {
|
|
7431
|
+
limit: 1,
|
|
7432
|
+
},
|
|
7433
|
+
})
|
|
7434
|
+
.then((res) => res.data.at(0));
|
|
7435
|
+
if (!product)
|
|
7436
|
+
return null;
|
|
7437
|
+
RoundProductPricesHelper.roundProductPrices(product);
|
|
7438
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
7439
|
+
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
|
7440
|
+
await this.cache.cacheAdapter.set({
|
|
7441
|
+
key: cacheKey,
|
|
7442
|
+
data: serialize(product),
|
|
7443
|
+
expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
|
|
7444
|
+
});
|
|
7445
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
7446
|
+
}
|
|
7489
7447
|
return product;
|
|
7490
7448
|
}
|
|
7491
7449
|
async find(params, optionsParams) {
|
|
@@ -7502,7 +7460,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7502
7460
|
options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
|
|
7503
7461
|
return super.find({
|
|
7504
7462
|
...options,
|
|
7505
|
-
filters: { ...filters
|
|
7463
|
+
filters: { ...filters },
|
|
7506
7464
|
fields: [
|
|
7507
7465
|
...bindFields,
|
|
7508
7466
|
...(bindFields.includes('price')
|
|
@@ -7515,18 +7473,598 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7515
7473
|
],
|
|
7516
7474
|
}, optionsParams);
|
|
7517
7475
|
}
|
|
7518
|
-
async
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7476
|
+
async findCatalog(params, mainGender, options) {
|
|
7477
|
+
const result = await this.find({
|
|
7478
|
+
...params,
|
|
7479
|
+
filters: { ...params.filters, published: true },
|
|
7480
|
+
orderBy: {
|
|
7481
|
+
hasStock: 'desc',
|
|
7482
|
+
...(!mainGender ? {} : { intGender: mainGender === 'female' ? 'desc' : 'asc' }),
|
|
7483
|
+
...omit(params.orderBy, ['hasStock', 'intGender']),
|
|
7484
|
+
},
|
|
7485
|
+
}, options);
|
|
7486
|
+
return result;
|
|
7487
|
+
}
|
|
7488
|
+
}
|
|
7489
|
+
__decorate([
|
|
7490
|
+
Log(),
|
|
7491
|
+
__metadata("design:type", Function),
|
|
7492
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
7493
|
+
__metadata("design:returntype", Promise)
|
|
7494
|
+
], ProductCatalogHasuraGraphQLRepository.prototype, "findCatalog", null);
|
|
7495
|
+
|
|
7496
|
+
class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7497
|
+
constructor({ endpoint, authOptions, interceptors, cache, }, productRepository) {
|
|
7498
|
+
super({
|
|
7499
|
+
tableName: 'product_errors',
|
|
7500
|
+
model: ProductErrorsHasuraGraphQL,
|
|
7501
|
+
endpoint,
|
|
7502
|
+
authOptions,
|
|
7503
|
+
interceptors,
|
|
7504
|
+
cache,
|
|
7505
|
+
fields: [
|
|
7506
|
+
{
|
|
7507
|
+
productId: {
|
|
7508
|
+
columnName: 'product_id',
|
|
7509
|
+
to: (value) => +value,
|
|
7510
|
+
from: (value) => value.toString(),
|
|
7511
|
+
},
|
|
7512
|
+
},
|
|
7513
|
+
'source',
|
|
7514
|
+
'error',
|
|
7515
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7516
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7517
|
+
{
|
|
7518
|
+
product: {
|
|
7519
|
+
columnName: 'product',
|
|
7520
|
+
foreignKeyColumn: { id: 'productId' },
|
|
7521
|
+
fields: [
|
|
7522
|
+
{ id: { columnName: 'id', from: (value) => value.toString() } },
|
|
7523
|
+
{ productId: { columnName: 'main_product_id' } },
|
|
7524
|
+
'name',
|
|
7525
|
+
'published',
|
|
7526
|
+
'group',
|
|
7527
|
+
'validity',
|
|
7528
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7529
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7530
|
+
],
|
|
7531
|
+
},
|
|
7532
|
+
},
|
|
7533
|
+
],
|
|
7534
|
+
});
|
|
7535
|
+
this.productRepository = productRepository;
|
|
7536
|
+
}
|
|
7537
|
+
async get(params) {
|
|
7538
|
+
const result = await super.get(params);
|
|
7539
|
+
if (result instanceof VariantHasuraGraphQL) {
|
|
7540
|
+
const product = await this.productRepository.get({ id: result.productId.toString() });
|
|
7541
|
+
result.product.name = product.name;
|
|
7542
|
+
result.product.group = product.group;
|
|
7543
|
+
}
|
|
7544
|
+
return result;
|
|
7545
|
+
}
|
|
7546
|
+
async find(params) {
|
|
7547
|
+
const result = await super.find(params);
|
|
7548
|
+
const variantsWithNoData = result.data.filter((item) => item.product instanceof VariantHasuraGraphQL &&
|
|
7549
|
+
(isEmpty(item.product.name) || isEmpty(item.product.group) || isEmpty(item.product)));
|
|
7550
|
+
if (variantsWithNoData.length > 0) {
|
|
7551
|
+
const { data: products } = await this.productRepository.find({
|
|
7552
|
+
filters: {
|
|
7553
|
+
id: {
|
|
7554
|
+
operator: Where.IN,
|
|
7555
|
+
value: Array.from(new Set(variantsWithNoData.map((item) => item.product.productId?.toString()))),
|
|
7556
|
+
},
|
|
7557
|
+
},
|
|
7558
|
+
});
|
|
7559
|
+
products.forEach((product) => {
|
|
7560
|
+
result.data
|
|
7561
|
+
.filter((variant) => variant.product.productId?.toString() === product.id.toString())
|
|
7562
|
+
.forEach((variant) => {
|
|
7563
|
+
variant.product.name = product.name;
|
|
7564
|
+
variant.product.group = product.group;
|
|
7565
|
+
});
|
|
7566
|
+
});
|
|
7567
|
+
}
|
|
7568
|
+
return result;
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
|
|
7572
|
+
const commonFields = [
|
|
7573
|
+
{
|
|
7574
|
+
id: {
|
|
7575
|
+
columnName: 'id',
|
|
7576
|
+
to: (value) => +value,
|
|
7577
|
+
from: (value) => value.toString(),
|
|
7578
|
+
},
|
|
7579
|
+
},
|
|
7580
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
7581
|
+
{ productId: { columnName: 'main_product_id' } },
|
|
7582
|
+
{ CEST: { columnName: 'cest' } },
|
|
7583
|
+
{ EAN: { columnName: 'ean' } },
|
|
7584
|
+
{ NCM: { columnName: 'ncm' } },
|
|
7585
|
+
'brand',
|
|
7586
|
+
{ costPrice: { columnName: 'cost_price' } },
|
|
7587
|
+
{
|
|
7588
|
+
description: {
|
|
7589
|
+
columnName: 'description',
|
|
7590
|
+
from: (description, data) => ({
|
|
7591
|
+
description,
|
|
7592
|
+
differentials: data.differentials,
|
|
7593
|
+
whoMustUse: data.who_must_use,
|
|
7594
|
+
howToUse: data.how_to_use,
|
|
7595
|
+
brand: data.brand_description,
|
|
7596
|
+
ingredients: data.ingredients,
|
|
7597
|
+
purpose: data.purpose,
|
|
7598
|
+
}),
|
|
7599
|
+
bindFindFilter: (filters) => {
|
|
7600
|
+
return {
|
|
7601
|
+
...(filters?.description && { description: filters.description }),
|
|
7602
|
+
...(filters.differentials && { differentials: filters.differentials }),
|
|
7603
|
+
...(filters.whoMustUse && {
|
|
7604
|
+
who_must_use: filters.whoMustUse,
|
|
7605
|
+
}),
|
|
7606
|
+
...(filters.howToUse && {
|
|
7607
|
+
how_to_use: filters.howToUse,
|
|
7608
|
+
}),
|
|
7609
|
+
...(filters.brand && {
|
|
7610
|
+
brand_description: filters.brand,
|
|
7611
|
+
}),
|
|
7612
|
+
...(filters.ingredients && {
|
|
7613
|
+
ingredients: filters.ingredients,
|
|
7614
|
+
}),
|
|
7615
|
+
...(filters.purpose && {
|
|
7616
|
+
purpose: filters.purpose,
|
|
7617
|
+
}),
|
|
7618
|
+
};
|
|
7619
|
+
},
|
|
7620
|
+
bindPersistData: (descriptionData) => ({
|
|
7621
|
+
...(descriptionData?.description && { description: descriptionData.description }),
|
|
7622
|
+
...(descriptionData.differentials && { differentials: descriptionData.differentials }),
|
|
7623
|
+
...(descriptionData.whoMustUse && {
|
|
7624
|
+
who_must_use: descriptionData.whoMustUse,
|
|
7625
|
+
}),
|
|
7626
|
+
...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
|
|
7627
|
+
...(descriptionData.brand && { brand_description: descriptionData.brand }),
|
|
7628
|
+
...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
|
|
7629
|
+
...(descriptionData.purpose && { purpose: descriptionData.purpose }),
|
|
7630
|
+
}),
|
|
7631
|
+
},
|
|
7632
|
+
},
|
|
7633
|
+
{ differentials: { columnName: 'differentials' } },
|
|
7634
|
+
{ whoMustUse: { columnName: 'who_must_use' } },
|
|
7635
|
+
{ howToUse: { columnName: 'how_to_use' } },
|
|
7636
|
+
{ brandDescription: { columnName: 'brand_description' } },
|
|
7637
|
+
{ ingredients: { columnName: 'ingredients' } },
|
|
7638
|
+
{ purpose: { columnName: 'purpose' } },
|
|
7639
|
+
{ hasVariants: { columnName: 'has_variants' } },
|
|
7640
|
+
{
|
|
7641
|
+
images: {
|
|
7642
|
+
columnName: 'images',
|
|
7643
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7644
|
+
},
|
|
7645
|
+
},
|
|
7646
|
+
{
|
|
7647
|
+
miniatures: {
|
|
7648
|
+
columnName: 'miniatures',
|
|
7649
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7650
|
+
},
|
|
7651
|
+
},
|
|
7652
|
+
{
|
|
7653
|
+
imagesCard: {
|
|
7654
|
+
columnName: 'images_card',
|
|
7655
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7656
|
+
},
|
|
7657
|
+
},
|
|
7658
|
+
'name',
|
|
7659
|
+
{
|
|
7660
|
+
price: {
|
|
7661
|
+
columnName: 'price',
|
|
7662
|
+
from: (price, data) => ({
|
|
7663
|
+
price,
|
|
7664
|
+
fullPrice: data.full_price,
|
|
7665
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
7666
|
+
fullPriceDiscountPercentage: data.full_price_discount_percentage,
|
|
7667
|
+
subscriberPrice: data.subscriber_price,
|
|
7668
|
+
}),
|
|
7669
|
+
bindFindFilter: (filters) => {
|
|
7670
|
+
return {
|
|
7671
|
+
...((filters?.price || filters?.price === 0) && { price: filters.price }),
|
|
7672
|
+
...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
|
|
7673
|
+
...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
|
|
7674
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
7675
|
+
}),
|
|
7676
|
+
...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
7677
|
+
subscriber_price: filters.subscriberPrice,
|
|
7678
|
+
}),
|
|
7679
|
+
...((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
|
|
7680
|
+
full_price_discount_percentage: filters.fullPriceDiscountPercentage,
|
|
7681
|
+
}),
|
|
7682
|
+
};
|
|
7683
|
+
},
|
|
7684
|
+
bindPersistData: (priceData) => ({
|
|
7685
|
+
...(priceData?.price >= 0 && { price: priceData.price }),
|
|
7686
|
+
...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
|
|
7687
|
+
...(priceData.subscriberDiscountPercentage >= 0 && {
|
|
7688
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
7689
|
+
}),
|
|
7690
|
+
...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
|
|
7691
|
+
...(priceData.fullPriceDiscountPercentage >= 0 && {
|
|
7692
|
+
full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
|
|
7693
|
+
}),
|
|
7694
|
+
}),
|
|
7695
|
+
},
|
|
7696
|
+
},
|
|
7697
|
+
{ fullPrice: { columnName: 'full_price' } },
|
|
7698
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
7699
|
+
{ fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
|
|
7700
|
+
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
7701
|
+
'published',
|
|
7702
|
+
'outlet',
|
|
7703
|
+
'label',
|
|
7704
|
+
'sku',
|
|
7705
|
+
{
|
|
7706
|
+
stock: {
|
|
7707
|
+
columnName: 'stock',
|
|
7708
|
+
from: (quantity) => ({ quantity }),
|
|
7709
|
+
to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
|
|
7710
|
+
},
|
|
7711
|
+
},
|
|
7712
|
+
{ hasStock: { columnName: 'has_stock' } },
|
|
7713
|
+
'slug',
|
|
7714
|
+
'type',
|
|
7715
|
+
'video',
|
|
7716
|
+
'weight',
|
|
7717
|
+
'gender',
|
|
7718
|
+
{ intGender: { columnName: 'int_gender' } },
|
|
7719
|
+
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7720
|
+
{ isKit: { columnName: 'is_kit' } },
|
|
7721
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7722
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7723
|
+
{ rate: { columnName: 'rating' } },
|
|
7724
|
+
{ reviewsTotal: { columnName: 'reviews_total' } },
|
|
7725
|
+
{ shoppingCount: { columnName: 'shopping_count' } },
|
|
7726
|
+
{ categoryId: { columnName: 'category_id' } },
|
|
7727
|
+
{
|
|
7728
|
+
category: {
|
|
7729
|
+
columnName: 'category',
|
|
7730
|
+
foreignKeyColumn: { id: 'categoryId' },
|
|
7731
|
+
fields: ['id', 'name', 'reference', 'slug'],
|
|
7732
|
+
},
|
|
7733
|
+
},
|
|
7734
|
+
'group',
|
|
7735
|
+
'validity',
|
|
7736
|
+
{ tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7737
|
+
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7738
|
+
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
7739
|
+
{ showVariants: { columnName: 'show_variants' } },
|
|
7740
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7741
|
+
];
|
|
7742
|
+
const fieldsConfiguration$2 = [
|
|
7743
|
+
...commonFields,
|
|
7744
|
+
{
|
|
7745
|
+
categories: {
|
|
7746
|
+
columnName: 'categories',
|
|
7747
|
+
fields: ['category_id'],
|
|
7748
|
+
bindPersistData: (value) => ({
|
|
7749
|
+
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
7750
|
+
}),
|
|
7751
|
+
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
7752
|
+
from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
|
|
7753
|
+
},
|
|
7754
|
+
},
|
|
7755
|
+
{
|
|
7756
|
+
kitProducts: {
|
|
7757
|
+
columnName: 'kit_products',
|
|
7758
|
+
foreignKeyColumn: { productId: 'id' },
|
|
7759
|
+
fields: [
|
|
7760
|
+
{ productId: { columnName: 'product_id' } },
|
|
7761
|
+
{ kitProductId: { columnName: 'kit_product_id' } },
|
|
7762
|
+
'quantity',
|
|
7763
|
+
{ product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
|
|
7764
|
+
],
|
|
7765
|
+
},
|
|
7766
|
+
},
|
|
7767
|
+
{
|
|
7768
|
+
reviews: {
|
|
7769
|
+
columnName: 'reviews',
|
|
7770
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
7771
|
+
fields: [
|
|
7772
|
+
'id',
|
|
7773
|
+
'shop',
|
|
7774
|
+
'rate',
|
|
7775
|
+
'author',
|
|
7776
|
+
'email',
|
|
7777
|
+
'location',
|
|
7778
|
+
'review',
|
|
7779
|
+
'status',
|
|
7780
|
+
'title',
|
|
7781
|
+
{ personId: { columnName: 'person_id' } },
|
|
7782
|
+
'points',
|
|
7783
|
+
{ orderId: { columnName: 'order_id' } },
|
|
7784
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7785
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7786
|
+
],
|
|
7787
|
+
},
|
|
7788
|
+
},
|
|
7789
|
+
{
|
|
7790
|
+
metadata: {
|
|
7791
|
+
columnName: 'metadata',
|
|
7792
|
+
fields: ['title', 'description'],
|
|
7793
|
+
bindPersistData: (value) => ({
|
|
7794
|
+
metadata: { data: value },
|
|
7795
|
+
}),
|
|
7796
|
+
},
|
|
7797
|
+
},
|
|
7798
|
+
{
|
|
7799
|
+
variants: {
|
|
7800
|
+
columnName: 'variants',
|
|
7801
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
7802
|
+
fields: [
|
|
7803
|
+
'id',
|
|
7804
|
+
'name',
|
|
7805
|
+
'ean',
|
|
7806
|
+
'sku',
|
|
7807
|
+
{
|
|
7808
|
+
description: {
|
|
7809
|
+
columnName: 'description',
|
|
7810
|
+
from: (description, data) => ({
|
|
7811
|
+
description,
|
|
7812
|
+
differentials: data.differentials,
|
|
7813
|
+
whoMustUse: data.who_must_use,
|
|
7814
|
+
howToUse: data.how_to_use,
|
|
7815
|
+
brand: data.brand_description,
|
|
7816
|
+
ingredients: data.ingredients,
|
|
7817
|
+
purpose: data.purpose,
|
|
7818
|
+
}),
|
|
7819
|
+
bindFindFilter: (filters) => {
|
|
7820
|
+
return {
|
|
7821
|
+
...(filters?.description && { description: filters.description }),
|
|
7822
|
+
...(filters.differentials && { differentials: filters.differentials }),
|
|
7823
|
+
...(filters.whoMustUse && {
|
|
7824
|
+
who_must_use: filters.whoMustUse,
|
|
7825
|
+
}),
|
|
7826
|
+
...(filters.howToUse && {
|
|
7827
|
+
how_to_use: filters.howToUse,
|
|
7828
|
+
}),
|
|
7829
|
+
...(filters.brand && {
|
|
7830
|
+
brand_description: filters.brand,
|
|
7831
|
+
}),
|
|
7832
|
+
...(filters.ingredients && {
|
|
7833
|
+
ingredients: filters.ingredients,
|
|
7834
|
+
}),
|
|
7835
|
+
...(filters.purpose && {
|
|
7836
|
+
purpose: filters.purpose,
|
|
7837
|
+
}),
|
|
7838
|
+
};
|
|
7839
|
+
},
|
|
7840
|
+
bindPersistData: (descriptionData) => ({
|
|
7841
|
+
...(descriptionData?.description && { description: descriptionData.description }),
|
|
7842
|
+
...(descriptionData.differentials && { differentials: descriptionData.differentials }),
|
|
7843
|
+
...(descriptionData.whoMustUse && {
|
|
7844
|
+
who_must_use: descriptionData.whoMustUse,
|
|
7845
|
+
}),
|
|
7846
|
+
...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
|
|
7847
|
+
...(descriptionData.brand && { brand_description: descriptionData.brand }),
|
|
7848
|
+
...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
|
|
7849
|
+
...(descriptionData.purpose && { purpose: descriptionData.purpose }),
|
|
7850
|
+
}),
|
|
7851
|
+
},
|
|
7852
|
+
},
|
|
7853
|
+
{ differentials: { columnName: 'differentials' } },
|
|
7854
|
+
{ whoMustUse: { columnName: 'who_must_use' } },
|
|
7855
|
+
{ howToUse: { columnName: 'how_to_use' } },
|
|
7856
|
+
{ brandDescription: { columnName: 'brand_description' } },
|
|
7857
|
+
{ ingredients: { columnName: 'ingredients' } },
|
|
7858
|
+
{ purpose: { columnName: 'purpose' } },
|
|
7859
|
+
{
|
|
7860
|
+
grade: {
|
|
7861
|
+
columnName: 'grade',
|
|
7862
|
+
type: HasuraGraphQLColumnType.Jsonb,
|
|
7863
|
+
},
|
|
7864
|
+
},
|
|
7865
|
+
{
|
|
7866
|
+
price: {
|
|
7867
|
+
columnName: 'price',
|
|
7868
|
+
from: (price, data) => ({
|
|
7869
|
+
price,
|
|
7870
|
+
fullPrice: data.full_price,
|
|
7871
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
7872
|
+
subscriberPrice: data.subscriber_price,
|
|
7873
|
+
fullPriceDiscountPercentage: data.full_price_discount_percentage,
|
|
7874
|
+
}),
|
|
7875
|
+
bindPersistData: (priceData) => ({
|
|
7876
|
+
...((priceData?.price || 0) >= 0 && { price: priceData.price }),
|
|
7877
|
+
...((priceData?.fullPrice || 0) >= 0 && { full_price: priceData.fullPrice }),
|
|
7878
|
+
...((priceData?.subscriberDiscountPercentage || 0) >= 0 && {
|
|
7879
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
7880
|
+
}),
|
|
7881
|
+
...((priceData?.subscriberPrice || 0) >= 0 && { subscriber_price: priceData.subscriberPrice }),
|
|
7882
|
+
...(priceData.fullPriceDiscountPercentage >= 0 && {
|
|
7883
|
+
full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
|
|
7884
|
+
}),
|
|
7885
|
+
}),
|
|
7886
|
+
},
|
|
7887
|
+
},
|
|
7888
|
+
{ fullPrice: { columnName: 'full_price' } },
|
|
7889
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
7890
|
+
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
7891
|
+
{ fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
|
|
7892
|
+
'published',
|
|
7893
|
+
{
|
|
7894
|
+
stock: {
|
|
7895
|
+
columnName: 'stock',
|
|
7896
|
+
from: (quantity) => ({ quantity }),
|
|
7897
|
+
to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
|
|
7898
|
+
},
|
|
7899
|
+
},
|
|
7900
|
+
{
|
|
7901
|
+
images: {
|
|
7902
|
+
columnName: 'images',
|
|
7903
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7904
|
+
},
|
|
7905
|
+
},
|
|
7906
|
+
{
|
|
7907
|
+
miniatures: {
|
|
7908
|
+
columnName: 'miniatures',
|
|
7909
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7910
|
+
},
|
|
7911
|
+
},
|
|
7912
|
+
{
|
|
7913
|
+
imagesCard: {
|
|
7914
|
+
columnName: 'images_card',
|
|
7915
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
7916
|
+
},
|
|
7917
|
+
},
|
|
7918
|
+
{ tagsProfile: { columnName: 'tags_profile' } },
|
|
7919
|
+
{ tagsCollection: { columnName: 'tags_collection' } },
|
|
7920
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
7921
|
+
{
|
|
7922
|
+
reviews: {
|
|
7923
|
+
columnName: 'reviews',
|
|
7924
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
7925
|
+
fields: [
|
|
7926
|
+
'id',
|
|
7927
|
+
'shop',
|
|
7928
|
+
'rate',
|
|
7929
|
+
'author',
|
|
7930
|
+
'email',
|
|
7931
|
+
'location',
|
|
7932
|
+
'review',
|
|
7933
|
+
'status',
|
|
7934
|
+
'title',
|
|
7935
|
+
{ personId: { columnName: 'person_id' } },
|
|
7936
|
+
'points',
|
|
7937
|
+
{ orderId: { columnName: 'order_id' } },
|
|
7938
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7939
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7940
|
+
],
|
|
7941
|
+
},
|
|
7942
|
+
},
|
|
7943
|
+
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
7944
|
+
{
|
|
7945
|
+
metadata: {
|
|
7946
|
+
columnName: 'metadata',
|
|
7947
|
+
fields: ['title', 'description'],
|
|
7948
|
+
bindPersistData: (value) => ({
|
|
7949
|
+
metadata: { data: value },
|
|
7950
|
+
}),
|
|
7951
|
+
},
|
|
7952
|
+
},
|
|
7953
|
+
],
|
|
7954
|
+
},
|
|
7955
|
+
},
|
|
7956
|
+
];
|
|
7957
|
+
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7958
|
+
get reviewsFields() {
|
|
7959
|
+
return [
|
|
7960
|
+
'id',
|
|
7961
|
+
'shop',
|
|
7962
|
+
'rate',
|
|
7963
|
+
'author',
|
|
7964
|
+
'email',
|
|
7965
|
+
'location',
|
|
7966
|
+
'review',
|
|
7967
|
+
'status',
|
|
7968
|
+
'title',
|
|
7969
|
+
{ personId: { columnName: 'person_id' } },
|
|
7970
|
+
'points',
|
|
7971
|
+
{ orderId: { columnName: 'order_id' } },
|
|
7972
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7973
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7974
|
+
];
|
|
7975
|
+
}
|
|
7976
|
+
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
7977
|
+
super({
|
|
7978
|
+
tableName: 'product',
|
|
7979
|
+
model: ProductHasuraGraphQL,
|
|
7980
|
+
endpoint,
|
|
7981
|
+
authOptions,
|
|
7982
|
+
interceptors,
|
|
7983
|
+
fields: fieldsConfiguration$2,
|
|
7984
|
+
cache,
|
|
7985
|
+
});
|
|
7986
|
+
this.bindReviewToModel = (plain) => ProductReview.toInstance({
|
|
7987
|
+
...is(omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])),
|
|
7988
|
+
createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at,
|
|
7989
|
+
updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at,
|
|
7990
|
+
personId: plain.person_id,
|
|
7991
|
+
orderId: plain.order_id,
|
|
7992
|
+
});
|
|
7993
|
+
this.bindReviewToHasura = (review) => ({
|
|
7994
|
+
...is(omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])),
|
|
7995
|
+
person_id: review.personId,
|
|
7996
|
+
order_id: review.orderId,
|
|
7997
|
+
});
|
|
7998
|
+
}
|
|
7999
|
+
async create(params) {
|
|
8000
|
+
const { metadata, ...data } = params;
|
|
8001
|
+
const product = await super.create(omit({ ...data, metadata: metadata || { description: null, title: null } }, ['reviews']));
|
|
8002
|
+
try {
|
|
8003
|
+
product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
|
|
8004
|
+
}
|
|
8005
|
+
catch (error) {
|
|
8006
|
+
await this.delete({ id: product.id });
|
|
8007
|
+
throw error;
|
|
8008
|
+
}
|
|
8009
|
+
return product;
|
|
8010
|
+
}
|
|
8011
|
+
async get(identifiers, options) {
|
|
8012
|
+
const product = Number.isNaN(+identifiers.id)
|
|
8013
|
+
? (await this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } }, options))
|
|
8014
|
+
.data?.[0]
|
|
8015
|
+
: await super.get(identifiers, options);
|
|
8016
|
+
if (product.productId)
|
|
8017
|
+
throw new NotFoundError('Product not found, it is a variant');
|
|
8018
|
+
product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id, false, options));
|
|
8019
|
+
if (!product.variants?.length) {
|
|
8020
|
+
for (const [index, variant] of product.variants.entries()) {
|
|
8021
|
+
product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
|
|
8022
|
+
}
|
|
8023
|
+
}
|
|
8024
|
+
return product;
|
|
8025
|
+
}
|
|
8026
|
+
async find(params, optionsParams) {
|
|
8027
|
+
const { filters, fields, ...options } = params || {};
|
|
8028
|
+
const bindFields = fields ||
|
|
8029
|
+
this.fields
|
|
8030
|
+
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
8031
|
+
.filter((field) => field !== 'reviews' && field !== 'categories');
|
|
8032
|
+
if (options.options?.minimal?.includes('price'))
|
|
8033
|
+
options.options?.minimal.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
8034
|
+
if (options.options?.maximum?.includes('price'))
|
|
8035
|
+
options.options?.maximum.push('price.price', 'price.fullPrice', 'price.subscriberPrice');
|
|
8036
|
+
options.options?.minimal?.splice(options.options?.minimal.indexOf('price'), 1);
|
|
8037
|
+
options.options?.maximum?.splice(options.options?.maximum.indexOf('price'), 1);
|
|
8038
|
+
return super.find({
|
|
8039
|
+
...options,
|
|
8040
|
+
filters: { ...filters, productId: { operator: Where.ISNULL } },
|
|
8041
|
+
fields: [
|
|
8042
|
+
...bindFields,
|
|
8043
|
+
...(bindFields.includes('price')
|
|
8044
|
+
? [
|
|
8045
|
+
'subscriberPrice',
|
|
8046
|
+
'subscriberDiscountPercentage',
|
|
8047
|
+
'fullPrice',
|
|
8048
|
+
]
|
|
8049
|
+
: []),
|
|
8050
|
+
],
|
|
8051
|
+
}, optionsParams);
|
|
8052
|
+
}
|
|
8053
|
+
async getBySlug(slug, options) {
|
|
8054
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
8055
|
+
const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
|
|
8056
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
8057
|
+
if (cachedData) {
|
|
8058
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
8059
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
8060
|
+
}
|
|
7526
8061
|
}
|
|
7527
8062
|
const result = await this.find({
|
|
7528
8063
|
filters: {
|
|
7529
8064
|
slug,
|
|
8065
|
+
productId: {
|
|
8066
|
+
operator: Where.ISNULL,
|
|
8067
|
+
},
|
|
7530
8068
|
},
|
|
7531
8069
|
fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
|
|
7532
8070
|
options: {
|
|
@@ -7536,6 +8074,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7536
8074
|
if (!result.data.length)
|
|
7537
8075
|
return null;
|
|
7538
8076
|
const product = result?.data?.shift();
|
|
8077
|
+
if (!product.variants?.length) {
|
|
8078
|
+
for (const [index, variant] of product.variants.entries()) {
|
|
8079
|
+
product.variants[index].reviews = await this.findReviewsByProduct(+variant.id, true);
|
|
8080
|
+
}
|
|
8081
|
+
}
|
|
7539
8082
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
7540
8083
|
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
7541
8084
|
const cacheKey = `${this.model.name.toLowerCase()}:slug:${slug}`;
|
|
@@ -7548,6 +8091,39 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7548
8091
|
}
|
|
7549
8092
|
return product;
|
|
7550
8093
|
}
|
|
8094
|
+
async getByEAN(EAN, options) {
|
|
8095
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
8096
|
+
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
|
8097
|
+
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
8098
|
+
if (cachedData) {
|
|
8099
|
+
this.logger.log(`Dados recuperados do cache: ${cacheKey}`);
|
|
8100
|
+
return this.model.toInstance(deserialize(cachedData));
|
|
8101
|
+
}
|
|
8102
|
+
}
|
|
8103
|
+
const result = await this.find({
|
|
8104
|
+
filters: {
|
|
8105
|
+
EAN,
|
|
8106
|
+
},
|
|
8107
|
+
fields: this.fields.map((field) => typeof field === 'string' ? field : Object.keys(field).shift()),
|
|
8108
|
+
options: {
|
|
8109
|
+
enableCount: false,
|
|
8110
|
+
},
|
|
8111
|
+
});
|
|
8112
|
+
if (!result.data.length)
|
|
8113
|
+
return null;
|
|
8114
|
+
const product = result?.data?.shift();
|
|
8115
|
+
RoundProductPricesHelper.roundProductPrices(product);
|
|
8116
|
+
if (this.cache?.cacheAdapter && options?.cache?.enabled && product) {
|
|
8117
|
+
const cacheKey = `${this.model.name.toLowerCase()}:EAN:${EAN}`;
|
|
8118
|
+
await this.cache.cacheAdapter.set({
|
|
8119
|
+
key: cacheKey,
|
|
8120
|
+
data: serialize(product),
|
|
8121
|
+
expirationInSeconds: options?.cache?.ttl || this.cache.ttlDefault,
|
|
8122
|
+
});
|
|
8123
|
+
this.logger.log(`Dados salvos no cache: ${cacheKey}`);
|
|
8124
|
+
}
|
|
8125
|
+
return product;
|
|
8126
|
+
}
|
|
7551
8127
|
async update(params) {
|
|
7552
8128
|
const { kitProducts, reviews, id: checkId, metadata, ...data } = omit(params, ['categories', 'rate']);
|
|
7553
8129
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
@@ -7682,7 +8258,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7682
8258
|
const plainData = this.paramsToPlain({ metadata });
|
|
7683
8259
|
if (!plainData.metadata)
|
|
7684
8260
|
return null;
|
|
7685
|
-
|
|
8261
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8262
|
+
const { update_product_metadata_by_pk } = await this.mutation('update_product_metadata_by_pk', ['product_id'], {
|
|
7686
8263
|
pk_columns: {
|
|
7687
8264
|
value: { product_id: productId },
|
|
7688
8265
|
type: 'product_metadata_pk_columns_input',
|
|
@@ -7694,6 +8271,14 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7694
8271
|
required: true,
|
|
7695
8272
|
},
|
|
7696
8273
|
});
|
|
8274
|
+
if (!update_product_metadata_by_pk) {
|
|
8275
|
+
await this.mutation('insert_product_metadata', ['affected_rows'], {
|
|
8276
|
+
objects: {
|
|
8277
|
+
type: '[product_metadata_insert_input!]!',
|
|
8278
|
+
value: [{ product_id: productId, ...metadata }],
|
|
8279
|
+
},
|
|
8280
|
+
});
|
|
8281
|
+
}
|
|
7697
8282
|
return plainData.metadata;
|
|
7698
8283
|
}
|
|
7699
8284
|
async getId(id) {
|
|
@@ -7704,7 +8289,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7704
8289
|
return data?.[0]?.id;
|
|
7705
8290
|
throw new NotFoundError(`Product with id ${id} not found`);
|
|
7706
8291
|
}
|
|
7707
|
-
async findReviewsByProduct(productId, options) {
|
|
8292
|
+
async findReviewsByProduct(productId, onlyApproved, options) {
|
|
7708
8293
|
if (this.cache?.cacheAdapter && options?.cache?.enabled) {
|
|
7709
8294
|
const cacheKey = `${this.model.name.toLowerCase()}:reviews:product:${productId}`;
|
|
7710
8295
|
const cachedData = await this.cache.cacheAdapter.get(cacheKey);
|
|
@@ -7717,10 +8302,16 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
7717
8302
|
where: {
|
|
7718
8303
|
value: {
|
|
7719
8304
|
product_id: { _eq: productId },
|
|
8305
|
+
...(onlyApproved && { status: { _eq: true } }),
|
|
7720
8306
|
},
|
|
7721
8307
|
type: 'product_review_bool_exp',
|
|
7722
8308
|
required: true,
|
|
7723
8309
|
},
|
|
8310
|
+
order_by: {
|
|
8311
|
+
type: '[product_review_order_by]',
|
|
8312
|
+
value: [{ createdAt: 'desc' }],
|
|
8313
|
+
required: true,
|
|
8314
|
+
},
|
|
7724
8315
|
});
|
|
7725
8316
|
const reviews = data?.map((review) => this.bindReviewToModel(review));
|
|
7726
8317
|
if (this.cache?.cacheAdapter && options?.cache?.enabled && reviews) {
|
|
@@ -7792,6 +8383,12 @@ __decorate([
|
|
|
7792
8383
|
__metadata("design:paramtypes", [String, Object]),
|
|
7793
8384
|
__metadata("design:returntype", Promise)
|
|
7794
8385
|
], ProductHasuraGraphQLRepository.prototype, "getBySlug", null);
|
|
8386
|
+
__decorate([
|
|
8387
|
+
Log(),
|
|
8388
|
+
__metadata("design:type", Function),
|
|
8389
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
8390
|
+
__metadata("design:returntype", Promise)
|
|
8391
|
+
], ProductHasuraGraphQLRepository.prototype, "getByEAN", null);
|
|
7795
8392
|
__decorate([
|
|
7796
8393
|
Log(),
|
|
7797
8394
|
__metadata("design:type", Function),
|
|
@@ -7819,7 +8416,7 @@ __decorate([
|
|
|
7819
8416
|
__decorate([
|
|
7820
8417
|
Log(),
|
|
7821
8418
|
__metadata("design:type", Function),
|
|
7822
|
-
__metadata("design:paramtypes", [Number, Object]),
|
|
8419
|
+
__metadata("design:paramtypes", [Number, Boolean, Object]),
|
|
7823
8420
|
__metadata("design:returntype", Promise)
|
|
7824
8421
|
], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
|
|
7825
8422
|
|
|
@@ -7847,6 +8444,31 @@ class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
|
|
|
7847
8444
|
{ orderId: { columnName: 'order_id' } },
|
|
7848
8445
|
{ createdAt: { columnName: 'created_at' } },
|
|
7849
8446
|
{ updatedAt: { columnName: 'updated_at' } },
|
|
8447
|
+
{
|
|
8448
|
+
product: {
|
|
8449
|
+
columnName: 'product',
|
|
8450
|
+
foreignKeyColumn: { id: 'productId' },
|
|
8451
|
+
fields: [
|
|
8452
|
+
'id',
|
|
8453
|
+
{
|
|
8454
|
+
productId: {
|
|
8455
|
+
columnName: 'main_product_id',
|
|
8456
|
+
to: (value) => +value,
|
|
8457
|
+
from: (value) => value?.toString(),
|
|
8458
|
+
},
|
|
8459
|
+
},
|
|
8460
|
+
'ean',
|
|
8461
|
+
'sku',
|
|
8462
|
+
'name',
|
|
8463
|
+
'brand',
|
|
8464
|
+
'slug',
|
|
8465
|
+
'images',
|
|
8466
|
+
'grade',
|
|
8467
|
+
'gender',
|
|
8468
|
+
'',
|
|
8469
|
+
],
|
|
8470
|
+
},
|
|
8471
|
+
},
|
|
7850
8472
|
],
|
|
7851
8473
|
cache,
|
|
7852
8474
|
});
|
|
@@ -8037,9 +8659,148 @@ const fieldsConfiguration$1 = [
|
|
|
8037
8659
|
},
|
|
8038
8660
|
},
|
|
8039
8661
|
'group',
|
|
8662
|
+
'type',
|
|
8040
8663
|
'validity',
|
|
8041
|
-
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8042
8664
|
'published',
|
|
8665
|
+
{ tagsCollection: { columnName: 'tags_collection', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8666
|
+
{ tagsProfile: { columnName: 'tags_profile', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8667
|
+
{ daysOfUse: { columnName: 'days_of_use' } },
|
|
8668
|
+
{
|
|
8669
|
+
images: {
|
|
8670
|
+
columnName: 'images',
|
|
8671
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
8672
|
+
},
|
|
8673
|
+
},
|
|
8674
|
+
{
|
|
8675
|
+
miniatures: {
|
|
8676
|
+
columnName: 'miniatures',
|
|
8677
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
8678
|
+
},
|
|
8679
|
+
},
|
|
8680
|
+
{
|
|
8681
|
+
imagesCard: {
|
|
8682
|
+
columnName: 'images_card',
|
|
8683
|
+
to: (value) => (value?.length > 0 ? `{"${value?.join?.('","') || ''}"}` : '{}'),
|
|
8684
|
+
},
|
|
8685
|
+
},
|
|
8686
|
+
'slug',
|
|
8687
|
+
'brand',
|
|
8688
|
+
'name',
|
|
8689
|
+
'sku',
|
|
8690
|
+
{ NCM: { columnName: 'ncm' } },
|
|
8691
|
+
{ CEST: { columnName: 'cest' } },
|
|
8692
|
+
{
|
|
8693
|
+
description: {
|
|
8694
|
+
columnName: 'description',
|
|
8695
|
+
from: (description, data) => ({
|
|
8696
|
+
description,
|
|
8697
|
+
differentials: data.differentials,
|
|
8698
|
+
whoMustUse: data.who_must_use,
|
|
8699
|
+
howToUse: data.how_to_use,
|
|
8700
|
+
brand: data.brand_description,
|
|
8701
|
+
ingredients: data.ingredients,
|
|
8702
|
+
purpose: data.purpose,
|
|
8703
|
+
}),
|
|
8704
|
+
bindFindFilter: (filters) => {
|
|
8705
|
+
return {
|
|
8706
|
+
...(filters?.description && { description: filters.description }),
|
|
8707
|
+
...(filters.differentials && { differentials: filters.differentials }),
|
|
8708
|
+
...(filters.whoMustUse && {
|
|
8709
|
+
who_must_use: filters.whoMustUse,
|
|
8710
|
+
}),
|
|
8711
|
+
...(filters.howToUse && {
|
|
8712
|
+
how_to_use: filters.howToUse,
|
|
8713
|
+
}),
|
|
8714
|
+
...(filters.brand && {
|
|
8715
|
+
brand_description: filters.brand,
|
|
8716
|
+
}),
|
|
8717
|
+
...(filters.ingredients && {
|
|
8718
|
+
ingredients: filters.ingredients,
|
|
8719
|
+
}),
|
|
8720
|
+
...(filters.purpose && {
|
|
8721
|
+
purpose: filters.purpose,
|
|
8722
|
+
}),
|
|
8723
|
+
};
|
|
8724
|
+
},
|
|
8725
|
+
bindPersistData: (descriptionData) => ({
|
|
8726
|
+
...(descriptionData?.description && { description: descriptionData.description }),
|
|
8727
|
+
...(descriptionData.differentials && { differentials: descriptionData.differentials }),
|
|
8728
|
+
...(descriptionData.whoMustUse && {
|
|
8729
|
+
who_must_use: descriptionData.whoMustUse,
|
|
8730
|
+
}),
|
|
8731
|
+
...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
|
|
8732
|
+
...(descriptionData.brand && { brand_description: descriptionData.brand }),
|
|
8733
|
+
...(descriptionData.ingredients && { ingredients: descriptionData.ingredients }),
|
|
8734
|
+
...(descriptionData.purpose && { purpose: descriptionData.purpose }),
|
|
8735
|
+
}),
|
|
8736
|
+
},
|
|
8737
|
+
},
|
|
8738
|
+
{ differentials: { columnName: 'differentials' } },
|
|
8739
|
+
{ whoMustUse: { columnName: 'who_must_use' } },
|
|
8740
|
+
{ howToUse: { columnName: 'how_to_use' } },
|
|
8741
|
+
{ brandDescription: { columnName: 'brand_description' } },
|
|
8742
|
+
{ ingredients: { columnName: 'ingredients' } },
|
|
8743
|
+
{ purpose: { columnName: 'purpose' } },
|
|
8744
|
+
'gender',
|
|
8745
|
+
{ intGender: { columnName: 'int_gender' } },
|
|
8746
|
+
'label',
|
|
8747
|
+
{ filters: { columnName: 'filters', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8748
|
+
{ rate: { columnName: 'rating' } },
|
|
8749
|
+
{ reviewsTotal: { columnName: 'reviews_total' } },
|
|
8750
|
+
{ shoppingCount: { columnName: 'shopping_count' } },
|
|
8751
|
+
{ categoryId: { columnName: 'category_id' } },
|
|
8752
|
+
{
|
|
8753
|
+
category: {
|
|
8754
|
+
columnName: 'category',
|
|
8755
|
+
foreignKeyColumn: { id: 'categoryId' },
|
|
8756
|
+
fields: ['id', 'name', 'reference', 'slug'],
|
|
8757
|
+
},
|
|
8758
|
+
},
|
|
8759
|
+
{
|
|
8760
|
+
categories: {
|
|
8761
|
+
columnName: 'categories',
|
|
8762
|
+
fields: ['category_id'],
|
|
8763
|
+
bindPersistData: (value) => ({
|
|
8764
|
+
categories: { data: value.map((category) => ({ category_id: +category })) },
|
|
8765
|
+
}),
|
|
8766
|
+
to: (categories) => categories.map((categoryId) => +categoryId),
|
|
8767
|
+
from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
|
|
8768
|
+
},
|
|
8769
|
+
},
|
|
8770
|
+
{
|
|
8771
|
+
metadata: {
|
|
8772
|
+
columnName: 'metadata',
|
|
8773
|
+
fields: ['title', 'description'],
|
|
8774
|
+
bindPersistData: (value) => ({
|
|
8775
|
+
metadata: { data: value },
|
|
8776
|
+
}),
|
|
8777
|
+
},
|
|
8778
|
+
},
|
|
8779
|
+
{
|
|
8780
|
+
reviews: {
|
|
8781
|
+
columnName: 'reviews',
|
|
8782
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
8783
|
+
fields: [
|
|
8784
|
+
'id',
|
|
8785
|
+
'shop',
|
|
8786
|
+
'rate',
|
|
8787
|
+
'author',
|
|
8788
|
+
'email',
|
|
8789
|
+
'location',
|
|
8790
|
+
'review',
|
|
8791
|
+
'status',
|
|
8792
|
+
'title',
|
|
8793
|
+
{ personId: { columnName: 'person_id' } },
|
|
8794
|
+
'points',
|
|
8795
|
+
{ orderId: { columnName: 'order_id' } },
|
|
8796
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
8797
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
8798
|
+
],
|
|
8799
|
+
},
|
|
8800
|
+
},
|
|
8801
|
+
{ variantSlug: { columnName: 'variant_slug' } },
|
|
8802
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
8803
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
8043
8804
|
];
|
|
8044
8805
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
8045
8806
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
@@ -8068,18 +8829,57 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
8068
8829
|
const { filters, ...options } = params || {};
|
|
8069
8830
|
return super.find({ ...options, filters: { productId: { operator: Where.ISNOTNULL }, ...filters } });
|
|
8070
8831
|
}
|
|
8832
|
+
async getByEAN(EAN) {
|
|
8833
|
+
const { data } = await this.find({
|
|
8834
|
+
filters: {
|
|
8835
|
+
EAN,
|
|
8836
|
+
},
|
|
8837
|
+
options: {
|
|
8838
|
+
enableCount: false,
|
|
8839
|
+
},
|
|
8840
|
+
});
|
|
8841
|
+
return data.at(0);
|
|
8842
|
+
}
|
|
8071
8843
|
async update(params) {
|
|
8072
|
-
const { productId, id: checkId, ...data } = params;
|
|
8844
|
+
const { productId, id: checkId, metadata, ...data } = params;
|
|
8073
8845
|
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
8074
8846
|
if (!dataWithProductId.id) {
|
|
8075
8847
|
throw new NotFoundError('Variant ID is required for update');
|
|
8076
8848
|
}
|
|
8077
8849
|
const id = await this.getId(dataWithProductId.id);
|
|
8078
8850
|
const product = await super.update({ id, ...data });
|
|
8851
|
+
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
8079
8852
|
if (dataWithProductId.productId) {
|
|
8080
8853
|
product.productId = dataWithProductId.productId;
|
|
8081
8854
|
}
|
|
8082
|
-
return product;
|
|
8855
|
+
return product;
|
|
8856
|
+
}
|
|
8857
|
+
async updateMetadata(productId, { metadata }) {
|
|
8858
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
8859
|
+
if (!plainData.metadata)
|
|
8860
|
+
return null;
|
|
8861
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8862
|
+
const { update_product_metadata_by_pk } = await this.mutation('update_product_metadata_by_pk', ['product_id'], {
|
|
8863
|
+
pk_columns: {
|
|
8864
|
+
value: { product_id: productId },
|
|
8865
|
+
type: 'product_metadata_pk_columns_input',
|
|
8866
|
+
required: true,
|
|
8867
|
+
},
|
|
8868
|
+
_set: {
|
|
8869
|
+
value: omit(metadata, ['product_id']),
|
|
8870
|
+
type: 'product_metadata_set_input',
|
|
8871
|
+
required: true,
|
|
8872
|
+
},
|
|
8873
|
+
});
|
|
8874
|
+
if (!update_product_metadata_by_pk) {
|
|
8875
|
+
await this.mutation('insert_product_metadata', ['affected_rows'], {
|
|
8876
|
+
objects: {
|
|
8877
|
+
type: '[product_metadata_insert_input!]!',
|
|
8878
|
+
value: [{ product_id: productId, ...metadata }],
|
|
8879
|
+
},
|
|
8880
|
+
});
|
|
8881
|
+
}
|
|
8882
|
+
return plainData.metadata;
|
|
8083
8883
|
}
|
|
8084
8884
|
async getId(id) {
|
|
8085
8885
|
if (!Number.isNaN(+id))
|
|
@@ -8395,6 +9195,9 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
8395
9195
|
productId: +productId,
|
|
8396
9196
|
});
|
|
8397
9197
|
}
|
|
9198
|
+
async getBrandsWithProducts() {
|
|
9199
|
+
return;
|
|
9200
|
+
}
|
|
8398
9201
|
}
|
|
8399
9202
|
__decorate([
|
|
8400
9203
|
Log(),
|
|
@@ -8561,6 +9364,201 @@ class PagarmePaymentOperationsHelper {
|
|
|
8561
9364
|
}
|
|
8562
9365
|
}
|
|
8563
9366
|
|
|
9367
|
+
class PagarMeV5RequestHelper {
|
|
9368
|
+
static build(checkout, method, card) {
|
|
9369
|
+
return {
|
|
9370
|
+
items: this.buildItems(checkout),
|
|
9371
|
+
customer: this.buildCustomer(checkout),
|
|
9372
|
+
shipping: this.buildShipping(checkout),
|
|
9373
|
+
payments: this.buildPayment(checkout, method, card),
|
|
9374
|
+
};
|
|
9375
|
+
}
|
|
9376
|
+
static buildItems(checkout) {
|
|
9377
|
+
return checkout.lineItems
|
|
9378
|
+
.filter((item) => !item.isGift)
|
|
9379
|
+
.map((item) => {
|
|
9380
|
+
return {
|
|
9381
|
+
amount: Math.floor(item.pricePaid * 100),
|
|
9382
|
+
description: item.name,
|
|
9383
|
+
quantity: item.quantity,
|
|
9384
|
+
code: item.EAN,
|
|
9385
|
+
};
|
|
9386
|
+
});
|
|
9387
|
+
}
|
|
9388
|
+
static buildCustomer(checkout) {
|
|
9389
|
+
return {
|
|
9390
|
+
name: checkout.user.displayName,
|
|
9391
|
+
email: checkout.user.email,
|
|
9392
|
+
type: 'individual',
|
|
9393
|
+
document: checkout.user.cpf,
|
|
9394
|
+
phones: {
|
|
9395
|
+
home_phone: {
|
|
9396
|
+
country_code: '55',
|
|
9397
|
+
number: checkout.user.phone.slice(2),
|
|
9398
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
9399
|
+
},
|
|
9400
|
+
mobile_phone: {
|
|
9401
|
+
country_code: '55',
|
|
9402
|
+
number: checkout.user.phone.slice(2),
|
|
9403
|
+
area_code: checkout.user.phone.slice(0, 2),
|
|
9404
|
+
},
|
|
9405
|
+
},
|
|
9406
|
+
address: {
|
|
9407
|
+
line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
|
|
9408
|
+
line_2: `${checkout.billingAddress.extension}`,
|
|
9409
|
+
zip_code: checkout.shippingAddress.zip,
|
|
9410
|
+
city: checkout.billingAddress.city,
|
|
9411
|
+
state: checkout.billingAddress.state,
|
|
9412
|
+
country: 'BR',
|
|
9413
|
+
},
|
|
9414
|
+
};
|
|
9415
|
+
}
|
|
9416
|
+
static buildShipping(checkout) {
|
|
9417
|
+
return {
|
|
9418
|
+
amount: Math.floor(checkout.shipping.ShippingPrice * 100),
|
|
9419
|
+
description: `${checkout.shipping.ShippingCompanyName} - ${checkout.shipping.description}`,
|
|
9420
|
+
recipient_name: checkout.shippingAddress.recipient,
|
|
9421
|
+
recipient_phone: checkout.user.phone,
|
|
9422
|
+
address: {
|
|
9423
|
+
line_1: `${checkout.shippingAddress.number}, ${checkout.shippingAddress.street}, ${checkout.shippingAddress.district}`,
|
|
9424
|
+
line_2: `${checkout.shippingAddress.extension}`,
|
|
9425
|
+
zip_code: checkout.shippingAddress.zip,
|
|
9426
|
+
city: checkout.shippingAddress.city,
|
|
9427
|
+
state: checkout.shippingAddress.state,
|
|
9428
|
+
country: 'BR',
|
|
9429
|
+
},
|
|
9430
|
+
};
|
|
9431
|
+
}
|
|
9432
|
+
static buildPayment(checkout, method, card) {
|
|
9433
|
+
return [
|
|
9434
|
+
{
|
|
9435
|
+
payment_method: method,
|
|
9436
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
9437
|
+
...(method === 'pix' && {
|
|
9438
|
+
pix: this.getPixOrder(),
|
|
9439
|
+
}),
|
|
9440
|
+
...(method === 'boleto' && {
|
|
9441
|
+
boleto: this.getBoletoOrder(),
|
|
9442
|
+
}),
|
|
9443
|
+
...(method === 'credit_card' && {
|
|
9444
|
+
credit_card: this.getCardOrder(checkout, card),
|
|
9445
|
+
}),
|
|
9446
|
+
},
|
|
9447
|
+
];
|
|
9448
|
+
}
|
|
9449
|
+
static getPixOrder() {
|
|
9450
|
+
return {
|
|
9451
|
+
expires_at: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
9452
|
+
};
|
|
9453
|
+
}
|
|
9454
|
+
static getBoletoOrder() {
|
|
9455
|
+
return {
|
|
9456
|
+
due_at: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
9457
|
+
instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
9458
|
+
type: 'DM',
|
|
9459
|
+
document_number: new Date().getTime().toString(),
|
|
9460
|
+
};
|
|
9461
|
+
}
|
|
9462
|
+
static getCardOrder(checkout, card) {
|
|
9463
|
+
return {
|
|
9464
|
+
installments: card.installments,
|
|
9465
|
+
statement_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
|
|
9466
|
+
card_id: card.cardId,
|
|
9467
|
+
card: {
|
|
9468
|
+
cvv: card.cardCvv,
|
|
9469
|
+
billing_address: {
|
|
9470
|
+
line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
|
|
9471
|
+
zip_code: checkout.billingAddress.zip,
|
|
9472
|
+
city: checkout.billingAddress.city,
|
|
9473
|
+
state: checkout.billingAddress.state,
|
|
9474
|
+
country: 'BR',
|
|
9475
|
+
},
|
|
9476
|
+
},
|
|
9477
|
+
};
|
|
9478
|
+
}
|
|
9479
|
+
}
|
|
9480
|
+
|
|
9481
|
+
class PagarMeV5ResponseHelper {
|
|
9482
|
+
static build(method, checkout, response) {
|
|
9483
|
+
return Payment.toInstance({
|
|
9484
|
+
createdAt: new Date(),
|
|
9485
|
+
updatedAt: new Date(),
|
|
9486
|
+
userId: checkout.user.id,
|
|
9487
|
+
checkoutId: checkout.id,
|
|
9488
|
+
totalPrice: checkout.totalPrice,
|
|
9489
|
+
paymentProvider: PaymentProviders.PAGARME,
|
|
9490
|
+
pagarMeOrderId: response.id,
|
|
9491
|
+
transaction: this.buildPaymentTransaction(method, response),
|
|
9492
|
+
});
|
|
9493
|
+
}
|
|
9494
|
+
static buildPaymentTransaction(method, response) {
|
|
9495
|
+
const charger = response.charges.at(0);
|
|
9496
|
+
const transaction = charger.last_transaction;
|
|
9497
|
+
return PaymentTransaction.toInstance({
|
|
9498
|
+
acquirer_name: 'pagar_me',
|
|
9499
|
+
amount: charger.amount,
|
|
9500
|
+
currency: charger.currency,
|
|
9501
|
+
gateway_id: charger.gateway_id,
|
|
9502
|
+
status: this.getPaymentStatus(transaction.status),
|
|
9503
|
+
payment_method: charger.payment_method,
|
|
9504
|
+
date_created: charger.created_at,
|
|
9505
|
+
date_updated: charger.updated_at,
|
|
9506
|
+
paid_amount: charger.paid_amount,
|
|
9507
|
+
paid_at: charger.paid_at,
|
|
9508
|
+
order_id: response.id,
|
|
9509
|
+
charger_id: charger.id,
|
|
9510
|
+
tid: charger.id,
|
|
9511
|
+
id: charger.id,
|
|
9512
|
+
...(method == TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
|
|
9513
|
+
...(method == TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
|
|
9514
|
+
...(method == TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
|
|
9515
|
+
});
|
|
9516
|
+
}
|
|
9517
|
+
static getPaymentStatus(status) {
|
|
9518
|
+
if (status == PagarMeV5PaymentStatus.Gerado)
|
|
9519
|
+
return PagarMeV5PaymentStatus['Aguardando pagamento'];
|
|
9520
|
+
if (status == PagarMeV5PaymentStatus.Capturada)
|
|
9521
|
+
return PagarMeV5PaymentStatus.Pago;
|
|
9522
|
+
return status;
|
|
9523
|
+
}
|
|
9524
|
+
static getBoletoReponse(transaction) {
|
|
9525
|
+
return {
|
|
9526
|
+
boleto_url: transaction.url?.toString(),
|
|
9527
|
+
boleto_barcode: transaction.line?.toString(),
|
|
9528
|
+
boleto_qr_code: transaction.qr_code?.toString(),
|
|
9529
|
+
boleto_expiration_date: transaction.due_at?.toString(),
|
|
9530
|
+
boleto_instructions: transaction.instructions?.toString(),
|
|
9531
|
+
boleto_nosso_numero: transaction.nosso_numero?.toString(),
|
|
9532
|
+
boleto_type: transaction.type?.toString(),
|
|
9533
|
+
boleto_document_number: transaction.document_number?.toString(),
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9536
|
+
static getPixReponse(transaction) {
|
|
9537
|
+
return {
|
|
9538
|
+
pix_qr_code: transaction.qr_code?.toString(),
|
|
9539
|
+
pix_qr_code_url: transaction.qr_code_url?.toString(),
|
|
9540
|
+
pix_expiration_date: transaction.expires_at?.toString(),
|
|
9541
|
+
};
|
|
9542
|
+
}
|
|
9543
|
+
static getCardReponse(transaction) {
|
|
9544
|
+
return {
|
|
9545
|
+
soft_descriptor: transaction.statement_descriptor?.toString(),
|
|
9546
|
+
acquirer_name: transaction.acquirer_name?.toString(),
|
|
9547
|
+
acquirer_id: transaction.acquirer_tid?.toString(),
|
|
9548
|
+
acquirer_nsu: transaction.acquirer_nsu?.toString(),
|
|
9549
|
+
acquirer_auth_code: transaction.acquirer_auth_code?.toString(),
|
|
9550
|
+
acquirer_message: transaction.acquirer_message?.toString(),
|
|
9551
|
+
acquirer_return_code: transaction.acquirer_return_code?.toString(),
|
|
9552
|
+
installments: transaction.installments ?? null,
|
|
9553
|
+
card_holder_name: transaction.card?.holder_name?.toString(),
|
|
9554
|
+
card_last_digits: transaction.card?.last_four_digits?.toString(),
|
|
9555
|
+
card_first_digits: transaction.card?.first_six_digits?.toString(),
|
|
9556
|
+
card_brand: transaction.card?.brand?.toString(),
|
|
9557
|
+
card_id: transaction.card?.id?.toString(),
|
|
9558
|
+
};
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9561
|
+
|
|
8564
9562
|
class PagarmeCardAxiosAdapter {
|
|
8565
9563
|
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
8566
9564
|
this.credentials = credentials;
|
|
@@ -8617,8 +9615,9 @@ class PagarmeCardAxiosAdapter {
|
|
|
8617
9615
|
});
|
|
8618
9616
|
}
|
|
8619
9617
|
}
|
|
8620
|
-
async createCardHash(bu) {
|
|
8621
|
-
const
|
|
9618
|
+
async createCardHash(bu, shop) {
|
|
9619
|
+
const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
|
|
9620
|
+
const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
8622
9621
|
try {
|
|
8623
9622
|
const { data } = await axios({
|
|
8624
9623
|
method: 'GET',
|
|
@@ -8781,6 +9780,281 @@ class PagarmePixAxiosAdapter {
|
|
|
8781
9780
|
}
|
|
8782
9781
|
}
|
|
8783
9782
|
|
|
9783
|
+
class PagarmeV5BankSlipAxiosAdapter {
|
|
9784
|
+
constructor(credentials, paymentRepository) {
|
|
9785
|
+
this.credentials = credentials;
|
|
9786
|
+
this.paymentRepository = paymentRepository;
|
|
9787
|
+
}
|
|
9788
|
+
async pay(checkout) {
|
|
9789
|
+
try {
|
|
9790
|
+
const payload = PagarMeV5RequestHelper.build(checkout, 'boleto');
|
|
9791
|
+
console.warn('[PAGARME BOLETO DATA TO SEND]', JSON.stringify(payload));
|
|
9792
|
+
const { data } = await axios({
|
|
9793
|
+
method: 'POST',
|
|
9794
|
+
url: `${this.credentials.URL}/orders`,
|
|
9795
|
+
headers: {
|
|
9796
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
9797
|
+
'Content-Type': 'application/json',
|
|
9798
|
+
},
|
|
9799
|
+
data: payload,
|
|
9800
|
+
});
|
|
9801
|
+
console.warn('[PAGARME RESPONSE BOLETO DATA]', JSON.stringify(data));
|
|
9802
|
+
if (data.status === PagarMeV5OrderStatus.Falha ||
|
|
9803
|
+
data.charges.at(0).status === PagarMeV5OrderStatus.Falha ||
|
|
9804
|
+
(data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Gerado &&
|
|
9805
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus['Em processamento'])) {
|
|
9806
|
+
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9807
|
+
checkoutId: checkout.id,
|
|
9808
|
+
userEmail: checkout.user.email,
|
|
9809
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
9810
|
+
}));
|
|
9811
|
+
}
|
|
9812
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.BANKSLIP, checkout, data));
|
|
9813
|
+
return payment;
|
|
9814
|
+
}
|
|
9815
|
+
catch (error) {
|
|
9816
|
+
if (error instanceof AxiosError) {
|
|
9817
|
+
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
9818
|
+
}
|
|
9819
|
+
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9820
|
+
checkoutId: checkout.id,
|
|
9821
|
+
userEmail: checkout.user.email,
|
|
9822
|
+
info: error.response?.data,
|
|
9823
|
+
});
|
|
9824
|
+
}
|
|
9825
|
+
}
|
|
9826
|
+
async getBoletoTransaction(paymentId) {
|
|
9827
|
+
try {
|
|
9828
|
+
const { data } = await axios({
|
|
9829
|
+
method: 'GET',
|
|
9830
|
+
url: `${this.credentials.URL}/charges/${paymentId}`,
|
|
9831
|
+
headers: {
|
|
9832
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
9833
|
+
'Content-Type': 'application/json',
|
|
9834
|
+
},
|
|
9835
|
+
});
|
|
9836
|
+
const payment = await this.paymentRepository.get({
|
|
9837
|
+
id: data.id,
|
|
9838
|
+
});
|
|
9839
|
+
return payment.transaction;
|
|
9840
|
+
}
|
|
9841
|
+
catch (error) {
|
|
9842
|
+
throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
|
|
9843
|
+
paymentId,
|
|
9844
|
+
info: error.response.data,
|
|
9845
|
+
});
|
|
9846
|
+
}
|
|
9847
|
+
}
|
|
9848
|
+
}
|
|
9849
|
+
|
|
9850
|
+
class PagarmeV5CardAxiosAdapter {
|
|
9851
|
+
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
9852
|
+
this.credentials = credentials;
|
|
9853
|
+
this.paymentRepository = paymentRepository;
|
|
9854
|
+
this.orderBlockedRepository = orderBlockedRepository;
|
|
9855
|
+
}
|
|
9856
|
+
async pay(checkout, card) {
|
|
9857
|
+
try {
|
|
9858
|
+
const payload = PagarMeV5RequestHelper.build(checkout, 'credit_card', card);
|
|
9859
|
+
console.warn('[PAGARME CARD DATA TO SEND]', JSON.stringify(payload));
|
|
9860
|
+
const { data } = await axios({
|
|
9861
|
+
method: 'POST',
|
|
9862
|
+
url: `${this.credentials.URL}/orders`,
|
|
9863
|
+
headers: {
|
|
9864
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
9865
|
+
'Content-Type': 'application/json',
|
|
9866
|
+
},
|
|
9867
|
+
data: payload,
|
|
9868
|
+
});
|
|
9869
|
+
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9870
|
+
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
9871
|
+
data.charges.at(0).status !== PagarMeV5OrderStatus.Pago ||
|
|
9872
|
+
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
|
|
9873
|
+
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9874
|
+
checkout,
|
|
9875
|
+
card,
|
|
9876
|
+
orderBlockedRepository: this.orderBlockedRepository,
|
|
9877
|
+
});
|
|
9878
|
+
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
|
|
9879
|
+
}
|
|
9880
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.CARD, checkout, data));
|
|
9881
|
+
return payment;
|
|
9882
|
+
}
|
|
9883
|
+
catch (error) {
|
|
9884
|
+
if (error instanceof PaymentError) {
|
|
9885
|
+
throw error;
|
|
9886
|
+
}
|
|
9887
|
+
if (error instanceof AxiosError) {
|
|
9888
|
+
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
9889
|
+
}
|
|
9890
|
+
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
9891
|
+
}
|
|
9892
|
+
}
|
|
9893
|
+
async addCard(card, customer) {
|
|
9894
|
+
try {
|
|
9895
|
+
const { id } = await this.createOrUpdateCustomer(customer);
|
|
9896
|
+
const { data } = await axios({
|
|
9897
|
+
method: 'POST',
|
|
9898
|
+
url: `${this.credentials.URL}/customers/${id}/cards`,
|
|
9899
|
+
headers: {
|
|
9900
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
9901
|
+
'Content-Type': 'application/json',
|
|
9902
|
+
},
|
|
9903
|
+
data: {
|
|
9904
|
+
number: card.number,
|
|
9905
|
+
holder_name: card.name,
|
|
9906
|
+
holder_document: card.cpf,
|
|
9907
|
+
exp_month: card.expirationDate.split('/').at(0),
|
|
9908
|
+
exp_year: card.expirationDate.split('/').at(1),
|
|
9909
|
+
cvv: card.cvv,
|
|
9910
|
+
billing_address: {
|
|
9911
|
+
line_1: `${customer.billingAddress.number}, ${customer.billingAddress.street}, ${customer.billingAddress.district}`,
|
|
9912
|
+
line_2: `${customer.billingAddress.extension}`,
|
|
9913
|
+
zip_code: customer.billingAddress.zip,
|
|
9914
|
+
city: customer.billingAddress.city,
|
|
9915
|
+
state: customer.billingAddress.state,
|
|
9916
|
+
country: 'BR',
|
|
9917
|
+
},
|
|
9918
|
+
},
|
|
9919
|
+
});
|
|
9920
|
+
return data;
|
|
9921
|
+
}
|
|
9922
|
+
catch (error) {
|
|
9923
|
+
console.warn(JSON.stringify(error));
|
|
9924
|
+
throw error;
|
|
9925
|
+
}
|
|
9926
|
+
}
|
|
9927
|
+
async createCardHash(bu, shop) {
|
|
9928
|
+
const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
|
|
9929
|
+
const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
|
|
9930
|
+
try {
|
|
9931
|
+
const { data } = await axios({
|
|
9932
|
+
method: 'GET',
|
|
9933
|
+
headers: {
|
|
9934
|
+
'content-type': 'application/json',
|
|
9935
|
+
},
|
|
9936
|
+
url: `${this.credentials.URL}/transactions/card_hash_key`,
|
|
9937
|
+
data: JSON.stringify({
|
|
9938
|
+
api_key: key,
|
|
9939
|
+
}),
|
|
9940
|
+
});
|
|
9941
|
+
return data;
|
|
9942
|
+
}
|
|
9943
|
+
catch (error) {
|
|
9944
|
+
throw new BusinessError('Houve uma falha gerar o hash', {
|
|
9945
|
+
info: error.response.data,
|
|
9946
|
+
});
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
async getCardByToken(customerId, token) {
|
|
9950
|
+
try {
|
|
9951
|
+
const { data } = await axios({
|
|
9952
|
+
method: 'GET',
|
|
9953
|
+
url: `${this.credentials.URL}/cards/${token}`,
|
|
9954
|
+
data: {
|
|
9955
|
+
api_key: this.credentials.API_KEY,
|
|
9956
|
+
},
|
|
9957
|
+
});
|
|
9958
|
+
return data;
|
|
9959
|
+
}
|
|
9960
|
+
catch (error) {
|
|
9961
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
|
|
9962
|
+
info: error.response.data,
|
|
9963
|
+
});
|
|
9964
|
+
}
|
|
9965
|
+
}
|
|
9966
|
+
async createTransaction(info) {
|
|
9967
|
+
return info;
|
|
9968
|
+
}
|
|
9969
|
+
async createOrUpdateCustomer(customer) {
|
|
9970
|
+
try {
|
|
9971
|
+
const { data } = await axios({
|
|
9972
|
+
method: 'POST',
|
|
9973
|
+
url: `${this.credentials.URL}/customers`,
|
|
9974
|
+
headers: {
|
|
9975
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
9976
|
+
'Content-Type': 'application/json',
|
|
9977
|
+
},
|
|
9978
|
+
data: {
|
|
9979
|
+
name: customer.displayName,
|
|
9980
|
+
email: customer.email,
|
|
9981
|
+
document: customer.cpf,
|
|
9982
|
+
type: 'individual',
|
|
9983
|
+
document_type: 'CPF',
|
|
9984
|
+
address: {
|
|
9985
|
+
line_1: `${customer.billingAddress.number}, ${customer.billingAddress.street}, ${customer.billingAddress.district}`,
|
|
9986
|
+
line_2: `${customer.billingAddress.extension}`,
|
|
9987
|
+
zip_code: customer.billingAddress.zip,
|
|
9988
|
+
city: customer.billingAddress.city,
|
|
9989
|
+
state: customer.billingAddress.state,
|
|
9990
|
+
country: 'BR',
|
|
9991
|
+
},
|
|
9992
|
+
birthdate: format(new Date(customer.birthday), 'MM/dd/yyyy'),
|
|
9993
|
+
phones: {
|
|
9994
|
+
home_phone: {
|
|
9995
|
+
country_code: '55',
|
|
9996
|
+
number: customer.phone.slice(2),
|
|
9997
|
+
area_code: customer.phone.slice(0, 2),
|
|
9998
|
+
},
|
|
9999
|
+
mobile_phone: {
|
|
10000
|
+
country_code: '55',
|
|
10001
|
+
number: customer.phone.slice(2),
|
|
10002
|
+
area_code: customer.phone.slice(0, 2),
|
|
10003
|
+
},
|
|
10004
|
+
},
|
|
10005
|
+
},
|
|
10006
|
+
});
|
|
10007
|
+
return data;
|
|
10008
|
+
}
|
|
10009
|
+
catch (error) {
|
|
10010
|
+
console.warn(error);
|
|
10011
|
+
throw error;
|
|
10012
|
+
}
|
|
10013
|
+
}
|
|
10014
|
+
}
|
|
10015
|
+
|
|
10016
|
+
class PagarmeV5PixAxiosAdapter {
|
|
10017
|
+
constructor(credentials, paymentRepository) {
|
|
10018
|
+
this.credentials = credentials;
|
|
10019
|
+
this.paymentRepository = paymentRepository;
|
|
10020
|
+
}
|
|
10021
|
+
async pay(checkout) {
|
|
10022
|
+
try {
|
|
10023
|
+
const payload = PagarMeV5RequestHelper.build(checkout, 'pix');
|
|
10024
|
+
console.warn('[PAGARME PIX DATA TO SEND]', JSON.stringify(payload));
|
|
10025
|
+
const { data } = await axios({
|
|
10026
|
+
method: 'POST',
|
|
10027
|
+
url: `${this.credentials.URL}/orders`,
|
|
10028
|
+
headers: {
|
|
10029
|
+
Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
|
|
10030
|
+
'Content-Type': 'application/json',
|
|
10031
|
+
},
|
|
10032
|
+
data: payload,
|
|
10033
|
+
});
|
|
10034
|
+
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
10035
|
+
if (data.status == PagarMeV5OrderStatus.Falha || data.status == PagarMeV5OrderStatus.Cancelado) {
|
|
10036
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
10037
|
+
checkoutId: checkout.id,
|
|
10038
|
+
userEmail: checkout.user.email,
|
|
10039
|
+
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
10040
|
+
});
|
|
10041
|
+
}
|
|
10042
|
+
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.PIX, checkout, data));
|
|
10043
|
+
return payment;
|
|
10044
|
+
}
|
|
10045
|
+
catch (error) {
|
|
10046
|
+
if (error instanceof AxiosError) {
|
|
10047
|
+
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
10048
|
+
}
|
|
10049
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
10050
|
+
checkoutId: checkout.id,
|
|
10051
|
+
userEmail: checkout.user.email,
|
|
10052
|
+
info: error.response?.data,
|
|
10053
|
+
});
|
|
10054
|
+
}
|
|
10055
|
+
}
|
|
10056
|
+
}
|
|
10057
|
+
|
|
8784
10058
|
class VertexAxiosAdapter {
|
|
8785
10059
|
constructor(config) {
|
|
8786
10060
|
this.config = config;
|
|
@@ -8934,4 +10208,4 @@ class ProductsVertexSearch {
|
|
|
8934
10208
|
}
|
|
8935
10209
|
}
|
|
8936
10210
|
|
|
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 };
|
|
10211
|
+
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 };
|