@infrab4a/connect-angular 5.0.0-beta.6 → 5.0.0-beta.60
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 +13 -8
- package/angular-firestore.module.d.ts +1 -2
- package/angular-vertex-search.module.d.ts +9 -0
- package/consts/index.d.ts +2 -0
- package/consts/persistence.const.d.ts +1 -0
- package/consts/vertex-config.const.d.ts +1 -0
- package/esm2022/angular-connect.module.mjs +38 -5
- package/esm2022/angular-elastic-search.module.mjs +1 -1
- package/esm2022/angular-firebase-auth.module.mjs +1 -1
- package/esm2022/angular-firestore.module.mjs +25 -28
- package/esm2022/angular-hasura-graphql.module.mjs +24 -2
- package/esm2022/angular-vertex-search.module.mjs +34 -0
- package/esm2022/consts/category-structure.mjs +1 -1
- package/esm2022/consts/default-shop.const.mjs +1 -1
- package/esm2022/consts/es-config.const.mjs +1 -1
- package/esm2022/consts/firebase-const.mjs +1 -1
- package/esm2022/consts/hasura-options.const.mjs +1 -1
- package/esm2022/consts/index.mjs +3 -1
- package/esm2022/consts/persistence.const.mjs +2 -0
- package/esm2022/consts/storage-base-url.const.mjs +1 -1
- package/esm2022/consts/vertex-config.const.mjs +2 -0
- package/esm2022/helpers/index.mjs +1 -1
- package/esm2022/helpers/mobile-operation-system-checker.helper.mjs +1 -1
- package/esm2022/index.mjs +2 -1
- package/esm2022/persistence/cookie-data-persistence.mjs +22 -0
- package/esm2022/persistence/data-persistence.mjs +2 -0
- package/esm2022/persistence/index.mjs +3 -0
- package/esm2022/services/auth.service.mjs +1 -1
- package/esm2022/services/cart.service.mjs +14 -11
- package/esm2022/services/catalog/adapters/category-structure.adapter.mjs +1 -1
- package/esm2022/services/catalog/adapters/index.mjs +1 -1
- package/esm2022/services/catalog/adapters/new-category-structure.adapter.mjs +6 -4
- package/esm2022/services/catalog/adapters/old-category-structure.adapter.mjs +1 -1
- package/esm2022/services/catalog/catalog.service.mjs +89 -33
- package/esm2022/services/catalog/category.service.mjs +1 -1
- package/esm2022/services/catalog/enums/index.mjs +1 -1
- package/esm2022/services/catalog/enums/product-sorts.enum.mjs +1 -1
- package/esm2022/services/catalog/index.mjs +1 -1
- package/esm2022/services/catalog/models/category-with-tree.model.mjs +1 -1
- package/esm2022/services/catalog/models/index.mjs +1 -1
- package/esm2022/services/catalog/types/index.mjs +1 -1
- package/esm2022/services/catalog/types/product-sort.type.mjs +1 -1
- package/esm2022/services/catalog/wishlist.service.mjs +50 -17
- package/esm2022/services/checkout-subscription.service.mjs +18 -21
- package/esm2022/services/checkout.service.mjs +13 -16
- package/esm2022/services/coupon.service.mjs +54 -19
- package/esm2022/services/helpers/index.mjs +1 -1
- package/esm2022/services/helpers/util.helper.mjs +1 -1
- package/esm2022/services/home-shop.service.mjs +1 -1
- package/esm2022/services/index.mjs +1 -1
- package/esm2022/services/order.service.mjs +1 -1
- package/esm2022/services/shipping.service.mjs +1 -1
- package/esm2022/services/types/index.mjs +1 -1
- package/esm2022/services/types/required-checkout-data.type.mjs +1 -1
- package/esm2022/services/types/required-checkout-subscription-data.type.mjs +1 -1
- package/esm2022/services/types/shipping-methods.type.mjs +1 -1
- package/esm2022/types/firebase-app-config.type.mjs +1 -1
- package/esm2022/types/index.mjs +1 -1
- package/fesm2022/infrab4a-connect-angular.mjs +366 -139
- package/fesm2022/infrab4a-connect-angular.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +5 -5
- package/persistence/cookie-data-persistence.d.ts +10 -0
- package/persistence/data-persistence.d.ts +6 -0
- package/persistence/index.d.ts +2 -0
- package/services/catalog/catalog.service.d.ts +7 -4
- package/services/catalog/wishlist.service.d.ts +11 -4
- package/services/checkout-subscription.service.d.ts +5 -4
- package/services/checkout.service.d.ts +8 -4
- package/services/coupon.service.d.ts +6 -2
|
@@ -2,18 +2,18 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { NgModule, InjectionToken, 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
|
+
import * as i2 from '@angular/fire/storage';
|
|
6
|
+
import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
|
|
5
7
|
import * as i1$2 from '@infrab4a/connect';
|
|
6
|
-
import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, 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,
|
|
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, OrderStatus, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, PersonTypes, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
|
|
7
9
|
import * as i1 from '@angular/fire/auth';
|
|
8
10
|
import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
|
|
9
11
|
import { isPlatformBrowser, isPlatformServer } from '@angular/common';
|
|
10
12
|
import * as i1$1 from '@angular/fire/firestore';
|
|
11
|
-
import { Firestore, provideFirestore,
|
|
12
|
-
import * as i2 from '@angular/fire/storage';
|
|
13
|
-
import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
|
|
14
|
-
import { combineLatest, from, of, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
15
|
-
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
13
|
+
import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
|
|
16
14
|
import cookie from 'js-cookie';
|
|
15
|
+
import { of, from, combineLatest, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
16
|
+
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
17
17
|
import { __decorate, __metadata } from 'tslib';
|
|
18
18
|
import { Type } from 'class-transformer';
|
|
19
19
|
import * as i1$3 from '@angular/common/http';
|
|
@@ -61,6 +61,10 @@ const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
|
|
|
61
61
|
|
|
62
62
|
const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
63
63
|
|
|
64
|
+
const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
|
|
65
|
+
|
|
66
|
+
const VERTEX_CONFIG = 'VERTEX_CONFIG';
|
|
67
|
+
|
|
64
68
|
class AngularFirebaseAuthModule {
|
|
65
69
|
static initializeApp(options, nameOrConfig) {
|
|
66
70
|
return {
|
|
@@ -169,8 +173,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
169
173
|
}]
|
|
170
174
|
}] });
|
|
171
175
|
|
|
172
|
-
const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
|
|
173
|
-
|
|
174
176
|
class MobileOperationSystemCheckerHelper {
|
|
175
177
|
static isAppleDevice() {
|
|
176
178
|
return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator?.platform) ||
|
|
@@ -190,12 +192,12 @@ class AngularFirestoreModule {
|
|
|
190
192
|
};
|
|
191
193
|
}
|
|
192
194
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
193
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule
|
|
195
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule] }); }
|
|
194
196
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
195
197
|
{
|
|
196
198
|
provide: 'FirestoreOptions',
|
|
197
199
|
useFactory: (firestore, platformId) => ({
|
|
198
|
-
firestore,
|
|
200
|
+
firestore: new ConnectFirestoreService(firestore),
|
|
199
201
|
interceptors: {
|
|
200
202
|
request: (request) => {
|
|
201
203
|
if (isPlatformBrowser(platformId))
|
|
@@ -404,26 +406,26 @@ class AngularFirestoreModule {
|
|
|
404
406
|
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
405
407
|
},
|
|
406
408
|
{
|
|
407
|
-
provide: '
|
|
408
|
-
useFactory: (
|
|
409
|
-
return new
|
|
409
|
+
provide: 'OrderBlockedRepository',
|
|
410
|
+
useFactory: (options) => {
|
|
411
|
+
return new OrderBlockedFirestoreRepository(options);
|
|
410
412
|
},
|
|
411
|
-
deps: [
|
|
413
|
+
deps: ['FirestoreOptions'],
|
|
412
414
|
},
|
|
413
415
|
], imports: [AngularElasticSeachModule,
|
|
414
416
|
provideFirestore((injector) => {
|
|
415
417
|
const platformId = injector.get(PLATFORM_ID);
|
|
416
|
-
if (isPlatformServer(platformId))
|
|
417
|
-
return
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
|
|
419
|
+
return initializeFirestore(injector.get(FirebaseApp), {
|
|
420
|
+
ignoreUndefinedProperties: true,
|
|
421
|
+
});
|
|
420
422
|
const firestore = initializeFirestore(injector.get(FirebaseApp), {
|
|
421
423
|
experimentalForceLongPolling: true,
|
|
424
|
+
ignoreUndefinedProperties: true,
|
|
422
425
|
localCache: memoryLocalCache(),
|
|
423
426
|
});
|
|
424
427
|
return firestore;
|
|
425
|
-
})
|
|
426
|
-
provideStorage(() => getStorage())] }); }
|
|
428
|
+
})] }); }
|
|
427
429
|
}
|
|
428
430
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
429
431
|
type: NgModule,
|
|
@@ -432,23 +434,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
432
434
|
AngularElasticSeachModule,
|
|
433
435
|
provideFirestore((injector) => {
|
|
434
436
|
const platformId = injector.get(PLATFORM_ID);
|
|
435
|
-
if (isPlatformServer(platformId))
|
|
436
|
-
return
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
|
|
438
|
+
return initializeFirestore(injector.get(FirebaseApp), {
|
|
439
|
+
ignoreUndefinedProperties: true,
|
|
440
|
+
});
|
|
439
441
|
const firestore = initializeFirestore(injector.get(FirebaseApp), {
|
|
440
442
|
experimentalForceLongPolling: true,
|
|
443
|
+
ignoreUndefinedProperties: true,
|
|
441
444
|
localCache: memoryLocalCache(),
|
|
442
445
|
});
|
|
443
446
|
return firestore;
|
|
444
447
|
}),
|
|
445
|
-
provideStorage(() => getStorage()),
|
|
446
448
|
],
|
|
447
449
|
providers: [
|
|
448
450
|
{
|
|
449
451
|
provide: 'FirestoreOptions',
|
|
450
452
|
useFactory: (firestore, platformId) => ({
|
|
451
|
-
firestore,
|
|
453
|
+
firestore: new ConnectFirestoreService(firestore),
|
|
452
454
|
interceptors: {
|
|
453
455
|
request: (request) => {
|
|
454
456
|
if (isPlatformBrowser(platformId))
|
|
@@ -657,11 +659,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
657
659
|
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
658
660
|
},
|
|
659
661
|
{
|
|
660
|
-
provide: '
|
|
661
|
-
useFactory: (
|
|
662
|
-
return new
|
|
662
|
+
provide: 'OrderBlockedRepository',
|
|
663
|
+
useFactory: (options) => {
|
|
664
|
+
return new OrderBlockedFirestoreRepository(options);
|
|
663
665
|
},
|
|
664
|
-
deps: [
|
|
666
|
+
deps: ['FirestoreOptions'],
|
|
665
667
|
},
|
|
666
668
|
],
|
|
667
669
|
}]
|
|
@@ -744,6 +746,17 @@ class AngularHasuraGraphQLModule {
|
|
|
744
746
|
},
|
|
745
747
|
deps: ['HasuraConfig'],
|
|
746
748
|
},
|
|
749
|
+
{
|
|
750
|
+
provide: 'ProductStockNotificationRepository',
|
|
751
|
+
useExisting: ProductStockNotificationHasuraGraphQLRepository,
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
provide: ProductStockNotificationHasuraGraphQLRepository,
|
|
755
|
+
useFactory: (hasuraConfig) => {
|
|
756
|
+
return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
|
|
757
|
+
},
|
|
758
|
+
deps: ['HasuraConfig'],
|
|
759
|
+
},
|
|
747
760
|
{
|
|
748
761
|
provide: 'CategoryFilterRepository',
|
|
749
762
|
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
@@ -870,6 +883,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
870
883
|
},
|
|
871
884
|
deps: ['HasuraConfig'],
|
|
872
885
|
},
|
|
886
|
+
{
|
|
887
|
+
provide: 'ProductStockNotificationRepository',
|
|
888
|
+
useExisting: ProductStockNotificationHasuraGraphQLRepository,
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
provide: ProductStockNotificationHasuraGraphQLRepository,
|
|
892
|
+
useFactory: (hasuraConfig) => {
|
|
893
|
+
return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
|
|
894
|
+
},
|
|
895
|
+
deps: ['HasuraConfig'],
|
|
896
|
+
},
|
|
873
897
|
{
|
|
874
898
|
provide: 'CategoryFilterRepository',
|
|
875
899
|
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
@@ -927,6 +951,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
927
951
|
}]
|
|
928
952
|
}] });
|
|
929
953
|
|
|
954
|
+
class AngularVertexSeachModule {
|
|
955
|
+
static initializeApp(options) {
|
|
956
|
+
return {
|
|
957
|
+
ngModule: AngularVertexSeachModule,
|
|
958
|
+
providers: [{ provide: VERTEX_CONFIG, useValue: options }],
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
962
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule }); }
|
|
963
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule, providers: [
|
|
964
|
+
{
|
|
965
|
+
provide: ProductsVertexSearch,
|
|
966
|
+
useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
|
|
967
|
+
deps: [VERTEX_CONFIG],
|
|
968
|
+
},
|
|
969
|
+
] }); }
|
|
970
|
+
}
|
|
971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", 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
|
+
|
|
984
|
+
const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
|
|
985
|
+
|
|
986
|
+
class CookieDataPersistence {
|
|
987
|
+
get(key) {
|
|
988
|
+
return of(cookie.get(key));
|
|
989
|
+
}
|
|
990
|
+
remove(key) {
|
|
991
|
+
return of(cookie.remove(key));
|
|
992
|
+
}
|
|
993
|
+
set(key, value) {
|
|
994
|
+
return from(cookie.set(key, value)).pipe(map(() => { }));
|
|
995
|
+
}
|
|
996
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
997
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence }); }
|
|
998
|
+
}
|
|
999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, decorators: [{
|
|
1000
|
+
type: Injectable
|
|
1001
|
+
}] });
|
|
1002
|
+
|
|
930
1003
|
class AuthService {
|
|
931
1004
|
constructor(angularFireAuth, userRepository) {
|
|
932
1005
|
this.angularFireAuth = angularFireAuth;
|
|
@@ -1007,11 +1080,11 @@ class CouponService {
|
|
|
1007
1080
|
throw 'Limite de uso atingido';
|
|
1008
1081
|
}
|
|
1009
1082
|
if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
|
|
1010
|
-
const
|
|
1011
|
-
if (!couponUseLimits.unlimited && couponUseLimits.total &&
|
|
1083
|
+
const ordersCoupon = await this.getOrdersWithCoupon(coupon);
|
|
1084
|
+
if (!couponUseLimits.unlimited && couponUseLimits.total && ordersCoupon.length >= couponUseLimits.total)
|
|
1012
1085
|
throw 'Limite de uso atingido.';
|
|
1013
1086
|
if (couponUseLimits.limitedPerUser) {
|
|
1014
|
-
const ordersWithUser = this.countOrdersWithUser(
|
|
1087
|
+
const ordersWithUser = this.countOrdersWithUser(ordersCoupon, checkout.user.email);
|
|
1015
1088
|
if (ordersWithUser > 0)
|
|
1016
1089
|
throw 'Limite de uso por usuário atingido.';
|
|
1017
1090
|
}
|
|
@@ -1033,38 +1106,44 @@ class CouponService {
|
|
|
1033
1106
|
return of(discount);
|
|
1034
1107
|
}
|
|
1035
1108
|
async calcDiscountShopping(coupon, checkout) {
|
|
1036
|
-
let
|
|
1109
|
+
let discountInfo = null;
|
|
1037
1110
|
if (checkout.user.isSubscriber && coupon.discount.subscriber.value) {
|
|
1038
|
-
|
|
1111
|
+
discountInfo = await this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
|
|
1039
1112
|
}
|
|
1040
1113
|
else {
|
|
1041
|
-
|
|
1114
|
+
discountInfo = await this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
|
|
1042
1115
|
}
|
|
1043
|
-
return discount;
|
|
1116
|
+
return { discount: discountInfo.discount, lineItems: discountInfo.lineItems };
|
|
1044
1117
|
}
|
|
1045
1118
|
async calcDiscountByType(type, value, categories, checkout) {
|
|
1046
1119
|
let discount = 0;
|
|
1047
|
-
|
|
1048
|
-
|
|
1120
|
+
if (type == CouponTypes.SHIPPING) {
|
|
1121
|
+
const subTotal = checkout.shipping.ShippingPrice;
|
|
1122
|
+
const discount = subTotal * ((value > 100 ? 100 : value) / 100);
|
|
1123
|
+
return { discount, lineItems: checkout.lineItems };
|
|
1124
|
+
}
|
|
1125
|
+
let lineItensElegibleForDiscount = await this.getLineItensEligebleForDiscount(categories, checkout);
|
|
1126
|
+
const subTotal = this.calcCheckoutSubtotal(lineItensElegibleForDiscount, checkout.user);
|
|
1049
1127
|
if (type == CouponTypes.ABSOLUTE) {
|
|
1050
1128
|
discount = value > subTotal ? subTotal : value;
|
|
1051
1129
|
}
|
|
1052
1130
|
else {
|
|
1053
|
-
discount = subTotal * (value / 100);
|
|
1131
|
+
discount = subTotal * ((value > 100 ? 100 : value) / 100);
|
|
1054
1132
|
}
|
|
1055
|
-
|
|
1133
|
+
const lineItems = this.calcLineItenDiscount(type, lineItensElegibleForDiscount, value, subTotal);
|
|
1134
|
+
return { discount, lineItems };
|
|
1056
1135
|
}
|
|
1057
1136
|
async hasMinSubTotal(coupon, checkout) {
|
|
1058
1137
|
if (!coupon.minSubTotalValue)
|
|
1059
1138
|
return true;
|
|
1060
1139
|
let lineItensDiscount = await this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
|
|
1061
|
-
const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user
|
|
1140
|
+
const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user);
|
|
1062
1141
|
if (coupon.minSubTotalValue <= subTotal)
|
|
1063
1142
|
return true;
|
|
1064
1143
|
return false;
|
|
1065
1144
|
}
|
|
1066
1145
|
async hasProductCategories(coupon, checkout) {
|
|
1067
|
-
if (!coupon.productsCategories || !coupon.productsCategories
|
|
1146
|
+
if (!coupon.productsCategories || !coupon.productsCategories?.length) {
|
|
1068
1147
|
return true;
|
|
1069
1148
|
}
|
|
1070
1149
|
const couponCategories = await this.getCouponCategoriesId(coupon.productsCategories);
|
|
@@ -1126,7 +1205,7 @@ class CouponService {
|
|
|
1126
1205
|
}
|
|
1127
1206
|
return lineItensDiscount;
|
|
1128
1207
|
}
|
|
1129
|
-
calcCheckoutSubtotal(lineItens, user
|
|
1208
|
+
calcCheckoutSubtotal(lineItens, user) {
|
|
1130
1209
|
return (lineItens?.reduce((acc, curr) => user?.isSubscriber && curr.price.subscriberPrice
|
|
1131
1210
|
? acc + curr.price?.subscriberPrice * curr.quantity
|
|
1132
1211
|
: acc + curr.pricePaid * curr.quantity, 0) || 0);
|
|
@@ -1136,7 +1215,7 @@ class CouponService {
|
|
|
1136
1215
|
.find({
|
|
1137
1216
|
filters: {
|
|
1138
1217
|
coupon: { id: coupon.id },
|
|
1139
|
-
|
|
1218
|
+
status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
|
|
1140
1219
|
},
|
|
1141
1220
|
})
|
|
1142
1221
|
.then((result) => result.data);
|
|
@@ -1146,7 +1225,7 @@ class CouponService {
|
|
|
1146
1225
|
.find({
|
|
1147
1226
|
filters: {
|
|
1148
1227
|
user: { email: { operator: Where.EQUALS, value: email } },
|
|
1149
|
-
|
|
1228
|
+
status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
|
|
1150
1229
|
},
|
|
1151
1230
|
})
|
|
1152
1231
|
.then((result) => result.data);
|
|
@@ -1157,13 +1236,42 @@ class CouponService {
|
|
|
1157
1236
|
getCouponUseLimits(coupon, checkoutType, user) {
|
|
1158
1237
|
let couponUseLimits;
|
|
1159
1238
|
if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
|
|
1160
|
-
|
|
1239
|
+
if (coupon.exclusivityType.length === 1 &&
|
|
1240
|
+
(coupon.exclusivityType.at(0) === Exclusivities.SPECIFIC_USER ||
|
|
1241
|
+
coupon.exclusivityType.at(0) === Exclusivities.COLLABORATORS))
|
|
1242
|
+
couponUseLimits = coupon.useLimits.non_subscriber;
|
|
1243
|
+
else
|
|
1244
|
+
couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
|
|
1161
1245
|
}
|
|
1162
1246
|
else {
|
|
1163
1247
|
couponUseLimits = coupon.useLimits.subscription;
|
|
1164
1248
|
}
|
|
1165
1249
|
return couponUseLimits;
|
|
1166
1250
|
}
|
|
1251
|
+
calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
|
|
1252
|
+
let lineItemsDiscount = [];
|
|
1253
|
+
if (type === CouponTypes.ABSOLUTE) {
|
|
1254
|
+
const couponDiscountMax = couponDiscount > subTotal ? subTotal : couponDiscount;
|
|
1255
|
+
lineItemsDiscount = lineItems.map((item) => {
|
|
1256
|
+
const totalItemPercentage = item.pricePaid / subTotal;
|
|
1257
|
+
const discountItem = couponDiscountMax * totalItemPercentage;
|
|
1258
|
+
return {
|
|
1259
|
+
...item,
|
|
1260
|
+
discount: Number(discountItem.toFixed(2)),
|
|
1261
|
+
};
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
else {
|
|
1265
|
+
lineItemsDiscount = lineItems.map((item) => {
|
|
1266
|
+
const discountItem = item.pricePaid * (couponDiscount / 100);
|
|
1267
|
+
return {
|
|
1268
|
+
...item,
|
|
1269
|
+
discount: Number(discountItem.toFixed(2)),
|
|
1270
|
+
};
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
return lineItemsDiscount;
|
|
1274
|
+
}
|
|
1167
1275
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1168
1276
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, providedIn: 'root' }); }
|
|
1169
1277
|
}
|
|
@@ -1187,18 +1295,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1187
1295
|
}] }] });
|
|
1188
1296
|
|
|
1189
1297
|
class CheckoutService {
|
|
1190
|
-
constructor(couponService, checkoutRepository,
|
|
1298
|
+
constructor(couponService, checkoutRepository, userRepository, defaultShop, dataPersistence) {
|
|
1191
1299
|
this.couponService = couponService;
|
|
1192
1300
|
this.checkoutRepository = checkoutRepository;
|
|
1193
|
-
this.orderRepository = orderRepository;
|
|
1194
1301
|
this.userRepository = userRepository;
|
|
1195
1302
|
this.defaultShop = defaultShop;
|
|
1303
|
+
this.dataPersistence = dataPersistence;
|
|
1196
1304
|
}
|
|
1197
1305
|
getCheckout(checkoutData) {
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
return from(this.createCheckout(checkoutData));
|
|
1306
|
+
return this.dataPersistence
|
|
1307
|
+
.get('checkoutId')
|
|
1308
|
+
.pipe(concatMap((id) => (!isNil(id) ? this.checkoutRepository.get({ id }) : this.createCheckout(checkoutData))));
|
|
1202
1309
|
}
|
|
1203
1310
|
getUserByCheckout(checkoutId) {
|
|
1204
1311
|
return from(this.checkoutRepository.get({ id: checkoutId })).pipe(concatMap((checkout) => checkout?.user?.id ? of(checkout.user) : from(this.userRepository.get({ id: checkout.user.id }))), concatMap((user) => of(user) || throwError(() => new NotFoundError('User is not found'))));
|
|
@@ -1210,8 +1317,7 @@ class CheckoutService {
|
|
|
1210
1317
|
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
1211
1318
|
}
|
|
1212
1319
|
clearCheckoutFromSession() {
|
|
1213
|
-
|
|
1214
|
-
return of();
|
|
1320
|
+
return this.dataPersistence.remove('checkoutId');
|
|
1215
1321
|
}
|
|
1216
1322
|
calcDiscount(coupon) {
|
|
1217
1323
|
return this.getCheckout().pipe(concatMap(async (checkout) => await this.couponService.calcDiscountShopping(coupon, checkout)));
|
|
@@ -1225,10 +1331,10 @@ class CheckoutService {
|
|
|
1225
1331
|
...Checkout.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
|
|
1226
1332
|
shop: checkoutData?.shop || this.defaultShop,
|
|
1227
1333
|
});
|
|
1228
|
-
|
|
1334
|
+
await this.dataPersistence.set('checkoutId', checkout.id).toPromise();
|
|
1229
1335
|
return checkout;
|
|
1230
1336
|
}
|
|
1231
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: '
|
|
1337
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }, { token: PERSISTENCE_PROVIDER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1232
1338
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService }); }
|
|
1233
1339
|
}
|
|
1234
1340
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, decorators: [{
|
|
@@ -1236,15 +1342,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1236
1342
|
}], ctorParameters: () => [{ type: CouponService }, { type: undefined, decorators: [{
|
|
1237
1343
|
type: Inject,
|
|
1238
1344
|
args: ['CheckoutRepository']
|
|
1239
|
-
}] }, { type: undefined, decorators: [{
|
|
1240
|
-
type: Inject,
|
|
1241
|
-
args: ['OrderRepository']
|
|
1242
1345
|
}] }, { type: undefined, decorators: [{
|
|
1243
1346
|
type: Inject,
|
|
1244
1347
|
args: ['UserRepository']
|
|
1245
1348
|
}] }, { type: i1$2.Shops, decorators: [{
|
|
1246
1349
|
type: Inject,
|
|
1247
1350
|
args: [DEFAULT_SHOP]
|
|
1351
|
+
}] }, { type: undefined, decorators: [{
|
|
1352
|
+
type: Inject,
|
|
1353
|
+
args: [PERSISTENCE_PROVIDER]
|
|
1248
1354
|
}] }] });
|
|
1249
1355
|
|
|
1250
1356
|
class CartService {
|
|
@@ -1263,6 +1369,7 @@ class CartService {
|
|
|
1263
1369
|
if (index > -1) {
|
|
1264
1370
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
1265
1371
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
1372
|
+
checkoutLoaded.lineItems[index].price = lineItem.price;
|
|
1266
1373
|
}
|
|
1267
1374
|
else
|
|
1268
1375
|
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
@@ -1280,17 +1387,18 @@ class CartService {
|
|
|
1280
1387
|
this.buildLineItem = async ({ checkout, item, quantity, }) => {
|
|
1281
1388
|
const product = await this.getProductData(item.id);
|
|
1282
1389
|
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.id === item.id)?.quantity || 0;
|
|
1283
|
-
if (this.checkMaxStock(item, quantity || 0))
|
|
1284
|
-
throw new Error('Desculpe! Temos apenas ' +
|
|
1390
|
+
if (this.checkMaxStock(product.stock.quantity, item.quantity || 0, quantity || 0))
|
|
1391
|
+
throw new Error('Desculpe! Temos apenas ' + product.stock?.quantity + ' em estoque.');
|
|
1285
1392
|
const image = item.image || item.images?.shift();
|
|
1286
|
-
const { id, name, EAN, slug,
|
|
1393
|
+
const { id, name, EAN, slug, weight, sku, type } = item;
|
|
1287
1394
|
const isGift = item.isGift || null;
|
|
1288
1395
|
const pricePaid = this.getProductPrice({
|
|
1289
|
-
product:
|
|
1396
|
+
product: LineItem.toInstance(product),
|
|
1290
1397
|
shop: checkout.shop || this.defaultShop,
|
|
1291
1398
|
isSubscriber: checkout.user?.isSubscriber,
|
|
1292
1399
|
});
|
|
1293
1400
|
RoundProductPricesHelper.roundProductPrices(item);
|
|
1401
|
+
RoundProductPricesHelper.roundProductPrices(product);
|
|
1294
1402
|
return {
|
|
1295
1403
|
checkout,
|
|
1296
1404
|
lineItem: LineItem.toInstance({
|
|
@@ -1300,12 +1408,13 @@ class CartService {
|
|
|
1300
1408
|
brand: product.brand,
|
|
1301
1409
|
slug: slug ?? product.slug,
|
|
1302
1410
|
sku: sku ?? product.sku,
|
|
1303
|
-
stock,
|
|
1304
|
-
price: this.roundPrice(price),
|
|
1411
|
+
stock: product.stock,
|
|
1412
|
+
price: this.roundPrice(product.price),
|
|
1305
1413
|
image,
|
|
1306
1414
|
weight: weight ?? product.weight,
|
|
1307
1415
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
1308
1416
|
pricePaid,
|
|
1417
|
+
discount: 0,
|
|
1309
1418
|
categories: product.categories ?? [],
|
|
1310
1419
|
isGift: isGift ?? null,
|
|
1311
1420
|
costPrice: product.costPrice ?? 0,
|
|
@@ -1321,10 +1430,10 @@ class CartService {
|
|
|
1321
1430
|
? Number(info.subscriberPrice.toFixed(2))
|
|
1322
1431
|
: Number(info.price.toFixed(2));
|
|
1323
1432
|
};
|
|
1324
|
-
this.checkMaxStock = (
|
|
1325
|
-
const maxStock =
|
|
1326
|
-
const currentItemAmount =
|
|
1327
|
-
return currentItemAmount +
|
|
1433
|
+
this.checkMaxStock = (currentStock, currentItemQtd, quantityToAdd) => {
|
|
1434
|
+
const maxStock = currentStock || 0;
|
|
1435
|
+
const currentItemAmount = currentItemQtd || 0;
|
|
1436
|
+
return currentItemAmount + quantityToAdd > maxStock;
|
|
1328
1437
|
};
|
|
1329
1438
|
}
|
|
1330
1439
|
addItem(item, quantity = 1) {
|
|
@@ -1541,9 +1650,11 @@ class NewCategoryStructureAdapter {
|
|
|
1541
1650
|
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1542
1651
|
}
|
|
1543
1652
|
async getCategory(category) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1653
|
+
const collectionCategory = category.isCollection ||
|
|
1654
|
+
(isNil(category.isCollection) && !category.products?.length) ||
|
|
1655
|
+
category.isWishlist ||
|
|
1656
|
+
category.brandCategory;
|
|
1657
|
+
return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
|
|
1547
1658
|
}
|
|
1548
1659
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1549
1660
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter }); }
|
|
@@ -1576,12 +1687,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1576
1687
|
}] }] });
|
|
1577
1688
|
|
|
1578
1689
|
class CatalogService {
|
|
1579
|
-
constructor(productRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1690
|
+
constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch) {
|
|
1580
1691
|
this.productRepository = productRepository;
|
|
1692
|
+
this.productStockNotificationRepository = productStockNotificationRepository;
|
|
1581
1693
|
this.categoryRepository = categoryRepository;
|
|
1582
1694
|
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1583
1695
|
this.shop = shop;
|
|
1584
|
-
this.
|
|
1696
|
+
this.productSearch = productSearch;
|
|
1585
1697
|
this.productsByTerm = {};
|
|
1586
1698
|
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1587
1699
|
const filters = {};
|
|
@@ -1608,17 +1720,22 @@ class CatalogService {
|
|
|
1608
1720
|
if (!sort || sort === 'most-relevant')
|
|
1609
1721
|
return {};
|
|
1610
1722
|
if (sort === 'best-sellers')
|
|
1611
|
-
return {
|
|
1723
|
+
return {
|
|
1724
|
+
shoppingCount: 'desc',
|
|
1725
|
+
rate: 'desc',
|
|
1726
|
+
stock: 'desc',
|
|
1727
|
+
name: 'asc',
|
|
1728
|
+
};
|
|
1612
1729
|
if (sort === 'biggest-price')
|
|
1613
|
-
return { subscriberPrice: 'desc' };
|
|
1730
|
+
return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
|
|
1614
1731
|
if (sort === 'lowest-price')
|
|
1615
|
-
return { subscriberPrice: 'asc' };
|
|
1732
|
+
return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
|
|
1616
1733
|
if (sort === 'best-rating')
|
|
1617
|
-
return { rate: 'desc' };
|
|
1734
|
+
return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
|
|
1618
1735
|
if (sort === 'news')
|
|
1619
1736
|
return { createdAt: 'desc' };
|
|
1620
1737
|
if (sort === 'biggest-discount')
|
|
1621
|
-
return { subscriberDiscountPercentage: 'desc' };
|
|
1738
|
+
return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
|
|
1622
1739
|
};
|
|
1623
1740
|
this.buildLimitQuery = (options) => {
|
|
1624
1741
|
const limit = options?.perPage || 20;
|
|
@@ -1652,16 +1769,26 @@ class CatalogService {
|
|
|
1652
1769
|
brands: distinct?.brand,
|
|
1653
1770
|
}));
|
|
1654
1771
|
}
|
|
1772
|
+
async addCustomerToStockNotification(shop, productId, name, email) {
|
|
1773
|
+
return this.productStockNotificationRepository.addCustomerEmail(shop, productId, name, email);
|
|
1774
|
+
}
|
|
1655
1775
|
async findCatalog(options, limits) {
|
|
1656
1776
|
if (this.hasTerm(options) && options.sort === 'most-relevant') {
|
|
1657
|
-
const productsIds = await this.
|
|
1658
|
-
return this.
|
|
1777
|
+
const productsIds = await this.findCatalogIdsBySearch(options.term);
|
|
1778
|
+
return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
|
|
1659
1779
|
}
|
|
1660
1780
|
if (this.hasCategory(options) && options.sort === 'most-relevant') {
|
|
1661
|
-
const
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1781
|
+
const mostRelevant = options.category.isWishlist ? [] : options.category.getMostRelevantByShop(this.shop);
|
|
1782
|
+
const productsIds = await this.productRepository
|
|
1783
|
+
.findCatalog({
|
|
1784
|
+
fields: ['id'],
|
|
1785
|
+
filters: {
|
|
1786
|
+
...(await this.buildMainFilter(options)),
|
|
1787
|
+
...this.buildFilterQuery(options?.filters || {}),
|
|
1788
|
+
},
|
|
1789
|
+
})
|
|
1790
|
+
.then((products) => products.data.map((product) => product.id));
|
|
1791
|
+
return this.findCatalogAndSortByMostRevelant(mostRelevant, productsIds, options, limits);
|
|
1665
1792
|
}
|
|
1666
1793
|
const repoParams = {
|
|
1667
1794
|
filters: {
|
|
@@ -1686,15 +1813,47 @@ class CatalogService {
|
|
|
1686
1813
|
if (profile)
|
|
1687
1814
|
return { tags: { operator: Where.LIKE, value: profile } };
|
|
1688
1815
|
if (term)
|
|
1689
|
-
return this.
|
|
1690
|
-
.search(term, 999, this.shop)
|
|
1691
|
-
.then((data) => ({ id: { operator: Where.IN, value: data.
|
|
1816
|
+
return this.productSearch
|
|
1817
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1818
|
+
.then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
|
|
1819
|
+
}
|
|
1820
|
+
async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
|
|
1821
|
+
const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
|
|
1822
|
+
const totalResult = await this.productRepository.findCatalog({
|
|
1823
|
+
filters: {
|
|
1824
|
+
id: { operator: Where.IN, value: mostRelevantProductsIds },
|
|
1825
|
+
...this.buildFilterQuery(options?.filters || {}),
|
|
1826
|
+
},
|
|
1827
|
+
orderBy: this.buildSortQuery('best-sellers'),
|
|
1828
|
+
options: {
|
|
1829
|
+
minimal: ['price'],
|
|
1830
|
+
maximum: ['price'],
|
|
1831
|
+
distinct: ['brand'],
|
|
1832
|
+
},
|
|
1833
|
+
}, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
|
|
1834
|
+
const mostRelevantWithouyStock = totalResult.data.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity <= 0);
|
|
1835
|
+
const firstProducts = totalResult.data
|
|
1836
|
+
.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
|
|
1837
|
+
.sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
|
|
1838
|
+
const lastProducts = totalResult.data
|
|
1839
|
+
.filter((product) => !mostRelevants.includes(product.id))
|
|
1840
|
+
.concat(mostRelevantWithouyStock);
|
|
1841
|
+
const categoryMostRelevants = firstProducts.concat(lastProducts);
|
|
1842
|
+
const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
|
|
1843
|
+
return {
|
|
1844
|
+
data: resultFinal,
|
|
1845
|
+
count: totalResult.count,
|
|
1846
|
+
maximum: totalResult.maximum,
|
|
1847
|
+
minimal: totalResult.minimal,
|
|
1848
|
+
distinct: totalResult.distinct,
|
|
1849
|
+
};
|
|
1692
1850
|
}
|
|
1693
|
-
async
|
|
1851
|
+
async findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
|
|
1694
1852
|
const totalResult = await this.productRepository.findCatalog({
|
|
1695
|
-
fields: ['id', 'stock'],
|
|
1853
|
+
fields: ['id', 'stock', 'gender'],
|
|
1696
1854
|
filters: {
|
|
1697
1855
|
id: { operator: Where.IN, value: productIds },
|
|
1856
|
+
published: { operator: Where.EQUALS, value: true },
|
|
1698
1857
|
...this.buildFilterQuery(options?.filters || {}),
|
|
1699
1858
|
},
|
|
1700
1859
|
options: {
|
|
@@ -1703,10 +1862,17 @@ class CatalogService {
|
|
|
1703
1862
|
distinct: ['brand'],
|
|
1704
1863
|
},
|
|
1705
1864
|
}, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
|
|
1865
|
+
const defaultGender = options?.filters?.gender
|
|
1866
|
+
? options?.filters?.gender.at(0)
|
|
1867
|
+
: this.shop === Shops.GLAMSHOP
|
|
1868
|
+
? 'female'
|
|
1869
|
+
: 'male';
|
|
1706
1870
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1707
1871
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1708
|
-
const
|
|
1709
|
-
const
|
|
1872
|
+
const productIdsStockGender = productIds.filter((product) => stockData.some((result) => result.id === product && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex'))));
|
|
1873
|
+
const productIdsStockNotGender = productIds.filter((product) => stockData.some((result) => result.id === product && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex')));
|
|
1874
|
+
const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender);
|
|
1875
|
+
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1710
1876
|
const limitedProductId = productIdsStock
|
|
1711
1877
|
.concat(productIdsStockOut)
|
|
1712
1878
|
.slice(limits.offset, limits.offset + limits.limit);
|
|
@@ -1724,19 +1890,14 @@ class CatalogService {
|
|
|
1724
1890
|
distinct: totalResult.distinct,
|
|
1725
1891
|
};
|
|
1726
1892
|
}
|
|
1727
|
-
async
|
|
1893
|
+
async findCatalogIdsBySearch(term, preview = false) {
|
|
1728
1894
|
if (this.productsByTerm[term])
|
|
1729
1895
|
return this.productsByTerm[term];
|
|
1730
|
-
return (this.productsByTerm[term] = await this.
|
|
1731
|
-
.search(term, 999, this.shop)
|
|
1732
|
-
.then((
|
|
1733
|
-
const withStock = products.filter(({ _source }) => _source.stock.quantity > 0);
|
|
1734
|
-
const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0);
|
|
1735
|
-
const sorted = [...withStock, ...withOutStock];
|
|
1736
|
-
return [...new Set(sorted.map(({ _source }) => _source.id))];
|
|
1737
|
-
}));
|
|
1896
|
+
return (this.productsByTerm[term] = await this.productSearch
|
|
1897
|
+
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1898
|
+
.then((products) => [...new Set(products.map((product) => product.id))]));
|
|
1738
1899
|
}
|
|
1739
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token:
|
|
1900
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1740
1901
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService }); }
|
|
1741
1902
|
}
|
|
1742
1903
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, decorators: [{
|
|
@@ -1744,6 +1905,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1744
1905
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1745
1906
|
type: Inject,
|
|
1746
1907
|
args: ['ProductRepository']
|
|
1908
|
+
}] }, { type: undefined, decorators: [{
|
|
1909
|
+
type: Inject,
|
|
1910
|
+
args: ['ProductStockNotificationRepository']
|
|
1747
1911
|
}] }, { type: undefined, decorators: [{
|
|
1748
1912
|
type: Inject,
|
|
1749
1913
|
args: ['CategoryRepository']
|
|
@@ -1753,7 +1917,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1753
1917
|
}] }, { type: i1$2.Shops, decorators: [{
|
|
1754
1918
|
type: Inject,
|
|
1755
1919
|
args: [DEFAULT_SHOP]
|
|
1756
|
-
}] }, { type:
|
|
1920
|
+
}] }, { type: undefined, decorators: [{
|
|
1921
|
+
type: Inject,
|
|
1922
|
+
args: ['ProductSearch']
|
|
1923
|
+
}] }] });
|
|
1757
1924
|
|
|
1758
1925
|
class CategoryService {
|
|
1759
1926
|
constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
|
|
@@ -1820,11 +1987,12 @@ __decorate([
|
|
|
1820
1987
|
], CategoryWithTree.prototype, "children", void 0);
|
|
1821
1988
|
|
|
1822
1989
|
class WishlistService {
|
|
1823
|
-
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository,
|
|
1990
|
+
constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productSearch) {
|
|
1824
1991
|
this.wishlistRepository = wishlistRepository;
|
|
1825
1992
|
this.shop = shop;
|
|
1993
|
+
this.productSearch = productSearch;
|
|
1826
1994
|
const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
|
|
1827
|
-
this.catalogService = new CatalogService(productRepository, categoryRepository, categoryStructureAdapter, shop,
|
|
1995
|
+
this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch);
|
|
1828
1996
|
this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
|
|
1829
1997
|
}
|
|
1830
1998
|
getCatalogService() {
|
|
@@ -1833,42 +2001,68 @@ class WishlistService {
|
|
|
1833
2001
|
getCategoryService() {
|
|
1834
2002
|
return this.categoryService;
|
|
1835
2003
|
}
|
|
1836
|
-
async create({ personId, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
|
|
2004
|
+
async create({ personId, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
|
|
1837
2005
|
const data = {
|
|
1838
2006
|
slug: '',
|
|
1839
2007
|
name: title,
|
|
1840
2008
|
description,
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
2009
|
+
metadatas: [
|
|
2010
|
+
{
|
|
2011
|
+
shop: this.shop,
|
|
2012
|
+
title: `${userFullName} - ${title}`,
|
|
2013
|
+
description: `${userFullName} - ${description}`,
|
|
2014
|
+
},
|
|
2015
|
+
],
|
|
1845
2016
|
shop: this.shop,
|
|
1846
2017
|
shops: [this.shop],
|
|
1847
2018
|
personId,
|
|
1848
2019
|
personName: userFullName,
|
|
1849
2020
|
personPhoto: userPhoto,
|
|
1850
2021
|
brandCategory: false,
|
|
1851
|
-
published
|
|
2022
|
+
published,
|
|
1852
2023
|
theme,
|
|
1853
2024
|
bannerUrl,
|
|
2025
|
+
personType: personType ?? PersonTypes.NONE,
|
|
2026
|
+
personIsSubscriber: personIsSubscriber ?? false,
|
|
1854
2027
|
};
|
|
2028
|
+
const hasWishlist = await this.wishlistRepository
|
|
2029
|
+
.find({
|
|
2030
|
+
filters: {
|
|
2031
|
+
personId,
|
|
2032
|
+
},
|
|
2033
|
+
options: {
|
|
2034
|
+
enableCount: false,
|
|
2035
|
+
},
|
|
2036
|
+
orderBy: {
|
|
2037
|
+
id: 'asc',
|
|
2038
|
+
},
|
|
2039
|
+
})
|
|
2040
|
+
.then((res) => res.data);
|
|
2041
|
+
if (hasWishlist.length)
|
|
2042
|
+
return hasWishlist.at(0);
|
|
1855
2043
|
const newWishlist = await this.wishlistRepository.create(data);
|
|
1856
2044
|
await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
|
|
1857
2045
|
return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });
|
|
1858
2046
|
}
|
|
1859
|
-
update({ id, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
|
|
2047
|
+
update({ id, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
|
|
1860
2048
|
const data = {
|
|
1861
2049
|
id,
|
|
1862
2050
|
name: title,
|
|
1863
2051
|
description,
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
2052
|
+
published,
|
|
2053
|
+
metadatas: [
|
|
2054
|
+
{
|
|
2055
|
+
shop: this.shop,
|
|
2056
|
+
title: `${userFullName} - ${title}`,
|
|
2057
|
+
description: `${userFullName} - ${description}`,
|
|
2058
|
+
},
|
|
2059
|
+
],
|
|
1868
2060
|
personName: userFullName,
|
|
1869
2061
|
personPhoto: userPhoto,
|
|
1870
2062
|
theme,
|
|
1871
2063
|
bannerUrl,
|
|
2064
|
+
personType: personType ?? PersonTypes.NONE,
|
|
2065
|
+
personIsSubscriber: personIsSubscriber ?? false,
|
|
1872
2066
|
};
|
|
1873
2067
|
return this.wishlistRepository.update(data);
|
|
1874
2068
|
}
|
|
@@ -1904,7 +2098,7 @@ class WishlistService {
|
|
|
1904
2098
|
}
|
|
1905
2099
|
return wishlist;
|
|
1906
2100
|
}
|
|
1907
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token:
|
|
2101
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1908
2102
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService }); }
|
|
1909
2103
|
}
|
|
1910
2104
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, decorators: [{
|
|
@@ -1924,31 +2118,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1924
2118
|
}] }, { type: undefined, decorators: [{
|
|
1925
2119
|
type: Inject,
|
|
1926
2120
|
args: ['CategoryRepository']
|
|
1927
|
-
}] }, { type:
|
|
2121
|
+
}] }, { type: undefined, decorators: [{
|
|
2122
|
+
type: Inject,
|
|
2123
|
+
args: ['ProductStockNotificationRepository']
|
|
2124
|
+
}] }, { type: undefined, decorators: [{
|
|
2125
|
+
type: Inject,
|
|
2126
|
+
args: ['ProductSearch']
|
|
2127
|
+
}] }] });
|
|
1928
2128
|
|
|
1929
2129
|
class CheckoutSubscriptionService {
|
|
1930
|
-
constructor(checkoutSubscriptionRepository,
|
|
2130
|
+
constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
|
|
1931
2131
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
1932
|
-
this.
|
|
2132
|
+
this.dataPersistence = dataPersistence;
|
|
1933
2133
|
this.couponService = couponService;
|
|
1934
2134
|
}
|
|
1935
2135
|
getCheckoutSubscription(checkoutData) {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
return from(this.createCheckoutSubscription(checkoutData));
|
|
1940
|
-
}
|
|
1941
|
-
async createCheckoutSubscription(checkoutData) {
|
|
1942
|
-
const checkout = await this.checkoutSubscriptionRepository.create({
|
|
1943
|
-
createdAt: new Date(),
|
|
1944
|
-
...CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
|
|
1945
|
-
});
|
|
1946
|
-
cookie.set('checkoutSubscriptionId', checkout.id);
|
|
1947
|
-
return checkout;
|
|
2136
|
+
return this.dataPersistence
|
|
2137
|
+
.get('checkoutSubscriptionId')
|
|
2138
|
+
.pipe(concatMap((id) => !isNil(id) ? this.checkoutSubscriptionRepository.get({ id }) : this.createCheckoutSubscription(checkoutData)));
|
|
1948
2139
|
}
|
|
1949
2140
|
clearCheckoutSubscriptionFromSession() {
|
|
1950
|
-
|
|
1951
|
-
return of();
|
|
2141
|
+
return this.dataPersistence.remove('checkoutSubscriptionId');
|
|
1952
2142
|
}
|
|
1953
2143
|
checkCoupon(nickname, userEmail) {
|
|
1954
2144
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
@@ -1958,7 +2148,15 @@ class CheckoutSubscriptionService {
|
|
|
1958
2148
|
calcDiscountSubscription(coupon) {
|
|
1959
2149
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
1960
2150
|
}
|
|
1961
|
-
|
|
2151
|
+
async createCheckoutSubscription(checkoutData) {
|
|
2152
|
+
const checkout = await this.checkoutSubscriptionRepository.create({
|
|
2153
|
+
createdAt: new Date(),
|
|
2154
|
+
...CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
|
|
2155
|
+
});
|
|
2156
|
+
await this.dataPersistence.set('checkoutSubscriptionId', checkout.id).toPromise();
|
|
2157
|
+
return checkout;
|
|
2158
|
+
}
|
|
2159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: PERSISTENCE_PROVIDER }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1962
2160
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService }); }
|
|
1963
2161
|
}
|
|
1964
2162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
@@ -1968,7 +2166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
1968
2166
|
args: ['CheckoutSubscriptionRepository']
|
|
1969
2167
|
}] }, { type: undefined, decorators: [{
|
|
1970
2168
|
type: Inject,
|
|
1971
|
-
args: [
|
|
2169
|
+
args: [PERSISTENCE_PROVIDER]
|
|
1972
2170
|
}] }, { type: CouponService }] });
|
|
1973
2171
|
|
|
1974
2172
|
class UtilHelper {
|
|
@@ -2226,10 +2424,12 @@ class AngularConnectModule {
|
|
|
2226
2424
|
? OldCategoryStructureAdapter
|
|
2227
2425
|
: NewCategoryStructureAdapter,
|
|
2228
2426
|
},
|
|
2427
|
+
{ provide: PERSISTENCE_PROVIDER, useClass: options?.persistenceProvider || CookieDataPersistence },
|
|
2229
2428
|
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
2230
2429
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
|
|
2231
2430
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
2232
2431
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
2432
|
+
...(isNil(options?.vertexConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexConfig }]),
|
|
2233
2433
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
2234
2434
|
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
2235
2435
|
...(isNil(options?.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
|
|
@@ -2237,7 +2437,8 @@ class AngularConnectModule {
|
|
|
2237
2437
|
};
|
|
2238
2438
|
}
|
|
2239
2439
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2240
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, AngularElasticSeachModule,
|
|
2440
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule, AngularElasticSeachModule,
|
|
2441
|
+
AngularVertexSeachModule,
|
|
2241
2442
|
AngularFirebaseAuthModule,
|
|
2242
2443
|
AngularFirestoreModule,
|
|
2243
2444
|
AngularHasuraGraphQLModule] }); }
|
|
@@ -2260,6 +2461,17 @@ class AngularConnectModule {
|
|
|
2260
2461
|
},
|
|
2261
2462
|
deps: ['UserRepository', 'FileUploaderService'],
|
|
2262
2463
|
},
|
|
2464
|
+
{
|
|
2465
|
+
provide: 'FileUploaderService',
|
|
2466
|
+
useFactory: (storage, baseUrl) => {
|
|
2467
|
+
return new FirebaseFileUploaderService(storage, baseUrl);
|
|
2468
|
+
},
|
|
2469
|
+
deps: [Storage, STORAGE_BASE_URL],
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
provide: 'ProductSearch',
|
|
2473
|
+
useExisting: ProductsVertexSearch,
|
|
2474
|
+
},
|
|
2263
2475
|
], imports: [provideFirebaseApp((injector) => {
|
|
2264
2476
|
const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
|
|
2265
2477
|
try {
|
|
@@ -2269,7 +2481,9 @@ class AngularConnectModule {
|
|
|
2269
2481
|
return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
|
|
2270
2482
|
}
|
|
2271
2483
|
}),
|
|
2484
|
+
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2272
2485
|
AngularElasticSeachModule,
|
|
2486
|
+
AngularVertexSeachModule,
|
|
2273
2487
|
AngularFirebaseAuthModule,
|
|
2274
2488
|
AngularFirestoreModule,
|
|
2275
2489
|
AngularHasuraGraphQLModule] }); }
|
|
@@ -2287,7 +2501,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2287
2501
|
return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
|
|
2288
2502
|
}
|
|
2289
2503
|
}),
|
|
2504
|
+
provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
|
|
2290
2505
|
AngularElasticSeachModule,
|
|
2506
|
+
AngularVertexSeachModule,
|
|
2291
2507
|
AngularFirebaseAuthModule,
|
|
2292
2508
|
AngularFirestoreModule,
|
|
2293
2509
|
AngularHasuraGraphQLModule,
|
|
@@ -2311,6 +2527,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2311
2527
|
},
|
|
2312
2528
|
deps: ['UserRepository', 'FileUploaderService'],
|
|
2313
2529
|
},
|
|
2530
|
+
{
|
|
2531
|
+
provide: 'FileUploaderService',
|
|
2532
|
+
useFactory: (storage, baseUrl) => {
|
|
2533
|
+
return new FirebaseFileUploaderService(storage, baseUrl);
|
|
2534
|
+
},
|
|
2535
|
+
deps: [Storage, STORAGE_BASE_URL],
|
|
2536
|
+
},
|
|
2537
|
+
{
|
|
2538
|
+
provide: 'ProductSearch',
|
|
2539
|
+
useExisting: ProductsVertexSearch,
|
|
2540
|
+
},
|
|
2314
2541
|
],
|
|
2315
2542
|
}]
|
|
2316
2543
|
}] });
|
|
@@ -2319,5 +2546,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
|
2319
2546
|
* Generated bundle index. Do not edit.
|
|
2320
2547
|
*/
|
|
2321
2548
|
|
|
2322
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, ShippingService, UtilHelper, WishlistService };
|
|
2549
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, ShippingService, UtilHelper, WishlistService };
|
|
2323
2550
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|