@infrab4a/connect-angular 6.0.0-beta.1 → 6.0.0-beta.10

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.
@@ -7,7 +7,7 @@ import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
7
7
  import * as i3$1 from '@angular/fire/storage';
8
8
  import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
9
9
  import * as i3 from '@infrab4a/connect';
10
- import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, GroupFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, 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';
10
+ import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, GroupFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, isNil, NotFoundError, Checkout, pick, LineItem, Where, Shops, isEmpty, set, InvalidArgumentError, RoundProductPricesHelper, Category, WishlistLogType, PersonTypes, Wishlist, CheckoutTypes, CouponTypes, Exclusivities, OrderStatus, CheckoutSubscription, Product, RequiredArgumentError, add, ProductReview, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
11
11
  import * as i1 from '@angular/fire/auth';
12
12
  import { Auth, provideAuth, initializeAuth, indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence, getAuth, getIdToken, authState } from '@angular/fire/auth';
13
13
  import { isPlatformBrowser, isPlatformServer } from '@angular/common';
@@ -1278,7 +1278,7 @@ class CheckoutService {
1278
1278
  })), concatMap(() => this.getCheckout()));
1279
1279
  }
1280
1280
  createOrder(checkoutPayload, paymentProvider, applicationVersion) {
1281
- return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkout`, {
1281
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutV5`, {
1282
1282
  data: {
1283
1283
  ...checkoutPayload,
1284
1284
  applicationVersion,
@@ -1577,7 +1577,8 @@ class CategorySearchStrategy {
1577
1577
  options: {
1578
1578
  minimal: ['price'],
1579
1579
  maximum: ['price'],
1580
- ...(isEmpty(filters?.brands) ? { distinct: ['brand'] } : {}),
1580
+ distinct: ['brand'],
1581
+ // ...(isEmpty(filters?.brands) ? { distinct: ['brand'] } : {}),
1581
1582
  },
1582
1583
  }, mainGender || (shop === Shops.MENSMARKET ? 'male' : 'female'), optionsCache);
1583
1584
  return this.sortProductsByRelevance(totalResult, mostRelevants, limits);
@@ -1624,7 +1625,7 @@ class ProfileSearchStrategy {
1624
1625
  const repoParams = {
1625
1626
  fields: fieldsHelper.getStandardFields(),
1626
1627
  filters: {
1627
- tags: { operator: Where.LIKE, value: profile },
1628
+ tagsProfile: { operator: Where.LIKE, value: profile },
1628
1629
  ...filterHelper.buildFilterQuery(filters || {}),
1629
1630
  },
1630
1631
  ...(sort ? { orderBy: sortHelper.buildSortQuery(sort) } : {}),
@@ -1831,6 +1832,9 @@ class CategoryService {
1831
1832
  .find({ filters: { brandCategory: true, shop: options?.shop || this.shop }, orderBy: { name: 'asc' } }, optionsCache)
1832
1833
  .then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
1833
1834
  }
1835
+ async getMenuBrands() {
1836
+ return this.categoryFacade.categoryRepository.getBrandsWithProducts();
1837
+ }
1834
1838
  async fetchFilterOptions(category, optionsCache) {
1835
1839
  return await this.categoryFacade.categoryFilterRepository
1836
1840
  .find({ filters: { categoryId: +category.id } }, optionsCache)
@@ -1885,11 +1889,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1885
1889
  }] }] });
1886
1890
 
1887
1891
  class BrandManagerHelper {
1888
- constructor(productCatalog) {
1892
+ constructor(productCatalog, searchContext, shop) {
1889
1893
  this.productCatalog = productCatalog;
1894
+ this.searchContext = searchContext;
1895
+ this.shop = shop;
1890
1896
  this.brandsList = {};
1891
1897
  }
1892
1898
  async setBrandsList(options, brands) {
1899
+ // eslint-disable-next-line no-console
1900
+ console.log('setBrandsList', brands);
1893
1901
  const filterBrands = options.filters?.brands;
1894
1902
  const indexKey = this.buildIndexBrands(options);
1895
1903
  if (isEmpty(brands) && options.filters) {
@@ -1897,6 +1905,8 @@ class BrandManagerHelper {
1897
1905
  }
1898
1906
  this.brandsList[indexKey] = this.brandsList[indexKey] || brands || (await this.fetchBrandsOnly(options));
1899
1907
  this.brandsList[indexKey] = this.brandsList[indexKey].filter(Boolean);
1908
+ // eslint-disable-next-line no-console
1909
+ console.log('setBrandsList indexKey', this.brandsList[indexKey]);
1900
1910
  if (options.filters) {
1901
1911
  options.filters = {
1902
1912
  ...options.filters,
@@ -1916,7 +1926,11 @@ class BrandManagerHelper {
1916
1926
  return `profile-${options.profile.join(',')}`;
1917
1927
  return '';
1918
1928
  }
1919
- async fetchBrandsOnly(options) {
1929
+ async fetchBrandsOnly(options, optionsCache) {
1930
+ if (options.category) {
1931
+ const { distinct } = await this.searchContext.executeSearch(options, this.shop, optionsCache);
1932
+ return distinct.brand;
1933
+ }
1920
1934
  return this.productCatalog.productRepository
1921
1935
  .findCatalog({
1922
1936
  fields: ['id'],
@@ -1929,12 +1943,15 @@ class BrandManagerHelper {
1929
1943
  }, options.mainGender)
1930
1944
  .then((result) => result.distinct.brand);
1931
1945
  }
1932
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BrandManagerHelper, deps: [{ token: ProductCatalogFacade }], target: i0.ɵɵFactoryTarget.Injectable }); }
1946
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BrandManagerHelper, deps: [{ token: ProductCatalogFacade }, { token: CatalogSearchContext }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable }); }
1933
1947
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BrandManagerHelper }); }
1934
1948
  }
1935
1949
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BrandManagerHelper, decorators: [{
1936
1950
  type: Injectable
1937
- }], ctorParameters: () => [{ type: ProductCatalogFacade }] });
1951
+ }], ctorParameters: () => [{ type: ProductCatalogFacade }, { type: CatalogSearchContext }, { type: i3.Shops, decorators: [{
1952
+ type: Inject,
1953
+ args: [DEFAULT_SHOP]
1954
+ }] }] });
1938
1955
 
1939
1956
  class CatalogFilterHelper {
1940
1957
  buildFilterQuery(filters) {
@@ -1963,7 +1980,7 @@ class CatalogFilterHelper {
1963
1980
  filterQuery.rate = { operator: Where.GTE, value: filters.rate };
1964
1981
  }
1965
1982
  if (filters.tags?.length) {
1966
- filterQuery.tags = { operator: Where.LIKE, value: filters.tags };
1983
+ filterQuery.tagsProfile = { operator: Where.LIKE, value: filters.tags };
1967
1984
  }
1968
1985
  if (filters.customOptions?.length) {
1969
1986
  filterQuery.filters = { operator: Where.LIKE, value: filters.customOptions };
@@ -2047,7 +2064,8 @@ class ProductFieldsHelper {
2047
2064
  'isKit',
2048
2065
  'sku',
2049
2066
  'rate',
2050
- 'tags',
2067
+ 'tagsProfile',
2068
+ 'tagsCollection',
2051
2069
  'type',
2052
2070
  'shoppingCount',
2053
2071
  'gender',
@@ -2164,8 +2182,14 @@ class CatalogService {
2164
2182
  async fetchProducts(options, optionsCache) {
2165
2183
  this.validateRequest(options);
2166
2184
  const searchParams = this.buildSearchParams(options);
2185
+ // eslint-disable-next-line no-console
2186
+ console.log('searchParams', searchParams);
2167
2187
  const { data, count: total, maximum, minimal, distinct, } = await this.searchContext.executeSearch(searchParams, this.shop, optionsCache);
2188
+ // eslint-disable-next-line no-console
2189
+ console.log('distinct', distinct);
2168
2190
  await this.helpersService.getBrandManager().setBrandsList(searchParams, distinct?.brand);
2191
+ // eslint-disable-next-line no-console
2192
+ console.log('searchParams 2', searchParams);
2169
2193
  return this.buildResponse({
2170
2194
  data,
2171
2195
  total,