@infrab4a/connect-angular 4.9.4-beta.0 → 4.10.0-beta.10
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/angular-connect.module.d.ts +8 -6
- package/angular-vertex-search.module.d.ts +9 -0
- package/consts/index.d.ts +1 -0
- package/consts/vertex-config.const.d.ts +1 -0
- package/esm2020/angular-connect.module.mjs +17 -4
- package/esm2020/angular-vertex-search.module.mjs +34 -0
- package/esm2020/consts/index.mjs +2 -1
- package/esm2020/consts/vertex-config.const.mjs +2 -0
- package/esm2020/services/cart.service.mjs +7 -9
- package/esm2020/services/catalog/catalog.service.mjs +61 -22
- package/esm2020/services/catalog/wishlist.service.mjs +10 -21
- package/esm2020/services/coupon.service.mjs +8 -13
- package/fesm2015/infrab4a-connect-angular.mjs +123 -58
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +122 -57
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/services/catalog/catalog.service.d.ts +4 -4
- package/services/catalog/wishlist.service.d.ts +3 -2
|
@@ -5,7 +5,7 @@ import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular
|
|
|
5
5
|
import * as i2 from '@angular/fire/storage';
|
|
6
6
|
import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
|
|
7
7
|
import * as i1$2 from '@infrab4a/connect';
|
|
8
|
-
import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities,
|
|
8
|
+
import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, PersonTypes, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
|
|
9
9
|
import * as i1 from '@angular/fire/auth';
|
|
10
10
|
import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
|
|
11
11
|
import { isPlatformBrowser, isPlatformServer } from '@angular/common';
|
|
@@ -63,6 +63,8 @@ const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
|
63
63
|
|
|
64
64
|
const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
|
|
65
65
|
|
|
66
|
+
const VERTEX_CONFIG = 'VERTEX_CONFIG';
|
|
67
|
+
|
|
66
68
|
class AngularFirebaseAuthModule {
|
|
67
69
|
static initializeApp(options, nameOrConfig) {
|
|
68
70
|
return {
|
|
@@ -949,6 +951,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
949
951
|
}]
|
|
950
952
|
}] });
|
|
951
953
|
|
|
954
|
+
class AngularVertexSeachModule {
|
|
955
|
+
static initializeApp(options) {
|
|
956
|
+
return {
|
|
957
|
+
ngModule: AngularVertexSeachModule,
|
|
958
|
+
providers: [{ provide: VERTEX_CONFIG, useValue: options }],
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
AngularVertexSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
963
|
+
AngularVertexSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule });
|
|
964
|
+
AngularVertexSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, providers: [
|
|
965
|
+
{
|
|
966
|
+
provide: ProductsVertexSearch,
|
|
967
|
+
useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
|
|
968
|
+
deps: [VERTEX_CONFIG],
|
|
969
|
+
},
|
|
970
|
+
] });
|
|
971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, decorators: [{
|
|
972
|
+
type: NgModule,
|
|
973
|
+
args: [{
|
|
974
|
+
providers: [
|
|
975
|
+
{
|
|
976
|
+
provide: ProductsVertexSearch,
|
|
977
|
+
useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
|
|
978
|
+
deps: [VERTEX_CONFIG],
|
|
979
|
+
},
|
|
980
|
+
],
|
|
981
|
+
}]
|
|
982
|
+
}] });
|
|
983
|
+
|
|
952
984
|
const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
|
|
953
985
|
|
|
954
986
|
class CookieDataPersistence {
|
|
@@ -1048,11 +1080,11 @@ class CouponService {
|
|
|
1048
1080
|
throw 'Limite de uso atingido';
|
|
1049
1081
|
}
|
|
1050
1082
|
if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
|
|
1051
|
-
const
|
|
1052
|
-
if (!couponUseLimits.unlimited && couponUseLimits.total &&
|
|
1083
|
+
const orders = await this.getOrdersWithCoupon(coupon);
|
|
1084
|
+
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
1053
1085
|
throw 'Limite de uso atingido.';
|
|
1054
1086
|
if (couponUseLimits.limitedPerUser) {
|
|
1055
|
-
const ordersWithUser = this.countOrdersWithUser(
|
|
1087
|
+
const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
1056
1088
|
if (ordersWithUser > 0)
|
|
1057
1089
|
throw 'Limite de uso por usuário atingido.';
|
|
1058
1090
|
}
|
|
@@ -1178,7 +1210,7 @@ class CouponService {
|
|
|
1178
1210
|
.find({
|
|
1179
1211
|
filters: {
|
|
1180
1212
|
coupon: { id: coupon.id },
|
|
1181
|
-
|
|
1213
|
+
payment: { status: 'paid' },
|
|
1182
1214
|
},
|
|
1183
1215
|
})
|
|
1184
1216
|
.then((result) => result.data);
|
|
@@ -1188,7 +1220,7 @@ class CouponService {
|
|
|
1188
1220
|
.find({
|
|
1189
1221
|
filters: {
|
|
1190
1222
|
user: { email: { operator: Where.EQUALS, value: email } },
|
|
1191
|
-
|
|
1223
|
+
payment: { status: 'paid' },
|
|
1192
1224
|
},
|
|
1193
1225
|
})
|
|
1194
1226
|
.then((result) => result.data);
|
|
@@ -1199,12 +1231,7 @@ class CouponService {
|
|
|
1199
1231
|
getCouponUseLimits(coupon, checkoutType, user) {
|
|
1200
1232
|
let couponUseLimits;
|
|
1201
1233
|
if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
|
|
1202
|
-
|
|
1203
|
-
(coupon.exclusivityType.at(0) === Exclusivities.SPECIFIC_USER ||
|
|
1204
|
-
coupon.exclusivityType.at(0) === Exclusivities.COLLABORATORS))
|
|
1205
|
-
couponUseLimits = coupon.useLimits.non_subscriber;
|
|
1206
|
-
else
|
|
1207
|
-
couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
|
|
1234
|
+
couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
|
|
1208
1235
|
}
|
|
1209
1236
|
else {
|
|
1210
1237
|
couponUseLimits = coupon.useLimits.subscription;
|
|
@@ -1332,7 +1359,6 @@ class CartService {
|
|
|
1332
1359
|
if (index > -1) {
|
|
1333
1360
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
1334
1361
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
1335
|
-
checkoutLoaded.lineItems[index].price = lineItem.price;
|
|
1336
1362
|
}
|
|
1337
1363
|
else
|
|
1338
1364
|
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
@@ -1353,15 +1379,14 @@ class CartService {
|
|
|
1353
1379
|
if (this.checkMaxStock(product.stock.quantity, item.quantity || 0, quantity || 0))
|
|
1354
1380
|
throw new Error('Desculpe! Temos apenas ' + product.stock?.quantity + ' em estoque.');
|
|
1355
1381
|
const image = item.image || item.images?.shift();
|
|
1356
|
-
const { id, name, EAN, slug, weight, sku, type } = item;
|
|
1382
|
+
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
1357
1383
|
const isGift = item.isGift || null;
|
|
1358
1384
|
const pricePaid = this.getProductPrice({
|
|
1359
|
-
product:
|
|
1385
|
+
product: item,
|
|
1360
1386
|
shop: checkout.shop || this.defaultShop,
|
|
1361
1387
|
isSubscriber: checkout.user?.isSubscriber,
|
|
1362
1388
|
});
|
|
1363
1389
|
RoundProductPricesHelper.roundProductPrices(item);
|
|
1364
|
-
RoundProductPricesHelper.roundProductPrices(product);
|
|
1365
1390
|
return {
|
|
1366
1391
|
checkout,
|
|
1367
1392
|
lineItem: LineItem.toInstance({
|
|
@@ -1371,8 +1396,8 @@ class CartService {
|
|
|
1371
1396
|
brand: product.brand,
|
|
1372
1397
|
slug: slug ?? product.slug,
|
|
1373
1398
|
sku: sku ?? product.sku,
|
|
1374
|
-
stock
|
|
1375
|
-
price: this.roundPrice(
|
|
1399
|
+
stock,
|
|
1400
|
+
price: this.roundPrice(price),
|
|
1376
1401
|
image,
|
|
1377
1402
|
weight: weight ?? product.weight,
|
|
1378
1403
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
@@ -1650,13 +1675,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1650
1675
|
}] }]; } });
|
|
1651
1676
|
|
|
1652
1677
|
class CatalogService {
|
|
1653
|
-
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1678
|
+
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch) {
|
|
1654
1679
|
this.productRepository = productRepository;
|
|
1655
1680
|
this.productStockNotificationRepository = productStockNotificationRepository;
|
|
1656
1681
|
this.categoryRepository = categoryRepository;
|
|
1657
1682
|
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1658
1683
|
this.shop = shop;
|
|
1659
|
-
this.
|
|
1684
|
+
this.productSearch = productSearch;
|
|
1660
1685
|
this.productsByTerm = {};
|
|
1661
1686
|
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1662
1687
|
const filters = {};
|
|
@@ -1719,6 +1744,7 @@ class CatalogService {
|
|
|
1719
1744
|
throw new InvalidArgumentError(`It couldn't filled tags when profile is given`);
|
|
1720
1745
|
if (this.hasTerm(options) && options.filters?.customOptions)
|
|
1721
1746
|
throw new InvalidArgumentError(`It couldn't filled customOptions when term is given`);
|
|
1747
|
+
console.log('fetchProducts', options);
|
|
1722
1748
|
return await this.findCatalog(options, limits).then(({ data, count: total, maximum, minimal, distinct }) => ({
|
|
1723
1749
|
products: { data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)), total },
|
|
1724
1750
|
pages: Math.ceil(total / limits.limit),
|
|
@@ -1737,7 +1763,8 @@ class CatalogService {
|
|
|
1737
1763
|
}
|
|
1738
1764
|
async findCatalog(options, limits) {
|
|
1739
1765
|
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1740
|
-
|
|
1766
|
+
// console.log('Step 1')
|
|
1767
|
+
const productsIds = await this.findCatalogIdsBySearch(options.term);
|
|
1741
1768
|
return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
|
|
1742
1769
|
}
|
|
1743
1770
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
@@ -1776,9 +1803,9 @@ class CatalogService {
|
|
|
1776
1803
|
if (profile)
|
|
1777
1804
|
return { tags: { operator: Where.LIKE, value: profile } };
|
|
1778
1805
|
if (term)
|
|
1779
|
-
return this.
|
|
1780
|
-
.search(term, 999, this.shop)
|
|
1781
|
-
.then((data) => ({ id: { operator: Where.IN, value: data.
|
|
1806
|
+
return this.productSearch
|
|
1807
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1808
|
+
.then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
|
|
1782
1809
|
}
|
|
1783
1810
|
async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
|
|
1784
1811
|
const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
|
|
@@ -1812,10 +1839,18 @@ class CatalogService {
|
|
|
1812
1839
|
};
|
|
1813
1840
|
}
|
|
1814
1841
|
async findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
|
|
1842
|
+
// console.log('findCatalogAndSortByMostRevelantByTerm', this.shop, options, limits)
|
|
1843
|
+
// console.log(
|
|
1844
|
+
// 'productIds from search',
|
|
1845
|
+
// productIds.length,
|
|
1846
|
+
// 'preview -> ',
|
|
1847
|
+
// productIds.slice(limits.offset, limits.offset + limits.limit),
|
|
1848
|
+
// )
|
|
1815
1849
|
const totalResult = await this.productRepository.findCatalog({
|
|
1816
|
-
fields: ['id', 'stock'],
|
|
1850
|
+
fields: ['id', 'stock', 'gender'],
|
|
1817
1851
|
filters: {
|
|
1818
1852
|
id: { operator: Where.IN, value: productIds },
|
|
1853
|
+
published: { operator: Where.EQUALS, value: true },
|
|
1819
1854
|
...this.buildFilterQuery(options?.filters || {}),
|
|
1820
1855
|
},
|
|
1821
1856
|
options: {
|
|
@@ -1824,19 +1859,50 @@ class CatalogService {
|
|
|
1824
1859
|
distinct: ['brand'],
|
|
1825
1860
|
},
|
|
1826
1861
|
}, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
|
|
1862
|
+
// const productsTotalResult = totalResult.data.slice(limits.offset, limits.offset + limits.limit)
|
|
1863
|
+
// console.log(
|
|
1864
|
+
// 'productsTotalResult',
|
|
1865
|
+
// productsTotalResult.map((p) => {
|
|
1866
|
+
// return {
|
|
1867
|
+
// id: p.id,
|
|
1868
|
+
// stock: p.stock.quantity,
|
|
1869
|
+
// }
|
|
1870
|
+
// }),
|
|
1871
|
+
// )
|
|
1872
|
+
const defaultGender = options?.filters?.gender
|
|
1873
|
+
? options?.filters?.gender.at(0)
|
|
1874
|
+
: this.shop === Shops.GLAMSHOP
|
|
1875
|
+
? 'female'
|
|
1876
|
+
: 'male';
|
|
1827
1877
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1828
1878
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1829
|
-
const
|
|
1830
|
-
const
|
|
1879
|
+
const productIdsStockGender = productIds.filter((product) => stockData.some((result) => result.id === product && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex'))));
|
|
1880
|
+
const productIdsStockNotGender = productIds.filter((product) => stockData.some((result) => result.id === product && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex')));
|
|
1881
|
+
const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender);
|
|
1882
|
+
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1831
1883
|
const limitedProductId = productIdsStock
|
|
1832
1884
|
.concat(productIdsStockOut)
|
|
1833
1885
|
.slice(limits.offset, limits.offset + limits.limit);
|
|
1886
|
+
// console.log('limitedProductId', limitedProductId)
|
|
1834
1887
|
const orderedId = productIds.filter((product) => limitedProductId.includes(product));
|
|
1835
1888
|
const productResult = await this.productRepository.findCatalog({
|
|
1836
1889
|
filters: {
|
|
1837
1890
|
id: { operator: Where.IN, value: orderedId },
|
|
1838
1891
|
},
|
|
1839
1892
|
});
|
|
1893
|
+
const finalResult = limitedProductId
|
|
1894
|
+
.map((id) => productResult.data.find((product) => product.id === id))
|
|
1895
|
+
.filter(Boolean);
|
|
1896
|
+
// console.log(
|
|
1897
|
+
// 'finalResult',
|
|
1898
|
+
// finalResult.map((p) => {
|
|
1899
|
+
// return {
|
|
1900
|
+
// id: p.id,
|
|
1901
|
+
// name: p.name,
|
|
1902
|
+
// brand: p.brand,
|
|
1903
|
+
// }
|
|
1904
|
+
// }),
|
|
1905
|
+
// )
|
|
1840
1906
|
return {
|
|
1841
1907
|
data: limitedProductId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
|
|
1842
1908
|
count: totalResult.count,
|
|
@@ -1845,20 +1911,15 @@ class CatalogService {
|
|
|
1845
1911
|
distinct: totalResult.distinct,
|
|
1846
1912
|
};
|
|
1847
1913
|
}
|
|
1848
|
-
async
|
|
1914
|
+
async findCatalogIdsBySearch(term, preview = false) {
|
|
1849
1915
|
if (this.productsByTerm[term])
|
|
1850
1916
|
return this.productsByTerm[term];
|
|
1851
|
-
return (this.productsByTerm[term] = await this.
|
|
1852
|
-
.search(term, 999, this.shop)
|
|
1853
|
-
.then((
|
|
1854
|
-
const withStock = products.filter(({ _source }) => _source.stock.quantity > 0);
|
|
1855
|
-
const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0);
|
|
1856
|
-
const sorted = [...withStock, ...withOutStock];
|
|
1857
|
-
return [...new Set(sorted.map(({ _source }) => _source.id))];
|
|
1858
|
-
}));
|
|
1917
|
+
return (this.productsByTerm[term] = await this.productSearch
|
|
1918
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1919
|
+
.then((products) => [...new Set(products.map((product) => product.id))]));
|
|
1859
1920
|
}
|
|
1860
1921
|
}
|
|
1861
|
-
CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token:
|
|
1922
|
+
CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1862
1923
|
CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
|
|
1863
1924
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
|
|
1864
1925
|
type: Injectable
|
|
@@ -1877,7 +1938,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1877
1938
|
}] }, { type: i1$2.Shops, decorators: [{
|
|
1878
1939
|
type: Inject,
|
|
1879
1940
|
args: [DEFAULT_SHOP]
|
|
1880
|
-
}] }, { type:
|
|
1941
|
+
}] }, { type: undefined, decorators: [{
|
|
1942
|
+
type: Inject,
|
|
1943
|
+
args: ['ProductSearch']
|
|
1944
|
+
}] }]; } });
|
|
1881
1945
|
|
|
1882
1946
|
class CategoryService {
|
|
1883
1947
|
constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
|
|
@@ -1944,11 +2008,12 @@ __decorate([
|
|
|
1944
2008
|
], CategoryWithTree.prototype, "children", void 0);
|
|
1945
2009
|
|
|
1946
2010
|
class WishlistService {
|
|
1947
|
-
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository,
|
|
2011
|
+
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productSearch) {
|
|
1948
2012
|
this.wishlistRepository = wishlistRepository;
|
|
1949
2013
|
this.shop = shop;
|
|
2014
|
+
this.productSearch = productSearch;
|
|
1950
2015
|
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
|
|
1951
|
-
this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
2016
|
+
this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch);
|
|
1952
2017
|
this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
1953
2018
|
}
|
|
1954
2019
|
getCatalogService() {
|
|
@@ -1981,21 +2046,6 @@ class WishlistService {
|
|
|
1981
2046
|
personType: personType ?? PersonTypes.NONE,
|
|
1982
2047
|
personIsSubscriber: personIsSubscriber ?? false,
|
|
1983
2048
|
};
|
|
1984
|
-
const hasWishlist = await this.wishlistRepository
|
|
1985
|
-
.find({
|
|
1986
|
-
filters: {
|
|
1987
|
-
personId,
|
|
1988
|
-
},
|
|
1989
|
-
options: {
|
|
1990
|
-
enableCount: false,
|
|
1991
|
-
},
|
|
1992
|
-
orderBy: {
|
|
1993
|
-
id: 'asc',
|
|
1994
|
-
},
|
|
1995
|
-
})
|
|
1996
|
-
.then((res) => res.data);
|
|
1997
|
-
if (hasWishlist.length)
|
|
1998
|
-
return hasWishlist.at(0);
|
|
1999
2049
|
const newWishlist = await this.wishlistRepository.create(data);
|
|
2000
2050
|
await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
|
|
2001
2051
|
return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });
|
|
@@ -2055,7 +2105,7 @@ class WishlistService {
|
|
|
2055
2105
|
return wishlist;
|
|
2056
2106
|
}
|
|
2057
2107
|
}
|
|
2058
|
-
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token: 'ProductStockNotificationRepository' }, { token:
|
|
2108
|
+
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2059
2109
|
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
|
|
2060
2110
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
|
|
2061
2111
|
type: Injectable
|
|
@@ -2077,7 +2127,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2077
2127
|
}] }, { type: undefined, decorators: [{
|
|
2078
2128
|
type: Inject,
|
|
2079
2129
|
args: ['ProductStockNotificationRepository']
|
|
2080
|
-
}] }, { type:
|
|
2130
|
+
}] }, { type: undefined, decorators: [{
|
|
2131
|
+
type: Inject,
|
|
2132
|
+
args: ['ProductSearch']
|
|
2133
|
+
}] }]; } });
|
|
2081
2134
|
|
|
2082
2135
|
class CheckoutSubscriptionService {
|
|
2083
2136
|
constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
|
|
@@ -2382,6 +2435,7 @@ class AngularConnectModule {
|
|
|
2382
2435
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
|
|
2383
2436
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
2384
2437
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
2438
|
+
...(isNil(options?.vertexConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexConfig }]),
|
|
2385
2439
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
2386
2440
|
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
2387
2441
|
...(isNil(options?.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
|
|
@@ -2391,6 +2445,7 @@ class AngularConnectModule {
|
|
|
2391
2445
|
}
|
|
2392
2446
|
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2393
2447
|
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule, AngularElasticSeachModule,
|
|
2448
|
+
AngularVertexSeachModule,
|
|
2394
2449
|
AngularFirebaseAuthModule,
|
|
2395
2450
|
AngularFirestoreModule,
|
|
2396
2451
|
AngularHasuraGraphQLModule] });
|
|
@@ -2420,6 +2475,10 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
2420
2475
|
},
|
|
2421
2476
|
deps: [Storage, STORAGE_BASE_URL],
|
|
2422
2477
|
},
|
|
2478
|
+
{
|
|
2479
|
+
provide: 'ProductSearch',
|
|
2480
|
+
useExisting: ProductsVertexSearch,
|
|
2481
|
+
},
|
|
2423
2482
|
], imports: [provideFirebaseApp((injector) => {
|
|
2424
2483
|
const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
|
|
2425
2484
|
try {
|
|
@@ -2431,6 +2490,7 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
2431
2490
|
}),
|
|
2432
2491
|
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2433
2492
|
AngularElasticSeachModule,
|
|
2493
|
+
AngularVertexSeachModule,
|
|
2434
2494
|
AngularFirebaseAuthModule,
|
|
2435
2495
|
AngularFirestoreModule,
|
|
2436
2496
|
AngularHasuraGraphQLModule] });
|
|
@@ -2449,6 +2509,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2449
2509
|
}),
|
|
2450
2510
|
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2451
2511
|
AngularElasticSeachModule,
|
|
2512
|
+
AngularVertexSeachModule,
|
|
2452
2513
|
AngularFirebaseAuthModule,
|
|
2453
2514
|
AngularFirestoreModule,
|
|
2454
2515
|
AngularHasuraGraphQLModule,
|
|
@@ -2479,6 +2540,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2479
2540
|
},
|
|
2480
2541
|
deps: [Storage, STORAGE_BASE_URL],
|
|
2481
2542
|
},
|
|
2543
|
+
{
|
|
2544
|
+
provide: 'ProductSearch',
|
|
2545
|
+
useExisting: ProductsVertexSearch,
|
|
2546
|
+
},
|
|
2482
2547
|
],
|
|
2483
2548
|
}]
|
|
2484
2549
|
}] });
|