@infrab4a/connect-angular 4.9.4-beta.0 → 4.10.0-beta.0
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 +5 -4
- 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 +13 -8
- 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 +27 -16
- package/esm2020/services/catalog/wishlist.service.mjs +6 -21
- package/esm2020/services/coupon.service.mjs +8 -13
- package/fesm2015/infrab4a-connect-angular.mjs +113 -87
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +113 -87
- 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 +2 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectionToken, NgModule, PLATFORM_ID, Injectable, Inject } from '@angular/core';
|
|
3
3
|
import * as i1$4 from '@angular/fire/app';
|
|
4
4
|
import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
|
|
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 {
|
|
8
|
+
import { Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, 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, DiscoveryEngineSearch, 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';
|
|
@@ -18,44 +18,14 @@ import { __decorate, __metadata } from 'tslib';
|
|
|
18
18
|
import { Type } from 'class-transformer';
|
|
19
19
|
import * as i1$3 from '@angular/common/http';
|
|
20
20
|
|
|
21
|
-
const ES_CONFIG = 'ES_CONFIG';
|
|
22
|
-
|
|
23
|
-
class AngularElasticSeachModule {
|
|
24
|
-
static initializeApp(options) {
|
|
25
|
-
return {
|
|
26
|
-
ngModule: AngularElasticSeachModule,
|
|
27
|
-
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
32
|
-
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
|
|
33
|
-
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
34
|
-
{
|
|
35
|
-
provide: ProductsIndex,
|
|
36
|
-
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
37
|
-
deps: [ES_CONFIG],
|
|
38
|
-
},
|
|
39
|
-
] });
|
|
40
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
41
|
-
type: NgModule,
|
|
42
|
-
args: [{
|
|
43
|
-
providers: [
|
|
44
|
-
{
|
|
45
|
-
provide: ProductsIndex,
|
|
46
|
-
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
47
|
-
deps: [ES_CONFIG],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
}]
|
|
51
|
-
}] });
|
|
52
|
-
|
|
53
21
|
const BACKEND_URL = 'BACKEND_URL';
|
|
54
22
|
|
|
55
23
|
const CATEGORY_STRUCTURE = 'CATEGORY_STRUCTURE';
|
|
56
24
|
|
|
57
25
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
58
26
|
|
|
27
|
+
const ES_CONFIG = 'ES_CONFIG';
|
|
28
|
+
|
|
59
29
|
const FIREBASE_APP_NAME = new InjectionToken('firebaseAppName');
|
|
60
30
|
const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
|
|
61
31
|
|
|
@@ -63,6 +33,8 @@ const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
|
63
33
|
|
|
64
34
|
const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
|
|
65
35
|
|
|
36
|
+
const VERTEX_CONFIG = 'VERTEX_CONFIG';
|
|
37
|
+
|
|
66
38
|
class AngularFirebaseAuthModule {
|
|
67
39
|
static initializeApp(options, nameOrConfig) {
|
|
68
40
|
return {
|
|
@@ -171,6 +143,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
171
143
|
}]
|
|
172
144
|
}] });
|
|
173
145
|
|
|
146
|
+
class AngularElasticSeachModule {
|
|
147
|
+
static initializeApp(options) {
|
|
148
|
+
return {
|
|
149
|
+
ngModule: AngularElasticSeachModule,
|
|
150
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
155
|
+
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
|
|
156
|
+
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
157
|
+
{
|
|
158
|
+
provide: ProductsIndex,
|
|
159
|
+
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
160
|
+
deps: [ES_CONFIG],
|
|
161
|
+
},
|
|
162
|
+
] });
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
164
|
+
type: NgModule,
|
|
165
|
+
args: [{
|
|
166
|
+
providers: [
|
|
167
|
+
{
|
|
168
|
+
provide: ProductsIndex,
|
|
169
|
+
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
170
|
+
deps: [ES_CONFIG],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
}]
|
|
174
|
+
}] });
|
|
175
|
+
|
|
174
176
|
class MobileOperationSystemCheckerHelper {
|
|
175
177
|
static isAppleDevice() {
|
|
176
178
|
return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator?.platform) ||
|
|
@@ -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 DiscoveryEngineSearch(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 DiscoveryEngineSearch(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,15 @@ 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,
|
|
1679
|
+
// private readonly productIndex: ProductsIndex,
|
|
1680
|
+
productVertexSearch) {
|
|
1654
1681
|
this.productRepository = productRepository;
|
|
1655
1682
|
this.productStockNotificationRepository = productStockNotificationRepository;
|
|
1656
1683
|
this.categoryRepository = categoryRepository;
|
|
1657
1684
|
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1658
1685
|
this.shop = shop;
|
|
1659
|
-
this.
|
|
1686
|
+
this.productVertexSearch = productVertexSearch;
|
|
1660
1687
|
this.productsByTerm = {};
|
|
1661
1688
|
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1662
1689
|
const filters = {};
|
|
@@ -1737,7 +1764,7 @@ class CatalogService {
|
|
|
1737
1764
|
}
|
|
1738
1765
|
async findCatalog(options, limits) {
|
|
1739
1766
|
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1740
|
-
const productsIds = await this.
|
|
1767
|
+
const productsIds = await this.findCatalogIdsByVertexAiSearch(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.
|
|
1806
|
+
return this.productVertexSearch
|
|
1780
1807
|
.search(term, 999, this.shop)
|
|
1781
|
-
.then((data) => ({ id: { operator: Where.IN, value: data.
|
|
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))];
|
|
@@ -1845,20 +1872,29 @@ class CatalogService {
|
|
|
1845
1872
|
distinct: totalResult.distinct,
|
|
1846
1873
|
};
|
|
1847
1874
|
}
|
|
1848
|
-
async findCatalogIdsByElasticSearch(term) {
|
|
1875
|
+
// private async findCatalogIdsByElasticSearch(term: string): Promise<string[]> {
|
|
1876
|
+
// if (this.productsByTerm[term]) return this.productsByTerm[term]
|
|
1877
|
+
// return (this.productsByTerm[term] = await this.productIndex
|
|
1878
|
+
// .search(term, 999, this.shop)
|
|
1879
|
+
// .then(({ hits: products }) => {
|
|
1880
|
+
// const withStock = products.filter(({ _source }) => _source.stock.quantity > 0)
|
|
1881
|
+
// const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0)
|
|
1882
|
+
// const sorted = [...withStock, ...withOutStock]
|
|
1883
|
+
// return [...new Set(sorted.map(({ _source }) => _source.id))]
|
|
1884
|
+
// }))
|
|
1885
|
+
// }
|
|
1886
|
+
async findCatalogIdsByVertexAiSearch(term) {
|
|
1849
1887
|
if (this.productsByTerm[term])
|
|
1850
1888
|
return this.productsByTerm[term];
|
|
1851
|
-
return (this.productsByTerm[term] = await this.
|
|
1852
|
-
.
|
|
1853
|
-
.
|
|
1854
|
-
const withStock = products.filter(({ _source }) => _source.stock.quantity > 0);
|
|
1855
|
-
const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0);
|
|
1889
|
+
return (this.productsByTerm[term] = await this.productVertexSearch.search(term, 999, this.shop).then((products) => {
|
|
1890
|
+
const withStock = products.filter((_source) => _source.stock > 0);
|
|
1891
|
+
const withOutStock = products.filter((_source) => _source.stock <= 0);
|
|
1856
1892
|
const sorted = [...withStock, ...withOutStock];
|
|
1857
|
-
return [...new Set(sorted.map((
|
|
1893
|
+
return [...new Set(sorted.map((products) => products.id))];
|
|
1858
1894
|
}));
|
|
1859
1895
|
}
|
|
1860
1896
|
}
|
|
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: i1$2.
|
|
1897
|
+
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: i1$2.ProductsVertexSearch }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1862
1898
|
CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
|
|
1863
1899
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
|
|
1864
1900
|
type: Injectable
|
|
@@ -1877,7 +1913,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1877
1913
|
}] }, { type: i1$2.Shops, decorators: [{
|
|
1878
1914
|
type: Inject,
|
|
1879
1915
|
args: [DEFAULT_SHOP]
|
|
1880
|
-
}] }, { type: i1$2.
|
|
1916
|
+
}] }, { type: i1$2.ProductsVertexSearch }]; } });
|
|
1881
1917
|
|
|
1882
1918
|
class CategoryService {
|
|
1883
1919
|
constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
|
|
@@ -1944,11 +1980,11 @@ __decorate([
|
|
|
1944
1980
|
], CategoryWithTree.prototype, "children", void 0);
|
|
1945
1981
|
|
|
1946
1982
|
class WishlistService {
|
|
1947
|
-
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository,
|
|
1983
|
+
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productVertexSearch) {
|
|
1948
1984
|
this.wishlistRepository = wishlistRepository;
|
|
1949
1985
|
this.shop = shop;
|
|
1950
1986
|
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
|
|
1951
|
-
this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1987
|
+
this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productVertexSearch);
|
|
1952
1988
|
this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
1953
1989
|
}
|
|
1954
1990
|
getCatalogService() {
|
|
@@ -1981,21 +2017,6 @@ class WishlistService {
|
|
|
1981
2017
|
personType: personType ?? PersonTypes.NONE,
|
|
1982
2018
|
personIsSubscriber: personIsSubscriber ?? false,
|
|
1983
2019
|
};
|
|
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
2020
|
const newWishlist = await this.wishlistRepository.create(data);
|
|
2000
2021
|
await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
|
|
2001
2022
|
return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });
|
|
@@ -2055,7 +2076,7 @@ class WishlistService {
|
|
|
2055
2076
|
return wishlist;
|
|
2056
2077
|
}
|
|
2057
2078
|
}
|
|
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: i1$2.
|
|
2079
|
+
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: i1$2.ProductsVertexSearch }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2059
2080
|
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
|
|
2060
2081
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
|
|
2061
2082
|
type: Injectable
|
|
@@ -2077,7 +2098,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2077
2098
|
}] }, { type: undefined, decorators: [{
|
|
2078
2099
|
type: Inject,
|
|
2079
2100
|
args: ['ProductStockNotificationRepository']
|
|
2080
|
-
}] }, { type: i1$2.
|
|
2101
|
+
}] }, { type: i1$2.ProductsVertexSearch }]; } });
|
|
2081
2102
|
|
|
2082
2103
|
class CheckoutSubscriptionService {
|
|
2083
2104
|
constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
|
|
@@ -2382,6 +2403,7 @@ class AngularConnectModule {
|
|
|
2382
2403
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
|
|
2383
2404
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
2384
2405
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
2406
|
+
...(isNil(options?.vertexAiConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexAiConfig }]),
|
|
2385
2407
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
2386
2408
|
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
2387
2409
|
...(isNil(options?.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
|
|
@@ -2390,7 +2412,9 @@ class AngularConnectModule {
|
|
|
2390
2412
|
}
|
|
2391
2413
|
}
|
|
2392
2414
|
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2393
|
-
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule,
|
|
2415
|
+
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule,
|
|
2416
|
+
// AngularElasticSeachModule,
|
|
2417
|
+
AngularVertexSeachModule,
|
|
2394
2418
|
AngularFirebaseAuthModule,
|
|
2395
2419
|
AngularFirestoreModule,
|
|
2396
2420
|
AngularHasuraGraphQLModule] });
|
|
@@ -2430,7 +2454,8 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
2430
2454
|
}
|
|
2431
2455
|
}),
|
|
2432
2456
|
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2433
|
-
AngularElasticSeachModule,
|
|
2457
|
+
// AngularElasticSeachModule,
|
|
2458
|
+
AngularVertexSeachModule,
|
|
2434
2459
|
AngularFirebaseAuthModule,
|
|
2435
2460
|
AngularFirestoreModule,
|
|
2436
2461
|
AngularHasuraGraphQLModule] });
|
|
@@ -2448,7 +2473,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2448
2473
|
}
|
|
2449
2474
|
}),
|
|
2450
2475
|
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2451
|
-
AngularElasticSeachModule,
|
|
2476
|
+
// AngularElasticSeachModule,
|
|
2477
|
+
AngularVertexSeachModule,
|
|
2452
2478
|
AngularFirebaseAuthModule,
|
|
2453
2479
|
AngularFirestoreModule,
|
|
2454
2480
|
AngularHasuraGraphQLModule,
|