@infrab4a/connect-angular 3.10.5 → 3.11.0-beta.1
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-angular.umd.js +122 -294
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/angular-connect.module.js +2 -4
- package/esm2015/angular-hasura-graphql.module.js +2 -10
- package/esm2015/services/catalog/catalog.service.js +1 -1
- package/esm2015/services/catalog/index.js +1 -2
- package/esm2015/services/coupon.service.js +7 -11
- package/esm2015/services/index.js +1 -2
- package/fesm2015/infrab4a-connect-angular.js +78 -218
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/package.json +2 -2
- package/services/catalog/catalog.service.d.ts +4 -4
- package/services/catalog/index.d.ts +0 -1
- package/services/index.d.ts +0 -1
- package/esm2015/services/catalog/wishlist.service.js +0 -110
- package/esm2015/services/helpers/index.js +0 -2
- package/esm2015/services/helpers/util.service.js +0 -29
- package/services/catalog/wishlist.service.d.ts +0 -25
- package/services/helpers/index.d.ts +0 -1
- package/services/helpers/util.service.d.ts +0 -7
|
@@ -870,10 +870,6 @@
|
|
|
870
870
|
provide: 'CategoryCollectionChildrenRepository',
|
|
871
871
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
872
872
|
},
|
|
873
|
-
{
|
|
874
|
-
provide: 'WishlistRepository',
|
|
875
|
-
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
876
|
-
},
|
|
877
873
|
] });
|
|
878
874
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
|
|
879
875
|
type: i0.NgModule,
|
|
@@ -953,10 +949,6 @@
|
|
|
953
949
|
provide: 'CategoryCollectionChildrenRepository',
|
|
954
950
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
955
951
|
},
|
|
956
|
-
{
|
|
957
|
-
provide: 'WishlistRepository',
|
|
958
|
-
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
959
|
-
},
|
|
960
952
|
],
|
|
961
953
|
}]
|
|
962
954
|
}] });
|
|
@@ -1043,7 +1035,7 @@
|
|
|
1043
1035
|
};
|
|
1044
1036
|
CouponService.prototype.couponRulesValidation = function (coupon, checkoutType, checkout, plan) {
|
|
1045
1037
|
return __awaiter(this, void 0, void 0, function () {
|
|
1046
|
-
var validUser,
|
|
1038
|
+
var validUser, orders, ordersWithUser, couponUseLimits, hasProductCategories, hasMinSubTotal;
|
|
1047
1039
|
return __generator(this, function (_c) {
|
|
1048
1040
|
switch (_c.label) {
|
|
1049
1041
|
case 0:
|
|
@@ -1055,26 +1047,22 @@
|
|
|
1055
1047
|
validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
1056
1048
|
if (!validUser)
|
|
1057
1049
|
throw 'Usuário não elegível.';
|
|
1058
|
-
couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
1059
|
-
if (!(!couponUseLimits.unlimited || couponUseLimits.limitedPerUser)) return [3 /*break*/, 2];
|
|
1060
1050
|
return [4 /*yield*/, this.getOrdersWithCoupon(coupon)];
|
|
1061
1051
|
case 1:
|
|
1062
1052
|
orders = _c.sent();
|
|
1053
|
+
ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
1054
|
+
couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
1055
|
+
if (couponUseLimits.limitedPerUser && ordersWithUser > 0)
|
|
1056
|
+
throw 'Limite de uso por usuário atingido.';
|
|
1063
1057
|
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
1064
1058
|
throw 'Limite de uso atingido.';
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
if (ordersWithUser > 0)
|
|
1068
|
-
throw 'Limite de uso por usuário atingido.';
|
|
1069
|
-
}
|
|
1070
|
-
_c.label = 2;
|
|
1071
|
-
case 2: return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
1072
|
-
case 3:
|
|
1059
|
+
return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
1060
|
+
case 2:
|
|
1073
1061
|
hasProductCategories = _c.sent();
|
|
1074
1062
|
if (!hasProductCategories)
|
|
1075
1063
|
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
1076
1064
|
return [4 /*yield*/, this.hasMinSubTotal(coupon, checkout)];
|
|
1077
|
-
case
|
|
1065
|
+
case 3:
|
|
1078
1066
|
hasMinSubTotal = _c.sent();
|
|
1079
1067
|
if (!hasMinSubTotal)
|
|
1080
1068
|
throw "Valor m\u00EDnimo de " + Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue) + " n\u00E3o atingido";
|
|
@@ -2054,276 +2042,6 @@
|
|
|
2054
2042
|
__metadata("design:type", Array)
|
|
2055
2043
|
], CategoryWithTree.prototype, "children", void 0);
|
|
2056
2044
|
|
|
2057
|
-
var NewCategoryStructureAdapter = /** @class */ (function () {
|
|
2058
|
-
function NewCategoryStructureAdapter(categoryRepository, categoryCollectionChildrenRepository) {
|
|
2059
|
-
this.categoryRepository = categoryRepository;
|
|
2060
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
2061
|
-
}
|
|
2062
|
-
NewCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2063
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2064
|
-
var categoriesIds, _a, _b;
|
|
2065
|
-
return __generator(this, function (_c) {
|
|
2066
|
-
switch (_c.label) {
|
|
2067
|
-
case 0: return [4 /*yield*/, this.isCollection(category)];
|
|
2068
|
-
case 1:
|
|
2069
|
-
if (!(_c.sent())) return [3 /*break*/, 3];
|
|
2070
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCollection(category)];
|
|
2071
|
-
case 2:
|
|
2072
|
-
_a = _c.sent();
|
|
2073
|
-
return [3 /*break*/, 5];
|
|
2074
|
-
case 3:
|
|
2075
|
-
_b = [[]];
|
|
2076
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCategory(category)];
|
|
2077
|
-
case 4:
|
|
2078
|
-
_a = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c.sent())])])), [category.id.toString()]]);
|
|
2079
|
-
_c.label = 5;
|
|
2080
|
-
case 5:
|
|
2081
|
-
categoriesIds = _a;
|
|
2082
|
-
return [2 /*return*/, { category: { id: { operator: i1.Where.IN, value: categoriesIds } } }];
|
|
2083
|
-
}
|
|
2084
|
-
});
|
|
2085
|
-
});
|
|
2086
|
-
};
|
|
2087
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCategory = function (category) {
|
|
2088
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2089
|
-
return __generator(this, function (_a) {
|
|
2090
|
-
return [2 /*return*/, this.categoryRepository
|
|
2091
|
-
.getChildren(+category.id)
|
|
2092
|
-
.then(function (categories) { return categories.map(function (category) { return category.id.toString(); }); })];
|
|
2093
|
-
});
|
|
2094
|
-
});
|
|
2095
|
-
};
|
|
2096
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCollection = function (category) {
|
|
2097
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2098
|
-
return __generator(this, function (_a) {
|
|
2099
|
-
return [2 /*return*/, this.categoryCollectionChildrenRepository
|
|
2100
|
-
.find({ filters: { collectionId: +category.id } })
|
|
2101
|
-
.then(function (_a) {
|
|
2102
|
-
var data = _a.data;
|
|
2103
|
-
return data.map(function (categoryCollection) { return categoryCollection.categoryId.toString(); });
|
|
2104
|
-
})];
|
|
2105
|
-
});
|
|
2106
|
-
});
|
|
2107
|
-
};
|
|
2108
|
-
NewCategoryStructureAdapter.prototype.isCollection = function (category) {
|
|
2109
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2110
|
-
return __generator(this, function (_a) {
|
|
2111
|
-
return [2 /*return*/, !i1.isNil(category.isCollection)
|
|
2112
|
-
? category.isCollection
|
|
2113
|
-
: this.categoryRepository.get({ id: category.id }).then(function (category) { return category.isCollection; })];
|
|
2114
|
-
});
|
|
2115
|
-
});
|
|
2116
|
-
};
|
|
2117
|
-
return NewCategoryStructureAdapter;
|
|
2118
|
-
}());
|
|
2119
|
-
NewCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2120
|
-
NewCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter });
|
|
2121
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, decorators: [{
|
|
2122
|
-
type: i0.Injectable
|
|
2123
|
-
}], ctorParameters: function () {
|
|
2124
|
-
return [{ type: undefined, decorators: [{
|
|
2125
|
-
type: i0.Inject,
|
|
2126
|
-
args: ['CategoryRepository']
|
|
2127
|
-
}] }, { type: undefined, decorators: [{
|
|
2128
|
-
type: i0.Inject,
|
|
2129
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
2130
|
-
}] }];
|
|
2131
|
-
} });
|
|
2132
|
-
|
|
2133
|
-
var OldCategoryStructureAdapter = /** @class */ (function () {
|
|
2134
|
-
function OldCategoryStructureAdapter(categoryRepository) {
|
|
2135
|
-
this.categoryRepository = categoryRepository;
|
|
2136
|
-
}
|
|
2137
|
-
OldCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2138
|
-
var _a;
|
|
2139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2140
|
-
var productsIds, _b;
|
|
2141
|
-
return __generator(this, function (_c) {
|
|
2142
|
-
switch (_c.label) {
|
|
2143
|
-
case 0:
|
|
2144
|
-
if (!((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 1];
|
|
2145
|
-
_b = category.products;
|
|
2146
|
-
return [3 /*break*/, 3];
|
|
2147
|
-
case 1: return [4 /*yield*/, this.categoryRepository.get({ id: category.id }).then(function (categoryFound) { return categoryFound.products; })];
|
|
2148
|
-
case 2:
|
|
2149
|
-
_b = _c.sent();
|
|
2150
|
-
_c.label = 3;
|
|
2151
|
-
case 3:
|
|
2152
|
-
productsIds = _b;
|
|
2153
|
-
return [2 /*return*/, { id: { operator: i1.Where.IN, value: productsIds } }];
|
|
2154
|
-
}
|
|
2155
|
-
});
|
|
2156
|
-
});
|
|
2157
|
-
};
|
|
2158
|
-
return OldCategoryStructureAdapter;
|
|
2159
|
-
}());
|
|
2160
|
-
OldCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2161
|
-
OldCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter });
|
|
2162
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, decorators: [{
|
|
2163
|
-
type: i0.Injectable
|
|
2164
|
-
}], ctorParameters: function () {
|
|
2165
|
-
return [{ type: undefined, decorators: [{
|
|
2166
|
-
type: i0.Inject,
|
|
2167
|
-
args: ['CategoryRepository']
|
|
2168
|
-
}] }];
|
|
2169
|
-
} });
|
|
2170
|
-
|
|
2171
|
-
var UtilService = /** @class */ (function () {
|
|
2172
|
-
function UtilService() {
|
|
2173
|
-
}
|
|
2174
|
-
UtilService.prototype.createSlug = function (name) {
|
|
2175
|
-
return name
|
|
2176
|
-
.toLowerCase()
|
|
2177
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
2178
|
-
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
2179
|
-
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
2180
|
-
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
2181
|
-
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
2182
|
-
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
2183
|
-
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
2184
|
-
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
2185
|
-
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
2186
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
2187
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
2188
|
-
};
|
|
2189
|
-
return UtilService;
|
|
2190
|
-
}());
|
|
2191
|
-
UtilService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: UtilService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2192
|
-
UtilService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: UtilService, providedIn: 'root' });
|
|
2193
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: UtilService, decorators: [{
|
|
2194
|
-
type: i0.Injectable,
|
|
2195
|
-
args: [{
|
|
2196
|
-
providedIn: 'root',
|
|
2197
|
-
}]
|
|
2198
|
-
}], ctorParameters: function () { return []; } });
|
|
2199
|
-
|
|
2200
|
-
var WishlistService = /** @class */ (function () {
|
|
2201
|
-
function WishlistService(wishlistRepository, productRepository, categoryFilterRepository, categoryCollectionChildrenRepository, categoryStructureAdapter, shop, catalogService, categoryService, utilService) {
|
|
2202
|
-
if (categoryStructureAdapter === void 0) { categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository, categoryCollectionChildrenRepository); }
|
|
2203
|
-
if (catalogService === void 0) { catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop); }
|
|
2204
|
-
if (categoryService === void 0) { categoryService = new CategoryService(productRepository, wishlistRepository, categoryFilterRepository, categoryStructureAdapter, shop); }
|
|
2205
|
-
this.wishlistRepository = wishlistRepository;
|
|
2206
|
-
this.shop = shop;
|
|
2207
|
-
this.catalogService = catalogService;
|
|
2208
|
-
this.categoryService = categoryService;
|
|
2209
|
-
this.utilService = utilService;
|
|
2210
|
-
}
|
|
2211
|
-
WishlistService.prototype.getCatalogService = function () {
|
|
2212
|
-
return this.catalogService;
|
|
2213
|
-
};
|
|
2214
|
-
WishlistService.prototype.getCategoryService = function () {
|
|
2215
|
-
return this.categoryService;
|
|
2216
|
-
};
|
|
2217
|
-
WishlistService.prototype.create = function (personId, title, description, userFullName) {
|
|
2218
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2219
|
-
var data, newWishlist;
|
|
2220
|
-
return __generator(this, function (_a) {
|
|
2221
|
-
switch (_a.label) {
|
|
2222
|
-
case 0:
|
|
2223
|
-
data = {
|
|
2224
|
-
slug: this.utilService.createSlug("favoritos " + userFullName + " " + title),
|
|
2225
|
-
name: title,
|
|
2226
|
-
description: description,
|
|
2227
|
-
metadata: {
|
|
2228
|
-
title: userFullName + " - " + title,
|
|
2229
|
-
description: userFullName + " - " + description,
|
|
2230
|
-
},
|
|
2231
|
-
shop: this.shop,
|
|
2232
|
-
shops: [this.shop],
|
|
2233
|
-
personId: personId,
|
|
2234
|
-
brandCategory: false,
|
|
2235
|
-
published: true,
|
|
2236
|
-
};
|
|
2237
|
-
return [4 /*yield*/, this.wishlistRepository.create(data)];
|
|
2238
|
-
case 1:
|
|
2239
|
-
newWishlist = _a.sent();
|
|
2240
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id + "-" + newWishlist.slug })];
|
|
2241
|
-
}
|
|
2242
|
-
});
|
|
2243
|
-
});
|
|
2244
|
-
};
|
|
2245
|
-
WishlistService.prototype.update = function (id, title, description, userFullName) {
|
|
2246
|
-
var data = {
|
|
2247
|
-
id: id,
|
|
2248
|
-
slug: this.utilService.createSlug(id + "-favoritos " + userFullName + " " + title),
|
|
2249
|
-
name: title,
|
|
2250
|
-
description: description,
|
|
2251
|
-
metadata: {
|
|
2252
|
-
title: userFullName + " - " + title,
|
|
2253
|
-
description: userFullName + " - " + description,
|
|
2254
|
-
},
|
|
2255
|
-
};
|
|
2256
|
-
return this.wishlistRepository.update(data);
|
|
2257
|
-
};
|
|
2258
|
-
WishlistService.prototype.delete = function (wishlistId) {
|
|
2259
|
-
return this.wishlistRepository.delete({ id: wishlistId });
|
|
2260
|
-
};
|
|
2261
|
-
WishlistService.prototype.getWishlistBySlug = function (slug) {
|
|
2262
|
-
return this.wishlistRepository.getWishlistBySlug(slug);
|
|
2263
|
-
};
|
|
2264
|
-
WishlistService.prototype.getWishlistsByPerson = function (personId) {
|
|
2265
|
-
return this.wishlistRepository.getWishlistByPerson(personId);
|
|
2266
|
-
};
|
|
2267
|
-
WishlistService.prototype.addProduct = function (wishlistId, productId) {
|
|
2268
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2269
|
-
var wishlist, hasProduct;
|
|
2270
|
-
return __generator(this, function (_a) {
|
|
2271
|
-
switch (_a.label) {
|
|
2272
|
-
case 0: return [4 /*yield*/, this.wishlistRepository.get({ id: wishlistId })];
|
|
2273
|
-
case 1:
|
|
2274
|
-
wishlist = _a.sent();
|
|
2275
|
-
hasProduct = wishlist.products.some(function (p) { return p == productId; });
|
|
2276
|
-
if (!hasProduct) {
|
|
2277
|
-
wishlist.products = __spreadArray(__spreadArray([], __read(wishlist.products)), [productId]);
|
|
2278
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: wishlist.products })];
|
|
2279
|
-
}
|
|
2280
|
-
return [2 /*return*/, wishlist];
|
|
2281
|
-
}
|
|
2282
|
-
});
|
|
2283
|
-
});
|
|
2284
|
-
};
|
|
2285
|
-
WishlistService.prototype.removeProduct = function (wishlistId, productId) {
|
|
2286
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2287
|
-
var wishlist, productIndex;
|
|
2288
|
-
return __generator(this, function (_a) {
|
|
2289
|
-
switch (_a.label) {
|
|
2290
|
-
case 0: return [4 /*yield*/, this.wishlistRepository.get({ id: wishlistId })];
|
|
2291
|
-
case 1:
|
|
2292
|
-
wishlist = _a.sent();
|
|
2293
|
-
productIndex = wishlist.products.findIndex(function (p) { return p == productId; });
|
|
2294
|
-
if (productIndex != -1) {
|
|
2295
|
-
wishlist.products.splice(productIndex, 1);
|
|
2296
|
-
if (!wishlist.products.length)
|
|
2297
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } })];
|
|
2298
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: wishlist.products })];
|
|
2299
|
-
}
|
|
2300
|
-
return [2 /*return*/, wishlist];
|
|
2301
|
-
}
|
|
2302
|
-
});
|
|
2303
|
-
});
|
|
2304
|
-
};
|
|
2305
|
-
return WishlistService;
|
|
2306
|
-
}());
|
|
2307
|
-
WishlistService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2308
|
-
WishlistService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService });
|
|
2309
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService, decorators: [{
|
|
2310
|
-
type: i0.Injectable
|
|
2311
|
-
}], ctorParameters: function () {
|
|
2312
|
-
return [{ type: undefined, decorators: [{
|
|
2313
|
-
type: i0.Inject,
|
|
2314
|
-
args: ['WishlistRepository']
|
|
2315
|
-
}] }, { type: undefined, decorators: [{
|
|
2316
|
-
type: i0.Inject,
|
|
2317
|
-
args: ['ProductRepository']
|
|
2318
|
-
}] }, { type: undefined, decorators: [{
|
|
2319
|
-
type: i0.Inject,
|
|
2320
|
-
args: ['CategoryFilterRepository']
|
|
2321
|
-
}] }, { type: undefined }, { type: undefined }, { type: i1__namespace$1.Shops, decorators: [{
|
|
2322
|
-
type: i0.Inject,
|
|
2323
|
-
args: [DEFAULT_SHOP]
|
|
2324
|
-
}] }, { type: undefined }, { type: undefined }, { type: UtilService }];
|
|
2325
|
-
} });
|
|
2326
|
-
|
|
2327
2045
|
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
2328
2046
|
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
2329
2047
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
@@ -2629,6 +2347,120 @@
|
|
|
2629
2347
|
}] }, { type: HomeShopService }];
|
|
2630
2348
|
} });
|
|
2631
2349
|
|
|
2350
|
+
var NewCategoryStructureAdapter = /** @class */ (function () {
|
|
2351
|
+
function NewCategoryStructureAdapter(categoryRepository, categoryCollectionChildrenRepository) {
|
|
2352
|
+
this.categoryRepository = categoryRepository;
|
|
2353
|
+
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
2354
|
+
}
|
|
2355
|
+
NewCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2356
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2357
|
+
var categoriesIds, _a, _b;
|
|
2358
|
+
return __generator(this, function (_c) {
|
|
2359
|
+
switch (_c.label) {
|
|
2360
|
+
case 0: return [4 /*yield*/, this.isCollection(category)];
|
|
2361
|
+
case 1:
|
|
2362
|
+
if (!(_c.sent())) return [3 /*break*/, 3];
|
|
2363
|
+
return [4 /*yield*/, this.getAllCategoriesIdFromCollection(category)];
|
|
2364
|
+
case 2:
|
|
2365
|
+
_a = _c.sent();
|
|
2366
|
+
return [3 /*break*/, 5];
|
|
2367
|
+
case 3:
|
|
2368
|
+
_b = [[]];
|
|
2369
|
+
return [4 /*yield*/, this.getAllCategoriesIdFromCategory(category)];
|
|
2370
|
+
case 4:
|
|
2371
|
+
_a = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c.sent())])])), [category.id.toString()]]);
|
|
2372
|
+
_c.label = 5;
|
|
2373
|
+
case 5:
|
|
2374
|
+
categoriesIds = _a;
|
|
2375
|
+
return [2 /*return*/, { category: { id: { operator: i1.Where.IN, value: categoriesIds } } }];
|
|
2376
|
+
}
|
|
2377
|
+
});
|
|
2378
|
+
});
|
|
2379
|
+
};
|
|
2380
|
+
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCategory = function (category) {
|
|
2381
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2382
|
+
return __generator(this, function (_a) {
|
|
2383
|
+
return [2 /*return*/, this.categoryRepository
|
|
2384
|
+
.getChildren(+category.id)
|
|
2385
|
+
.then(function (categories) { return categories.map(function (category) { return category.id.toString(); }); })];
|
|
2386
|
+
});
|
|
2387
|
+
});
|
|
2388
|
+
};
|
|
2389
|
+
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCollection = function (category) {
|
|
2390
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2391
|
+
return __generator(this, function (_a) {
|
|
2392
|
+
return [2 /*return*/, this.categoryCollectionChildrenRepository
|
|
2393
|
+
.find({ filters: { collectionId: +category.id } })
|
|
2394
|
+
.then(function (_a) {
|
|
2395
|
+
var data = _a.data;
|
|
2396
|
+
return data.map(function (categoryCollection) { return categoryCollection.categoryId.toString(); });
|
|
2397
|
+
})];
|
|
2398
|
+
});
|
|
2399
|
+
});
|
|
2400
|
+
};
|
|
2401
|
+
NewCategoryStructureAdapter.prototype.isCollection = function (category) {
|
|
2402
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2403
|
+
return __generator(this, function (_a) {
|
|
2404
|
+
return [2 /*return*/, !i1.isNil(category.isCollection)
|
|
2405
|
+
? category.isCollection
|
|
2406
|
+
: this.categoryRepository.get({ id: category.id }).then(function (category) { return category.isCollection; })];
|
|
2407
|
+
});
|
|
2408
|
+
});
|
|
2409
|
+
};
|
|
2410
|
+
return NewCategoryStructureAdapter;
|
|
2411
|
+
}());
|
|
2412
|
+
NewCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2413
|
+
NewCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter });
|
|
2414
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, decorators: [{
|
|
2415
|
+
type: i0.Injectable
|
|
2416
|
+
}], ctorParameters: function () {
|
|
2417
|
+
return [{ type: undefined, decorators: [{
|
|
2418
|
+
type: i0.Inject,
|
|
2419
|
+
args: ['CategoryRepository']
|
|
2420
|
+
}] }, { type: undefined, decorators: [{
|
|
2421
|
+
type: i0.Inject,
|
|
2422
|
+
args: ['CategoryCollectionChildrenRepository']
|
|
2423
|
+
}] }];
|
|
2424
|
+
} });
|
|
2425
|
+
|
|
2426
|
+
var OldCategoryStructureAdapter = /** @class */ (function () {
|
|
2427
|
+
function OldCategoryStructureAdapter(categoryRepository) {
|
|
2428
|
+
this.categoryRepository = categoryRepository;
|
|
2429
|
+
}
|
|
2430
|
+
OldCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2431
|
+
var _a;
|
|
2432
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2433
|
+
var productsIds, _b;
|
|
2434
|
+
return __generator(this, function (_c) {
|
|
2435
|
+
switch (_c.label) {
|
|
2436
|
+
case 0:
|
|
2437
|
+
if (!((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 1];
|
|
2438
|
+
_b = category.products;
|
|
2439
|
+
return [3 /*break*/, 3];
|
|
2440
|
+
case 1: return [4 /*yield*/, this.categoryRepository.get({ id: category.id }).then(function (categoryFound) { return categoryFound.products; })];
|
|
2441
|
+
case 2:
|
|
2442
|
+
_b = _c.sent();
|
|
2443
|
+
_c.label = 3;
|
|
2444
|
+
case 3:
|
|
2445
|
+
productsIds = _b;
|
|
2446
|
+
return [2 /*return*/, { id: { operator: i1.Where.IN, value: productsIds } }];
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
});
|
|
2450
|
+
};
|
|
2451
|
+
return OldCategoryStructureAdapter;
|
|
2452
|
+
}());
|
|
2453
|
+
OldCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2454
|
+
OldCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter });
|
|
2455
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, decorators: [{
|
|
2456
|
+
type: i0.Injectable
|
|
2457
|
+
}], ctorParameters: function () {
|
|
2458
|
+
return [{ type: undefined, decorators: [{
|
|
2459
|
+
type: i0.Inject,
|
|
2460
|
+
args: ['CategoryRepository']
|
|
2461
|
+
}] }];
|
|
2462
|
+
} });
|
|
2463
|
+
|
|
2632
2464
|
var AngularConnectModule = /** @class */ (function () {
|
|
2633
2465
|
function AngularConnectModule() {
|
|
2634
2466
|
}
|
|
@@ -2660,7 +2492,6 @@
|
|
|
2660
2492
|
HomeShopService,
|
|
2661
2493
|
OrderService,
|
|
2662
2494
|
ShippingService,
|
|
2663
|
-
WishlistService,
|
|
2664
2495
|
], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
2665
2496
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
|
|
2666
2497
|
type: i0.NgModule,
|
|
@@ -2677,7 +2508,6 @@
|
|
|
2677
2508
|
HomeShopService,
|
|
2678
2509
|
OrderService,
|
|
2679
2510
|
ShippingService,
|
|
2680
|
-
WishlistService,
|
|
2681
2511
|
],
|
|
2682
2512
|
}]
|
|
2683
2513
|
}] });
|
|
@@ -2812,8 +2642,6 @@
|
|
|
2812
2642
|
exports.HomeShopService = HomeShopService;
|
|
2813
2643
|
exports.OrderService = OrderService;
|
|
2814
2644
|
exports.ShippingService = ShippingService;
|
|
2815
|
-
exports.UtilService = UtilService;
|
|
2816
|
-
exports.WishlistService = WishlistService;
|
|
2817
2645
|
|
|
2818
2646
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2819
2647
|
|