@infrab4a/connect 1.0.0-beta.21 → 1.0.0-beta.23
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/bundles/infrab4a-connect.umd.js +17 -11
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/generic/repository/create.repository.d.ts +2 -2
- package/esm2015/domain/generic/repository/create.repository.js +1 -1
- package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +4 -4
- package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +2 -2
- package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +4 -2
- package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +2 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +3 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +8 -6
- package/fesm2015/infrab4a-connect.js +17 -11
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -1755,7 +1755,7 @@
|
|
|
1755
1755
|
fromFirestore: function (snap) {
|
|
1756
1756
|
var data = snap.data();
|
|
1757
1757
|
Object.keys(data).forEach(function (key) {
|
|
1758
|
-
if (typeof data[key] === 'object' && '_seconds' in data[key]) {
|
|
1758
|
+
if (data[key] && typeof data[key] === 'object' && '_seconds' in data[key]) {
|
|
1759
1759
|
data[key] = data[key].toDate();
|
|
1760
1760
|
}
|
|
1761
1761
|
});
|
|
@@ -1861,14 +1861,14 @@
|
|
|
1861
1861
|
return _this;
|
|
1862
1862
|
}
|
|
1863
1863
|
FindFirestore.prototype.find = function (_a) {
|
|
1864
|
-
var filters =
|
|
1864
|
+
var _b = _a === void 0 ? {} : _a, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
|
|
1865
1865
|
return __awaiter(this, void 0, void 0, function () {
|
|
1866
1866
|
var query, docs, data;
|
|
1867
1867
|
return __generator(this, function (_a) {
|
|
1868
1868
|
switch (_a.label) {
|
|
1869
1869
|
case 0:
|
|
1870
|
-
query = this.collection(this.buildCollectionPathForFind(filters));
|
|
1871
|
-
query = this.makeFirestoreWhere(query, filters);
|
|
1870
|
+
query = this.collection(this.buildCollectionPathForFind(filters || {}));
|
|
1871
|
+
query = this.makeFirestoreWhere(query, filters || {});
|
|
1872
1872
|
Object.keys(orderBy || {}).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
|
|
1873
1873
|
return [4 /*yield*/, this.defineLimits(query, filters, limits)];
|
|
1874
1874
|
case 1:
|
|
@@ -2404,7 +2404,9 @@
|
|
|
2404
2404
|
productIds = chunks_1_1.value;
|
|
2405
2405
|
if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
|
|
2406
2406
|
return [3 /*break*/, 6];
|
|
2407
|
-
return [4 /*yield*/, this.collection('
|
|
2407
|
+
return [4 /*yield*/, this.collection('productsErpVitrine')
|
|
2408
|
+
.where(publishedField, '==', true)
|
|
2409
|
+
.where('id', 'in', productIds)];
|
|
2408
2410
|
case 3:
|
|
2409
2411
|
query = _b.sent();
|
|
2410
2412
|
if (options === null || options === void 0 ? void 0 : options.hasStock)
|
|
@@ -2446,7 +2448,7 @@
|
|
|
2446
2448
|
var _this = _super.call(this) || this;
|
|
2447
2449
|
_this.firestore = firestore;
|
|
2448
2450
|
_this.reviews = {};
|
|
2449
|
-
_this.collectionName = '
|
|
2451
|
+
_this.collectionName = 'productsErpVitrine';
|
|
2450
2452
|
_this.model = Product;
|
|
2451
2453
|
return _this;
|
|
2452
2454
|
}
|
|
@@ -4019,6 +4021,8 @@
|
|
|
4019
4021
|
return __generator(this, function (_c) {
|
|
4020
4022
|
switch (_c.label) {
|
|
4021
4023
|
case 0:
|
|
4024
|
+
if (!reviews)
|
|
4025
|
+
return [2 /*return*/, []];
|
|
4022
4026
|
if (!('action' in reviews && reviews.action === 'remove')) return [3 /*break*/, 3];
|
|
4023
4027
|
return [4 /*yield*/, Promise.all(reviews.value.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
|
|
4024
4028
|
var review;
|
|
@@ -4221,15 +4225,17 @@
|
|
|
4221
4225
|
}, {}); },
|
|
4222
4226
|
bindFindFilter: function (sentence) {
|
|
4223
4227
|
var filters = Object.values(sentence).shift();
|
|
4224
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.price) && { price: filters.price })), (filters.fullPrice && { full_price: filters.fullPrice })), (filters.subscriberDiscountPercentage && {
|
|
4228
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
|
|
4225
4229
|
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
4226
|
-
})), (filters.subscriberPrice
|
|
4230
|
+
})), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
|
|
4231
|
+
subscriber_price: filters.subscriberPrice,
|
|
4232
|
+
}));
|
|
4227
4233
|
},
|
|
4228
|
-
bindPersistData: function (value
|
|
4234
|
+
bindPersistData: function (value) {
|
|
4229
4235
|
var priceData = Object.values(value).shift();
|
|
4230
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) && { price: priceData.price })), (priceData.fullPrice && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage && {
|
|
4236
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
|
|
4231
4237
|
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
4232
|
-
})), (priceData.subscriberPrice && { subscriber_price: priceData.subscriberPrice }));
|
|
4238
|
+
})), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
|
|
4233
4239
|
},
|
|
4234
4240
|
},
|
|
4235
4241
|
},
|