@infrab4a/connect-angular 3.10.6 → 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 -302
- 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 -26
- 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 -228
- 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 -112
- package/esm2015/services/helpers/index.js +0 -2
- package/esm2015/services/helpers/util.helper.js +0 -18
- package/services/catalog/wishlist.service.d.ts +0 -22
- package/services/helpers/index.d.ts +0 -1
- package/services/helpers/util.helper.d.ts +0 -3
|
@@ -865,23 +865,11 @@
|
|
|
865
865
|
{
|
|
866
866
|
provide: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
867
867
|
useFactory: function (options) { return new i1.CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials); },
|
|
868
|
-
deps: ['HasuraConfig'],
|
|
869
868
|
},
|
|
870
869
|
{
|
|
871
870
|
provide: 'CategoryCollectionChildrenRepository',
|
|
872
871
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
873
872
|
},
|
|
874
|
-
{
|
|
875
|
-
provide: i1.WishlistHasuraGraphQLRepository,
|
|
876
|
-
useFactory: function (options, categoryFilterRepository) {
|
|
877
|
-
return new i1.WishlistHasuraGraphQLRepository(options.endpoint, options.credentials, categoryFilterRepository);
|
|
878
|
-
},
|
|
879
|
-
deps: ['HasuraConfig', i1.CategoryFilterHasuraGraphQLRepository],
|
|
880
|
-
},
|
|
881
|
-
{
|
|
882
|
-
provide: 'WishlistRepository',
|
|
883
|
-
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
884
|
-
},
|
|
885
873
|
] });
|
|
886
874
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
|
|
887
875
|
type: i0.NgModule,
|
|
@@ -956,23 +944,11 @@
|
|
|
956
944
|
{
|
|
957
945
|
provide: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
958
946
|
useFactory: function (options) { return new i1.CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials); },
|
|
959
|
-
deps: ['HasuraConfig'],
|
|
960
947
|
},
|
|
961
948
|
{
|
|
962
949
|
provide: 'CategoryCollectionChildrenRepository',
|
|
963
950
|
useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
964
951
|
},
|
|
965
|
-
{
|
|
966
|
-
provide: i1.WishlistHasuraGraphQLRepository,
|
|
967
|
-
useFactory: function (options, categoryFilterRepository) {
|
|
968
|
-
return new i1.WishlistHasuraGraphQLRepository(options.endpoint, options.credentials, categoryFilterRepository);
|
|
969
|
-
},
|
|
970
|
-
deps: ['HasuraConfig', i1.CategoryFilterHasuraGraphQLRepository],
|
|
971
|
-
},
|
|
972
|
-
{
|
|
973
|
-
provide: 'WishlistRepository',
|
|
974
|
-
useExisting: i1.WishlistHasuraGraphQLRepository,
|
|
975
|
-
},
|
|
976
952
|
],
|
|
977
953
|
}]
|
|
978
954
|
}] });
|
|
@@ -1059,7 +1035,7 @@
|
|
|
1059
1035
|
};
|
|
1060
1036
|
CouponService.prototype.couponRulesValidation = function (coupon, checkoutType, checkout, plan) {
|
|
1061
1037
|
return __awaiter(this, void 0, void 0, function () {
|
|
1062
|
-
var validUser,
|
|
1038
|
+
var validUser, orders, ordersWithUser, couponUseLimits, hasProductCategories, hasMinSubTotal;
|
|
1063
1039
|
return __generator(this, function (_c) {
|
|
1064
1040
|
switch (_c.label) {
|
|
1065
1041
|
case 0:
|
|
@@ -1071,26 +1047,22 @@
|
|
|
1071
1047
|
validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
1072
1048
|
if (!validUser)
|
|
1073
1049
|
throw 'Usuário não elegível.';
|
|
1074
|
-
couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
1075
|
-
if (!(!couponUseLimits.unlimited || couponUseLimits.limitedPerUser)) return [3 /*break*/, 2];
|
|
1076
1050
|
return [4 /*yield*/, this.getOrdersWithCoupon(coupon)];
|
|
1077
1051
|
case 1:
|
|
1078
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.';
|
|
1079
1057
|
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
1080
1058
|
throw 'Limite de uso atingido.';
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
if (ordersWithUser > 0)
|
|
1084
|
-
throw 'Limite de uso por usuário atingido.';
|
|
1085
|
-
}
|
|
1086
|
-
_c.label = 2;
|
|
1087
|
-
case 2: return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
1088
|
-
case 3:
|
|
1059
|
+
return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
1060
|
+
case 2:
|
|
1089
1061
|
hasProductCategories = _c.sent();
|
|
1090
1062
|
if (!hasProductCategories)
|
|
1091
1063
|
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
1092
1064
|
return [4 /*yield*/, this.hasMinSubTotal(coupon, checkout)];
|
|
1093
|
-
case
|
|
1065
|
+
case 3:
|
|
1094
1066
|
hasMinSubTotal = _c.sent();
|
|
1095
1067
|
if (!hasMinSubTotal)
|
|
1096
1068
|
throw "Valor m\u00EDnimo de " + Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue) + " n\u00E3o atingido";
|
|
@@ -2070,268 +2042,6 @@
|
|
|
2070
2042
|
__metadata("design:type", Array)
|
|
2071
2043
|
], CategoryWithTree.prototype, "children", void 0);
|
|
2072
2044
|
|
|
2073
|
-
var UtilHelper = /** @class */ (function () {
|
|
2074
|
-
function UtilHelper() {
|
|
2075
|
-
}
|
|
2076
|
-
UtilHelper.createSlug = function (name) {
|
|
2077
|
-
return name
|
|
2078
|
-
.toLowerCase()
|
|
2079
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
2080
|
-
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
2081
|
-
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
2082
|
-
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
2083
|
-
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
2084
|
-
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
2085
|
-
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
2086
|
-
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
2087
|
-
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
2088
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
2089
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
2090
|
-
};
|
|
2091
|
-
return UtilHelper;
|
|
2092
|
-
}());
|
|
2093
|
-
|
|
2094
|
-
var NewCategoryStructureAdapter = /** @class */ (function () {
|
|
2095
|
-
function NewCategoryStructureAdapter(categoryRepository, categoryCollectionChildrenRepository) {
|
|
2096
|
-
this.categoryRepository = categoryRepository;
|
|
2097
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
2098
|
-
}
|
|
2099
|
-
NewCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2100
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2101
|
-
var categoriesIds, _a, _b;
|
|
2102
|
-
return __generator(this, function (_c) {
|
|
2103
|
-
switch (_c.label) {
|
|
2104
|
-
case 0: return [4 /*yield*/, this.isCollection(category)];
|
|
2105
|
-
case 1:
|
|
2106
|
-
if (!(_c.sent())) return [3 /*break*/, 3];
|
|
2107
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCollection(category)];
|
|
2108
|
-
case 2:
|
|
2109
|
-
_a = _c.sent();
|
|
2110
|
-
return [3 /*break*/, 5];
|
|
2111
|
-
case 3:
|
|
2112
|
-
_b = [[]];
|
|
2113
|
-
return [4 /*yield*/, this.getAllCategoriesIdFromCategory(category)];
|
|
2114
|
-
case 4:
|
|
2115
|
-
_a = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c.sent())])])), [category.id.toString()]]);
|
|
2116
|
-
_c.label = 5;
|
|
2117
|
-
case 5:
|
|
2118
|
-
categoriesIds = _a;
|
|
2119
|
-
return [2 /*return*/, { category: { id: { operator: i1.Where.IN, value: categoriesIds } } }];
|
|
2120
|
-
}
|
|
2121
|
-
});
|
|
2122
|
-
});
|
|
2123
|
-
};
|
|
2124
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCategory = function (category) {
|
|
2125
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2126
|
-
return __generator(this, function (_a) {
|
|
2127
|
-
return [2 /*return*/, this.categoryRepository
|
|
2128
|
-
.getChildren(+category.id)
|
|
2129
|
-
.then(function (categories) { return categories.map(function (category) { return category.id.toString(); }); })];
|
|
2130
|
-
});
|
|
2131
|
-
});
|
|
2132
|
-
};
|
|
2133
|
-
NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCollection = function (category) {
|
|
2134
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2135
|
-
return __generator(this, function (_a) {
|
|
2136
|
-
return [2 /*return*/, this.categoryCollectionChildrenRepository
|
|
2137
|
-
.find({ filters: { collectionId: +category.id } })
|
|
2138
|
-
.then(function (_a) {
|
|
2139
|
-
var data = _a.data;
|
|
2140
|
-
return data.map(function (categoryCollection) { return categoryCollection.categoryId.toString(); });
|
|
2141
|
-
})];
|
|
2142
|
-
});
|
|
2143
|
-
});
|
|
2144
|
-
};
|
|
2145
|
-
NewCategoryStructureAdapter.prototype.isCollection = function (category) {
|
|
2146
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2147
|
-
return __generator(this, function (_a) {
|
|
2148
|
-
return [2 /*return*/, !i1.isNil(category.isCollection)
|
|
2149
|
-
? category.isCollection
|
|
2150
|
-
: this.categoryRepository.get({ id: category.id }).then(function (category) { return category.isCollection; })];
|
|
2151
|
-
});
|
|
2152
|
-
});
|
|
2153
|
-
};
|
|
2154
|
-
return NewCategoryStructureAdapter;
|
|
2155
|
-
}());
|
|
2156
|
-
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 });
|
|
2157
|
-
NewCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter });
|
|
2158
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, decorators: [{
|
|
2159
|
-
type: i0.Injectable
|
|
2160
|
-
}], ctorParameters: function () {
|
|
2161
|
-
return [{ type: undefined, decorators: [{
|
|
2162
|
-
type: i0.Inject,
|
|
2163
|
-
args: ['CategoryRepository']
|
|
2164
|
-
}] }, { type: undefined, decorators: [{
|
|
2165
|
-
type: i0.Inject,
|
|
2166
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
2167
|
-
}] }];
|
|
2168
|
-
} });
|
|
2169
|
-
|
|
2170
|
-
var OldCategoryStructureAdapter = /** @class */ (function () {
|
|
2171
|
-
function OldCategoryStructureAdapter(categoryRepository) {
|
|
2172
|
-
this.categoryRepository = categoryRepository;
|
|
2173
|
-
}
|
|
2174
|
-
OldCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
|
|
2175
|
-
var _a;
|
|
2176
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2177
|
-
var productsIds, _b;
|
|
2178
|
-
return __generator(this, function (_c) {
|
|
2179
|
-
switch (_c.label) {
|
|
2180
|
-
case 0:
|
|
2181
|
-
if (!((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 1];
|
|
2182
|
-
_b = category.products;
|
|
2183
|
-
return [3 /*break*/, 3];
|
|
2184
|
-
case 1: return [4 /*yield*/, this.categoryRepository.get({ id: category.id }).then(function (categoryFound) { return categoryFound.products; })];
|
|
2185
|
-
case 2:
|
|
2186
|
-
_b = _c.sent();
|
|
2187
|
-
_c.label = 3;
|
|
2188
|
-
case 3:
|
|
2189
|
-
productsIds = _b;
|
|
2190
|
-
return [2 /*return*/, { id: { operator: i1.Where.IN, value: productsIds } }];
|
|
2191
|
-
}
|
|
2192
|
-
});
|
|
2193
|
-
});
|
|
2194
|
-
};
|
|
2195
|
-
return OldCategoryStructureAdapter;
|
|
2196
|
-
}());
|
|
2197
|
-
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 });
|
|
2198
|
-
OldCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter });
|
|
2199
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, decorators: [{
|
|
2200
|
-
type: i0.Injectable
|
|
2201
|
-
}], ctorParameters: function () {
|
|
2202
|
-
return [{ type: undefined, decorators: [{
|
|
2203
|
-
type: i0.Inject,
|
|
2204
|
-
args: ['CategoryRepository']
|
|
2205
|
-
}] }];
|
|
2206
|
-
} });
|
|
2207
|
-
|
|
2208
|
-
var WishlistService = /** @class */ (function () {
|
|
2209
|
-
function WishlistService(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryCollectionChildrenRepository) {
|
|
2210
|
-
this.wishlistRepository = wishlistRepository;
|
|
2211
|
-
this.shop = shop;
|
|
2212
|
-
var categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository, categoryCollectionChildrenRepository);
|
|
2213
|
-
this.catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop);
|
|
2214
|
-
this.categoryService = new CategoryService(productRepository, wishlistRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
2215
|
-
}
|
|
2216
|
-
WishlistService.prototype.getCatalogService = function () {
|
|
2217
|
-
return this.catalogService;
|
|
2218
|
-
};
|
|
2219
|
-
WishlistService.prototype.getCategoryService = function () {
|
|
2220
|
-
return this.categoryService;
|
|
2221
|
-
};
|
|
2222
|
-
WishlistService.prototype.create = function (personId, title, description, userFullName) {
|
|
2223
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2224
|
-
var data, newWishlist;
|
|
2225
|
-
return __generator(this, function (_a) {
|
|
2226
|
-
switch (_a.label) {
|
|
2227
|
-
case 0:
|
|
2228
|
-
data = {
|
|
2229
|
-
slug: UtilHelper.createSlug("favoritos " + userFullName + " " + title),
|
|
2230
|
-
name: title,
|
|
2231
|
-
description: description,
|
|
2232
|
-
metadata: {
|
|
2233
|
-
title: userFullName + " - " + title,
|
|
2234
|
-
description: userFullName + " - " + description,
|
|
2235
|
-
},
|
|
2236
|
-
shop: this.shop,
|
|
2237
|
-
shops: [this.shop],
|
|
2238
|
-
personId: personId,
|
|
2239
|
-
brandCategory: false,
|
|
2240
|
-
published: true,
|
|
2241
|
-
};
|
|
2242
|
-
return [4 /*yield*/, this.wishlistRepository.create(data)];
|
|
2243
|
-
case 1:
|
|
2244
|
-
newWishlist = _a.sent();
|
|
2245
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id + "-" + newWishlist.slug })];
|
|
2246
|
-
}
|
|
2247
|
-
});
|
|
2248
|
-
});
|
|
2249
|
-
};
|
|
2250
|
-
WishlistService.prototype.update = function (id, title, description, userFullName) {
|
|
2251
|
-
var data = {
|
|
2252
|
-
id: id,
|
|
2253
|
-
slug: UtilHelper.createSlug(id + "-favoritos " + userFullName + " " + title),
|
|
2254
|
-
name: title,
|
|
2255
|
-
description: description,
|
|
2256
|
-
metadata: {
|
|
2257
|
-
title: userFullName + " - " + title,
|
|
2258
|
-
description: userFullName + " - " + description,
|
|
2259
|
-
},
|
|
2260
|
-
};
|
|
2261
|
-
return this.wishlistRepository.update(data);
|
|
2262
|
-
};
|
|
2263
|
-
WishlistService.prototype.delete = function (wishlistId) {
|
|
2264
|
-
return this.wishlistRepository.delete({ id: wishlistId });
|
|
2265
|
-
};
|
|
2266
|
-
WishlistService.prototype.getWishlistBySlug = function (slug) {
|
|
2267
|
-
return this.wishlistRepository.getWishlistBySlug(slug);
|
|
2268
|
-
};
|
|
2269
|
-
WishlistService.prototype.getWishlistsByPerson = function (personId) {
|
|
2270
|
-
return this.wishlistRepository.getWishlistByPerson(personId);
|
|
2271
|
-
};
|
|
2272
|
-
WishlistService.prototype.addProduct = function (wishlistId, productId) {
|
|
2273
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2274
|
-
var wishlist, hasProduct;
|
|
2275
|
-
return __generator(this, function (_a) {
|
|
2276
|
-
switch (_a.label) {
|
|
2277
|
-
case 0: return [4 /*yield*/, this.wishlistRepository.get({ id: wishlistId })];
|
|
2278
|
-
case 1:
|
|
2279
|
-
wishlist = _a.sent();
|
|
2280
|
-
hasProduct = wishlist.products.some(function (p) { return p == productId; });
|
|
2281
|
-
if (!hasProduct) {
|
|
2282
|
-
wishlist.products = __spreadArray(__spreadArray([], __read(wishlist.products)), [productId]);
|
|
2283
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: wishlist.products })];
|
|
2284
|
-
}
|
|
2285
|
-
return [2 /*return*/, wishlist];
|
|
2286
|
-
}
|
|
2287
|
-
});
|
|
2288
|
-
});
|
|
2289
|
-
};
|
|
2290
|
-
WishlistService.prototype.removeProduct = function (wishlistId, productId) {
|
|
2291
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2292
|
-
var wishlist, productIndex;
|
|
2293
|
-
return __generator(this, function (_a) {
|
|
2294
|
-
switch (_a.label) {
|
|
2295
|
-
case 0: return [4 /*yield*/, this.wishlistRepository.get({ id: wishlistId })];
|
|
2296
|
-
case 1:
|
|
2297
|
-
wishlist = _a.sent();
|
|
2298
|
-
productIndex = wishlist.products.findIndex(function (p) { return p == productId; });
|
|
2299
|
-
if (productIndex != -1) {
|
|
2300
|
-
wishlist.products.splice(productIndex, 1);
|
|
2301
|
-
if (!wishlist.products.length)
|
|
2302
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } })];
|
|
2303
|
-
return [2 /*return*/, this.wishlistRepository.update({ id: wishlistId, products: wishlist.products })];
|
|
2304
|
-
}
|
|
2305
|
-
return [2 /*return*/, wishlist];
|
|
2306
|
-
}
|
|
2307
|
-
});
|
|
2308
|
-
});
|
|
2309
|
-
};
|
|
2310
|
-
return WishlistService;
|
|
2311
|
-
}());
|
|
2312
|
-
WishlistService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
2313
|
-
WishlistService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService });
|
|
2314
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: WishlistService, decorators: [{
|
|
2315
|
-
type: i0.Injectable
|
|
2316
|
-
}], ctorParameters: function () {
|
|
2317
|
-
return [{ type: undefined, decorators: [{
|
|
2318
|
-
type: i0.Inject,
|
|
2319
|
-
args: ['WishlistRepository']
|
|
2320
|
-
}] }, { type: i1__namespace$1.Shops, decorators: [{
|
|
2321
|
-
type: i0.Inject,
|
|
2322
|
-
args: [DEFAULT_SHOP]
|
|
2323
|
-
}] }, { type: undefined, decorators: [{
|
|
2324
|
-
type: i0.Inject,
|
|
2325
|
-
args: ['ProductRepository']
|
|
2326
|
-
}] }, { type: undefined, decorators: [{
|
|
2327
|
-
type: i0.Inject,
|
|
2328
|
-
args: ['CategoryFilterRepository']
|
|
2329
|
-
}] }, { type: undefined, decorators: [{
|
|
2330
|
-
type: i0.Inject,
|
|
2331
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
2332
|
-
}] }];
|
|
2333
|
-
} });
|
|
2334
|
-
|
|
2335
2045
|
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
2336
2046
|
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
2337
2047
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
@@ -2637,6 +2347,120 @@
|
|
|
2637
2347
|
}] }, { type: HomeShopService }];
|
|
2638
2348
|
} });
|
|
2639
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
|
+
|
|
2640
2464
|
var AngularConnectModule = /** @class */ (function () {
|
|
2641
2465
|
function AngularConnectModule() {
|
|
2642
2466
|
}
|
|
@@ -2668,7 +2492,6 @@
|
|
|
2668
2492
|
HomeShopService,
|
|
2669
2493
|
OrderService,
|
|
2670
2494
|
ShippingService,
|
|
2671
|
-
WishlistService,
|
|
2672
2495
|
], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
2673
2496
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
|
|
2674
2497
|
type: i0.NgModule,
|
|
@@ -2685,7 +2508,6 @@
|
|
|
2685
2508
|
HomeShopService,
|
|
2686
2509
|
OrderService,
|
|
2687
2510
|
ShippingService,
|
|
2688
|
-
WishlistService,
|
|
2689
2511
|
],
|
|
2690
2512
|
}]
|
|
2691
2513
|
}] });
|
|
@@ -2820,8 +2642,6 @@
|
|
|
2820
2642
|
exports.HomeShopService = HomeShopService;
|
|
2821
2643
|
exports.OrderService = OrderService;
|
|
2822
2644
|
exports.ShippingService = ShippingService;
|
|
2823
|
-
exports.UtilHelper = UtilHelper;
|
|
2824
|
-
exports.WishlistService = WishlistService;
|
|
2825
2645
|
|
|
2826
2646
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2827
2647
|
|