@infrab4a/connect 4.10.1-beta.4 → 4.11.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +113 -25
- package/index.esm.js +112 -26
- package/package.json +1 -1
- package/src/domain/catalog/models/category-base.d.ts +4 -2
- package/src/domain/catalog/models/filter.d.ts +1 -0
- package/src/domain/catalog/models/types/index.d.ts +1 -0
- package/src/domain/catalog/models/types/report-stock-notification.type.d.ts +21 -0
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +9 -1
- package/src/domain/shopping/index.d.ts +1 -0
- package/src/domain/shopping/models/index.d.ts +1 -0
- package/src/domain/shopping/models/order-blocked.d.ts +26 -0
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +6 -0
- package/src/domain/shopping/types/index.d.ts +1 -0
- package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +9 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +8 -1
package/index.cjs.js
CHANGED
|
@@ -90,13 +90,13 @@ class CategoryBase extends BaseModel {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
get glamMetadata() {
|
|
93
|
-
return this.
|
|
93
|
+
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.GLAMSHOP);
|
|
94
94
|
}
|
|
95
95
|
get mensMetadata() {
|
|
96
|
-
return this.
|
|
96
|
+
return this.metadatas.find((metadata) => metadata.shop === exports.Shops.MENSMARKET);
|
|
97
97
|
}
|
|
98
98
|
getMostRelevantByShop(shop) {
|
|
99
|
-
return this.
|
|
99
|
+
return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
tslib.__decorate([
|
|
@@ -2201,6 +2201,12 @@ tslib.__decorate([
|
|
|
2201
2201
|
tslib.__metadata("design:type", Payment)
|
|
2202
2202
|
], Order.prototype, "payment", void 0);
|
|
2203
2203
|
|
|
2204
|
+
class OrderBlocked extends BaseModel {
|
|
2205
|
+
static get identifiersFields() {
|
|
2206
|
+
return ['id'];
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2204
2210
|
class CheckoutSubscription extends BaseModel {
|
|
2205
2211
|
static get identifiersFields() {
|
|
2206
2212
|
return ['id'];
|
|
@@ -3592,6 +3598,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3592
3598
|
}
|
|
3593
3599
|
}
|
|
3594
3600
|
|
|
3601
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3602
|
+
constructor({ firestore, interceptors, }) {
|
|
3603
|
+
super({
|
|
3604
|
+
firestore,
|
|
3605
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3606
|
+
model: OrderBlocked,
|
|
3607
|
+
interceptors,
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3611
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3612
|
+
return this.create(OrderBlocked.toInstance({
|
|
3613
|
+
customer: {
|
|
3614
|
+
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3615
|
+
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3616
|
+
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3617
|
+
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3618
|
+
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3619
|
+
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3620
|
+
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3621
|
+
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3622
|
+
},
|
|
3623
|
+
blockType,
|
|
3624
|
+
limiteRange,
|
|
3625
|
+
type,
|
|
3626
|
+
card,
|
|
3627
|
+
checkout: {
|
|
3628
|
+
id: checkout.id,
|
|
3629
|
+
shop: checkout.shop,
|
|
3630
|
+
total: checkout.totalPrice,
|
|
3631
|
+
},
|
|
3632
|
+
date: new Date(),
|
|
3633
|
+
}));
|
|
3634
|
+
}
|
|
3635
|
+
formatZip(zip) {
|
|
3636
|
+
if (zip.length === 8)
|
|
3637
|
+
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3638
|
+
return zip;
|
|
3639
|
+
}
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3595
3642
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3596
3643
|
constructor({ firestore, interceptors }) {
|
|
3597
3644
|
super({
|
|
@@ -4614,6 +4661,7 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
4614
4661
|
fields: [
|
|
4615
4662
|
'id',
|
|
4616
4663
|
'description',
|
|
4664
|
+
'title',
|
|
4617
4665
|
'slug',
|
|
4618
4666
|
'enabled',
|
|
4619
4667
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -4758,7 +4806,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4758
4806
|
filters: {
|
|
4759
4807
|
columnName: 'filters',
|
|
4760
4808
|
foreignKeyColumn: { filter_id: 'id' },
|
|
4761
|
-
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
4809
|
+
fields: [{ filter: ['id', 'title', 'description', 'slug', 'enabled'] }],
|
|
4762
4810
|
bindPersistData: (value) => ({
|
|
4763
4811
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4764
4812
|
}),
|
|
@@ -4787,6 +4835,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4787
4835
|
}),
|
|
4788
4836
|
},
|
|
4789
4837
|
},
|
|
4838
|
+
{
|
|
4839
|
+
metadatas: {
|
|
4840
|
+
columnName: 'metadatas',
|
|
4841
|
+
fields: ['shop', 'title', 'description'],
|
|
4842
|
+
bindPersistData: (value) => ({
|
|
4843
|
+
metadatas: { data: value },
|
|
4844
|
+
}),
|
|
4845
|
+
},
|
|
4846
|
+
},
|
|
4790
4847
|
{ isCollection: { columnName: 'is_collection' } },
|
|
4791
4848
|
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4792
4849
|
'reference',
|
|
@@ -4801,14 +4858,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4801
4858
|
'theme',
|
|
4802
4859
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
4803
4860
|
{ mostRelevant: { columnName: 'most_relevant', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4861
|
+
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4804
4862
|
],
|
|
4805
4863
|
});
|
|
4806
4864
|
this.productRepository = productRepository;
|
|
4807
4865
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4808
4866
|
}
|
|
4809
4867
|
async create(params) {
|
|
4810
|
-
const { images,
|
|
4811
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false,
|
|
4868
|
+
const { images, mostRelevants, metadatas } = params, data = tslib.__rest(params, ["images", "mostRelevants", "metadatas"]);
|
|
4869
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadatas: metadatas || [{ shop: null, description: null, title: null }], mostRelevants: mostRelevants || {
|
|
4812
4870
|
[exports.Shops.GLAMSHOP]: null,
|
|
4813
4871
|
[exports.Shops.MENSMARKET]: null,
|
|
4814
4872
|
}, images: images || {
|
|
@@ -4831,12 +4889,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4831
4889
|
: super.get(identifiers);
|
|
4832
4890
|
}
|
|
4833
4891
|
async update(params) {
|
|
4834
|
-
const { products, id: checkId,
|
|
4892
|
+
const { products, id: checkId, metadatas, filters } = params, data = tslib.__rest(params, ["products", "id", "metadatas", "filters"]);
|
|
4835
4893
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4836
4894
|
const id = await this.getId(plainData.id);
|
|
4837
4895
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
4838
4896
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
4839
|
-
category.
|
|
4897
|
+
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
4840
4898
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
4841
4899
|
return category;
|
|
4842
4900
|
}
|
|
@@ -5012,10 +5070,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5012
5070
|
});
|
|
5013
5071
|
return plainData.products;
|
|
5014
5072
|
}
|
|
5015
|
-
async updateMetadata(categoryId, {
|
|
5016
|
-
if (Array.isArray(
|
|
5073
|
+
async updateMetadata(categoryId, { metadatas }) {
|
|
5074
|
+
if (Array.isArray(metadatas) && !metadatas.length)
|
|
5017
5075
|
return [];
|
|
5018
|
-
if (Array.isArray(
|
|
5076
|
+
if (Array.isArray(metadatas) && metadatas.length) {
|
|
5019
5077
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5020
5078
|
where: {
|
|
5021
5079
|
type: 'category_metadata_bool_exp',
|
|
@@ -5027,12 +5085,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5027
5085
|
objects: {
|
|
5028
5086
|
type: '[category_metadata_insert_input!]',
|
|
5029
5087
|
required: true,
|
|
5030
|
-
value:
|
|
5088
|
+
value: metadatas.map((m) => (Object.assign({ category_id: categoryId }, m))),
|
|
5031
5089
|
},
|
|
5032
5090
|
});
|
|
5033
|
-
return
|
|
5091
|
+
return metadatas;
|
|
5034
5092
|
}
|
|
5035
|
-
if ('action' in
|
|
5093
|
+
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
5036
5094
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5037
5095
|
where: {
|
|
5038
5096
|
type: 'category_metadata_bool_exp',
|
|
@@ -5135,6 +5193,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5135
5193
|
interceptors,
|
|
5136
5194
|
fields: [
|
|
5137
5195
|
'id',
|
|
5196
|
+
'title',
|
|
5138
5197
|
'description',
|
|
5139
5198
|
'slug',
|
|
5140
5199
|
'enabled',
|
|
@@ -5522,6 +5581,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5522
5581
|
enableCount: false,
|
|
5523
5582
|
},
|
|
5524
5583
|
});
|
|
5584
|
+
if (!result.data.length)
|
|
5585
|
+
return null;
|
|
5525
5586
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
5526
5587
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
5527
5588
|
return product;
|
|
@@ -5875,6 +5936,31 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5875
5936
|
email,
|
|
5876
5937
|
});
|
|
5877
5938
|
}
|
|
5939
|
+
async getNotificationsReport(params, orderBy, pagination) {
|
|
5940
|
+
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.productId && { product_id: { _eq: params.productId } })), (params.ean && { ean: { _eq: params.ean } })), (params.sku && { sku: { _eq: params.sku } })), (params.name && { name: { _iregex: params.name } })), (params.categoryId && { category_id: { _eq: params.categoryId } })), (params.category && { category: { _iregex: params.category } })), (params.reference && { category_reference: { _eq: params.reference } })), (params.emailsCount && { emails_registered: { _eq: params.emailsCount } }));
|
|
5941
|
+
const orderByField = {
|
|
5942
|
+
[orderBy.field]: orderBy.direction,
|
|
5943
|
+
};
|
|
5944
|
+
const { report_stock_notification } = await this.query('report_stock_notification', ['product_id', 'ean', 'sku', 'name', 'stock', 'category_id', 'category', 'reference', 'emails_registered'], {
|
|
5945
|
+
where: {
|
|
5946
|
+
type: 'report_stock_notification_bool_exp',
|
|
5947
|
+
value: query,
|
|
5948
|
+
required: true,
|
|
5949
|
+
},
|
|
5950
|
+
order_by: {
|
|
5951
|
+
type: '[report_stock_notification_order_by]',
|
|
5952
|
+
value: orderByField,
|
|
5953
|
+
required: true,
|
|
5954
|
+
},
|
|
5955
|
+
});
|
|
5956
|
+
const data = (pagination === null || pagination === void 0 ? void 0 : pagination.limit)
|
|
5957
|
+
? report_stock_notification.slice(pagination === null || pagination === void 0 ? void 0 : pagination.offset, (pagination === null || pagination === void 0 ? void 0 : pagination.offset) + (pagination === null || pagination === void 0 ? void 0 : pagination.limit))
|
|
5958
|
+
: report_stock_notification;
|
|
5959
|
+
return {
|
|
5960
|
+
data,
|
|
5961
|
+
count: report_stock_notification.length,
|
|
5962
|
+
};
|
|
5963
|
+
}
|
|
5878
5964
|
}
|
|
5879
5965
|
|
|
5880
5966
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -6082,8 +6168,8 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6082
6168
|
}
|
|
6083
6169
|
async create(params) {
|
|
6084
6170
|
var _a;
|
|
6085
|
-
const { images,
|
|
6086
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false,
|
|
6171
|
+
const { images, mostRelevants, metadatas } = params, data = tslib.__rest(params, ["images", "mostRelevants", "metadatas"]);
|
|
6172
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadatas: metadatas || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }], mostRelevants: mostRelevants || {
|
|
6087
6173
|
[exports.Shops.GLAMSHOP]: null,
|
|
6088
6174
|
[exports.Shops.MENSMARKET]: null,
|
|
6089
6175
|
}, images: images || {
|
|
@@ -6110,12 +6196,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6110
6196
|
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
|
|
6111
6197
|
}
|
|
6112
6198
|
async update(params) {
|
|
6113
|
-
const { products, id: checkId,
|
|
6199
|
+
const { products, id: checkId, metadatas, filters } = params, data = tslib.__rest(params, ["products", "id", "metadatas", "filters"]);
|
|
6114
6200
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6115
6201
|
const id = plainData.id;
|
|
6116
6202
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6117
6203
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6118
|
-
category.
|
|
6204
|
+
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
6119
6205
|
return category;
|
|
6120
6206
|
}
|
|
6121
6207
|
async getWishlistBySlug(slug) {
|
|
@@ -6227,12 +6313,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6227
6313
|
});
|
|
6228
6314
|
return plainData.products;
|
|
6229
6315
|
}
|
|
6230
|
-
async updateMetadata(categoryId, {
|
|
6231
|
-
if (Array.isArray(
|
|
6316
|
+
async updateMetadata(categoryId, { metadatas }) {
|
|
6317
|
+
if (Array.isArray(metadatas) && !metadatas.length)
|
|
6232
6318
|
return [];
|
|
6233
|
-
if (Array.isArray(
|
|
6319
|
+
if (Array.isArray(metadatas) && metadatas.length) {
|
|
6234
6320
|
const metadataUpdated = [];
|
|
6235
|
-
for (const data of
|
|
6321
|
+
for (const data of metadatas) {
|
|
6236
6322
|
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6237
6323
|
pk_columns: {
|
|
6238
6324
|
value: { category_id: categoryId, shop: data.shop },
|
|
@@ -6249,13 +6335,13 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6249
6335
|
}
|
|
6250
6336
|
return metadataUpdated;
|
|
6251
6337
|
}
|
|
6252
|
-
if ('action' in
|
|
6253
|
-
for (let i = 0; i <
|
|
6338
|
+
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
6339
|
+
for (let i = 0; i < metadatas.value.length; i++) {
|
|
6254
6340
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6255
6341
|
where: {
|
|
6256
6342
|
type: 'category_metadata_bool_exp',
|
|
6257
6343
|
required: true,
|
|
6258
|
-
value: { category_id: { _eq: categoryId }, shop:
|
|
6344
|
+
value: { category_id: { _eq: categoryId }, shop: metadatas.value[i].shop },
|
|
6259
6345
|
},
|
|
6260
6346
|
});
|
|
6261
6347
|
}
|
|
@@ -6462,6 +6548,8 @@ exports.Log = Log;
|
|
|
6462
6548
|
exports.Logger = Logger;
|
|
6463
6549
|
exports.NotFoundError = NotFoundError;
|
|
6464
6550
|
exports.Order = Order;
|
|
6551
|
+
exports.OrderBlocked = OrderBlocked;
|
|
6552
|
+
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
6465
6553
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
6466
6554
|
exports.Payment = Payment;
|
|
6467
6555
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
package/index.esm.js
CHANGED
|
@@ -84,13 +84,13 @@ class CategoryBase extends BaseModel {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
get glamMetadata() {
|
|
87
|
-
return this.
|
|
87
|
+
return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMSHOP);
|
|
88
88
|
}
|
|
89
89
|
get mensMetadata() {
|
|
90
|
-
return this.
|
|
90
|
+
return this.metadatas.find((metadata) => metadata.shop === Shops.MENSMARKET);
|
|
91
91
|
}
|
|
92
92
|
getMostRelevantByShop(shop) {
|
|
93
|
-
return this.
|
|
93
|
+
return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
__decorate([
|
|
@@ -2195,6 +2195,12 @@ __decorate([
|
|
|
2195
2195
|
__metadata("design:type", Payment)
|
|
2196
2196
|
], Order.prototype, "payment", void 0);
|
|
2197
2197
|
|
|
2198
|
+
class OrderBlocked extends BaseModel {
|
|
2199
|
+
static get identifiersFields() {
|
|
2200
|
+
return ['id'];
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2198
2204
|
class CheckoutSubscription extends BaseModel {
|
|
2199
2205
|
static get identifiersFields() {
|
|
2200
2206
|
return ['id'];
|
|
@@ -3586,6 +3592,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3586
3592
|
}
|
|
3587
3593
|
}
|
|
3588
3594
|
|
|
3595
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3596
|
+
constructor({ firestore, interceptors, }) {
|
|
3597
|
+
super({
|
|
3598
|
+
firestore,
|
|
3599
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3600
|
+
model: OrderBlocked,
|
|
3601
|
+
interceptors,
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
3605
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3606
|
+
return this.create(OrderBlocked.toInstance({
|
|
3607
|
+
customer: {
|
|
3608
|
+
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
3609
|
+
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
3610
|
+
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
3611
|
+
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
3612
|
+
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
3613
|
+
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
3614
|
+
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
3615
|
+
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
3616
|
+
},
|
|
3617
|
+
blockType,
|
|
3618
|
+
limiteRange,
|
|
3619
|
+
type,
|
|
3620
|
+
card,
|
|
3621
|
+
checkout: {
|
|
3622
|
+
id: checkout.id,
|
|
3623
|
+
shop: checkout.shop,
|
|
3624
|
+
total: checkout.totalPrice,
|
|
3625
|
+
},
|
|
3626
|
+
date: new Date(),
|
|
3627
|
+
}));
|
|
3628
|
+
}
|
|
3629
|
+
formatZip(zip) {
|
|
3630
|
+
if (zip.length === 8)
|
|
3631
|
+
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
3632
|
+
return zip;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3589
3636
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3590
3637
|
constructor({ firestore, interceptors }) {
|
|
3591
3638
|
super({
|
|
@@ -4608,6 +4655,7 @@ class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
4608
4655
|
fields: [
|
|
4609
4656
|
'id',
|
|
4610
4657
|
'description',
|
|
4658
|
+
'title',
|
|
4611
4659
|
'slug',
|
|
4612
4660
|
'enabled',
|
|
4613
4661
|
{ createdAt: { columnName: 'created_at' } },
|
|
@@ -4752,7 +4800,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4752
4800
|
filters: {
|
|
4753
4801
|
columnName: 'filters',
|
|
4754
4802
|
foreignKeyColumn: { filter_id: 'id' },
|
|
4755
|
-
fields: [{ filter: ['id', 'description', 'slug', 'enabled'] }],
|
|
4803
|
+
fields: [{ filter: ['id', 'title', 'description', 'slug', 'enabled'] }],
|
|
4756
4804
|
bindPersistData: (value) => ({
|
|
4757
4805
|
filters: { data: value.map((filter) => ({ filter_id: filter.id })) },
|
|
4758
4806
|
}),
|
|
@@ -4781,6 +4829,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4781
4829
|
}),
|
|
4782
4830
|
},
|
|
4783
4831
|
},
|
|
4832
|
+
{
|
|
4833
|
+
metadatas: {
|
|
4834
|
+
columnName: 'metadatas',
|
|
4835
|
+
fields: ['shop', 'title', 'description'],
|
|
4836
|
+
bindPersistData: (value) => ({
|
|
4837
|
+
metadatas: { data: value },
|
|
4838
|
+
}),
|
|
4839
|
+
},
|
|
4840
|
+
},
|
|
4784
4841
|
{ isCollection: { columnName: 'is_collection' } },
|
|
4785
4842
|
{ isWishlist: { columnName: 'is_wishlist' } },
|
|
4786
4843
|
'reference',
|
|
@@ -4795,14 +4852,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4795
4852
|
'theme',
|
|
4796
4853
|
{ bannerUrl: { columnName: 'banner_url' } },
|
|
4797
4854
|
{ mostRelevant: { columnName: 'most_relevant', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4855
|
+
{ mostRelevants: { columnName: 'most_relevants', type: HasuraGraphQLColumnType.Jsonb } },
|
|
4798
4856
|
],
|
|
4799
4857
|
});
|
|
4800
4858
|
this.productRepository = productRepository;
|
|
4801
4859
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4802
4860
|
}
|
|
4803
4861
|
async create(params) {
|
|
4804
|
-
const { images,
|
|
4805
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false,
|
|
4862
|
+
const { images, mostRelevants, metadatas } = params, data = __rest(params, ["images", "mostRelevants", "metadatas"]);
|
|
4863
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadatas: metadatas || [{ shop: null, description: null, title: null }], mostRelevants: mostRelevants || {
|
|
4806
4864
|
[Shops.GLAMSHOP]: null,
|
|
4807
4865
|
[Shops.MENSMARKET]: null,
|
|
4808
4866
|
}, images: images || {
|
|
@@ -4825,12 +4883,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4825
4883
|
: super.get(identifiers);
|
|
4826
4884
|
}
|
|
4827
4885
|
async update(params) {
|
|
4828
|
-
const { products, id: checkId,
|
|
4886
|
+
const { products, id: checkId, metadatas, filters } = params, data = __rest(params, ["products", "id", "metadatas", "filters"]);
|
|
4829
4887
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4830
4888
|
const id = await this.getId(plainData.id);
|
|
4831
4889
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
4832
4890
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
4833
|
-
category.
|
|
4891
|
+
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
4834
4892
|
category.filters = filters && (await this.updateFilters(+id, { filters }));
|
|
4835
4893
|
return category;
|
|
4836
4894
|
}
|
|
@@ -5006,10 +5064,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5006
5064
|
});
|
|
5007
5065
|
return plainData.products;
|
|
5008
5066
|
}
|
|
5009
|
-
async updateMetadata(categoryId, {
|
|
5010
|
-
if (Array.isArray(
|
|
5067
|
+
async updateMetadata(categoryId, { metadatas }) {
|
|
5068
|
+
if (Array.isArray(metadatas) && !metadatas.length)
|
|
5011
5069
|
return [];
|
|
5012
|
-
if (Array.isArray(
|
|
5070
|
+
if (Array.isArray(metadatas) && metadatas.length) {
|
|
5013
5071
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5014
5072
|
where: {
|
|
5015
5073
|
type: 'category_metadata_bool_exp',
|
|
@@ -5021,12 +5079,12 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5021
5079
|
objects: {
|
|
5022
5080
|
type: '[category_metadata_insert_input!]',
|
|
5023
5081
|
required: true,
|
|
5024
|
-
value:
|
|
5082
|
+
value: metadatas.map((m) => (Object.assign({ category_id: categoryId }, m))),
|
|
5025
5083
|
},
|
|
5026
5084
|
});
|
|
5027
|
-
return
|
|
5085
|
+
return metadatas;
|
|
5028
5086
|
}
|
|
5029
|
-
if ('action' in
|
|
5087
|
+
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
5030
5088
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
5031
5089
|
where: {
|
|
5032
5090
|
type: 'category_metadata_bool_exp',
|
|
@@ -5129,6 +5187,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5129
5187
|
interceptors,
|
|
5130
5188
|
fields: [
|
|
5131
5189
|
'id',
|
|
5190
|
+
'title',
|
|
5132
5191
|
'description',
|
|
5133
5192
|
'slug',
|
|
5134
5193
|
'enabled',
|
|
@@ -5516,6 +5575,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5516
5575
|
enableCount: false,
|
|
5517
5576
|
},
|
|
5518
5577
|
});
|
|
5578
|
+
if (!result.data.length)
|
|
5579
|
+
return null;
|
|
5519
5580
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
5520
5581
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
5521
5582
|
return product;
|
|
@@ -5869,6 +5930,31 @@ class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGrap
|
|
|
5869
5930
|
email,
|
|
5870
5931
|
});
|
|
5871
5932
|
}
|
|
5933
|
+
async getNotificationsReport(params, orderBy, pagination) {
|
|
5934
|
+
const query = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.productId && { product_id: { _eq: params.productId } })), (params.ean && { ean: { _eq: params.ean } })), (params.sku && { sku: { _eq: params.sku } })), (params.name && { name: { _iregex: params.name } })), (params.categoryId && { category_id: { _eq: params.categoryId } })), (params.category && { category: { _iregex: params.category } })), (params.reference && { category_reference: { _eq: params.reference } })), (params.emailsCount && { emails_registered: { _eq: params.emailsCount } }));
|
|
5935
|
+
const orderByField = {
|
|
5936
|
+
[orderBy.field]: orderBy.direction,
|
|
5937
|
+
};
|
|
5938
|
+
const { report_stock_notification } = await this.query('report_stock_notification', ['product_id', 'ean', 'sku', 'name', 'stock', 'category_id', 'category', 'reference', 'emails_registered'], {
|
|
5939
|
+
where: {
|
|
5940
|
+
type: 'report_stock_notification_bool_exp',
|
|
5941
|
+
value: query,
|
|
5942
|
+
required: true,
|
|
5943
|
+
},
|
|
5944
|
+
order_by: {
|
|
5945
|
+
type: '[report_stock_notification_order_by]',
|
|
5946
|
+
value: orderByField,
|
|
5947
|
+
required: true,
|
|
5948
|
+
},
|
|
5949
|
+
});
|
|
5950
|
+
const data = (pagination === null || pagination === void 0 ? void 0 : pagination.limit)
|
|
5951
|
+
? report_stock_notification.slice(pagination === null || pagination === void 0 ? void 0 : pagination.offset, (pagination === null || pagination === void 0 ? void 0 : pagination.offset) + (pagination === null || pagination === void 0 ? void 0 : pagination.limit))
|
|
5952
|
+
: report_stock_notification;
|
|
5953
|
+
return {
|
|
5954
|
+
data,
|
|
5955
|
+
count: report_stock_notification.length,
|
|
5956
|
+
};
|
|
5957
|
+
}
|
|
5872
5958
|
}
|
|
5873
5959
|
|
|
5874
5960
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -6076,8 +6162,8 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6076
6162
|
}
|
|
6077
6163
|
async create(params) {
|
|
6078
6164
|
var _a;
|
|
6079
|
-
const { images,
|
|
6080
|
-
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false,
|
|
6165
|
+
const { images, mostRelevants, metadatas } = params, data = __rest(params, ["images", "mostRelevants", "metadatas"]);
|
|
6166
|
+
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadatas: metadatas || [{ shop: (_a = data.shop) !== null && _a !== void 0 ? _a : null, description: data.description, title: data.name }], mostRelevants: mostRelevants || {
|
|
6081
6167
|
[Shops.GLAMSHOP]: null,
|
|
6082
6168
|
[Shops.MENSMARKET]: null,
|
|
6083
6169
|
}, images: images || {
|
|
@@ -6104,12 +6190,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6104
6190
|
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
|
|
6105
6191
|
}
|
|
6106
6192
|
async update(params) {
|
|
6107
|
-
const { products, id: checkId,
|
|
6193
|
+
const { products, id: checkId, metadatas, filters } = params, data = __rest(params, ["products", "id", "metadatas", "filters"]);
|
|
6108
6194
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6109
6195
|
const id = plainData.id;
|
|
6110
6196
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
6111
6197
|
category.products = products && (await this.updateProducts(+id, { products }));
|
|
6112
|
-
category.
|
|
6198
|
+
category.metadatas = metadatas && (await this.updateMetadata(+id, { metadatas }));
|
|
6113
6199
|
return category;
|
|
6114
6200
|
}
|
|
6115
6201
|
async getWishlistBySlug(slug) {
|
|
@@ -6221,12 +6307,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6221
6307
|
});
|
|
6222
6308
|
return plainData.products;
|
|
6223
6309
|
}
|
|
6224
|
-
async updateMetadata(categoryId, {
|
|
6225
|
-
if (Array.isArray(
|
|
6310
|
+
async updateMetadata(categoryId, { metadatas }) {
|
|
6311
|
+
if (Array.isArray(metadatas) && !metadatas.length)
|
|
6226
6312
|
return [];
|
|
6227
|
-
if (Array.isArray(
|
|
6313
|
+
if (Array.isArray(metadatas) && metadatas.length) {
|
|
6228
6314
|
const metadataUpdated = [];
|
|
6229
|
-
for (const data of
|
|
6315
|
+
for (const data of metadatas) {
|
|
6230
6316
|
const update = await this.mutation('update_category_metadata_by_pk', ['category_id', 'shop'], {
|
|
6231
6317
|
pk_columns: {
|
|
6232
6318
|
value: { category_id: categoryId, shop: data.shop },
|
|
@@ -6243,13 +6329,13 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6243
6329
|
}
|
|
6244
6330
|
return metadataUpdated;
|
|
6245
6331
|
}
|
|
6246
|
-
if ('action' in
|
|
6247
|
-
for (let i = 0; i <
|
|
6332
|
+
if ('action' in metadatas && metadatas.action === 'remove' && metadatas.value.length) {
|
|
6333
|
+
for (let i = 0; i < metadatas.value.length; i++) {
|
|
6248
6334
|
await this.mutation('delete_category_metadata', ['affected_rows'], {
|
|
6249
6335
|
where: {
|
|
6250
6336
|
type: 'category_metadata_bool_exp',
|
|
6251
6337
|
required: true,
|
|
6252
|
-
value: { category_id: { _eq: categoryId }, shop:
|
|
6338
|
+
value: { category_id: { _eq: categoryId }, shop: metadatas.value[i].shop },
|
|
6253
6339
|
},
|
|
6254
6340
|
});
|
|
6255
6341
|
}
|
|
@@ -6282,4 +6368,4 @@ __decorate([
|
|
|
6282
6368
|
__metadata("design:returntype", Promise)
|
|
6283
6369
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6284
6370
|
|
|
6285
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, 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, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
6371
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, 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, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -20,14 +20,16 @@ export declare class CategoryBase<ChildCategory extends ModelBaseStructure<Child
|
|
|
20
20
|
shop?: Shops;
|
|
21
21
|
shops?: string[];
|
|
22
22
|
published: boolean;
|
|
23
|
-
metadata: CategoryMetadata
|
|
23
|
+
metadata: CategoryMetadata;
|
|
24
|
+
metadatas: CategoryMetadata[];
|
|
24
25
|
isCollection?: boolean;
|
|
25
26
|
isWishlist?: boolean;
|
|
26
27
|
reference?: string;
|
|
27
28
|
parentId?: number;
|
|
28
29
|
theme?: string;
|
|
29
30
|
bannerUrl?: string;
|
|
30
|
-
mostRelevant?:
|
|
31
|
+
mostRelevant?: string[];
|
|
32
|
+
mostRelevants?: CategoryMostRelevant;
|
|
31
33
|
parent?: CategoryBase;
|
|
32
34
|
filters?: Filter[];
|
|
33
35
|
static get identifiersFields(): GenericIdentifier[];
|
|
@@ -7,6 +7,7 @@ export * from './product-evaluation.type';
|
|
|
7
7
|
export * from './product-gender.type';
|
|
8
8
|
export * from './product-metadata.type';
|
|
9
9
|
export * from './product-review.type';
|
|
10
|
+
export * from './report-stock-notification.type';
|
|
10
11
|
export * from './shop-description.type';
|
|
11
12
|
export * from './shop-price.type';
|
|
12
13
|
export * from './stock.type';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ReportStockNotification = {
|
|
2
|
+
product_id: string;
|
|
3
|
+
ean: string;
|
|
4
|
+
sku: string;
|
|
5
|
+
name: string;
|
|
6
|
+
stock: number;
|
|
7
|
+
category: string;
|
|
8
|
+
category_id: string;
|
|
9
|
+
category_reference: string;
|
|
10
|
+
emails_registered: number;
|
|
11
|
+
};
|
|
12
|
+
export type ReportStockNotificationInput = {
|
|
13
|
+
productId?: string;
|
|
14
|
+
ean?: string;
|
|
15
|
+
sku?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
category?: string;
|
|
18
|
+
categoryId?: string;
|
|
19
|
+
reference?: string;
|
|
20
|
+
emailsCount?: number;
|
|
21
|
+
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { RepositoryFindResult } from '../../generic';
|
|
1
2
|
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
-
import { ProductStockNotification, Shops } from '../models';
|
|
3
|
+
import { ProductStockNotification, ReportStockNotification, ReportStockNotificationInput, Shops } from '../models';
|
|
3
4
|
export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
|
|
4
5
|
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
6
|
+
getNotificationsReport(params: ReportStockNotificationInput, orderBy: {
|
|
7
|
+
field: string;
|
|
8
|
+
direction: string;
|
|
9
|
+
}, pagination?: {
|
|
10
|
+
offset: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
}): Promise<RepositoryFindResult<ReportStockNotification>>;
|
|
5
13
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseModel, GenericIdentifier } from '../../generic';
|
|
2
|
+
import { UserAddress } from '../../users';
|
|
3
|
+
export declare class OrderBlocked extends BaseModel<OrderBlocked> {
|
|
4
|
+
id?: string;
|
|
5
|
+
customer: {
|
|
6
|
+
name: string;
|
|
7
|
+
cpf: string;
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
phoneNumber: string;
|
|
11
|
+
isSubscriber: boolean;
|
|
12
|
+
subscriptionPlan: string;
|
|
13
|
+
shippingAddress: UserAddress;
|
|
14
|
+
};
|
|
15
|
+
blockType: string;
|
|
16
|
+
limiteRange: string;
|
|
17
|
+
type: string;
|
|
18
|
+
card?: any;
|
|
19
|
+
checkout: {
|
|
20
|
+
id: string;
|
|
21
|
+
shop: string;
|
|
22
|
+
total: number;
|
|
23
|
+
};
|
|
24
|
+
date: Date;
|
|
25
|
+
static get identifiersFields(): GenericIdentifier[];
|
|
26
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './campaign-hashtag.repository';
|
|
|
4
4
|
export * from './checkout.repository';
|
|
5
5
|
export * from './coupon.repository';
|
|
6
6
|
export * from './legacy-order.repository';
|
|
7
|
+
export * from './order-blocked.repository';
|
|
7
8
|
export * from './order.repository';
|
|
8
9
|
export * from './payment.repository';
|
|
9
10
|
export * from './subscription';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
+
import { Checkout, OrderBlocked } from '../models';
|
|
3
|
+
import { PaymentCardInfo } from '../types';
|
|
4
|
+
export interface OrderBlockedRepository extends CrudRepository<OrderBlocked> {
|
|
5
|
+
createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payment-card-info.type';
|
|
@@ -5,6 +5,7 @@ export * from './checkout-firestore.repository';
|
|
|
5
5
|
export * from './checkout-subscription-firestore.repository';
|
|
6
6
|
export * from './coupon-firestore.repository';
|
|
7
7
|
export * from './legacy-order-firestore.repository';
|
|
8
|
+
export * from './order-blocked-firestore.repository.ts';
|
|
8
9
|
export * from './order-firestore.repository';
|
|
9
10
|
export * from './payment-firestore.repository';
|
|
10
11
|
export * from './subscription-plan-firestore.repository';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Checkout, OrderBlocked, OrderBlockedRepository, PaymentCardInfo } from '../../../../../domain';
|
|
2
|
+
import { FirestoreConstructorParams } from '../../mixins';
|
|
3
|
+
declare const OrderBlockedFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<OrderBlocked> & import("../../../../../domain").CrudRepository<OrderBlocked, import("../../../../../domain").CrudParams<OrderBlocked>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<OrderBlocked>, ...any[]]>;
|
|
4
|
+
export declare class OrderBlockedFirestoreRepository extends OrderBlockedFirestoreRepository_base implements OrderBlockedRepository {
|
|
5
|
+
constructor({ firestore, interceptors, }: Pick<FirestoreConstructorParams<OrderBlocked>, 'firestore' | 'interceptors'>);
|
|
6
|
+
createBlockedOrderOrPayment(checkout: Checkout, blockType: string, type: string, limiteRange: string, card?: PaymentCardInfo): Promise<OrderBlocked>;
|
|
7
|
+
private formatZip;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Filter, ProductStockNotification, Shops } from '../../../../domain';
|
|
1
|
+
import { Filter, ProductStockNotification, ReportStockNotification, ReportStockNotificationInput, RepositoryFindResult, Shops } from '../../../../domain';
|
|
2
2
|
import { ProductStockNotificationRepository } from '../../../../domain/catalog/repositories';
|
|
3
3
|
import { HasuraConstructorParams } from '../../mixins';
|
|
4
4
|
declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<ProductStockNotification> & import("../../../../domain").CrudRepository<ProductStockNotification, import("../../../../domain").CrudParams<ProductStockNotification>> & import("../../../../domain").UpdateRepository<ProductStockNotification, import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>> & {
|
|
@@ -7,5 +7,12 @@ declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../.
|
|
|
7
7
|
export declare class ProductStockNotificationHasuraGraphQLRepository extends ProductStockNotificationHasuraGraphQLRepository_base implements ProductStockNotificationRepository {
|
|
8
8
|
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors'>);
|
|
9
9
|
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
10
|
+
getNotificationsReport(params: ReportStockNotificationInput, orderBy: {
|
|
11
|
+
field: string;
|
|
12
|
+
direction: string;
|
|
13
|
+
}, pagination?: {
|
|
14
|
+
offset: number;
|
|
15
|
+
limit: number;
|
|
16
|
+
}): Promise<RepositoryFindResult<ReportStockNotification>>;
|
|
10
17
|
}
|
|
11
18
|
export {};
|