@infrab4a/connect-angular 5.7.5-beta.10 → 5.7.5-beta.12

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.
@@ -3,12 +3,12 @@ import { NgModule, InjectionToken, PLATFORM_ID, Injectable, Inject } from '@angu
3
3
  import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
4
4
  import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
5
5
  import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
6
- import * as i3 from '@infrab4a/connect';
7
- import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, CategoryFirestoreRepository, ProductFirestoreRepository, ProductVariantFirestoreRepository, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignHashtagPostsFirestoreRepository, CampaignDashboardFirestoreRepository, CampaignSettingsFirestoreRepository, SubscriptionEditionFirestoreRepository, GroupFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PendingOrderFirestoreRepository, PaymentFirestoreRepository, ShoppingRecurrenceFirestoreRepository, ShoppingRecurrenceEditionFirestoreRepository, ShoppingRecurrenceErrorLogFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, BrandCategoryFirestoreRepository, ShopConfigsFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, ProductCatalogHasuraGraphQLRepository, ProductStockEntryHasuraGraphQLRepository, ProductGroupHasuraGraphQLRepository, ProductPriceLogHasuraGraphQLRepository, resolveCacheConfig, ProductsVertexSearch, VertexAxiosAdapter, isNil, NotFoundError, Checkout, pick, LineItem, Where, isEmpty, Shops, set, InvalidArgumentError, RoundProductPricesHelper, Category, WishlistLogType, PersonTypes, Wishlist, Product, RequiredArgumentError, add, OrderStatus, ProductReview, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
6
+ import * as i1$2 from '@infrab4a/connect';
7
+ import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, CategoryFirestoreRepository, ProductFirestoreRepository, ProductVariantFirestoreRepository, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, GroupFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, BrandCategoryFirestoreRepository, ShopConfigsFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, ProductCatalogHasuraGraphQLRepository, ProductStockEntryHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, isNil, NotFoundError, Checkout, pick, LineItem, Where, isEmpty, Shops, set, InvalidArgumentError, RoundProductPricesHelper, Category, WishlistLogType, PersonTypes, Wishlist, CheckoutTypes, CouponTypes, Exclusivities, OrderStatus, CheckoutSubscription, Product, RequiredArgumentError, add, ProductReview, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
8
8
  import * as i1 from '@angular/fire/auth';
9
9
  import { Auth, provideAuth, initializeAuth, indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence, getAuth, getIdToken, authState } from '@angular/fire/auth';
10
10
  import { isPlatformServer, isPlatformBrowser } from '@angular/common';
11
- import * as i1$2 from '@angular/fire/firestore';
11
+ import * as i1$3 from '@angular/fire/firestore';
12
12
  import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
13
13
  import cookie from 'js-cookie';
14
14
  import { of, from, combineLatest, throwError, Subject, forkJoin } from 'rxjs';
@@ -304,13 +304,6 @@ class AngularFirestoreModule {
304
304
  },
305
305
  deps: ['FirestoreOptions'],
306
306
  },
307
- {
308
- provide: 'CampaignHashtagPostsRepository',
309
- useFactory: (options) => {
310
- return new CampaignHashtagPostsFirestoreRepository(options);
311
- },
312
- deps: ['FirestoreOptions'],
313
- },
314
307
  {
315
308
  provide: 'CampaignDashboardRepository',
316
309
  useFactory: (options) => {
@@ -318,13 +311,6 @@ class AngularFirestoreModule {
318
311
  },
319
312
  deps: ['FirestoreOptions'],
320
313
  },
321
- {
322
- provide: 'CampaignSettingsRepository',
323
- useFactory: (options) => {
324
- return new CampaignSettingsFirestoreRepository(options);
325
- },
326
- deps: ['FirestoreOptions'],
327
- },
328
314
  {
329
315
  provide: 'EditionRepository',
330
316
  useFactory: (options, subscriptionRepository) => {
@@ -374,13 +360,6 @@ class AngularFirestoreModule {
374
360
  },
375
361
  deps: ['FirestoreOptions'],
376
362
  },
377
- {
378
- provide: 'PendingOrderRepository',
379
- useFactory: (options) => {
380
- return new PendingOrderFirestoreRepository(options);
381
- },
382
- deps: ['FirestoreOptions'],
383
- },
384
363
  {
385
364
  provide: 'PaymentRepository',
386
365
  useFactory: (options) => {
@@ -388,27 +367,6 @@ class AngularFirestoreModule {
388
367
  },
389
368
  deps: ['FirestoreOptions'],
390
369
  },
391
- {
392
- provide: 'ShoppingRecurrenceRepository',
393
- useFactory: (options) => {
394
- return new ShoppingRecurrenceFirestoreRepository(options);
395
- },
396
- deps: ['FirestoreOptions'],
397
- },
398
- {
399
- provide: 'ShoppingRecurrenceEditionRepository',
400
- useFactory: (options) => {
401
- return new ShoppingRecurrenceEditionFirestoreRepository(options);
402
- },
403
- deps: ['FirestoreOptions'],
404
- },
405
- {
406
- provide: 'ShoppingRecurrenceErrorLogRepository',
407
- useFactory: (options) => {
408
- return new ShoppingRecurrenceErrorLogFirestoreRepository(options);
409
- },
410
- deps: ['FirestoreOptions'],
411
- },
412
370
  {
413
371
  provide: ProductFirestoreRepository,
414
372
  useFactory: (options) => {
@@ -619,13 +577,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
619
577
  },
620
578
  deps: ['FirestoreOptions'],
621
579
  },
622
- {
623
- provide: 'CampaignHashtagPostsRepository',
624
- useFactory: (options) => {
625
- return new CampaignHashtagPostsFirestoreRepository(options);
626
- },
627
- deps: ['FirestoreOptions'],
628
- },
629
580
  {
630
581
  provide: 'CampaignDashboardRepository',
631
582
  useFactory: (options) => {
@@ -633,13 +584,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
633
584
  },
634
585
  deps: ['FirestoreOptions'],
635
586
  },
636
- {
637
- provide: 'CampaignSettingsRepository',
638
- useFactory: (options) => {
639
- return new CampaignSettingsFirestoreRepository(options);
640
- },
641
- deps: ['FirestoreOptions'],
642
- },
643
587
  {
644
588
  provide: 'EditionRepository',
645
589
  useFactory: (options, subscriptionRepository) => {
@@ -689,13 +633,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
689
633
  },
690
634
  deps: ['FirestoreOptions'],
691
635
  },
692
- {
693
- provide: 'PendingOrderRepository',
694
- useFactory: (options) => {
695
- return new PendingOrderFirestoreRepository(options);
696
- },
697
- deps: ['FirestoreOptions'],
698
- },
699
636
  {
700
637
  provide: 'PaymentRepository',
701
638
  useFactory: (options) => {
@@ -703,27 +640,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
703
640
  },
704
641
  deps: ['FirestoreOptions'],
705
642
  },
706
- {
707
- provide: 'ShoppingRecurrenceRepository',
708
- useFactory: (options) => {
709
- return new ShoppingRecurrenceFirestoreRepository(options);
710
- },
711
- deps: ['FirestoreOptions'],
712
- },
713
- {
714
- provide: 'ShoppingRecurrenceEditionRepository',
715
- useFactory: (options) => {
716
- return new ShoppingRecurrenceEditionFirestoreRepository(options);
717
- },
718
- deps: ['FirestoreOptions'],
719
- },
720
- {
721
- provide: 'ShoppingRecurrenceErrorLogRepository',
722
- useFactory: (options) => {
723
- return new ShoppingRecurrenceErrorLogFirestoreRepository(options);
724
- },
725
- deps: ['FirestoreOptions'],
726
- },
727
643
  {
728
644
  provide: ProductFirestoreRepository,
729
645
  useFactory: (options) => {
@@ -862,7 +778,7 @@ class AngularHasuraGraphQLModule {
862
778
  useFactory: (options, platformId) => ({
863
779
  endpoint: options.endpoint,
864
780
  authOptions: options.credentials,
865
- cache: resolveCacheConfig(options.cache),
781
+ cache: options.cache,
866
782
  interceptors: {
867
783
  request: (request) => {
868
784
  if (isPlatformBrowser(platformId))
@@ -1033,28 +949,6 @@ class AngularHasuraGraphQLModule {
1033
949
  provide: 'ProductStockEntryRepository',
1034
950
  useExisting: ProductStockEntryHasuraGraphQLRepository,
1035
951
  },
1036
- {
1037
- provide: ProductGroupHasuraGraphQLRepository,
1038
- useFactory: (options) => {
1039
- return new ProductGroupHasuraGraphQLRepository(options);
1040
- },
1041
- deps: ['HasuraConfig'],
1042
- },
1043
- {
1044
- provide: 'ProductGroupRepository',
1045
- useExisting: ProductGroupHasuraGraphQLRepository,
1046
- },
1047
- {
1048
- provide: ProductPriceLogHasuraGraphQLRepository,
1049
- useFactory: (options) => {
1050
- return new ProductPriceLogHasuraGraphQLRepository(options);
1051
- },
1052
- deps: ['HasuraConfig'],
1053
- },
1054
- {
1055
- provide: 'ProductPriceLogRepository',
1056
- useExisting: ProductPriceLogHasuraGraphQLRepository,
1057
- },
1058
952
  ] }); }
1059
953
  }
1060
954
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
@@ -1066,7 +960,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
1066
960
  useFactory: (options, platformId) => ({
1067
961
  endpoint: options.endpoint,
1068
962
  authOptions: options.credentials,
1069
- cache: resolveCacheConfig(options.cache),
963
+ cache: options.cache,
1070
964
  interceptors: {
1071
965
  request: (request) => {
1072
966
  if (isPlatformBrowser(platformId))
@@ -1237,28 +1131,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
1237
1131
  provide: 'ProductStockEntryRepository',
1238
1132
  useExisting: ProductStockEntryHasuraGraphQLRepository,
1239
1133
  },
1240
- {
1241
- provide: ProductGroupHasuraGraphQLRepository,
1242
- useFactory: (options) => {
1243
- return new ProductGroupHasuraGraphQLRepository(options);
1244
- },
1245
- deps: ['HasuraConfig'],
1246
- },
1247
- {
1248
- provide: 'ProductGroupRepository',
1249
- useExisting: ProductGroupHasuraGraphQLRepository,
1250
- },
1251
- {
1252
- provide: ProductPriceLogHasuraGraphQLRepository,
1253
- useFactory: (options) => {
1254
- return new ProductPriceLogHasuraGraphQLRepository(options);
1255
- },
1256
- deps: ['HasuraConfig'],
1257
- },
1258
- {
1259
- provide: 'ProductPriceLogRepository',
1260
- useExisting: ProductPriceLogHasuraGraphQLRepository,
1261
- },
1262
1134
  ],
1263
1135
  }]
1264
1136
  }] });
@@ -1392,7 +1264,7 @@ class ConfigurationFacade {
1392
1264
  }
1393
1265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ConfigurationFacade, decorators: [{
1394
1266
  type: Injectable
1395
- }], ctorParameters: () => [{ type: i3.Shops, decorators: [{
1267
+ }], ctorParameters: () => [{ type: i1$2.Shops, decorators: [{
1396
1268
  type: Inject,
1397
1269
  args: [DEFAULT_SHOP]
1398
1270
  }] }, { type: undefined, decorators: [{
@@ -1444,41 +1316,16 @@ class CheckoutService {
1444
1316
  checkoutId: checkout.id,
1445
1317
  })), concatMap(() => this.getCheckout()));
1446
1318
  }
1447
- applyPointsDiscount(points) {
1448
- return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutApplyPointsDiscount`, {
1449
- checkoutId: checkout.id,
1450
- points,
1451
- })), concatMap(() => this.getCheckout()));
1452
- }
1453
- removePointsDiscount() {
1454
- return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutRemovePointsDiscount`, {
1455
- checkoutId: checkout.id,
1456
- })), concatMap(() => this.getCheckout()));
1457
- }
1458
1319
  validateStockProducts() {
1459
1320
  return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutValidateProductStock`, {
1460
1321
  checkoutId: checkout.id,
1461
1322
  })));
1462
1323
  }
1463
1324
  selectShippingAddress(address) {
1464
- const formattedAddress = {
1465
- ...address,
1466
- zip: this.formatZip(address.zip),
1467
- };
1468
1325
  return this.getCheckout().pipe(concatMap((checkout) => {
1469
- return this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({
1470
- id: checkout.id,
1471
- shippingAddress: formattedAddress,
1472
- billingAddress: formattedAddress,
1473
- }));
1326
+ return this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, shippingAddress: address, billingAddress: address }));
1474
1327
  }));
1475
1328
  }
1476
- formatZip(zip) {
1477
- if (!zip)
1478
- return zip;
1479
- const digits = zip.replace(/\D/g, '');
1480
- return digits;
1481
- }
1482
1329
  getAvailableShippingForProduct(productShipping) {
1483
1330
  return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutGetAvailableShipping`, {
1484
1331
  checkoutId: null,
@@ -1535,7 +1382,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
1535
1382
  type: Injectable
1536
1383
  }], ctorParameters: () => [{ type: AuthService }, { type: CheckoutService }, { type: i1$1.HttpClient }] });
1537
1384
 
1538
- /* eslint-disable max-params */
1539
1385
  class CartService {
1540
1386
  constructor(servicesFacade, configurationFacade) {
1541
1387
  this.servicesFacade = servicesFacade;
@@ -1551,21 +1397,11 @@ class CartService {
1551
1397
  }), {}) || {};
1552
1398
  this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
1553
1399
  }
1554
- addItem(item, quantity = 1, recurrence = false, recurrenceCycle = null) {
1400
+ addItem(item, quantity = 1) {
1555
1401
  return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutAddItemToCart`, {
1556
1402
  checkoutId: checkout.id,
1557
1403
  productId: item.id,
1558
1404
  quantity,
1559
- recurrence,
1560
- recurrenceCycle,
1561
- })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1562
- }
1563
- updateItemRecurrence(item, recurrence = false, recurrenceCycle = null) {
1564
- return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutUpdateItemRecurrence`, {
1565
- checkoutId: checkout.id,
1566
- productId: item.id,
1567
- recurrence,
1568
- recurrenceCycle,
1569
1405
  })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1570
1406
  }
1571
1407
  decreaseItem(item) {
@@ -1818,9 +1654,12 @@ class CategorySearchStrategy {
1818
1654
  const firstProducts = totalResult.data
1819
1655
  .filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
1820
1656
  .sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
1821
- const lastProducts = totalResult.data
1822
- .filter((product) => !mostRelevants.includes(product.id))
1823
- .concat(mostRelevantWithoutStock);
1657
+ const nonPinnedProducts = totalResult.data.filter((product) => !mostRelevants.includes(product.id));
1658
+ const novoProducts = nonPinnedProducts
1659
+ .filter((product) => product.stock?.quantity > 0 && this.isCreatedWithinLastDays(product.createdAt, 30))
1660
+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
1661
+ const restProducts = nonPinnedProducts.filter((product) => !(product.stock?.quantity > 0 && this.isCreatedWithinLastDays(product.createdAt, 30)));
1662
+ const lastProducts = novoProducts.concat(restProducts).concat(mostRelevantWithoutStock);
1824
1663
  const categoryMostRelevants = firstProducts.concat(lastProducts);
1825
1664
  const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
1826
1665
  return {
@@ -1831,6 +1670,17 @@ class CategorySearchStrategy {
1831
1670
  distinct: totalResult.distinct,
1832
1671
  };
1833
1672
  }
1673
+ isCreatedWithinLastDays(createdAt, days) {
1674
+ if (!createdAt || days <= 0) {
1675
+ return false;
1676
+ }
1677
+ const createdDate = createdAt instanceof Date ? createdAt : new Date(createdAt);
1678
+ if (Number.isNaN(createdDate.getTime())) {
1679
+ return false;
1680
+ }
1681
+ const cutoff = Date.now() - days * 24 * 60 * 60 * 1000;
1682
+ return createdDate.getTime() >= cutoff;
1683
+ }
1834
1684
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CategorySearchStrategy, deps: [{ token: CatalogRepositoryService }, { token: CatalogHelpersService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1835
1685
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CategorySearchStrategy }); }
1836
1686
  }
@@ -2025,7 +1875,7 @@ class CatalogServiceFacade {
2025
1875
  }
2026
1876
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CatalogServiceFacade, decorators: [{
2027
1877
  type: Injectable
2028
- }], ctorParameters: () => [{ type: CatalogHelpersService }, { type: CatalogStrategiesFacade }, { type: i3.Shops, decorators: [{
1878
+ }], ctorParameters: () => [{ type: CatalogHelpersService }, { type: CatalogStrategiesFacade }, { type: i1$2.Shops, decorators: [{
2029
1879
  type: Inject,
2030
1880
  args: [DEFAULT_SHOP]
2031
1881
  }] }] });
@@ -2078,7 +1928,7 @@ class CategoryService {
2078
1928
  }
2079
1929
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CategoryService, decorators: [{
2080
1930
  type: Injectable
2081
- }], ctorParameters: () => [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i3.Shops, decorators: [{
1931
+ }], ctorParameters: () => [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i1$2.Shops, decorators: [{
2082
1932
  type: Inject,
2083
1933
  args: [DEFAULT_SHOP]
2084
1934
  }] }] });
@@ -2116,7 +1966,7 @@ class CategoryServiceFacade {
2116
1966
  }
2117
1967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CategoryServiceFacade, decorators: [{
2118
1968
  type: Injectable
2119
- }], ctorParameters: () => [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i3.Shops, decorators: [{
1969
+ }], ctorParameters: () => [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i1$2.Shops, decorators: [{
2120
1970
  type: Inject,
2121
1971
  args: [DEFAULT_SHOP]
2122
1972
  }] }] });
@@ -2498,7 +2348,7 @@ class CatalogService {
2498
2348
  }
2499
2349
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CatalogService, decorators: [{
2500
2350
  type: Injectable
2501
- }], ctorParameters: () => [{ type: CatalogSearchContext }, { type: CatalogHelpersService }, { type: i3.Shops, decorators: [{
2351
+ }], ctorParameters: () => [{ type: CatalogSearchContext }, { type: CatalogHelpersService }, { type: i1$2.Shops, decorators: [{
2502
2352
  type: Inject,
2503
2353
  args: [DEFAULT_SHOP]
2504
2354
  }] }] });
@@ -2769,11 +2619,320 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
2769
2619
  }] }, { type: undefined, decorators: [{
2770
2620
  type: Inject,
2771
2621
  args: ['LogRepository']
2772
- }] }, { type: i3.Shops, decorators: [{
2622
+ }] }, { type: i1$2.Shops, decorators: [{
2773
2623
  type: Inject,
2774
2624
  args: [DEFAULT_SHOP]
2775
2625
  }] }] });
2776
2626
 
2627
+ class CouponRepositoriesFacade {
2628
+ constructor(couponRepository, orderRepository, categoryRepository) {
2629
+ this.couponRepository = couponRepository;
2630
+ this.orderRepository = orderRepository;
2631
+ this.categoryRepository = categoryRepository;
2632
+ }
2633
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade, deps: [{ token: 'CouponRepository' }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
2634
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade }); }
2635
+ }
2636
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade, decorators: [{
2637
+ type: Injectable
2638
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
2639
+ type: Inject,
2640
+ args: ['CouponRepository']
2641
+ }] }, { type: undefined, decorators: [{
2642
+ type: Inject,
2643
+ args: ['OrderRepository']
2644
+ }] }, { type: undefined, decorators: [{
2645
+ type: Inject,
2646
+ args: ['CategoryRepository']
2647
+ }] }] });
2648
+
2649
+ class CouponService {
2650
+ constructor(repositoriesFacade, configurationFacade) {
2651
+ this.repositoriesFacade = repositoriesFacade;
2652
+ this.configurationFacade = configurationFacade;
2653
+ this.emailIsFromCollaborator = (userEmail) => !!userEmail?.match(/@b4a.com.br/g);
2654
+ }
2655
+ checkCoupon(params) {
2656
+ const { nickname, checkoutType, checkout, plan } = params;
2657
+ return from(this.repositoriesFacade.couponRepository
2658
+ .find({
2659
+ filters: {
2660
+ nickname: { operator: Where.EQUALS, value: nickname },
2661
+ active: { operator: Where.EQUALS, value: true },
2662
+ },
2663
+ })
2664
+ .then((result) => result.data[0])).pipe(concatMap((coupon) => this.couponValidation(coupon, checkoutType)), concatMap((couponValid) => this.couponRulesValidation({ coupon: couponValid, checkoutType, checkout, plan })), map((couponValidated) => couponValidated));
2665
+ }
2666
+ async couponValidation(coupon, checkoutType) {
2667
+ if (!coupon)
2668
+ throw 'Cupom inválido.';
2669
+ if (coupon?.beginAt && coupon?.beginAt.getTime() > new Date().getTime())
2670
+ throw 'Cupom inválido.';
2671
+ if (coupon?.expiresIn && (coupon?.expiresIn).getTime() < new Date().getTime())
2672
+ throw 'Cupom expirado.';
2673
+ const isInShop = coupon.shopAvailability === Shops.ALL || coupon.shopAvailability === this.configurationFacade.defaultShop;
2674
+ if (!isInShop)
2675
+ throw 'Cupom inválido para loja.';
2676
+ const isCheckoutType = coupon.checkoutType === CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
2677
+ if (!isCheckoutType)
2678
+ throw 'Cupom inválido. Erro de checkout.';
2679
+ return coupon;
2680
+ }
2681
+ async couponRulesValidation(params) {
2682
+ const { coupon, checkoutType, checkout, plan } = params;
2683
+ if (checkoutType == CheckoutTypes.SUBSCRIPTION) {
2684
+ return this.validateSubscriptionCoupon(coupon, plan);
2685
+ }
2686
+ return this.validateEcommerceCoupon(coupon, checkoutType, checkout);
2687
+ }
2688
+ validateSubscriptionCoupon(coupon, plan) {
2689
+ if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase()) {
2690
+ throw 'Cupom inválido para sua assinatura.';
2691
+ }
2692
+ return coupon;
2693
+ }
2694
+ async validateEcommerceCoupon(coupon, checkoutType, checkout) {
2695
+ this.validateUserEligibility(coupon, checkout?.user);
2696
+ await this.validateUsageLimits(coupon, checkoutType, checkout);
2697
+ await this.validateProductEligibility(coupon, checkout);
2698
+ return coupon;
2699
+ }
2700
+ validateUserEligibility(coupon, user) {
2701
+ const validUser = this.coupomUserValidation(coupon, user);
2702
+ if (!validUser)
2703
+ throw 'Usuário não elegível.';
2704
+ }
2705
+ async validateUsageLimits(coupon, checkoutType, checkout) {
2706
+ const couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
2707
+ if (couponUseLimits.firstOrder) {
2708
+ await this.validateFirstOrderLimit(checkout.user.email);
2709
+ }
2710
+ if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
2711
+ await this.validateCouponUsageLimits(coupon, couponUseLimits, checkout.user.email);
2712
+ }
2713
+ }
2714
+ async validateFirstOrderLimit(userEmail) {
2715
+ const ordersUser = await this.getOrdersFromUser(userEmail.toLocaleLowerCase());
2716
+ if (ordersUser.length >= 1)
2717
+ throw 'Limite de uso atingido';
2718
+ }
2719
+ async validateCouponUsageLimits(coupon, couponUseLimits, userEmail) {
2720
+ const ordersCoupon = await this.getOrdersWithCoupon(coupon);
2721
+ if (!couponUseLimits.unlimited && couponUseLimits.total && ordersCoupon.length >= couponUseLimits.total) {
2722
+ throw 'Limite de uso atingido.';
2723
+ }
2724
+ if (couponUseLimits.limitedPerUser) {
2725
+ const ordersWithUser = this.countOrdersWithUser(ordersCoupon, userEmail);
2726
+ if (ordersWithUser > 0)
2727
+ throw 'Limite de uso por usuário atingido.';
2728
+ }
2729
+ }
2730
+ async validateProductEligibility(coupon, checkout) {
2731
+ const hasProductCategories = await this.hasProductCategories(coupon, checkout);
2732
+ if (!hasProductCategories)
2733
+ throw 'Seu carrinho não possui produtos elegíveis para desconto.';
2734
+ const hasMinSubTotal = await this.hasMinSubTotal(coupon, checkout);
2735
+ if (!hasMinSubTotal) {
2736
+ this.throwMinSubTotalError(coupon);
2737
+ }
2738
+ }
2739
+ throwMinSubTotalError(coupon) {
2740
+ const formattedValue = Intl.NumberFormat('pt-BR', {
2741
+ style: 'currency',
2742
+ currency: 'BRL',
2743
+ }).format(coupon.minSubTotalValue);
2744
+ if (coupon.productsCategories?.length) {
2745
+ throw `Valor mínimo de ${formattedValue} não atingido na(s) categoria(s) elegíveis para o desconto.`;
2746
+ }
2747
+ throw `Valor mínimo de ${formattedValue} não atingido.`;
2748
+ }
2749
+ calcDiscountSubscription(coupon, checkout) {
2750
+ let discount = 0;
2751
+ if (coupon.discount.subscription.type == CouponTypes.ABSOLUTE)
2752
+ discount = coupon.discount.subscription.value;
2753
+ else
2754
+ discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount.subscription.value / 100);
2755
+ return of(discount);
2756
+ }
2757
+ async hasMinSubTotal(coupon, checkout) {
2758
+ if (!coupon.minSubTotalValue)
2759
+ return true;
2760
+ const lineItensDiscount = await this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
2761
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user);
2762
+ if (coupon.minSubTotalValue <= subTotal)
2763
+ return true;
2764
+ return false;
2765
+ }
2766
+ async hasProductCategories(coupon, checkout) {
2767
+ if (!coupon.productsCategories?.length) {
2768
+ return true;
2769
+ }
2770
+ const couponCategories = await this.getCouponCategoriesId(coupon.productsCategories);
2771
+ const hasCategories = checkout.lineItems?.filter((item) => {
2772
+ if (item.isGift)
2773
+ return false;
2774
+ if (!item.categories?.length)
2775
+ return true;
2776
+ return item.categories.some((c) => couponCategories.some((cat) => cat == c));
2777
+ });
2778
+ return hasCategories?.length ? true : false;
2779
+ }
2780
+ coupomUserValidation(coupon, user) {
2781
+ if (!user || coupon.exclusivityType.includes(Exclusivities.ALL_USERS))
2782
+ return true;
2783
+ const userTypes = [];
2784
+ if (coupon.exclusivityType.includes(Exclusivities.COLLABORATORS) &&
2785
+ this.emailIsFromCollaborator(user.email.toLocaleLowerCase()))
2786
+ userTypes.push(Exclusivities.COLLABORATORS);
2787
+ if (coupon.exclusivityType.includes(Exclusivities.SPECIFIC_USER) &&
2788
+ coupon.userExclusiveEmail.includes(user.email.toLocaleLowerCase()))
2789
+ userTypes.push(Exclusivities.SPECIFIC_USER);
2790
+ if (coupon.exclusivityType.includes(Exclusivities.ACTIVE_SUBSCRIBER) &&
2791
+ user.isSubscriber &&
2792
+ user.subscriptionPlan != '')
2793
+ userTypes.push(Exclusivities.ACTIVE_SUBSCRIBER);
2794
+ if (user.isSubscriber &&
2795
+ user.subscriptionPlan == '' &&
2796
+ coupon.exclusivityType.includes(Exclusivities.INACTIVE_SUBSCRIBER))
2797
+ userTypes.push(Exclusivities.INACTIVE_SUBSCRIBER);
2798
+ if (coupon.exclusivityType.includes(Exclusivities.NON_SUBSCRIBER) && !user.isSubscriber)
2799
+ userTypes.push(Exclusivities.NON_SUBSCRIBER);
2800
+ return coupon.exclusivityType.some((r) => userTypes.includes(r));
2801
+ }
2802
+ async getCouponCategoriesId(productsCategories) {
2803
+ const couponCategories = [];
2804
+ for (let index = 0; index < productsCategories.length; index++) {
2805
+ const category = await this.repositoriesFacade.categoryRepository.get({
2806
+ id: productsCategories[index],
2807
+ });
2808
+ if (category) {
2809
+ const children = await this.repositoriesFacade.categoryRepository.getChildren(parseInt(productsCategories[index]));
2810
+ couponCategories.push(category.id, ...children.map((c) => c.id.toString()));
2811
+ }
2812
+ }
2813
+ return [...new Set(couponCategories)];
2814
+ }
2815
+ async getLineItensEligebleForDiscount(productsCategories, checkout) {
2816
+ let lineItensDiscount = [];
2817
+ const couponCategories = await this.getCouponCategoriesId(productsCategories);
2818
+ if (productsCategories?.length) {
2819
+ lineItensDiscount = checkout.lineItems?.filter((item) => {
2820
+ if (item.isGift)
2821
+ return false;
2822
+ if (item.categories?.length) {
2823
+ return item.categories.some((c) => couponCategories.some((cat) => cat == c));
2824
+ }
2825
+ return true;
2826
+ });
2827
+ }
2828
+ else {
2829
+ lineItensDiscount = checkout.lineItems.filter((item) => !item.isGift);
2830
+ }
2831
+ return lineItensDiscount;
2832
+ }
2833
+ calcCheckoutSubtotal(lineItens, user) {
2834
+ return (lineItens
2835
+ ?.filter((item) => !item.isGift)
2836
+ .reduce((acc, curr) => user?.isSubscriber && curr.price?.subscriberPrice
2837
+ ? acc + curr.price?.subscriberPrice * curr.quantity
2838
+ : acc + curr.pricePaid * curr.quantity, 0) || 0);
2839
+ }
2840
+ async getOrdersWithCoupon(coupon) {
2841
+ return await this.repositoriesFacade.orderRepository
2842
+ .find({
2843
+ filters: {
2844
+ coupon: { id: coupon.id },
2845
+ status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
2846
+ },
2847
+ })
2848
+ .then((result) => result.data);
2849
+ }
2850
+ async getOrdersFromUser(email) {
2851
+ return await this.repositoriesFacade.orderRepository
2852
+ .find({
2853
+ filters: {
2854
+ user: { email: { operator: Where.EQUALS, value: email } },
2855
+ status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
2856
+ },
2857
+ })
2858
+ .then((result) => result.data);
2859
+ }
2860
+ countOrdersWithUser(orders, email) {
2861
+ return orders.filter((o) => o.user.email == email).length;
2862
+ }
2863
+ getCouponUseLimits(coupon, checkoutType, user) {
2864
+ let couponUseLimits;
2865
+ if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
2866
+ if (coupon.exclusivityType.length === 1 &&
2867
+ (coupon.exclusivityType.at(0) === Exclusivities.SPECIFIC_USER ||
2868
+ coupon.exclusivityType.at(0) === Exclusivities.COLLABORATORS))
2869
+ couponUseLimits = coupon.useLimits.non_subscriber;
2870
+ else
2871
+ couponUseLimits = user?.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
2872
+ }
2873
+ else {
2874
+ couponUseLimits = coupon.useLimits.subscription;
2875
+ }
2876
+ return couponUseLimits;
2877
+ }
2878
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponService, deps: [{ token: CouponRepositoriesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable }); }
2879
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponService, providedIn: 'root' }); }
2880
+ }
2881
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponService, decorators: [{
2882
+ type: Injectable,
2883
+ args: [{
2884
+ providedIn: 'root',
2885
+ }]
2886
+ }], ctorParameters: () => [{ type: CouponRepositoriesFacade }, { type: ConfigurationFacade }] });
2887
+
2888
+ class CheckoutSubscriptionService {
2889
+ constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
2890
+ this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
2891
+ this.dataPersistence = dataPersistence;
2892
+ this.couponService = couponService;
2893
+ }
2894
+ getCheckoutSubscription(checkoutData) {
2895
+ return this.dataPersistence
2896
+ .get('checkoutSubscriptionId')
2897
+ .pipe(concatMap((id) => !isNil(id) ? this.checkoutSubscriptionRepository.get({ id }) : this.createCheckoutSubscription(checkoutData)));
2898
+ }
2899
+ clearCheckoutSubscriptionFromSession() {
2900
+ return this.dataPersistence.remove('checkoutSubscriptionId');
2901
+ }
2902
+ checkCoupon(nickname, _userEmail) {
2903
+ return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
2904
+ .checkCoupon({
2905
+ nickname,
2906
+ checkoutType: CheckoutTypes.SUBSCRIPTION,
2907
+ checkout,
2908
+ plan: checkout.subscriptionPlan.name,
2909
+ })
2910
+ .pipe()));
2911
+ }
2912
+ calcDiscountSubscription(coupon) {
2913
+ return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
2914
+ }
2915
+ async createCheckoutSubscription(checkoutData) {
2916
+ const checkout = await this.checkoutSubscriptionRepository.create({
2917
+ createdAt: new Date(),
2918
+ ...CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain(),
2919
+ });
2920
+ await this.dataPersistence.set('checkoutSubscriptionId', checkout.id).toPromise();
2921
+ return checkout;
2922
+ }
2923
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: PERSISTENCE_PROVIDER }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2924
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CheckoutSubscriptionService }); }
2925
+ }
2926
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
2927
+ type: Injectable
2928
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
2929
+ type: Inject,
2930
+ args: ['CheckoutSubscriptionRepository']
2931
+ }] }, { type: undefined, decorators: [{
2932
+ type: Inject,
2933
+ args: [PERSISTENCE_PROVIDER]
2934
+ }] }, { type: CouponService }] });
2935
+
2777
2936
  class UtilHelper {
2778
2937
  static createSlug(name) {
2779
2938
  return name
@@ -2875,17 +3034,6 @@ class HomeShopService {
2875
3034
  getMinValueForFreeShipping() {
2876
3035
  return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
2877
3036
  }
2878
- /**
2879
- * Retorna os thresholds de frete grátis estruturados configurados no documento
2880
- * Home (`shippingThresholds`). Quando o documento ainda não possui essa
2881
- * estrutura, retorna um default conservador equivalente à regra legada
2882
- * (edition: 50, avulsoSp: 99, avulsoOutro: null) para que consumidores não
2883
- * quebrem durante a migração.
2884
- */
2885
- getShippingThresholds() {
2886
- const conservativeDefault = { edition: 50, avulsoSp: 99, avulsoOutro: null };
2887
- return this.getHomeConfiguration().pipe(map((home) => home.shippingThresholds ?? conservativeDefault));
2888
- }
2889
3037
  getDiscoverProducts(_gender) {
2890
3038
  return this.getHomeConfiguration().pipe(concatMap((home) => from(this.repositoriesFacade.categoryRepository.getCategoriesForHome({
2891
3039
  categoryIds: home.discoverCategories,
@@ -3042,7 +3190,7 @@ class OrderProductReviewService {
3042
3190
  }
3043
3191
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderProductReviewService, decorators: [{
3044
3192
  type: Injectable
3045
- }], ctorParameters: () => [{ type: i3.OrderFirestoreRepository, decorators: [{
3193
+ }], ctorParameters: () => [{ type: i1$2.OrderFirestoreRepository, decorators: [{
3046
3194
  type: Inject,
3047
3195
  args: ['OrderRepository']
3048
3196
  }] }, { type: undefined, decorators: [{
@@ -3051,77 +3199,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
3051
3199
  }] }, { type: undefined, decorators: [{
3052
3200
  type: Inject,
3053
3201
  args: ['VariantRepository']
3054
- }] }, { type: i3.Shops, decorators: [{
3202
+ }] }, { type: i1$2.Shops, decorators: [{
3055
3203
  type: Inject,
3056
3204
  args: [DEFAULT_SHOP]
3057
3205
  }] }] });
3058
3206
 
3059
- class OrderRecurrenceService {
3060
- constructor(shoppingRecurrenceRepository, defaultShop, dependenciesFacade, configurationFacade) {
3061
- this.shoppingRecurrenceRepository = shoppingRecurrenceRepository;
3062
- this.defaultShop = defaultShop;
3063
- this.dependenciesFacade = dependenciesFacade;
3064
- this.configurationFacade = configurationFacade;
3065
- this.checkoutUrl = null;
3066
- this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
3067
- }
3068
- getRecurrenceOrder(recurrenceId) {
3069
- return from(this.shoppingRecurrenceRepository.get({ id: recurrenceId }));
3070
- }
3071
- createRecurrenceOrder(recurrencePayload) {
3072
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/createShoppingRecurrence`, {
3073
- data: recurrencePayload,
3074
- });
3075
- }
3076
- updatePaymentMethod(data) {
3077
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrencePaymentMethod`, {
3078
- data,
3079
- });
3080
- }
3081
- getRecurrenceAvailableShipping(data) {
3082
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/getShoppingRecurrenceAvailableShipping`, {
3083
- data,
3084
- });
3085
- }
3086
- updateShippingAddress(data) {
3087
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceShippingAddress`, {
3088
- data,
3089
- });
3090
- }
3091
- cancelRecurrenceOrder(data) {
3092
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/cancelShoppingRecurrence`, {
3093
- data,
3094
- });
3095
- }
3096
- enableOrDisableRecurrenceOrder(recurrenceId, active) {
3097
- const payload = { recurrenceId, active };
3098
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/enableOrDisableShoppingRecurrence`, payload);
3099
- }
3100
- skipRecurrenceOrder(recurrenceEditionId) {
3101
- const payload = { recurrenceEditionId };
3102
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/skipShoppingRecurrenceEdition`, payload);
3103
- }
3104
- updateFrequency(recurrenceId, frequency) {
3105
- const payload = { recurrenceId, frequency };
3106
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceFrequency`, payload);
3107
- }
3108
- updateLineItems(recurrenceId, lineItems) {
3109
- const payload = { recurrenceId, lineItems };
3110
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceLineItems`, payload);
3111
- }
3112
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderRecurrenceService, deps: [{ token: 'ShoppingRecurrenceRepository' }, { token: DEFAULT_SHOP }, { token: CheckoutDependenciesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable }); }
3113
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderRecurrenceService }); }
3114
- }
3115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderRecurrenceService, decorators: [{
3116
- type: Injectable
3117
- }], ctorParameters: () => [{ type: i3.ShoppingRecurrenceFirestoreRepository, decorators: [{
3118
- type: Inject,
3119
- args: ['ShoppingRecurrenceRepository']
3120
- }] }, { type: i3.Shops, decorators: [{
3121
- type: Inject,
3122
- args: [DEFAULT_SHOP]
3123
- }] }, { type: CheckoutDependenciesFacade }, { type: ConfigurationFacade }] });
3124
-
3125
3207
  class OrderService {
3126
3208
  constructor(angularFirestore, orderRepository) {
3127
3209
  this.angularFirestore = angularFirestore;
@@ -3134,36 +3216,14 @@ class OrderService {
3134
3216
  .subscribe((doc) => this.orderSubject.next(doc));
3135
3217
  return this.orderSubject;
3136
3218
  }
3137
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderService, deps: [{ token: i1$2.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
3219
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderService, deps: [{ token: i1$3.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
3138
3220
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderService }); }
3139
3221
  }
3140
3222
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: OrderService, decorators: [{
3141
3223
  type: Injectable
3142
- }], ctorParameters: () => [{ type: i1$2.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
3143
- type: Inject,
3144
- args: ['OrderRepository']
3145
- }] }] });
3146
-
3147
- class CouponRepositoriesFacade {
3148
- constructor(couponRepository, orderRepository, categoryRepository) {
3149
- this.couponRepository = couponRepository;
3150
- this.orderRepository = orderRepository;
3151
- this.categoryRepository = categoryRepository;
3152
- }
3153
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade, deps: [{ token: 'CouponRepository' }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
3154
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade }); }
3155
- }
3156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: CouponRepositoriesFacade, decorators: [{
3157
- type: Injectable
3158
- }], ctorParameters: () => [{ type: undefined, decorators: [{
3159
- type: Inject,
3160
- args: ['CouponRepository']
3161
- }] }, { type: undefined, decorators: [{
3224
+ }], ctorParameters: () => [{ type: i1$3.Firestore }, { type: i1$2.OrderFirestoreRepository, decorators: [{
3162
3225
  type: Inject,
3163
3226
  args: ['OrderRepository']
3164
- }] }, { type: undefined, decorators: [{
3165
- type: Inject,
3166
- args: ['CategoryRepository']
3167
3227
  }] }] });
3168
3228
 
3169
3229
  class AngularConnectModule {
@@ -3248,6 +3308,8 @@ class AngularConnectModule {
3248
3308
  CatalogService,
3249
3309
  CategoryService,
3250
3310
  CheckoutService,
3311
+ CheckoutSubscriptionService,
3312
+ CouponService,
3251
3313
  HomeShopService,
3252
3314
  OrderService,
3253
3315
  WishlistService,
@@ -3308,7 +3370,6 @@ class AngularConnectModule {
3308
3370
  CouponRepositoriesFacade,
3309
3371
  HomeShopRepositoriesFacade,
3310
3372
  OrderProductReviewService,
3311
- OrderRecurrenceService,
3312
3373
  ], imports: [AngularElasticSeachModule,
3313
3374
  AngularVertexSeachModule,
3314
3375
  AngularFirebaseAuthModule,
@@ -3361,6 +3422,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
3361
3422
  CatalogService,
3362
3423
  CategoryService,
3363
3424
  CheckoutService,
3425
+ CheckoutSubscriptionService,
3426
+ CouponService,
3364
3427
  HomeShopService,
3365
3428
  OrderService,
3366
3429
  WishlistService,
@@ -3421,7 +3484,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
3421
3484
  CouponRepositoriesFacade,
3422
3485
  HomeShopRepositoriesFacade,
3423
3486
  OrderProductReviewService,
3424
- OrderRecurrenceService,
3425
3487
  ],
3426
3488
  }]
3427
3489
  }] });
@@ -3430,5 +3492,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
3430
3492
  * Generated bundle index. Do not edit.
3431
3493
  */
3432
3494
 
3433
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CookieDataPersistence, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderProductReviewService, OrderRecurrenceService, OrderService, ProductSorts, UtilHelper, WishlistService };
3495
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderProductReviewService, OrderService, ProductSorts, UtilHelper, WishlistService };
3434
3496
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map