@infrab4a/connect-angular 5.0.0-beta.29 → 5.0.0-beta.3

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.
Files changed (67) hide show
  1. package/angular-connect.module.d.ts +6 -9
  2. package/angular-firestore.module.d.ts +2 -1
  3. package/consts/index.d.ts +0 -1
  4. package/esm2022/angular-connect.module.mjs +5 -25
  5. package/esm2022/angular-elastic-search.module.mjs +1 -1
  6. package/esm2022/angular-firebase-auth.module.mjs +1 -1
  7. package/esm2022/angular-firestore.module.mjs +34 -17
  8. package/esm2022/angular-hasura-graphql.module.mjs +2 -24
  9. package/esm2022/consts/category-structure.mjs +1 -1
  10. package/esm2022/consts/default-shop.const.mjs +1 -1
  11. package/esm2022/consts/es-config.const.mjs +1 -1
  12. package/esm2022/consts/firebase-const.mjs +1 -1
  13. package/esm2022/consts/hasura-options.const.mjs +1 -1
  14. package/esm2022/consts/index.mjs +1 -2
  15. package/esm2022/consts/storage-base-url.const.mjs +1 -1
  16. package/esm2022/helpers/index.mjs +1 -1
  17. package/esm2022/helpers/mobile-operation-system-checker.helper.mjs +1 -1
  18. package/esm2022/index.mjs +1 -2
  19. package/esm2022/services/auth.service.mjs +1 -1
  20. package/esm2022/services/cart.service.mjs +2 -3
  21. package/esm2022/services/catalog/adapters/category-structure.adapter.mjs +1 -1
  22. package/esm2022/services/catalog/adapters/index.mjs +1 -1
  23. package/esm2022/services/catalog/adapters/new-category-structure.adapter.mjs +4 -6
  24. package/esm2022/services/catalog/adapters/old-category-structure.adapter.mjs +1 -1
  25. package/esm2022/services/catalog/catalog.service.mjs +13 -69
  26. package/esm2022/services/catalog/category.service.mjs +4 -4
  27. package/esm2022/services/catalog/enums/index.mjs +1 -1
  28. package/esm2022/services/catalog/enums/product-sorts.enum.mjs +1 -1
  29. package/esm2022/services/catalog/index.mjs +1 -1
  30. package/esm2022/services/catalog/models/category-with-tree.model.mjs +1 -1
  31. package/esm2022/services/catalog/models/index.mjs +1 -1
  32. package/esm2022/services/catalog/types/index.mjs +1 -1
  33. package/esm2022/services/catalog/types/product-sort.type.mjs +1 -1
  34. package/esm2022/services/catalog/wishlist.service.mjs +11 -14
  35. package/esm2022/services/checkout-subscription.service.mjs +21 -18
  36. package/esm2022/services/checkout.service.mjs +16 -13
  37. package/esm2022/services/coupon.service.mjs +10 -35
  38. package/esm2022/services/helpers/index.mjs +1 -1
  39. package/esm2022/services/helpers/util.helper.mjs +1 -1
  40. package/esm2022/services/home-shop.service.mjs +1 -1
  41. package/esm2022/services/index.mjs +1 -1
  42. package/esm2022/services/order.service.mjs +1 -1
  43. package/esm2022/services/shipping.service.mjs +1 -1
  44. package/esm2022/services/types/index.mjs +1 -1
  45. package/esm2022/services/types/required-checkout-data.type.mjs +1 -1
  46. package/esm2022/services/types/required-checkout-subscription-data.type.mjs +1 -1
  47. package/esm2022/services/types/shipping-methods.type.mjs +1 -1
  48. package/esm2022/types/firebase-app-config.type.mjs +1 -1
  49. package/esm2022/types/index.mjs +1 -1
  50. package/fesm2022/infrab4a-connect-angular.mjs +109 -236
  51. package/fesm2022/infrab4a-connect-angular.mjs.map +1 -1
  52. package/index.d.ts +0 -1
  53. package/package.json +5 -5
  54. package/services/catalog/catalog.service.d.ts +4 -10
  55. package/services/catalog/category.service.d.ts +1 -6
  56. package/services/catalog/wishlist.service.d.ts +5 -6
  57. package/services/checkout-subscription.service.d.ts +4 -5
  58. package/services/checkout.service.d.ts +4 -8
  59. package/services/coupon.service.d.ts +2 -6
  60. package/consts/persistence.const.d.ts +0 -1
  61. package/esm2022/consts/persistence.const.mjs +0 -2
  62. package/esm2022/persistence/cookie-data-persistence.mjs +0 -22
  63. package/esm2022/persistence/data-persistence.mjs +0 -2
  64. package/esm2022/persistence/index.mjs +0 -3
  65. package/persistence/cookie-data-persistence.d.ts +0 -10
  66. package/persistence/data-persistence.d.ts +0 -6
  67. package/persistence/index.d.ts +0 -2
@@ -1,20 +1,20 @@
1
1
  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
- 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';
4
+ import { FirebaseApp, getApp, initializeApp, provideFirebaseApp } from '@angular/fire/app';
7
5
  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, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage, FirebaseFileUploaderService } 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, FirebaseFileUploaderService, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage } from '@infrab4a/connect';
9
7
  import * as i1 from '@angular/fire/auth';
10
- import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
8
+ import { Auth, getAuth, provideAuth, getIdToken, authState } from '@angular/fire/auth';
11
9
  import { isPlatformBrowser, isPlatformServer } from '@angular/common';
12
10
  import * as i1$1 from '@angular/fire/firestore';
13
- import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
11
+ import { Firestore, getFirestore, memoryLocalCache, initializeFirestore, provideFirestore, doc, docSnapshots } from '@angular/fire/firestore';
12
+ import * as i2 from '@angular/fire/storage';
13
+ import { Storage, getStorage, provideStorage } from '@angular/fire/storage';
14
+ import { combineLatest, of, from, throwError, Subject, iif, forkJoin } from 'rxjs';
15
+ import { map, catchError, mergeMap, concatMap, tap } from 'rxjs/operators';
14
16
  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
- import { __decorate, __metadata } from 'tslib';
17
+ import { __metadata, __decorate } from 'tslib';
18
18
  import { Type } from 'class-transformer';
19
19
  import * as i1$3 from '@angular/common/http';
20
20
 
@@ -61,8 +61,6 @@ 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
64
  class AngularFirebaseAuthModule {
67
65
  static initializeApp(options, nameOrConfig) {
68
66
  return {
@@ -171,6 +169,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
171
169
  }]
172
170
  }] });
173
171
 
172
+ const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
173
+
174
174
  class MobileOperationSystemCheckerHelper {
175
175
  static isAppleDevice() {
176
176
  return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator?.platform) ||
@@ -190,12 +190,12 @@ class AngularFirestoreModule {
190
190
  };
191
191
  }
192
192
  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] }); }
193
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule, i2.StorageModule] }); }
194
194
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, providers: [
195
195
  {
196
196
  provide: 'FirestoreOptions',
197
197
  useFactory: (firestore, platformId) => ({
198
- firestore: new ConnectFirestoreService(firestore),
198
+ firestore,
199
199
  interceptors: {
200
200
  request: (request) => {
201
201
  if (isPlatformBrowser(platformId))
@@ -403,20 +403,27 @@ class AngularFirestoreModule {
403
403
  },
404
404
  deps: ['FirestoreOptions', ProductFirestoreRepository],
405
405
  },
406
+ {
407
+ provide: 'FileUploaderService',
408
+ useFactory: (storage, baseUrl) => {
409
+ return new FirebaseFileUploaderService(storage, baseUrl);
410
+ },
411
+ deps: [Storage, STORAGE_BASE_URL],
412
+ },
406
413
  ], imports: [AngularElasticSeachModule,
407
414
  provideFirestore((injector) => {
408
415
  const platformId = injector.get(PLATFORM_ID);
409
- if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
410
- return initializeFirestore(injector.get(FirebaseApp), {
411
- ignoreUndefinedProperties: true,
412
- });
416
+ if (isPlatformServer(platformId))
417
+ return getFirestore(injector.get(FirebaseApp));
418
+ if (!MobileOperationSystemCheckerHelper.isAppleDevice())
419
+ return getFirestore(injector.get(FirebaseApp));
413
420
  const firestore = initializeFirestore(injector.get(FirebaseApp), {
414
421
  experimentalForceLongPolling: true,
415
- ignoreUndefinedProperties: true,
416
422
  localCache: memoryLocalCache(),
417
423
  });
418
424
  return firestore;
419
- })] }); }
425
+ }),
426
+ provideStorage(() => getStorage())] }); }
420
427
  }
421
428
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, decorators: [{
422
429
  type: NgModule,
@@ -425,23 +432,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
425
432
  AngularElasticSeachModule,
426
433
  provideFirestore((injector) => {
427
434
  const platformId = injector.get(PLATFORM_ID);
428
- if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
429
- return initializeFirestore(injector.get(FirebaseApp), {
430
- ignoreUndefinedProperties: true,
431
- });
435
+ if (isPlatformServer(platformId))
436
+ return getFirestore(injector.get(FirebaseApp));
437
+ if (!MobileOperationSystemCheckerHelper.isAppleDevice())
438
+ return getFirestore(injector.get(FirebaseApp));
432
439
  const firestore = initializeFirestore(injector.get(FirebaseApp), {
433
440
  experimentalForceLongPolling: true,
434
- ignoreUndefinedProperties: true,
435
441
  localCache: memoryLocalCache(),
436
442
  });
437
443
  return firestore;
438
444
  }),
445
+ provideStorage(() => getStorage()),
439
446
  ],
440
447
  providers: [
441
448
  {
442
449
  provide: 'FirestoreOptions',
443
450
  useFactory: (firestore, platformId) => ({
444
- firestore: new ConnectFirestoreService(firestore),
451
+ firestore,
445
452
  interceptors: {
446
453
  request: (request) => {
447
454
  if (isPlatformBrowser(platformId))
@@ -649,6 +656,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
649
656
  },
650
657
  deps: ['FirestoreOptions', ProductFirestoreRepository],
651
658
  },
659
+ {
660
+ provide: 'FileUploaderService',
661
+ useFactory: (storage, baseUrl) => {
662
+ return new FirebaseFileUploaderService(storage, baseUrl);
663
+ },
664
+ deps: [Storage, STORAGE_BASE_URL],
665
+ },
652
666
  ],
653
667
  }]
654
668
  }] });
@@ -730,17 +744,6 @@ class AngularHasuraGraphQLModule {
730
744
  },
731
745
  deps: ['HasuraConfig'],
732
746
  },
733
- {
734
- provide: 'ProductStockNotificationRepository',
735
- useExisting: ProductStockNotificationHasuraGraphQLRepository,
736
- },
737
- {
738
- provide: ProductStockNotificationHasuraGraphQLRepository,
739
- useFactory: (hasuraConfig) => {
740
- return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
741
- },
742
- deps: ['HasuraConfig'],
743
- },
744
747
  {
745
748
  provide: 'CategoryFilterRepository',
746
749
  useExisting: CategoryFilterHasuraGraphQLRepository,
@@ -867,17 +870,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
867
870
  },
868
871
  deps: ['HasuraConfig'],
869
872
  },
870
- {
871
- provide: 'ProductStockNotificationRepository',
872
- useExisting: ProductStockNotificationHasuraGraphQLRepository,
873
- },
874
- {
875
- provide: ProductStockNotificationHasuraGraphQLRepository,
876
- useFactory: (hasuraConfig) => {
877
- return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
878
- },
879
- deps: ['HasuraConfig'],
880
- },
881
873
  {
882
874
  provide: 'CategoryFilterRepository',
883
875
  useExisting: CategoryFilterHasuraGraphQLRepository,
@@ -935,25 +927,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
935
927
  }]
936
928
  }] });
937
929
 
938
- const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
939
-
940
- class CookieDataPersistence {
941
- get(key) {
942
- return of(cookie.get(key));
943
- }
944
- remove(key) {
945
- return of(cookie.remove(key));
946
- }
947
- set(key, value) {
948
- return from(cookie.set(key, value)).pipe(map(() => { }));
949
- }
950
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
951
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence }); }
952
- }
953
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, decorators: [{
954
- type: Injectable
955
- }] });
956
-
957
930
  class AuthService {
958
931
  constructor(angularFireAuth, userRepository) {
959
932
  this.angularFireAuth = angularFireAuth;
@@ -1060,33 +1033,32 @@ class CouponService {
1060
1033
  return of(discount);
1061
1034
  }
1062
1035
  async calcDiscountShopping(coupon, checkout) {
1063
- let discountInfo = null;
1036
+ let discount = 0;
1064
1037
  if (checkout.user.isSubscriber && coupon.discount.subscriber.value) {
1065
- discountInfo = await this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
1038
+ discount = await this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
1066
1039
  }
1067
1040
  else {
1068
- discountInfo = await this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
1041
+ discount = await this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
1069
1042
  }
1070
- return { discount: discountInfo.discount, lineItems: discountInfo.lineItems };
1043
+ return discount;
1071
1044
  }
1072
1045
  async calcDiscountByType(type, value, categories, checkout) {
1073
1046
  let discount = 0;
1074
- let lineItensElegibleForDiscount = await this.getLineItensEligebleForDiscount(categories, checkout);
1075
- const subTotal = this.calcCheckoutSubtotal(lineItensElegibleForDiscount, checkout.user);
1047
+ let lineItensDiscount = await this.getLineItensEligebleForDiscount(categories, checkout);
1048
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1076
1049
  if (type == CouponTypes.ABSOLUTE) {
1077
1050
  discount = value > subTotal ? subTotal : value;
1078
1051
  }
1079
1052
  else {
1080
1053
  discount = subTotal * (value / 100);
1081
1054
  }
1082
- const lineItems = this.calcLineItenDiscount(type, lineItensElegibleForDiscount, value, subTotal);
1083
- return { discount, lineItems };
1055
+ return discount;
1084
1056
  }
1085
1057
  async hasMinSubTotal(coupon, checkout) {
1086
1058
  if (!coupon.minSubTotalValue)
1087
1059
  return true;
1088
1060
  let lineItensDiscount = await this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
1089
- const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user);
1061
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1090
1062
  if (coupon.minSubTotalValue <= subTotal)
1091
1063
  return true;
1092
1064
  return false;
@@ -1154,7 +1126,7 @@ class CouponService {
1154
1126
  }
1155
1127
  return lineItensDiscount;
1156
1128
  }
1157
- calcCheckoutSubtotal(lineItens, user) {
1129
+ calcCheckoutSubtotal(lineItens, user, shop) {
1158
1130
  return (lineItens?.reduce((acc, curr) => user?.isSubscriber && curr.price.subscriberPrice
1159
1131
  ? acc + curr.price?.subscriberPrice * curr.quantity
1160
1132
  : acc + curr.pricePaid * curr.quantity, 0) || 0);
@@ -1192,30 +1164,6 @@ class CouponService {
1192
1164
  }
1193
1165
  return couponUseLimits;
1194
1166
  }
1195
- calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
1196
- let lineItemsDiscount = [];
1197
- if (type === CouponTypes.ABSOLUTE) {
1198
- const couponDiscountMax = couponDiscount > subTotal ? subTotal : couponDiscount;
1199
- lineItemsDiscount = lineItems.map((item) => {
1200
- const totalItemPercentage = item.pricePaid / subTotal;
1201
- const discountItem = couponDiscountMax * totalItemPercentage;
1202
- return {
1203
- ...item,
1204
- discount: Number(discountItem.toFixed(2)),
1205
- };
1206
- });
1207
- }
1208
- else {
1209
- lineItemsDiscount = lineItems.map((item) => {
1210
- const discountItem = item.pricePaid * (couponDiscount / 100);
1211
- return {
1212
- ...item,
1213
- discount: Number(discountItem.toFixed(2)),
1214
- };
1215
- });
1216
- }
1217
- return lineItemsDiscount;
1218
- }
1219
1167
  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 }); }
1220
1168
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, providedIn: 'root' }); }
1221
1169
  }
@@ -1239,17 +1187,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1239
1187
  }] }] });
1240
1188
 
1241
1189
  class CheckoutService {
1242
- constructor(couponService, checkoutRepository, userRepository, defaultShop, dataPersistence) {
1190
+ constructor(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
1243
1191
  this.couponService = couponService;
1244
1192
  this.checkoutRepository = checkoutRepository;
1193
+ this.orderRepository = orderRepository;
1245
1194
  this.userRepository = userRepository;
1246
1195
  this.defaultShop = defaultShop;
1247
- this.dataPersistence = dataPersistence;
1248
1196
  }
1249
1197
  getCheckout(checkoutData) {
1250
- return this.dataPersistence
1251
- .get('checkoutId')
1252
- .pipe(concatMap((id) => (!isNil(id) ? this.checkoutRepository.get({ id }) : this.createCheckout(checkoutData))));
1198
+ const checkoutId = cookie.get('checkoutId');
1199
+ if (!isNil(checkoutId))
1200
+ return from(this.checkoutRepository.get({ id: checkoutId }));
1201
+ return from(this.createCheckout(checkoutData));
1253
1202
  }
1254
1203
  getUserByCheckout(checkoutId) {
1255
1204
  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'))));
@@ -1261,7 +1210,8 @@ class CheckoutService {
1261
1210
  return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
1262
1211
  }
1263
1212
  clearCheckoutFromSession() {
1264
- return this.dataPersistence.remove('checkoutId');
1213
+ cookie.remove('checkoutId');
1214
+ return of();
1265
1215
  }
1266
1216
  calcDiscount(coupon) {
1267
1217
  return this.getCheckout().pipe(concatMap(async (checkout) => await this.couponService.calcDiscountShopping(coupon, checkout)));
@@ -1275,10 +1225,10 @@ class CheckoutService {
1275
1225
  ...Checkout.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
1276
1226
  shop: checkoutData?.shop || this.defaultShop,
1277
1227
  });
1278
- await this.dataPersistence.set('checkoutId', checkout.id).toPromise();
1228
+ cookie.set('checkoutId', checkout.id);
1279
1229
  return checkout;
1280
1230
  }
1281
- 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 }); }
1231
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable }); }
1282
1232
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService }); }
1283
1233
  }
1284
1234
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, decorators: [{
@@ -1286,15 +1236,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1286
1236
  }], ctorParameters: () => [{ type: CouponService }, { type: undefined, decorators: [{
1287
1237
  type: Inject,
1288
1238
  args: ['CheckoutRepository']
1239
+ }] }, { type: undefined, decorators: [{
1240
+ type: Inject,
1241
+ args: ['OrderRepository']
1289
1242
  }] }, { type: undefined, decorators: [{
1290
1243
  type: Inject,
1291
1244
  args: ['UserRepository']
1292
1245
  }] }, { type: i1$2.Shops, decorators: [{
1293
1246
  type: Inject,
1294
1247
  args: [DEFAULT_SHOP]
1295
- }] }, { type: undefined, decorators: [{
1296
- type: Inject,
1297
- args: [PERSISTENCE_PROVIDER]
1298
1248
  }] }] });
1299
1249
 
1300
1250
  class CartService {
@@ -1356,7 +1306,6 @@ class CartService {
1356
1306
  weight: weight ?? product.weight,
1357
1307
  quantity: (item.quantity || 0) + (quantity || 0),
1358
1308
  pricePaid,
1359
- discount: 0,
1360
1309
  categories: product.categories ?? [],
1361
1310
  isGift: isGift ?? null,
1362
1311
  costPrice: product.costPrice ?? 0,
@@ -1408,7 +1357,7 @@ class CartService {
1408
1357
  }), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1409
1358
  }
1410
1359
  updateUserCart(user) {
1411
- return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => await this.checkoutService
1360
+ return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService
1412
1361
  .updateCheckoutLineItems(Checkout.toInstance({
1413
1362
  ...checkout.toPlain(),
1414
1363
  lineItems: checkout.lineItems?.length
@@ -1592,11 +1541,9 @@ class NewCategoryStructureAdapter {
1592
1541
  .then((categories) => categories.map((category) => category.id.toString()));
1593
1542
  }
1594
1543
  async getCategory(category) {
1595
- const collectionCategory = category.isCollection ||
1596
- (isNil(category.isCollection) && !category.products?.length) ||
1597
- category.isWishlist ||
1598
- category.brandCategory;
1599
- return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
1544
+ return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
1545
+ ? this.categoryRepository.get({ id: category.id })
1546
+ : category;
1600
1547
  }
1601
1548
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1602
1549
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter }); }
@@ -1629,10 +1576,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1629
1576
  }] }] });
1630
1577
 
1631
1578
  class CatalogService {
1632
- constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productIndex) {
1579
+ constructor(productRepository, categoryStructureAdapter, shop, productIndex) {
1633
1580
  this.productRepository = productRepository;
1634
- this.productStockNotificationRepository = productStockNotificationRepository;
1635
- this.categoryRepository = categoryRepository;
1636
1581
  this.categoryStructureAdapter = categoryStructureAdapter;
1637
1582
  this.shop = shop;
1638
1583
  this.productIndex = productIndex;
@@ -1662,22 +1607,17 @@ class CatalogService {
1662
1607
  if (!sort || sort === 'most-relevant')
1663
1608
  return {};
1664
1609
  if (sort === 'best-sellers')
1665
- return {
1666
- shoppingCount: 'desc',
1667
- rate: 'desc',
1668
- stock: 'desc',
1669
- name: 'asc',
1670
- };
1610
+ return { shoppingCount: 'desc' };
1671
1611
  if (sort === 'biggest-price')
1672
- return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
1612
+ return { subscriberPrice: 'desc' };
1673
1613
  if (sort === 'lowest-price')
1674
- return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
1614
+ return { subscriberPrice: 'asc' };
1675
1615
  if (sort === 'best-rating')
1676
- return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
1616
+ return { rate: 'desc' };
1677
1617
  if (sort === 'news')
1678
1618
  return { createdAt: 'desc' };
1679
1619
  if (sort === 'biggest-discount')
1680
- return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
1620
+ return { subscriberDiscountPercentage: 'desc' };
1681
1621
  };
1682
1622
  this.buildLimitQuery = (options) => {
1683
1623
  const limit = options?.perPage || 20;
@@ -1711,27 +1651,9 @@ class CatalogService {
1711
1651
  brands: distinct?.brand,
1712
1652
  }));
1713
1653
  }
1714
- async addCustomerToStockNotification(shop, productId, name, email) {
1715
- return this.productStockNotificationRepository.addCustomerEmail(shop, productId, name, email);
1716
- }
1717
1654
  async findCatalog(options, limits) {
1718
- if (this.hasTerm(options) && options.sort === 'most-relevant') {
1719
- const productsIds = await this.findCatalogIdsByElasticSearch(options.term);
1720
- return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
1721
- }
1722
- if (this.hasCategory(options) && options.sort === 'most-relevant') {
1723
- const mostRelevant = options.category.mostRelevant ?? [];
1724
- const productsIds = await this.productRepository
1725
- .findCatalog({
1726
- fields: ['id'],
1727
- filters: {
1728
- ...(await this.buildMainFilter(options)),
1729
- ...this.buildFilterQuery(options?.filters || {}),
1730
- },
1731
- })
1732
- .then((products) => products.data.map((product) => product.id));
1733
- return this.findCatalogAndSortByMostRevelant(mostRelevant, productsIds, options, limits);
1734
- }
1655
+ if (this.hasTerm(options) && options.sort === 'most-relevant')
1656
+ return this.findCatalogByTermAndSortByMostRevelant(options, limits);
1735
1657
  const repoParams = {
1736
1658
  filters: {
1737
1659
  ...(await this.buildMainFilter(options)),
@@ -1759,33 +1681,8 @@ class CatalogService {
1759
1681
  .search(term, 999, this.shop)
1760
1682
  .then((data) => ({ id: { operator: Where.IN, value: data.hits.map(({ _source }) => _source.id) } }));
1761
1683
  }
1762
- async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
1763
- const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
1764
- const totalResult = await this.productRepository.findCatalog({
1765
- filters: {
1766
- id: { operator: Where.IN, value: mostRelevantProductsIds },
1767
- ...this.buildFilterQuery(options?.filters || {}),
1768
- },
1769
- orderBy: this.buildSortQuery('news'),
1770
- options: {
1771
- minimal: ['price'],
1772
- maximum: ['price'],
1773
- distinct: ['brand'],
1774
- },
1775
- }, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
1776
- const firstProducts = totalResult.data.filter((product) => mostRelevants.includes(product.id));
1777
- const lastProducts = totalResult.data.filter((product) => !mostRelevants.includes(product.id));
1778
- const categoryMostRelevants = firstProducts.concat(lastProducts);
1779
- const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
1780
- return {
1781
- data: resultFinal,
1782
- count: totalResult.count,
1783
- maximum: totalResult.maximum,
1784
- minimal: totalResult.minimal,
1785
- distinct: totalResult.distinct,
1786
- };
1787
- }
1788
- async findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
1684
+ async findCatalogByTermAndSortByMostRevelant(options, limits) {
1685
+ const productIds = await this.findCatalogIdsByElasticSearch(options.term);
1789
1686
  const totalResult = await this.productRepository.findCatalog({
1790
1687
  fields: ['id', 'stock'],
1791
1688
  filters: {
@@ -1831,7 +1728,7 @@ class CatalogService {
1831
1728
  return [...new Set(sorted.map(({ _source }) => _source.id))];
1832
1729
  }));
1833
1730
  }
1834
- 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: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable }); }
1731
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable }); }
1835
1732
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService }); }
1836
1733
  }
1837
1734
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, decorators: [{
@@ -1839,12 +1736,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1839
1736
  }], ctorParameters: () => [{ type: undefined, decorators: [{
1840
1737
  type: Inject,
1841
1738
  args: ['ProductRepository']
1842
- }] }, { type: undefined, decorators: [{
1843
- type: Inject,
1844
- args: ['ProductStockNotificationRepository']
1845
- }] }, { type: undefined, decorators: [{
1846
- type: Inject,
1847
- args: ['CategoryRepository']
1848
1739
  }] }, { type: undefined, decorators: [{
1849
1740
  type: Inject,
1850
1741
  args: [CATEGORY_STRUCTURE]
@@ -1861,15 +1752,15 @@ class CategoryService {
1861
1752
  this.categoryStructureAdapter = categoryStructureAdapter;
1862
1753
  this.shop = shop;
1863
1754
  }
1864
- async fetchBrands(category, options) {
1755
+ async fetchBrands(category, mainGender) {
1865
1756
  const brands = await this.productRepository
1866
1757
  .findCatalog({
1867
1758
  filters: await this.categoryStructureAdapter.buildProductFilterByCategory(category),
1868
1759
  fields: ['brand'],
1869
- }, options?.mainGender ? options?.mainGender : this.shop === Shops.MENSMARKET ? 'male' : 'female')
1760
+ }, mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female')
1870
1761
  .then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => ({ ...brands, [brand]: true }), {})));
1871
1762
  return this.categoryRepository
1872
- .find({ filters: { brandCategory: true, shop: options?.shop || this.shop }, orderBy: { name: 'asc' } })
1763
+ .find({ filters: { brandCategory: true, shop: this.shop }, orderBy: { name: 'asc' } })
1873
1764
  .then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
1874
1765
  }
1875
1766
  async fetchFilterOptions(category) {
@@ -1918,11 +1809,12 @@ __decorate([
1918
1809
  ], CategoryWithTree.prototype, "children", void 0);
1919
1810
 
1920
1811
  class WishlistService {
1921
- constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productIndex) {
1812
+ constructor(wishlistRepository, categoryRepository, shop, productRepository, categoryFilterRepository, productIndex) {
1922
1813
  this.wishlistRepository = wishlistRepository;
1814
+ this.categoryRepository = categoryRepository;
1923
1815
  this.shop = shop;
1924
1816
  const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
1925
- this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productIndex);
1817
+ this.catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop, productIndex);
1926
1818
  this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
1927
1819
  }
1928
1820
  getCatalogService() {
@@ -1931,7 +1823,7 @@ class WishlistService {
1931
1823
  getCategoryService() {
1932
1824
  return this.categoryService;
1933
1825
  }
1934
- async create({ personId, title, description, published, userFullName, userPhoto, theme, bannerUrl, }) {
1826
+ async create({ personId, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
1935
1827
  const data = {
1936
1828
  slug: '',
1937
1829
  name: title,
@@ -1946,7 +1838,7 @@ class WishlistService {
1946
1838
  personName: userFullName,
1947
1839
  personPhoto: userPhoto,
1948
1840
  brandCategory: false,
1949
- published,
1841
+ published: true,
1950
1842
  theme,
1951
1843
  bannerUrl,
1952
1844
  };
@@ -1954,12 +1846,11 @@ class WishlistService {
1954
1846
  await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
1955
1847
  return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });
1956
1848
  }
1957
- update({ id, title, description, published, userFullName, userPhoto, theme, bannerUrl, }) {
1849
+ update({ id, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
1958
1850
  const data = {
1959
1851
  id,
1960
1852
  name: title,
1961
1853
  description,
1962
- published,
1963
1854
  metadata: {
1964
1855
  title: `${userFullName} - ${title}`,
1965
1856
  description: `${userFullName} - ${description}`,
@@ -2003,7 +1894,7 @@ class WishlistService {
2003
1894
  }
2004
1895
  return wishlist;
2005
1896
  }
2006
- 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: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable }); }
1897
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: 'CategoryRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable }); }
2007
1898
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService }); }
2008
1899
  }
2009
1900
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, decorators: [{
@@ -2011,6 +1902,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2011
1902
  }], ctorParameters: () => [{ type: undefined, decorators: [{
2012
1903
  type: Inject,
2013
1904
  args: ['WishlistRepository']
1905
+ }] }, { type: undefined, decorators: [{
1906
+ type: Inject,
1907
+ args: ['CategoryRepository']
2014
1908
  }] }, { type: i1$2.Shops, decorators: [{
2015
1909
  type: Inject,
2016
1910
  args: [DEFAULT_SHOP]
@@ -2020,27 +1914,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2020
1914
  }] }, { type: undefined, decorators: [{
2021
1915
  type: Inject,
2022
1916
  args: ['CategoryFilterRepository']
2023
- }] }, { type: undefined, decorators: [{
2024
- type: Inject,
2025
- args: ['CategoryRepository']
2026
- }] }, { type: undefined, decorators: [{
2027
- type: Inject,
2028
- args: ['ProductStockNotificationRepository']
2029
1917
  }] }, { type: i1$2.ProductsIndex }] });
2030
1918
 
2031
1919
  class CheckoutSubscriptionService {
2032
- constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
1920
+ constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
2033
1921
  this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
2034
- this.dataPersistence = dataPersistence;
1922
+ this.subscriptionRepository = subscriptionRepository;
2035
1923
  this.couponService = couponService;
2036
1924
  }
2037
1925
  getCheckoutSubscription(checkoutData) {
2038
- return this.dataPersistence
2039
- .get('checkoutSubscriptionId')
2040
- .pipe(concatMap((id) => !isNil(id) ? this.checkoutSubscriptionRepository.get({ id }) : this.createCheckoutSubscription(checkoutData)));
1926
+ const checkoutId = cookie.get('checkoutSubscriptionId');
1927
+ if (!isNil(checkoutId))
1928
+ return from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
1929
+ return from(this.createCheckoutSubscription(checkoutData));
1930
+ }
1931
+ async createCheckoutSubscription(checkoutData) {
1932
+ const checkout = await this.checkoutSubscriptionRepository.create({
1933
+ createdAt: new Date(),
1934
+ ...CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
1935
+ });
1936
+ cookie.set('checkoutSubscriptionId', checkout.id);
1937
+ return checkout;
2041
1938
  }
2042
1939
  clearCheckoutSubscriptionFromSession() {
2043
- return this.dataPersistence.remove('checkoutSubscriptionId');
1940
+ cookie.remove('checkoutSubscriptionId');
1941
+ return of();
2044
1942
  }
2045
1943
  checkCoupon(nickname, userEmail) {
2046
1944
  return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
@@ -2050,15 +1948,7 @@ class CheckoutSubscriptionService {
2050
1948
  calcDiscountSubscription(coupon) {
2051
1949
  return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
2052
1950
  }
2053
- async createCheckoutSubscription(checkoutData) {
2054
- const checkout = await this.checkoutSubscriptionRepository.create({
2055
- createdAt: new Date(),
2056
- ...CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
2057
- });
2058
- await this.dataPersistence.set('checkoutSubscriptionId', checkout.id).toPromise();
2059
- return checkout;
2060
- }
2061
- 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 }); }
1951
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2062
1952
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService }); }
2063
1953
  }
2064
1954
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
@@ -2068,7 +1958,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2068
1958
  args: ['CheckoutSubscriptionRepository']
2069
1959
  }] }, { type: undefined, decorators: [{
2070
1960
  type: Inject,
2071
- args: [PERSISTENCE_PROVIDER]
1961
+ args: ['SubscriptionRepository']
2072
1962
  }] }, { type: CouponService }] });
2073
1963
 
2074
1964
  class UtilHelper {
@@ -2326,7 +2216,6 @@ class AngularConnectModule {
2326
2216
  ? OldCategoryStructureAdapter
2327
2217
  : NewCategoryStructureAdapter,
2328
2218
  },
2329
- { provide: PERSISTENCE_PROVIDER, useClass: options?.persistenceProvider || CookieDataPersistence },
2330
2219
  ...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
2331
2220
  ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
2332
2221
  ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
@@ -2338,7 +2227,7 @@ class AngularConnectModule {
2338
2227
  };
2339
2228
  }
2340
2229
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2341
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule, AngularElasticSeachModule,
2230
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, AngularElasticSeachModule,
2342
2231
  AngularFirebaseAuthModule,
2343
2232
  AngularFirestoreModule,
2344
2233
  AngularHasuraGraphQLModule] }); }
@@ -2361,13 +2250,6 @@ class AngularConnectModule {
2361
2250
  },
2362
2251
  deps: ['UserRepository', 'FileUploaderService'],
2363
2252
  },
2364
- {
2365
- provide: 'FileUploaderService',
2366
- useFactory: (storage, baseUrl) => {
2367
- return new FirebaseFileUploaderService(storage, baseUrl);
2368
- },
2369
- deps: [Storage, STORAGE_BASE_URL],
2370
- },
2371
2253
  ], imports: [provideFirebaseApp((injector) => {
2372
2254
  const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2373
2255
  try {
@@ -2377,7 +2259,6 @@ class AngularConnectModule {
2377
2259
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2378
2260
  }
2379
2261
  }),
2380
- provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2381
2262
  AngularElasticSeachModule,
2382
2263
  AngularFirebaseAuthModule,
2383
2264
  AngularFirestoreModule,
@@ -2396,7 +2277,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2396
2277
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2397
2278
  }
2398
2279
  }),
2399
- provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2400
2280
  AngularElasticSeachModule,
2401
2281
  AngularFirebaseAuthModule,
2402
2282
  AngularFirestoreModule,
@@ -2421,13 +2301,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2421
2301
  },
2422
2302
  deps: ['UserRepository', 'FileUploaderService'],
2423
2303
  },
2424
- {
2425
- provide: 'FileUploaderService',
2426
- useFactory: (storage, baseUrl) => {
2427
- return new FirebaseFileUploaderService(storage, baseUrl);
2428
- },
2429
- deps: [Storage, STORAGE_BASE_URL],
2430
- },
2431
2304
  ],
2432
2305
  }]
2433
2306
  }] });
@@ -2436,5 +2309,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2436
2309
  * Generated bundle index. Do not edit.
2437
2310
  */
2438
2311
 
2439
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, ShippingService, UtilHelper, WishlistService };
2312
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, ShippingService, UtilHelper, WishlistService };
2440
2313
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map