@infrab4a/connect-angular 3.10.2 → 3.10.4
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 +280 -114
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/angular-hasura-graphql.module.js +10 -2
- package/esm2015/services/catalog/catalog.service.js +1 -1
- package/esm2015/services/catalog/index.js +2 -1
- package/esm2015/services/catalog/wishlist.service.js +110 -0
- package/esm2015/services/helpers/index.js +2 -0
- package/esm2015/services/helpers/util.service.js +29 -0
- package/esm2015/services/index.js +2 -1
- package/fesm2015/infrab4a-connect-angular.js +206 -72
- 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 +1 -0
- package/services/catalog/wishlist.service.d.ts +25 -0
- package/services/helpers/index.d.ts +1 -0
- package/services/helpers/util.service.d.ts +7 -0
- package/services/index.d.ts +1 -0
|
@@ -870,6 +870,10 @@
|
|
|
870
870
|
provide: 'CategoryCollectionChildrenRepository',
|
|
871
871
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
872
872
|
},
|
|
873
|
+
{
|
|
874
|
+
provide: 'WishlistRepository',
|
|
875
|
+
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
876
|
+
},
|
|
873
877
|
] });
|
|
874
878
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
|
|
875
879
|
type: i0.NgModule,
|
|
@@ -949,6 +953,10 @@
|
|
|
949
953
|
provide: 'CategoryCollectionChildrenRepository',
|
|
950
954
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
951
955
|
},
|
|
956
|
+
{
|
|
957
|
+
provide: 'WishlistRepository',
|
|
958
|
+
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
959
|
+
},
|
|
952
960
|
],
|
|
953
961
|
}]
|
|
954
962
|
}] });
|
|
@@ -2046,6 +2054,276 @@
|
|
|
2046
2054
|
__metadata("design:type", Array)
|
|
2047
2055
|
], CategoryWithTree.prototype, "children", void 0);
|
|
2048
2056
|
|
|
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
|
+
|
|
2049
2327
|
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
2050
2328
|
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
2051
2329
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
@@ -2351,120 +2629,6 @@
|
|
|
2351
2629
|
}] }, { type: HomeShopService }];
|
|
2352
2630
|
} });
|
|
2353
2631
|
|
|
2354
|
-
var NewCategoryStructureAdapter = /** @class */ (function () {
|
|
2355
|
-
function NewCategoryStructureAdapter(categoryRepository, categoryCollectionChildrenRepository) {
|
|
2356
|
-
this.categoryRepository = categoryRepository;
|
|
2357
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
2358
|
-
}
|
|
2359
|
-
NewCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2360
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2361
|
-
var categoriesIds, _a, _b;
|
|
2362
|
-
return __generator(this, function (_c) {
|
|
2363
|
-
switch (_c.label) {
|
|
2364
|
-
case 0: return [4 /*yield*/, this.isCollection(category)];
|
|
2365
|
-
case 1:
|
|
2366
|
-
if (!(_c.sent())) return [3 /*break*/, 3];
|
|
2367
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCollection(category)];
|
|
2368
|
-
case 2:
|
|
2369
|
-
_a = _c.sent();
|
|
2370
|
-
return [3 /*break*/, 5];
|
|
2371
|
-
case 3:
|
|
2372
|
-
_b = [[]];
|
|
2373
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCategory(category)];
|
|
2374
|
-
case 4:
|
|
2375
|
-
_a = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c.sent())])])), [category.id.toString()]]);
|
|
2376
|
-
_c.label = 5;
|
|
2377
|
-
case 5:
|
|
2378
|
-
categoriesIds = _a;
|
|
2379
|
-
return [2 /*return*/, { category: { id: { operator: i1.Where.IN, value: categoriesIds } } }];
|
|
2380
|
-
}
|
|
2381
|
-
});
|
|
2382
|
-
});
|
|
2383
|
-
};
|
|
2384
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCategory = function (category) {
|
|
2385
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2386
|
-
return __generator(this, function (_a) {
|
|
2387
|
-
return [2 /*return*/, this.categoryRepository
|
|
2388
|
-
.getChildren(+category.id)
|
|
2389
|
-
.then(function (categories) { return categories.map(function (category) { return category.id.toString(); }); })];
|
|
2390
|
-
});
|
|
2391
|
-
});
|
|
2392
|
-
};
|
|
2393
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCollection = function (category) {
|
|
2394
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2395
|
-
return __generator(this, function (_a) {
|
|
2396
|
-
return [2 /*return*/, this.categoryCollectionChildrenRepository
|
|
2397
|
-
.find({ filters: { collectionId: +category.id } })
|
|
2398
|
-
.then(function (_a) {
|
|
2399
|
-
var data = _a.data;
|
|
2400
|
-
return data.map(function (categoryCollection) { return categoryCollection.categoryId.toString(); });
|
|
2401
|
-
})];
|
|
2402
|
-
});
|
|
2403
|
-
});
|
|
2404
|
-
};
|
|
2405
|
-
NewCategoryStructureAdapter.prototype.isCollection = function (category) {
|
|
2406
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2407
|
-
return __generator(this, function (_a) {
|
|
2408
|
-
return [2 /*return*/, !i1.isNil(category.isCollection)
|
|
2409
|
-
? category.isCollection
|
|
2410
|
-
: this.categoryRepository.get({ id: category.id }).then(function (category) { return category.isCollection; })];
|
|
2411
|
-
});
|
|
2412
|
-
});
|
|
2413
|
-
};
|
|
2414
|
-
return NewCategoryStructureAdapter;
|
|
2415
|
-
}());
|
|
2416
|
-
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 });
|
|
2417
|
-
NewCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter });
|
|
2418
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, decorators: [{
|
|
2419
|
-
type: i0.Injectable
|
|
2420
|
-
}], ctorParameters: function () {
|
|
2421
|
-
return [{ type: undefined, decorators: [{
|
|
2422
|
-
type: i0.Inject,
|
|
2423
|
-
args: ['CategoryRepository']
|
|
2424
|
-
}] }, { type: undefined, decorators: [{
|
|
2425
|
-
type: i0.Inject,
|
|
2426
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
2427
|
-
}] }];
|
|
2428
|
-
} });
|
|
2429
|
-
|
|
2430
|
-
var OldCategoryStructureAdapter = /** @class */ (function () {
|
|
2431
|
-
function OldCategoryStructureAdapter(categoryRepository) {
|
|
2432
|
-
this.categoryRepository = categoryRepository;
|
|
2433
|
-
}
|
|
2434
|
-
OldCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2435
|
-
var _a;
|
|
2436
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2437
|
-
var productsIds, _b;
|
|
2438
|
-
return __generator(this, function (_c) {
|
|
2439
|
-
switch (_c.label) {
|
|
2440
|
-
case 0:
|
|
2441
|
-
if (!((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 1];
|
|
2442
|
-
_b = category.products;
|
|
2443
|
-
return [3 /*break*/, 3];
|
|
2444
|
-
case 1: return [4 /*yield*/, this.categoryRepository.get({ id: category.id }).then(function (categoryFound) { return categoryFound.products; })];
|
|
2445
|
-
case 2:
|
|
2446
|
-
_b = _c.sent();
|
|
2447
|
-
_c.label = 3;
|
|
2448
|
-
case 3:
|
|
2449
|
-
productsIds = _b;
|
|
2450
|
-
return [2 /*return*/, { id: { operator: i1.Where.IN, value: productsIds } }];
|
|
2451
|
-
}
|
|
2452
|
-
});
|
|
2453
|
-
});
|
|
2454
|
-
};
|
|
2455
|
-
return OldCategoryStructureAdapter;
|
|
2456
|
-
}());
|
|
2457
|
-
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 });
|
|
2458
|
-
OldCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter });
|
|
2459
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, decorators: [{
|
|
2460
|
-
type: i0.Injectable
|
|
2461
|
-
}], ctorParameters: function () {
|
|
2462
|
-
return [{ type: undefined, decorators: [{
|
|
2463
|
-
type: i0.Inject,
|
|
2464
|
-
args: ['CategoryRepository']
|
|
2465
|
-
}] }];
|
|
2466
|
-
} });
|
|
2467
|
-
|
|
2468
2632
|
var AngularConnectModule = /** @class */ (function () {
|
|
2469
2633
|
function AngularConnectModule() {
|
|
2470
2634
|
}
|
|
@@ -2646,6 +2810,8 @@
|
|
|
2646
2810
|
exports.HomeShopService = HomeShopService;
|
|
2647
2811
|
exports.OrderService = OrderService;
|
|
2648
2812
|
exports.ShippingService = ShippingService;
|
|
2813
|
+
exports.UtilService = UtilService;
|
|
2814
|
+
exports.WishlistService = WishlistService;
|
|
2649
2815
|
|
|
2650
2816
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2651
2817
|
|