@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
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { NgModule, APP_INITIALIZER, Injectable, Inject } from '@angular/core';
|
|
3
3
|
import { FIREBASE_OPTIONS, FIREBASE_APP_NAME, AngularFireModule } from '@angular/fire';
|
|
4
4
|
import * as i1$1 from '@infrab4a/connect';
|
|
5
|
-
import { ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
5
|
+
import { ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, Category, CheckoutSubscription, Product, RequiredArgumentError, add, Order, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword } from '@infrab4a/connect';
|
|
6
6
|
import * as i1$2 from '@angular/fire/firestore';
|
|
7
7
|
import { AngularFirestore } from '@angular/fire/firestore';
|
|
8
8
|
import * as i1 from '@angular/fire/auth';
|
|
@@ -526,10 +526,6 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
526
526
|
provide: 'CategoryCollectionChildrenRepository',
|
|
527
527
|
useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
528
528
|
},
|
|
529
|
-
{
|
|
530
|
-
provide: 'WishlistRepository',
|
|
531
|
-
useExisting: WishlistHasuraGraphQLRepository,
|
|
532
|
-
},
|
|
533
529
|
] });
|
|
534
530
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
535
531
|
type: NgModule,
|
|
@@ -609,10 +605,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
609
605
|
provide: 'CategoryCollectionChildrenRepository',
|
|
610
606
|
useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
611
607
|
},
|
|
612
|
-
{
|
|
613
|
-
provide: 'WishlistRepository',
|
|
614
|
-
useExisting: WishlistHasuraGraphQLRepository,
|
|
615
|
-
},
|
|
616
608
|
],
|
|
617
609
|
}]
|
|
618
610
|
}] });
|
|
@@ -698,17 +690,13 @@ class CouponService {
|
|
|
698
690
|
const validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
699
691
|
if (!validUser)
|
|
700
692
|
throw 'Usuário não elegível.';
|
|
693
|
+
const orders = yield this.getOrdersWithCoupon(coupon);
|
|
694
|
+
const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
701
695
|
const couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
702
|
-
if (
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if (couponUseLimits.limitedPerUser) {
|
|
707
|
-
const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
708
|
-
if (ordersWithUser > 0)
|
|
709
|
-
throw 'Limite de uso por usuário atingido.';
|
|
710
|
-
}
|
|
711
|
-
}
|
|
696
|
+
if (couponUseLimits.limitedPerUser && ordersWithUser > 0)
|
|
697
|
+
throw 'Limite de uso por usuário atingido.';
|
|
698
|
+
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
699
|
+
throw 'Limite de uso atingido.';
|
|
712
700
|
const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
|
|
713
701
|
if (!hasProductCategories)
|
|
714
702
|
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
@@ -1375,202 +1363,6 @@ __decorate([
|
|
|
1375
1363
|
__metadata("design:type", Array)
|
|
1376
1364
|
], CategoryWithTree.prototype, "children", void 0);
|
|
1377
1365
|
|
|
1378
|
-
class UtilService {
|
|
1379
|
-
constructor() { }
|
|
1380
|
-
createSlug(name) {
|
|
1381
|
-
return name
|
|
1382
|
-
.toLowerCase()
|
|
1383
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
1384
|
-
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
1385
|
-
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
1386
|
-
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
1387
|
-
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
1388
|
-
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
1389
|
-
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
1390
|
-
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
1391
|
-
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
1392
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
1393
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
UtilService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: UtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1397
|
-
UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: UtilService, providedIn: 'root' });
|
|
1398
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: UtilService, decorators: [{
|
|
1399
|
-
type: Injectable,
|
|
1400
|
-
args: [{
|
|
1401
|
-
providedIn: 'root',
|
|
1402
|
-
}]
|
|
1403
|
-
}], ctorParameters: function () { return []; } });
|
|
1404
|
-
|
|
1405
|
-
class NewCategoryStructureAdapter {
|
|
1406
|
-
constructor(categoryRepository, categoryCollectionChildrenRepository) {
|
|
1407
|
-
this.categoryRepository = categoryRepository;
|
|
1408
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
1409
|
-
}
|
|
1410
|
-
buildProductFilterByCategory(category) {
|
|
1411
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1412
|
-
const categoriesIds = (yield this.isCollection(category))
|
|
1413
|
-
? yield this.getAllCategoriesIdFromCollection(category)
|
|
1414
|
-
: [...(yield this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1415
|
-
return { category: { id: { operator: Where.IN, value: categoriesIds } } };
|
|
1416
|
-
});
|
|
1417
|
-
}
|
|
1418
|
-
getAllCategoriesIdFromCategory(category) {
|
|
1419
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1420
|
-
return this.categoryRepository
|
|
1421
|
-
.getChildren(+category.id)
|
|
1422
|
-
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
getAllCategoriesIdFromCollection(category) {
|
|
1426
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1427
|
-
return this.categoryCollectionChildrenRepository
|
|
1428
|
-
.find({ filters: { collectionId: +category.id } })
|
|
1429
|
-
.then(({ data }) => data.map((categoryCollection) => categoryCollection.categoryId.toString()));
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
1432
|
-
isCollection(category) {
|
|
1433
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1434
|
-
return !isNil(category.isCollection)
|
|
1435
|
-
? category.isCollection
|
|
1436
|
-
: this.categoryRepository.get({ id: category.id }).then((category) => category.isCollection);
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
}
|
|
1440
|
-
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1441
|
-
NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter });
|
|
1442
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
|
|
1443
|
-
type: Injectable
|
|
1444
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1445
|
-
type: Inject,
|
|
1446
|
-
args: ['CategoryRepository']
|
|
1447
|
-
}] }, { type: undefined, decorators: [{
|
|
1448
|
-
type: Inject,
|
|
1449
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
1450
|
-
}] }]; } });
|
|
1451
|
-
|
|
1452
|
-
class OldCategoryStructureAdapter {
|
|
1453
|
-
constructor(categoryRepository) {
|
|
1454
|
-
this.categoryRepository = categoryRepository;
|
|
1455
|
-
}
|
|
1456
|
-
buildProductFilterByCategory(category) {
|
|
1457
|
-
var _a;
|
|
1458
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1459
|
-
const productsIds = ((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)
|
|
1460
|
-
? category.products
|
|
1461
|
-
: yield this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
|
|
1462
|
-
return { id: { operator: Where.IN, value: productsIds } };
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1467
|
-
OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter });
|
|
1468
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
|
|
1469
|
-
type: Injectable
|
|
1470
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1471
|
-
type: Inject,
|
|
1472
|
-
args: ['CategoryRepository']
|
|
1473
|
-
}] }]; } });
|
|
1474
|
-
|
|
1475
|
-
class WishlistService {
|
|
1476
|
-
constructor(wishlistRepository, productRepository, categoryFilterRepository, categoryCollectionChildrenRepository, categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository, categoryCollectionChildrenRepository), shop, catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop), categoryService = new CategoryService(productRepository, wishlistRepository, categoryFilterRepository, categoryStructureAdapter, shop), utilService) {
|
|
1477
|
-
this.wishlistRepository = wishlistRepository;
|
|
1478
|
-
this.shop = shop;
|
|
1479
|
-
this.catalogService = catalogService;
|
|
1480
|
-
this.categoryService = categoryService;
|
|
1481
|
-
this.utilService = utilService;
|
|
1482
|
-
}
|
|
1483
|
-
getCatalogService() {
|
|
1484
|
-
return this.catalogService;
|
|
1485
|
-
}
|
|
1486
|
-
getCategoryService() {
|
|
1487
|
-
return this.categoryService;
|
|
1488
|
-
}
|
|
1489
|
-
create(personId, title, description, userFullName) {
|
|
1490
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1491
|
-
const data = {
|
|
1492
|
-
slug: this.utilService.createSlug(`favoritos ${userFullName} ${title}`),
|
|
1493
|
-
name: title,
|
|
1494
|
-
description,
|
|
1495
|
-
metadata: {
|
|
1496
|
-
title: `${userFullName} - ${title}`,
|
|
1497
|
-
description: `${userFullName} - ${description}`,
|
|
1498
|
-
},
|
|
1499
|
-
shop: this.shop,
|
|
1500
|
-
shops: [this.shop],
|
|
1501
|
-
personId,
|
|
1502
|
-
brandCategory: false,
|
|
1503
|
-
published: true,
|
|
1504
|
-
};
|
|
1505
|
-
const newWishlist = yield this.wishlistRepository.create(data);
|
|
1506
|
-
return this.wishlistRepository.update({ id: newWishlist.id, slug: `${newWishlist.id}-${newWishlist.slug}` });
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
update(id, title, description, userFullName) {
|
|
1510
|
-
const data = {
|
|
1511
|
-
id,
|
|
1512
|
-
slug: this.utilService.createSlug(`${id}-favoritos ${userFullName} ${title}`),
|
|
1513
|
-
name: title,
|
|
1514
|
-
description,
|
|
1515
|
-
metadata: {
|
|
1516
|
-
title: `${userFullName} - ${title}`,
|
|
1517
|
-
description: `${userFullName} - ${description}`,
|
|
1518
|
-
},
|
|
1519
|
-
};
|
|
1520
|
-
return this.wishlistRepository.update(data);
|
|
1521
|
-
}
|
|
1522
|
-
delete(wishlistId) {
|
|
1523
|
-
return this.wishlistRepository.delete({ id: wishlistId });
|
|
1524
|
-
}
|
|
1525
|
-
getWishlistBySlug(slug) {
|
|
1526
|
-
return this.wishlistRepository.getWishlistBySlug(slug);
|
|
1527
|
-
}
|
|
1528
|
-
getWishlistsByPerson(personId) {
|
|
1529
|
-
return this.wishlistRepository.getWishlistByPerson(personId);
|
|
1530
|
-
}
|
|
1531
|
-
addProduct(wishlistId, productId) {
|
|
1532
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1533
|
-
const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
|
|
1534
|
-
const hasProduct = wishlist.products.some((p) => p == productId);
|
|
1535
|
-
if (!hasProduct) {
|
|
1536
|
-
wishlist.products = [...wishlist.products, productId];
|
|
1537
|
-
return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
|
|
1538
|
-
}
|
|
1539
|
-
return wishlist;
|
|
1540
|
-
});
|
|
1541
|
-
}
|
|
1542
|
-
removeProduct(wishlistId, productId) {
|
|
1543
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1544
|
-
const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
|
|
1545
|
-
const productIndex = wishlist.products.findIndex((p) => p == productId);
|
|
1546
|
-
if (productIndex != -1) {
|
|
1547
|
-
wishlist.products.splice(productIndex, 1);
|
|
1548
|
-
if (!wishlist.products.length)
|
|
1549
|
-
return this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } });
|
|
1550
|
-
return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
|
|
1551
|
-
}
|
|
1552
|
-
return wishlist;
|
|
1553
|
-
});
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: WishlistService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
1557
|
-
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: WishlistService });
|
|
1558
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: WishlistService, decorators: [{
|
|
1559
|
-
type: Injectable
|
|
1560
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1561
|
-
type: Inject,
|
|
1562
|
-
args: ['WishlistRepository']
|
|
1563
|
-
}] }, { type: undefined, decorators: [{
|
|
1564
|
-
type: Inject,
|
|
1565
|
-
args: ['ProductRepository']
|
|
1566
|
-
}] }, { type: undefined, decorators: [{
|
|
1567
|
-
type: Inject,
|
|
1568
|
-
args: ['CategoryFilterRepository']
|
|
1569
|
-
}] }, { type: undefined }, { type: undefined }, { type: i1$1.Shops, decorators: [{
|
|
1570
|
-
type: Inject,
|
|
1571
|
-
args: [DEFAULT_SHOP]
|
|
1572
|
-
}] }, { type: undefined }, { type: undefined }, { type: UtilService }]; } });
|
|
1573
|
-
|
|
1574
1366
|
class CheckoutSubscriptionService {
|
|
1575
1367
|
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
1576
1368
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
@@ -1836,6 +1628,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1836
1628
|
args: [BACKEND_URL]
|
|
1837
1629
|
}] }, { type: HomeShopService }]; } });
|
|
1838
1630
|
|
|
1631
|
+
class NewCategoryStructureAdapter {
|
|
1632
|
+
constructor(categoryRepository, categoryCollectionChildrenRepository) {
|
|
1633
|
+
this.categoryRepository = categoryRepository;
|
|
1634
|
+
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
1635
|
+
}
|
|
1636
|
+
buildProductFilterByCategory(category) {
|
|
1637
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1638
|
+
const categoriesIds = (yield this.isCollection(category))
|
|
1639
|
+
? yield this.getAllCategoriesIdFromCollection(category)
|
|
1640
|
+
: [...(yield this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1641
|
+
return { category: { id: { operator: Where.IN, value: categoriesIds } } };
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
getAllCategoriesIdFromCategory(category) {
|
|
1645
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1646
|
+
return this.categoryRepository
|
|
1647
|
+
.getChildren(+category.id)
|
|
1648
|
+
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
getAllCategoriesIdFromCollection(category) {
|
|
1652
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1653
|
+
return this.categoryCollectionChildrenRepository
|
|
1654
|
+
.find({ filters: { collectionId: +category.id } })
|
|
1655
|
+
.then(({ data }) => data.map((categoryCollection) => categoryCollection.categoryId.toString()));
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
isCollection(category) {
|
|
1659
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1660
|
+
return !isNil(category.isCollection)
|
|
1661
|
+
? category.isCollection
|
|
1662
|
+
: this.categoryRepository.get({ id: category.id }).then((category) => category.isCollection);
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1667
|
+
NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter });
|
|
1668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
|
|
1669
|
+
type: Injectable
|
|
1670
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1671
|
+
type: Inject,
|
|
1672
|
+
args: ['CategoryRepository']
|
|
1673
|
+
}] }, { type: undefined, decorators: [{
|
|
1674
|
+
type: Inject,
|
|
1675
|
+
args: ['CategoryCollectionChildrenRepository']
|
|
1676
|
+
}] }]; } });
|
|
1677
|
+
|
|
1678
|
+
class OldCategoryStructureAdapter {
|
|
1679
|
+
constructor(categoryRepository) {
|
|
1680
|
+
this.categoryRepository = categoryRepository;
|
|
1681
|
+
}
|
|
1682
|
+
buildProductFilterByCategory(category) {
|
|
1683
|
+
var _a;
|
|
1684
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1685
|
+
const productsIds = ((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)
|
|
1686
|
+
? category.products
|
|
1687
|
+
: yield this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
|
|
1688
|
+
return { id: { operator: Where.IN, value: productsIds } };
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1693
|
+
OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter });
|
|
1694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
|
|
1695
|
+
type: Injectable
|
|
1696
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1697
|
+
type: Inject,
|
|
1698
|
+
args: ['CategoryRepository']
|
|
1699
|
+
}] }]; } });
|
|
1700
|
+
|
|
1839
1701
|
class AngularConnectModule {
|
|
1840
1702
|
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
1841
1703
|
return {
|
|
@@ -1870,7 +1732,6 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
1870
1732
|
HomeShopService,
|
|
1871
1733
|
OrderService,
|
|
1872
1734
|
ShippingService,
|
|
1873
|
-
WishlistService,
|
|
1874
1735
|
], imports: [[AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
1875
1736
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1876
1737
|
type: NgModule,
|
|
@@ -1887,7 +1748,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1887
1748
|
HomeShopService,
|
|
1888
1749
|
OrderService,
|
|
1889
1750
|
ShippingService,
|
|
1890
|
-
WishlistService,
|
|
1891
1751
|
],
|
|
1892
1752
|
}]
|
|
1893
1753
|
}] });
|
|
@@ -2004,5 +1864,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
2004
1864
|
* Generated bundle index. Do not edit.
|
|
2005
1865
|
*/
|
|
2006
1866
|
|
|
2007
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService, ProductSorts, ShippingService
|
|
1867
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService, ProductSorts, ShippingService };
|
|
2008
1868
|
//# sourceMappingURL=infrab4a-connect-angular.js.map
|