@infrab4a/connect-angular 4.0.7 → 4.1.0-beta.1

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.
@@ -1,7 +1,7 @@
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$3 from '@infrab4a/connect';
4
- 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, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, CheckoutSubscription, Product, RequiredArgumentError, add, Order } from '@infrab4a/connect';
4
+ 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, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, CheckoutSubscription, Product, RequiredArgumentError, add, Order } from '@infrab4a/connect';
5
5
  import * as i1 from '@angular/fire/app';
6
6
  import { provideFirebaseApp, initializeApp, FirebaseApp } from '@angular/fire/app';
7
7
  import * as i1$1 from '@angular/fire/auth';
@@ -394,6 +394,13 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
394
394
  },
395
395
  deps: ['FirestoreOptions', 'UserRepository'],
396
396
  },
397
+ {
398
+ provide: 'SubscriptionMaterializationRepository',
399
+ useFactory: (options) => {
400
+ return new SubscriptionMaterializationFirestoreRepository(options);
401
+ },
402
+ deps: ['FirestoreOptions'],
403
+ },
397
404
  {
398
405
  provide: ProductVariantFirestoreRepository,
399
406
  useFactory: (options, productRepository) => {
@@ -625,6 +632,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
625
632
  },
626
633
  deps: ['FirestoreOptions', 'UserRepository'],
627
634
  },
635
+ {
636
+ provide: 'SubscriptionMaterializationRepository',
637
+ useFactory: (options) => {
638
+ return new SubscriptionMaterializationFirestoreRepository(options);
639
+ },
640
+ deps: ['FirestoreOptions'],
641
+ },
628
642
  {
629
643
  provide: ProductVariantFirestoreRepository,
630
644
  useFactory: (options, productRepository) => {
@@ -1630,6 +1644,24 @@ __decorate([
1630
1644
  __metadata("design:type", Array)
1631
1645
  ], CategoryWithTree.prototype, "children", void 0);
1632
1646
 
1647
+ class UtilHelper {
1648
+ static createSlug(name) {
1649
+ return name
1650
+ .toLowerCase()
1651
+ .replace(/\s+/g, '-') // Replace spaces with -
1652
+ .replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
1653
+ .replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
1654
+ .replace(/[ìíïî]/g, 'i') // Replace spaces with -
1655
+ .replace(/[õòóöô]/g, 'o') // Replace spaces with -
1656
+ .replace(/[ùúüû]/g, 'u') // Replace spaces with -
1657
+ .replace(/[ñ]/g, 'n') // Replace spaces with -
1658
+ .replace(/[ç]/g, 'c') // Replace spaces with -
1659
+ .replace(/[&]/g, 'and') // Replace spaces with -
1660
+ .replace(/[^\w\-]+/g, '') // Remove all non-word chars
1661
+ .replace(/\-\-+/g, '-'); // Replace multiple - with single -
1662
+ }
1663
+ }
1664
+
1633
1665
  class NewCategoryStructureAdapter {
1634
1666
  constructor(categoryRepository) {
1635
1667
  this.categoryRepository = categoryRepository;
@@ -1704,7 +1736,7 @@ class WishlistService {
1704
1736
  }
1705
1737
  async create(personId, title, description, userFullName, userPhoto) {
1706
1738
  const data = {
1707
- slug: '',
1739
+ slug: UtilHelper.createSlug(`favoritos ${title}`),
1708
1740
  name: title,
1709
1741
  description,
1710
1742
  metadata: {
@@ -1720,11 +1752,12 @@ class WishlistService {
1720
1752
  published: true,
1721
1753
  };
1722
1754
  const newWishlist = await this.wishlistRepository.create(data);
1723
- return this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
1755
+ return this.wishlistRepository.update({ id: newWishlist.id, slug: `${newWishlist.id}-${newWishlist.slug}` });
1724
1756
  }
1725
1757
  update(id, title, description, userFullName, userPhoto) {
1726
1758
  const data = {
1727
1759
  id,
1760
+ slug: UtilHelper.createSlug(`${id}-favoritos ${title}`),
1728
1761
  name: title,
1729
1762
  description,
1730
1763
  metadata: {
@@ -1740,9 +1773,6 @@ class WishlistService {
1740
1773
  return this.wishlistRepository.delete({ id: wishlistId });
1741
1774
  }
1742
1775
  getWishlistBySlug(slug) {
1743
- const [id] = slug.split('-');
1744
- if (+id)
1745
- return this.wishlistRepository.get({ id });
1746
1776
  return this.wishlistRepository.getWishlistBySlug(slug);
1747
1777
  }
1748
1778
  getWishlistsByPerson(personId) {
@@ -1832,24 +1862,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1832
1862
  args: ['SubscriptionRepository']
1833
1863
  }] }, { type: CouponService }]; } });
1834
1864
 
1835
- class UtilHelper {
1836
- static createSlug(name) {
1837
- return name
1838
- .toLowerCase()
1839
- .replace(/\s+/g, '-') // Replace spaces with -
1840
- .replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
1841
- .replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
1842
- .replace(/[ìíïî]/g, 'i') // Replace spaces with -
1843
- .replace(/[õòóöô]/g, 'o') // Replace spaces with -
1844
- .replace(/[ùúüû]/g, 'u') // Replace spaces with -
1845
- .replace(/[ñ]/g, 'n') // Replace spaces with -
1846
- .replace(/[ç]/g, 'c') // Replace spaces with -
1847
- .replace(/[&]/g, 'and') // Replace spaces with -
1848
- .replace(/[^\w\-]+/g, '') // Remove all non-word chars
1849
- .replace(/\-\-+/g, '-'); // Replace multiple - with single -
1850
- }
1851
- }
1852
-
1853
1865
  class HomeShopService {
1854
1866
  constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
1855
1867
  this.categoryRepository = categoryRepository;