@infrab4a/connect-angular 4.0.0-beta.2 → 4.0.0-beta.21

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.
@@ -2,17 +2,21 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Inject, InjectionToken, NgModule, PLATFORM_ID } from '@angular/core';
3
3
  import * as i1 from '@angular/fire/auth';
4
4
  import { getIdToken, authState, Auth, provideAuth, getAuth } from '@angular/fire/auth';
5
- import { combineLatest, of, from, throwError, Subject, iif, forkJoin } from 'rxjs';
5
+ import { combineLatest, from, of, throwError, Subject, iif, forkJoin } from 'rxjs';
6
6
  import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
7
7
  import { __awaiter } from 'tslib';
8
- import * as i2 from '@infrab4a/connect';
9
- import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, Status, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Order, Category, Product, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, VariantHasuraGraphQLRepository } from '@infrab4a/connect';
8
+ import * as i3 from '@infrab4a/connect';
9
+ import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Category, Product, RequiredArgumentError, add, Order, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, 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 } from '@infrab4a/connect';
10
10
  import cookie from 'js-cookie';
11
11
  import { CustomError } from 'ts-custom-error';
12
12
  import * as i1$1 from '@angular/fire/firestore';
13
- import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
14
- import * as i1$2 from '@angular/fire/app';
13
+ import { docSnapshots, doc, Firestore, provideFirestore } from '@angular/fire/firestore';
14
+ import * as i1$2 from '@angular/common/http';
15
+ import * as i1$3 from '@angular/fire/app';
15
16
  import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
17
+ import { isPlatformBrowser } from '@angular/common';
18
+ import { initializeApp as initializeApp$1 } from 'firebase/app';
19
+ import { getFirestore } from 'firebase/firestore';
16
20
 
17
21
  class AuthService {
18
22
  constructor(angularFireAuth, userRepository) {
@@ -27,7 +31,7 @@ class AuthService {
27
31
  })));
28
32
  }
29
33
  getUser() {
30
- return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? this.userRepository.get({ id }) : of(null))), catchError(() => of(null)));
34
+ return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? from(this.userRepository.get({ id })).pipe(catchError(() => of(null))) : of(null))));
31
35
  }
32
36
  getTokenId() {
33
37
  return from(getIdToken(this.angularFireAuth.currentUser));
@@ -47,6 +51,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
47
51
  }] }];
48
52
  } });
49
53
 
54
+ const BACKEND_URL = 'BACKEND_URL';
55
+
50
56
  const DEFAULT_SHOP = 'DEFAULT_SHOP';
51
57
 
52
58
  const ES_CONFIG = 'ES_CONFIG';
@@ -70,11 +76,10 @@ class GroupInvalidCouponError extends CustomError {
70
76
  }
71
77
 
72
78
  class CouponService {
73
- constructor(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
79
+ constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
74
80
  this.couponRepository = couponRepository;
75
81
  this.defaultShop = defaultShop;
76
82
  this.orderRepository = orderRepository;
77
- this.subscriptionRepository = subscriptionRepository;
78
83
  this.categoryRepository = categoryRepository;
79
84
  this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
80
85
  }
@@ -115,7 +120,7 @@ class CouponService {
115
120
  const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
116
121
  // Se não tem valor mínimo atingido, retorna erro
117
122
  if (!hasMinSubTotal)
118
- return throwError('Valor mínimo não atingido');
123
+ return throwError(`Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`);
119
124
  return of(coupon);
120
125
  }
121
126
  isValidCoupon(coupon, userEmail) {
@@ -143,7 +148,7 @@ class CouponService {
143
148
  // Verifica o limite de uso geral por usuario
144
149
  if (coupon.useLimit && orders.data.length >= coupon.useLimit)
145
150
  throw new InvalidCouponError('Limite de uso atingido.');
146
- const validUser = yield this.userValidationAndSubscriptionStatus(coupon, userEmail);
151
+ const validUser = this.userValidationAndSubscriptionStatus(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
147
152
  if (!validUser)
148
153
  throw new InvalidCouponError('Usuário não elegível.');
149
154
  const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
@@ -237,41 +242,26 @@ class CouponService {
237
242
  return hasCategories.length ? true : false;
238
243
  });
239
244
  }
240
- userValidationAndSubscriptionStatus(coupon, userEmail) {
241
- return __awaiter(this, void 0, void 0, function* () {
242
- // Verifica se o email do usuário é coorporativo
243
- if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
244
- throw new InvalidCouponError('Você não é colaborador.');
245
- // Verifica se o email do usuário é associado ao cupom de uso por usuario
246
- if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
247
- throw new InvalidCouponError('Cupom não é válido para este usuário.');
248
- const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
249
- coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
250
- coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
251
- if (couponRuleSubscription && userEmail) {
252
- const sub = yield this.subscriptionRepository
253
- .find({
254
- filters: {
255
- user: {
256
- email: { operator: Where.EQUALS, value: userEmail },
257
- },
258
- },
259
- })
260
- .then((sub) => sub.data);
261
- const activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter((s) => s.status === Status.ACTIVE);
262
- switch (coupon.exclusivityType) {
263
- case Exclusivities.ACTIVE_SUBSCRIBER:
264
- return activeSubs.length > 0;
265
- case Exclusivities.INACTIVE_SUBSCRIBER:
266
- return activeSubs.length === 0;
267
- case Exclusivities.NON_SUBSCRIBER:
268
- return sub.length === 0;
269
- default:
270
- return false;
271
- }
272
- }
245
+ userValidationAndSubscriptionStatus(coupon, user) {
246
+ if (coupon.exclusivityType === Exclusivities.ALL_USERS)
273
247
  return true;
274
- });
248
+ if (!user)
249
+ return true;
250
+ // Verifica se o email do usuário é coorporativo
251
+ if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
252
+ throw new InvalidCouponError('Você não é colaborador.');
253
+ // Verifica se o email do usuário é associado ao cupom de uso por usuario
254
+ if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
255
+ throw new InvalidCouponError('Cupom não é válido para este usuário.');
256
+ switch (coupon.exclusivityType) {
257
+ case Exclusivities.ACTIVE_SUBSCRIBER:
258
+ return user.isSubscriber ? true : false;
259
+ case Exclusivities.INACTIVE_SUBSCRIBER:
260
+ return user.isSubscriber ? false : true;
261
+ case Exclusivities.NON_SUBSCRIBER:
262
+ return user.isSubscriber ? false : true;
263
+ }
264
+ return true;
275
265
  }
276
266
  getCouponCategoriesId(coupon) {
277
267
  return __awaiter(this, void 0, void 0, function* () {
@@ -286,7 +276,7 @@ class CouponService {
286
276
  });
287
277
  }
288
278
  }
289
- CouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'SubscriptionRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
279
+ CouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
290
280
  CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
291
281
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
292
282
  type: Injectable,
@@ -297,15 +287,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
297
287
  return [{ type: undefined, decorators: [{
298
288
  type: Inject,
299
289
  args: ['CouponRepository']
300
- }] }, { type: i2.Shops, decorators: [{
290
+ }] }, { type: i3.Shops, decorators: [{
301
291
  type: Inject,
302
292
  args: [DEFAULT_SHOP]
303
293
  }] }, { type: undefined, decorators: [{
304
294
  type: Inject,
305
295
  args: ['OrderRepository']
306
- }] }, { type: undefined, decorators: [{
307
- type: Inject,
308
- args: ['SubscriptionRepository']
309
296
  }] }, { type: undefined, decorators: [{
310
297
  type: Inject,
311
298
  args: ['CategoryRepository']
@@ -372,23 +359,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
372
359
  }] }, { type: undefined, decorators: [{
373
360
  type: Inject,
374
361
  args: ['UserRepository']
375
- }] }, { type: i2.Shops, decorators: [{
362
+ }] }, { type: i3.Shops, decorators: [{
376
363
  type: Inject,
377
364
  args: [DEFAULT_SHOP]
378
365
  }] }];
379
366
  } });
380
367
 
381
368
  class CartService {
382
- constructor(authService, checkoutService, defaultShop, productRepository) {
369
+ constructor(authService, checkoutService, defaultShop, productRepository, variantRepository, buy2WinRepository) {
383
370
  this.authService = authService;
384
371
  this.checkoutService = checkoutService;
385
372
  this.defaultShop = defaultShop;
386
373
  this.productRepository = productRepository;
374
+ this.variantRepository = variantRepository;
375
+ this.buy2WinRepository = buy2WinRepository;
387
376
  this.cartSubject = new Subject();
388
377
  this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
389
378
  var _a;
390
379
  const items = [];
391
- const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
380
+ const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
392
381
  if (index > -1) {
393
382
  checkoutLoaded.lineItems[index].quantity += quantity;
394
383
  checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
@@ -399,22 +388,18 @@ class CartService {
399
388
  .updateCheckoutLineItems(checkoutLoaded)
400
389
  .pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
401
390
  }));
402
- this.generateCartObject = (items) => {
403
- const cart = {};
404
- items === null || items === void 0 ? void 0 : items.forEach((item) => {
405
- var _a;
406
- return (cart[item.sku] = LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
407
- });
408
- return cart;
409
- };
391
+ this.generateCartObject = (items) => (items === null || items === void 0 ? void 0 : items.reduce((cart, item) => {
392
+ var _a;
393
+ return (Object.assign(Object.assign({}, cart), { [item.id]: LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.id] || item)), { quantity: (((_a = cart[item.id]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })) }));
394
+ }, {})) || {};
410
395
  this.buildLineItem = ({ checkout, item, quantity, }) => __awaiter(this, void 0, void 0, function* () {
411
396
  var _a, _b, _c, _d, _e, _f, _g;
412
- const product = yield this.productRepository.get({ id: item.id });
413
- item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
397
+ const product = yield this.getProductData(item.id);
398
+ item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.id === item.id)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
414
399
  if (this.checkMaxStock(item, quantity || 0))
415
400
  throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
416
401
  const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
417
- const { id, name, EAN, brand, slug, stock, price, weight, categories, sku, type } = item;
402
+ const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
418
403
  const isGift = item.isGift || null;
419
404
  const pricePaid = this.getProductPrice({
420
405
  product: item,
@@ -462,7 +447,7 @@ class CartService {
462
447
  decreaseItem(item) {
463
448
  return this.checkoutService.getCheckout().pipe(map((checkout) => {
464
449
  var _a;
465
- const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
450
+ const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.id === item.id);
466
451
  if (!isNil(checkoutItem))
467
452
  checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
468
453
  return checkout;
@@ -480,7 +465,7 @@ class CartService {
480
465
  }
481
466
  removeItem(item) {
482
467
  return this.checkoutService.getCheckout().pipe(map((checkout) => {
483
- const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
468
+ const index = checkout.lineItems.findIndex((lineItem) => lineItem.id === item.id);
484
469
  if (index >= 0)
485
470
  checkout.lineItems.splice(index, 1);
486
471
  return checkout;
@@ -489,8 +474,12 @@ class CartService {
489
474
  updateUserCart(user) {
490
475
  return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => __awaiter(this, void 0, void 0, function* () {
491
476
  var _a, _b;
492
- return this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length) ? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; }))) : [] }))).toPromise();
493
- })), map(checkout => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
477
+ return this.checkoutService
478
+ .updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)
479
+ ? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; })))
480
+ : [] })))
481
+ .toPromise();
482
+ })), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
494
483
  }
495
484
  clearCart() {
496
485
  return this.checkoutService.getCheckout().pipe(map((checkout) => {
@@ -501,18 +490,127 @@ class CartService {
501
490
  buildCartFromCheckout(checkoutData) {
502
491
  return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
503
492
  }
493
+ getProductData(productId) {
494
+ return __awaiter(this, void 0, void 0, function* () {
495
+ let product;
496
+ let variant;
497
+ try {
498
+ product = yield this.productRepository.get({ id: productId });
499
+ }
500
+ catch (error) {
501
+ if (!(error instanceof NotFoundError))
502
+ throw error;
503
+ variant = yield this.variantRepository.get({ id: productId });
504
+ product = yield this.productRepository.get({ id: variant.productId });
505
+ }
506
+ return Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())));
507
+ });
508
+ }
509
+ getGifts() {
510
+ return this.checkoutService.getCheckout().pipe(mergeMap((checkout) => __awaiter(this, void 0, void 0, function* () {
511
+ const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
512
+ if (!notGiftItems.length)
513
+ return Object.assign(Object.assign({}, checkout), { lineItems: [] });
514
+ const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
515
+ const campaigns = yield this.buy2WinRepository
516
+ .find({
517
+ filters: {
518
+ active: { operator: Where.EQUALS, value: true },
519
+ shop: { operator: Where.EQUALS, value: this.defaultShop },
520
+ },
521
+ })
522
+ .then((data) => data.data);
523
+ if (!campaigns.length)
524
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
525
+ const elegibleCampaigns = [];
526
+ for (const campaign of campaigns) {
527
+ const today = new Date();
528
+ if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
529
+ continue;
530
+ if (campaign.activeCategory) {
531
+ const categoriesCampaing = campaign.categories.map((c) => c.id);
532
+ const filterProductsCategories = checkout.lineItems.filter((l) => {
533
+ var _a;
534
+ if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
535
+ return true;
536
+ return l.categories.some((c) => categoriesCampaing.some((cat) => cat == c));
537
+ });
538
+ if (filterProductsCategories.length) {
539
+ const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
540
+ if (cartTotalCategories >= campaign.cartValueMin)
541
+ elegibleCampaigns.push(campaign);
542
+ }
543
+ }
544
+ else {
545
+ if (campaign.cartValue && campaign.cartValue > 0) {
546
+ if (campaign.cartValue <= cartTotal)
547
+ elegibleCampaigns.push(campaign);
548
+ }
549
+ }
550
+ }
551
+ if (!elegibleCampaigns.length)
552
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
553
+ const campaingnProducts = [];
554
+ for (const campaign of elegibleCampaigns) {
555
+ let elegibleProducts = [];
556
+ for (const product of campaign.products) {
557
+ const { data: productData } = yield this.productRepository.find({ filters: { sku: product } });
558
+ if (!productData.length)
559
+ continue;
560
+ const gift = productData.shift();
561
+ if (gift.stock.quantity < 1)
562
+ continue;
563
+ elegibleProducts.push(gift);
564
+ }
565
+ campaingnProducts.push(elegibleProducts);
566
+ }
567
+ if (!campaingnProducts.length)
568
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
569
+ const gifts = this.giftToLineItems([].concat(...campaingnProducts));
570
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) });
571
+ })), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
572
+ }
573
+ giftToLineItems(items) {
574
+ return items.map((item) => {
575
+ var _a;
576
+ const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
577
+ const image = ((_a = item === null || item === void 0 ? void 0 : item.miniatures) === null || _a === void 0 ? void 0 : _a.length) ? item.miniatures[0] : item.images[0];
578
+ return LineItem.toInstance({
579
+ brand,
580
+ categories,
581
+ id: id.toString(),
582
+ name,
583
+ price,
584
+ sku,
585
+ slug,
586
+ stock,
587
+ weight,
588
+ EAN,
589
+ image,
590
+ pricePaid: 0,
591
+ quantity: 1,
592
+ isGift: true,
593
+ });
594
+ });
595
+ }
504
596
  }
505
- CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
597
+ CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
506
598
  CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
507
599
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
508
600
  type: Injectable
509
601
  }], ctorParameters: function () {
510
- return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
602
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i3.Shops, decorators: [{
511
603
  type: Inject,
512
604
  args: [DEFAULT_SHOP]
513
605
  }] }, { type: undefined, decorators: [{
514
606
  type: Inject,
515
607
  args: ['ProductRepository']
608
+ }] }, { type: undefined, decorators: [{
609
+ type: Inject,
610
+ args: ['VariantRepository']
611
+ }] }, { type: i3.Buy2WinFirestoreRepository, decorators: [{
612
+ type: Inject,
613
+ args: ['Buy2WinRepository']
516
614
  }] }];
517
615
  } });
518
616
 
@@ -540,7 +638,9 @@ class CheckoutSubscriptionService {
540
638
  return of();
541
639
  }
542
640
  checkCoupon(nickname, userEmail) {
543
- return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe()));
641
+ return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
642
+ .checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
643
+ .pipe()));
544
644
  }
545
645
  calcDiscountSubscription(coupon) {
546
646
  return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
@@ -560,30 +660,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
560
660
  }] }, { type: CouponService }];
561
661
  } });
562
662
 
563
- class OrderService {
564
- constructor(angularFirestore, orderRepository) {
565
- this.angularFirestore = angularFirestore;
566
- this.orderRepository = orderRepository;
567
- this.orderSubject = new Subject();
568
- }
569
- getOrder(id) {
570
- docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
571
- .pipe(map((doc) => Order.toInstance(doc.data())))
572
- .subscribe((doc) => this.orderSubject.next(doc));
573
- return this.orderSubject;
574
- }
575
- }
576
- OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
577
- OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
579
- type: Injectable
580
- }], ctorParameters: function () {
581
- return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
582
- type: Inject,
583
- args: ['OrderRepository']
584
- }] }];
585
- } });
586
-
587
663
  class HomeShopService {
588
664
  constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
589
665
  this.categoryRepository = categoryRepository;
@@ -690,12 +766,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
690
766
  }] }, { type: undefined, decorators: [{
691
767
  type: Inject,
692
768
  args: ['ProductRepository']
693
- }] }, { type: i2.Shops, decorators: [{
769
+ }] }, { type: i3.Shops, decorators: [{
694
770
  type: Inject,
695
771
  args: [DEFAULT_SHOP]
696
772
  }] }];
697
773
  } });
698
774
 
775
+ class OrderService {
776
+ constructor(angularFirestore, orderRepository) {
777
+ this.angularFirestore = angularFirestore;
778
+ this.orderRepository = orderRepository;
779
+ this.orderSubject = new Subject();
780
+ }
781
+ getOrder(id) {
782
+ docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
783
+ .pipe(map((doc) => Order.toInstance(doc.data())))
784
+ .subscribe((doc) => this.orderSubject.next(doc));
785
+ return this.orderSubject;
786
+ }
787
+ }
788
+ OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
789
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
790
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
791
+ type: Injectable
792
+ }], ctorParameters: function () {
793
+ return [{ type: i1$1.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
794
+ type: Inject,
795
+ args: ['OrderRepository']
796
+ }] }];
797
+ } });
798
+
799
+ class ShippingService {
800
+ constructor(http, apiUrl, homeService) {
801
+ this.http = http;
802
+ this.apiUrl = apiUrl;
803
+ this.homeService = homeService;
804
+ }
805
+ getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
806
+ return combineLatest([
807
+ this.homeService.getHomeData(),
808
+ this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
809
+ ]).pipe(map(([datas, shippingMethodsResponse]) => {
810
+ let shippingMethods = shippingMethodsResponse.result;
811
+ if (!shippingMethods.length)
812
+ return [];
813
+ shippingMethods = shippingMethods.map((shippingMethod) => {
814
+ if (shippingMethod.ShippingCompanyName == 'Same Day EG')
815
+ shippingMethod.ShippingCompanyName = 'Same Day';
816
+ return shippingMethod;
817
+ });
818
+ const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
819
+ if (this.isHolidays(datasSameDayNotAvaliable)) {
820
+ shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
821
+ }
822
+ if (totalPrice >= 200) {
823
+ shippingMethods = shippingMethods.map((s) => {
824
+ if (s.serviceName !== 'Same Day')
825
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
826
+ else
827
+ return s;
828
+ });
829
+ }
830
+ if (shop == Shops.GLAMSHOP)
831
+ return shippingMethods;
832
+ if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
833
+ shippingMethods = shippingMethods.map((s) => {
834
+ if (s.serviceName == 'Same Day')
835
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
836
+ else
837
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
838
+ });
839
+ }
840
+ if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
841
+ shippingMethods = shippingMethods.map((s) => {
842
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
843
+ });
844
+ }
845
+ return shippingMethods;
846
+ }));
847
+ }
848
+ isFreeShippingBySubscription(shop, subscriptionPlan) {
849
+ if (!subscriptionPlan)
850
+ return false;
851
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
852
+ return true;
853
+ return false;
854
+ }
855
+ isHalfShippingBySubscription(shop, subscriptionPlan) {
856
+ if (!subscriptionPlan)
857
+ return false;
858
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
859
+ return true;
860
+ }
861
+ return false;
862
+ }
863
+ isHolidays(datas) {
864
+ const today = new Date();
865
+ for (const key in datas) {
866
+ let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
867
+ let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
868
+ if (start > end)
869
+ end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
870
+ if (today >= start && today <= end)
871
+ return true;
872
+ }
873
+ return false;
874
+ }
875
+ }
876
+ ShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, deps: [{ token: i1$2.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0.ɵɵFactoryTarget.Injectable });
877
+ ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
878
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
879
+ type: Injectable
880
+ }], ctorParameters: function () {
881
+ return [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
882
+ type: Inject,
883
+ args: [BACKEND_URL]
884
+ }] }, { type: HomeShopService }];
885
+ } });
886
+
699
887
  class AngularFirebaseAuthModule {
700
888
  static initializeApp(options, nameOrConfig) {
701
889
  return {
@@ -708,7 +896,7 @@ class AngularFirebaseAuthModule {
708
896
  }
709
897
  }
710
898
  AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
711
- AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
899
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$3.FirebaseAppModule, i1.AuthModule] });
712
900
  AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
713
901
  {
714
902
  provide: 'Authentication',
@@ -831,9 +1019,7 @@ AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0
831
1019
  AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
832
1020
  {
833
1021
  provide: ProductsIndex,
834
- useFactory: (configuration) => {
835
- return new ProductsIndex(new AxiosAdapter(configuration));
836
- },
1022
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
837
1023
  deps: [ES_CONFIG],
838
1024
  },
839
1025
  ] });
@@ -843,9 +1029,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
843
1029
  providers: [
844
1030
  {
845
1031
  provide: ProductsIndex,
846
- useFactory: (configuration) => {
847
- return new ProductsIndex(new AxiosAdapter(configuration));
848
- },
1032
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
849
1033
  deps: [ES_CONFIG],
850
1034
  },
851
1035
  ],
@@ -865,168 +1049,211 @@ class AngularFirestoreModule {
865
1049
  }
866
1050
  }
867
1051
  AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
868
- AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
1052
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$3.FirebaseAppModule, i1$1.FirestoreModule] });
869
1053
  AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
1054
+ {
1055
+ provide: 'FirestoreOptions',
1056
+ useFactory: (firestore, platformId) => ({
1057
+ firestore,
1058
+ interceptors: {
1059
+ request: (request) => {
1060
+ if (isPlatformBrowser(platformId))
1061
+ return request;
1062
+ const interval = setInterval(() => { }, 100);
1063
+ request.interval = interval;
1064
+ return request;
1065
+ },
1066
+ response: (response, request) => {
1067
+ if (isPlatformBrowser(platformId))
1068
+ return response;
1069
+ clearInterval(request.interval);
1070
+ return response;
1071
+ },
1072
+ },
1073
+ }),
1074
+ deps: [Firestore, PLATFORM_ID],
1075
+ },
870
1076
  {
871
1077
  provide: 'BeautyProfileRepository',
872
- useFactory: (firestore, userRepository) => {
873
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
1078
+ useFactory: (config, userRepository) => {
1079
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
874
1080
  },
875
- deps: [Firestore, 'UserRepository'],
1081
+ deps: ['FirestoreOptions', 'UserRepository'],
876
1082
  },
877
1083
  {
878
1084
  provide: 'Buy2WinRepository',
879
- useFactory: (firestore) => {
880
- return new Buy2WinFirestoreRepository(firestore);
1085
+ useFactory: (options) => {
1086
+ return new Buy2WinFirestoreRepository(options);
881
1087
  },
882
- deps: [Firestore],
1088
+ deps: ['FirestoreOptions'],
883
1089
  },
884
1090
  {
885
1091
  provide: CategoryFirestoreRepository,
886
- useFactory: (firestore) => {
887
- return new CategoryFirestoreRepository(firestore);
1092
+ useFactory: (options) => {
1093
+ return new CategoryFirestoreRepository(options);
888
1094
  },
889
- deps: [Firestore],
1095
+ deps: ['FirestoreOptions'],
890
1096
  },
891
1097
  {
892
1098
  provide: 'CheckoutRepository',
893
- useFactory: (firestore) => {
894
- return new CheckoutFirestoreRepository(firestore);
1099
+ useFactory: (options) => {
1100
+ return new CheckoutFirestoreRepository(options);
895
1101
  },
896
- deps: [Firestore],
1102
+ deps: ['FirestoreOptions'],
897
1103
  },
898
1104
  {
899
1105
  provide: 'CheckoutSubscriptionRepository',
900
- useFactory: (firestore) => {
901
- return new CheckoutSubscriptionFirestoreRepository(firestore);
1106
+ useFactory: (options) => {
1107
+ return new CheckoutSubscriptionFirestoreRepository(options);
902
1108
  },
903
- deps: [Firestore],
1109
+ deps: ['FirestoreOptions'],
904
1110
  },
905
1111
  {
906
1112
  provide: 'CouponRepository',
907
- useFactory: (firestore) => {
908
- return new CouponFirestoreRepository(firestore);
1113
+ useFactory: (options) => {
1114
+ return new CouponFirestoreRepository(options);
909
1115
  },
910
- deps: [Firestore],
1116
+ deps: ['FirestoreOptions'],
1117
+ },
1118
+ {
1119
+ provide: 'CampaignHashtagRepository',
1120
+ useFactory: (options) => {
1121
+ return new CampaignHashtagFirestoreRepository(options);
1122
+ },
1123
+ deps: ['FirestoreOptions'],
1124
+ },
1125
+ {
1126
+ provide: 'CampaignDashboardRepository',
1127
+ useFactory: (options) => {
1128
+ return new CampaignDashboardFirestoreRepository(options);
1129
+ },
1130
+ deps: ['FirestoreOptions'],
911
1131
  },
912
1132
  {
913
1133
  provide: 'EditionRepository',
914
- useFactory: (firestore, subscriptionRepository) => {
915
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1134
+ useFactory: (options, subscriptionRepository) => {
1135
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
916
1136
  },
917
- deps: [Firestore, 'SubscriptionRepository'],
1137
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
918
1138
  },
919
1139
  {
920
1140
  provide: 'HomeRepository',
921
- useFactory: (firestore) => {
922
- return new HomeFirestoreRepository(firestore);
1141
+ useFactory: (options) => {
1142
+ return new HomeFirestoreRepository(options);
923
1143
  },
924
- deps: [Firestore],
1144
+ deps: ['FirestoreOptions'],
925
1145
  },
926
1146
  {
927
1147
  provide: 'LeadRepository',
928
- useFactory: (firestore) => {
929
- return new LeadFirestoreRepository(firestore);
1148
+ useFactory: (options) => {
1149
+ return new LeadFirestoreRepository(options);
930
1150
  },
931
- deps: [Firestore],
1151
+ deps: ['FirestoreOptions'],
932
1152
  },
933
1153
  {
934
1154
  provide: 'LegacyOrderRepository',
935
- useFactory: (firestore) => {
936
- return new LegacyOrderFirestoreRepository(firestore);
1155
+ useFactory: (options) => {
1156
+ return new LegacyOrderFirestoreRepository(options);
937
1157
  },
938
- deps: [Firestore],
1158
+ deps: ['FirestoreOptions'],
939
1159
  },
940
1160
  {
941
1161
  provide: 'ShopMenuRepository',
942
- useFactory: (firestore) => {
943
- return new ShopMenuFirestoreRepository(firestore);
1162
+ useFactory: (options) => {
1163
+ return new ShopMenuFirestoreRepository(options);
944
1164
  },
945
- deps: [Firestore],
1165
+ deps: ['FirestoreOptions'],
946
1166
  },
947
1167
  {
948
1168
  provide: 'OrderRepository',
949
- useFactory: (firestore) => {
950
- return new OrderFirestoreRepository(firestore);
1169
+ useFactory: (options) => {
1170
+ return new OrderFirestoreRepository(options);
951
1171
  },
952
- deps: [Firestore],
1172
+ deps: ['FirestoreOptions'],
953
1173
  },
954
1174
  {
955
1175
  provide: 'PaymentRepository',
956
- useFactory: (firestore) => {
957
- return new PaymentFirestoreRepository(firestore);
1176
+ useFactory: (options) => {
1177
+ return new PaymentFirestoreRepository(options);
958
1178
  },
959
- deps: [Firestore],
1179
+ deps: ['FirestoreOptions'],
960
1180
  },
961
1181
  {
962
1182
  provide: ProductFirestoreRepository,
963
- useFactory: (firestore) => {
964
- return new ProductFirestoreRepository(firestore);
1183
+ useFactory: (options) => {
1184
+ return new ProductFirestoreRepository(options);
1185
+ },
1186
+ deps: ['FirestoreOptions'],
1187
+ },
1188
+ {
1189
+ provide: 'ShopSettingsRepository',
1190
+ useFactory: (options) => {
1191
+ return new ShopSettingsFirestoreRepository(options);
965
1192
  },
966
- deps: [Firestore],
1193
+ deps: ['FirestoreOptions'],
967
1194
  },
968
1195
  {
969
1196
  provide: 'SubscriptionPaymentRepository',
970
- useFactory: (firestore, subscriptionRepository) => {
971
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1197
+ useFactory: (options, subscriptionRepository) => {
1198
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
972
1199
  },
973
- deps: [Firestore, 'SubscriptionRepository'],
1200
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
974
1201
  },
975
1202
  {
976
1203
  provide: 'SubscriptionPlanRepository',
977
- useFactory: (firestore) => {
978
- return new SubscriptionPlanFirestoreRepository(firestore);
1204
+ useFactory: (options) => {
1205
+ return new SubscriptionPlanFirestoreRepository(options);
979
1206
  },
980
- deps: [Firestore],
1207
+ deps: ['FirestoreOptions'],
981
1208
  },
982
1209
  {
983
1210
  provide: 'SubscriptionProductRepository',
984
- useFactory: (firestore) => {
985
- return new SubscriptionProductFirestoreRepository(firestore);
1211
+ useFactory: (options) => {
1212
+ return new SubscriptionProductFirestoreRepository(options);
986
1213
  },
987
- deps: [Firestore],
1214
+ deps: ['FirestoreOptions'],
988
1215
  },
989
1216
  {
990
1217
  provide: 'SubscriptionRepository',
991
- useFactory: (firestore) => {
992
- return new SubscriptionFirestoreRepository(firestore);
1218
+ useFactory: (options) => {
1219
+ return new SubscriptionFirestoreRepository(options);
993
1220
  },
994
- deps: [Firestore],
1221
+ deps: ['FirestoreOptions'],
995
1222
  },
996
1223
  {
997
1224
  provide: 'UserRepository',
998
- useFactory: (firestore) => {
999
- return new UserFirestoreRepository(firestore);
1225
+ useFactory: (options) => {
1226
+ return new UserFirestoreRepository(options);
1000
1227
  },
1001
- deps: [Firestore],
1228
+ deps: ['FirestoreOptions'],
1002
1229
  },
1003
1230
  {
1004
1231
  provide: 'UserAddressRepository',
1005
- useFactory: (firestore, userRepository) => {
1006
- return new UserAddressFirestoreRepository(firestore, userRepository);
1232
+ useFactory: (options, userRepository) => {
1233
+ return new UserAddressFirestoreRepository(options, userRepository);
1007
1234
  },
1008
- deps: [Firestore, 'UserRepository'],
1235
+ deps: ['FirestoreOptions', 'UserRepository'],
1009
1236
  },
1010
1237
  {
1011
1238
  provide: 'UserPaymentMethodRepository',
1012
- useFactory: (firestore, userRepository) => {
1013
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1239
+ useFactory: (options, userRepository) => {
1240
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
1014
1241
  },
1015
- deps: [Firestore, 'UserRepository'],
1242
+ deps: ['FirestoreOptions', 'UserRepository'],
1016
1243
  },
1017
1244
  {
1018
1245
  provide: ProductVariantFirestoreRepository,
1019
- useFactory: (firestore, productRepository) => {
1020
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1246
+ useFactory: (options, productRepository) => {
1247
+ return new ProductVariantFirestoreRepository(options, productRepository);
1021
1248
  },
1022
- deps: [Firestore, ProductFirestoreRepository],
1249
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
1023
1250
  },
1024
1251
  ], imports: [AngularElasticSeachModule,
1025
1252
  provideFirebaseApp((injector) => {
1026
1253
  const appName = injector.get(FIREBASE_APP_NAME);
1027
1254
  return appName
1028
- ? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
1029
- : initializeApp(injector.get(FIREBASE_OPTIONS));
1255
+ ? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
1256
+ : initializeApp$1(injector.get(FIREBASE_OPTIONS));
1030
1257
  }),
1031
1258
  provideFirestore(() => getFirestore())] });
1032
1259
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
@@ -1037,165 +1264,208 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1037
1264
  provideFirebaseApp((injector) => {
1038
1265
  const appName = injector.get(FIREBASE_APP_NAME);
1039
1266
  return appName
1040
- ? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
1041
- : initializeApp(injector.get(FIREBASE_OPTIONS));
1267
+ ? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
1268
+ : initializeApp$1(injector.get(FIREBASE_OPTIONS));
1042
1269
  }),
1043
1270
  provideFirestore(() => getFirestore()),
1044
1271
  ],
1045
1272
  providers: [
1273
+ {
1274
+ provide: 'FirestoreOptions',
1275
+ useFactory: (firestore, platformId) => ({
1276
+ firestore,
1277
+ interceptors: {
1278
+ request: (request) => {
1279
+ if (isPlatformBrowser(platformId))
1280
+ return request;
1281
+ const interval = setInterval(() => { }, 100);
1282
+ request.interval = interval;
1283
+ return request;
1284
+ },
1285
+ response: (response, request) => {
1286
+ if (isPlatformBrowser(platformId))
1287
+ return response;
1288
+ clearInterval(request.interval);
1289
+ return response;
1290
+ },
1291
+ },
1292
+ }),
1293
+ deps: [Firestore, PLATFORM_ID],
1294
+ },
1046
1295
  {
1047
1296
  provide: 'BeautyProfileRepository',
1048
- useFactory: (firestore, userRepository) => {
1049
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
1297
+ useFactory: (config, userRepository) => {
1298
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
1050
1299
  },
1051
- deps: [Firestore, 'UserRepository'],
1300
+ deps: ['FirestoreOptions', 'UserRepository'],
1052
1301
  },
1053
1302
  {
1054
1303
  provide: 'Buy2WinRepository',
1055
- useFactory: (firestore) => {
1056
- return new Buy2WinFirestoreRepository(firestore);
1304
+ useFactory: (options) => {
1305
+ return new Buy2WinFirestoreRepository(options);
1057
1306
  },
1058
- deps: [Firestore],
1307
+ deps: ['FirestoreOptions'],
1059
1308
  },
1060
1309
  {
1061
1310
  provide: CategoryFirestoreRepository,
1062
- useFactory: (firestore) => {
1063
- return new CategoryFirestoreRepository(firestore);
1311
+ useFactory: (options) => {
1312
+ return new CategoryFirestoreRepository(options);
1064
1313
  },
1065
- deps: [Firestore],
1314
+ deps: ['FirestoreOptions'],
1066
1315
  },
1067
1316
  {
1068
1317
  provide: 'CheckoutRepository',
1069
- useFactory: (firestore) => {
1070
- return new CheckoutFirestoreRepository(firestore);
1318
+ useFactory: (options) => {
1319
+ return new CheckoutFirestoreRepository(options);
1071
1320
  },
1072
- deps: [Firestore],
1321
+ deps: ['FirestoreOptions'],
1073
1322
  },
1074
1323
  {
1075
1324
  provide: 'CheckoutSubscriptionRepository',
1076
- useFactory: (firestore) => {
1077
- return new CheckoutSubscriptionFirestoreRepository(firestore);
1325
+ useFactory: (options) => {
1326
+ return new CheckoutSubscriptionFirestoreRepository(options);
1078
1327
  },
1079
- deps: [Firestore],
1328
+ deps: ['FirestoreOptions'],
1080
1329
  },
1081
1330
  {
1082
1331
  provide: 'CouponRepository',
1083
- useFactory: (firestore) => {
1084
- return new CouponFirestoreRepository(firestore);
1332
+ useFactory: (options) => {
1333
+ return new CouponFirestoreRepository(options);
1085
1334
  },
1086
- deps: [Firestore],
1335
+ deps: ['FirestoreOptions'],
1336
+ },
1337
+ {
1338
+ provide: 'CampaignHashtagRepository',
1339
+ useFactory: (options) => {
1340
+ return new CampaignHashtagFirestoreRepository(options);
1341
+ },
1342
+ deps: ['FirestoreOptions'],
1343
+ },
1344
+ {
1345
+ provide: 'CampaignDashboardRepository',
1346
+ useFactory: (options) => {
1347
+ return new CampaignDashboardFirestoreRepository(options);
1348
+ },
1349
+ deps: ['FirestoreOptions'],
1087
1350
  },
1088
1351
  {
1089
1352
  provide: 'EditionRepository',
1090
- useFactory: (firestore, subscriptionRepository) => {
1091
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1353
+ useFactory: (options, subscriptionRepository) => {
1354
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
1092
1355
  },
1093
- deps: [Firestore, 'SubscriptionRepository'],
1356
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
1094
1357
  },
1095
1358
  {
1096
1359
  provide: 'HomeRepository',
1097
- useFactory: (firestore) => {
1098
- return new HomeFirestoreRepository(firestore);
1360
+ useFactory: (options) => {
1361
+ return new HomeFirestoreRepository(options);
1099
1362
  },
1100
- deps: [Firestore],
1363
+ deps: ['FirestoreOptions'],
1101
1364
  },
1102
1365
  {
1103
1366
  provide: 'LeadRepository',
1104
- useFactory: (firestore) => {
1105
- return new LeadFirestoreRepository(firestore);
1367
+ useFactory: (options) => {
1368
+ return new LeadFirestoreRepository(options);
1106
1369
  },
1107
- deps: [Firestore],
1370
+ deps: ['FirestoreOptions'],
1108
1371
  },
1109
1372
  {
1110
1373
  provide: 'LegacyOrderRepository',
1111
- useFactory: (firestore) => {
1112
- return new LegacyOrderFirestoreRepository(firestore);
1374
+ useFactory: (options) => {
1375
+ return new LegacyOrderFirestoreRepository(options);
1113
1376
  },
1114
- deps: [Firestore],
1377
+ deps: ['FirestoreOptions'],
1115
1378
  },
1116
1379
  {
1117
1380
  provide: 'ShopMenuRepository',
1118
- useFactory: (firestore) => {
1119
- return new ShopMenuFirestoreRepository(firestore);
1381
+ useFactory: (options) => {
1382
+ return new ShopMenuFirestoreRepository(options);
1120
1383
  },
1121
- deps: [Firestore],
1384
+ deps: ['FirestoreOptions'],
1122
1385
  },
1123
1386
  {
1124
1387
  provide: 'OrderRepository',
1125
- useFactory: (firestore) => {
1126
- return new OrderFirestoreRepository(firestore);
1388
+ useFactory: (options) => {
1389
+ return new OrderFirestoreRepository(options);
1127
1390
  },
1128
- deps: [Firestore],
1391
+ deps: ['FirestoreOptions'],
1129
1392
  },
1130
1393
  {
1131
1394
  provide: 'PaymentRepository',
1132
- useFactory: (firestore) => {
1133
- return new PaymentFirestoreRepository(firestore);
1395
+ useFactory: (options) => {
1396
+ return new PaymentFirestoreRepository(options);
1134
1397
  },
1135
- deps: [Firestore],
1398
+ deps: ['FirestoreOptions'],
1136
1399
  },
1137
1400
  {
1138
1401
  provide: ProductFirestoreRepository,
1139
- useFactory: (firestore) => {
1140
- return new ProductFirestoreRepository(firestore);
1402
+ useFactory: (options) => {
1403
+ return new ProductFirestoreRepository(options);
1141
1404
  },
1142
- deps: [Firestore],
1405
+ deps: ['FirestoreOptions'],
1406
+ },
1407
+ {
1408
+ provide: 'ShopSettingsRepository',
1409
+ useFactory: (options) => {
1410
+ return new ShopSettingsFirestoreRepository(options);
1411
+ },
1412
+ deps: ['FirestoreOptions'],
1143
1413
  },
1144
1414
  {
1145
1415
  provide: 'SubscriptionPaymentRepository',
1146
- useFactory: (firestore, subscriptionRepository) => {
1147
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1416
+ useFactory: (options, subscriptionRepository) => {
1417
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
1148
1418
  },
1149
- deps: [Firestore, 'SubscriptionRepository'],
1419
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
1150
1420
  },
1151
1421
  {
1152
1422
  provide: 'SubscriptionPlanRepository',
1153
- useFactory: (firestore) => {
1154
- return new SubscriptionPlanFirestoreRepository(firestore);
1423
+ useFactory: (options) => {
1424
+ return new SubscriptionPlanFirestoreRepository(options);
1155
1425
  },
1156
- deps: [Firestore],
1426
+ deps: ['FirestoreOptions'],
1157
1427
  },
1158
1428
  {
1159
1429
  provide: 'SubscriptionProductRepository',
1160
- useFactory: (firestore) => {
1161
- return new SubscriptionProductFirestoreRepository(firestore);
1430
+ useFactory: (options) => {
1431
+ return new SubscriptionProductFirestoreRepository(options);
1162
1432
  },
1163
- deps: [Firestore],
1433
+ deps: ['FirestoreOptions'],
1164
1434
  },
1165
1435
  {
1166
1436
  provide: 'SubscriptionRepository',
1167
- useFactory: (firestore) => {
1168
- return new SubscriptionFirestoreRepository(firestore);
1437
+ useFactory: (options) => {
1438
+ return new SubscriptionFirestoreRepository(options);
1169
1439
  },
1170
- deps: [Firestore],
1440
+ deps: ['FirestoreOptions'],
1171
1441
  },
1172
1442
  {
1173
1443
  provide: 'UserRepository',
1174
- useFactory: (firestore) => {
1175
- return new UserFirestoreRepository(firestore);
1444
+ useFactory: (options) => {
1445
+ return new UserFirestoreRepository(options);
1176
1446
  },
1177
- deps: [Firestore],
1447
+ deps: ['FirestoreOptions'],
1178
1448
  },
1179
1449
  {
1180
1450
  provide: 'UserAddressRepository',
1181
- useFactory: (firestore, userRepository) => {
1182
- return new UserAddressFirestoreRepository(firestore, userRepository);
1451
+ useFactory: (options, userRepository) => {
1452
+ return new UserAddressFirestoreRepository(options, userRepository);
1183
1453
  },
1184
- deps: [Firestore, 'UserRepository'],
1454
+ deps: ['FirestoreOptions', 'UserRepository'],
1185
1455
  },
1186
1456
  {
1187
1457
  provide: 'UserPaymentMethodRepository',
1188
- useFactory: (firestore, userRepository) => {
1189
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1458
+ useFactory: (options, userRepository) => {
1459
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
1190
1460
  },
1191
- deps: [Firestore, 'UserRepository'],
1461
+ deps: ['FirestoreOptions', 'UserRepository'],
1192
1462
  },
1193
1463
  {
1194
1464
  provide: ProductVariantFirestoreRepository,
1195
- useFactory: (firestore, productRepository) => {
1196
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1465
+ useFactory: (options, productRepository) => {
1466
+ return new ProductVariantFirestoreRepository(options, productRepository);
1197
1467
  },
1198
- deps: [Firestore, ProductFirestoreRepository],
1468
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
1199
1469
  },
1200
1470
  ],
1201
1471
  }]
@@ -1214,13 +1484,23 @@ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.
1214
1484
  AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
1215
1485
  {
1216
1486
  provide: 'HasuraConfig',
1217
- useFactory: (options) => ({
1487
+ useFactory: (options, platformId) => ({
1218
1488
  endpoint: options.endpoint,
1219
1489
  authOptions: options.credentials,
1220
1490
  interceptors: {
1221
1491
  request: (request) => {
1492
+ if (isPlatformBrowser(platformId))
1493
+ return request;
1494
+ const interval = setInterval(() => { }, 100);
1495
+ request.interval = interval;
1222
1496
  return request;
1223
1497
  },
1498
+ response: (response, request) => {
1499
+ if (isPlatformBrowser(platformId))
1500
+ return response;
1501
+ clearInterval(request.interval);
1502
+ return response;
1503
+ },
1224
1504
  },
1225
1505
  }),
1226
1506
  deps: [HASURA_OPTIONS, PLATFORM_ID],
@@ -1231,11 +1511,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1231
1511
  },
1232
1512
  {
1233
1513
  provide: CategoryHasuraGraphQLRepository,
1234
- useFactory: (options, productRepository, eta) => {
1235
- console.log(eta);
1236
- return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
1514
+ useFactory: (options, productRepository, categoryFilterRepository) => {
1515
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
1237
1516
  },
1238
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
1517
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1239
1518
  },
1240
1519
  {
1241
1520
  provide: 'ProductRepository',
@@ -1243,10 +1522,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1243
1522
  },
1244
1523
  {
1245
1524
  provide: ProductHasuraGraphQLRepository,
1246
- useFactory: (options) => {
1247
- return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
1525
+ useFactory: (hasuraConfig) => {
1526
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1248
1527
  },
1249
- deps: [HASURA_OPTIONS],
1528
+ deps: ['HasuraConfig'],
1250
1529
  },
1251
1530
  {
1252
1531
  provide: 'VariantRepository',
@@ -1254,10 +1533,43 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1254
1533
  },
1255
1534
  {
1256
1535
  provide: VariantHasuraGraphQLRepository,
1536
+ useFactory: (hasuraConfig) => {
1537
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1538
+ },
1539
+ deps: ['HasuraConfig'],
1540
+ },
1541
+ {
1542
+ provide: 'CategoryFilterRepository',
1543
+ useExisting: CategoryFilterHasuraGraphQLRepository,
1544
+ },
1545
+ {
1546
+ provide: CategoryFilterHasuraGraphQLRepository,
1257
1547
  useFactory: (options) => {
1258
- return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
1548
+ return new CategoryFilterHasuraGraphQLRepository(options);
1259
1549
  },
1260
- deps: [HASURA_OPTIONS],
1550
+ deps: ['HasuraConfig'],
1551
+ },
1552
+ {
1553
+ provide: 'FilterOptionRepository',
1554
+ useExisting: FilterOptionHasuraGraphQLRepository,
1555
+ },
1556
+ {
1557
+ provide: FilterOptionHasuraGraphQLRepository,
1558
+ useFactory: (options) => {
1559
+ return new FilterOptionHasuraGraphQLRepository(options);
1560
+ },
1561
+ deps: ['HasuraConfig'],
1562
+ },
1563
+ {
1564
+ provide: 'FilterRepository',
1565
+ useExisting: FilterHasuraGraphQLRepository,
1566
+ },
1567
+ {
1568
+ provide: FilterHasuraGraphQLRepository,
1569
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
1570
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
1571
+ },
1572
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1261
1573
  },
1262
1574
  ] });
1263
1575
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
@@ -1266,13 +1578,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1266
1578
  providers: [
1267
1579
  {
1268
1580
  provide: 'HasuraConfig',
1269
- useFactory: (options) => ({
1581
+ useFactory: (options, platformId) => ({
1270
1582
  endpoint: options.endpoint,
1271
1583
  authOptions: options.credentials,
1272
1584
  interceptors: {
1273
1585
  request: (request) => {
1586
+ if (isPlatformBrowser(platformId))
1587
+ return request;
1588
+ const interval = setInterval(() => { }, 100);
1589
+ request.interval = interval;
1274
1590
  return request;
1275
1591
  },
1592
+ response: (response, request) => {
1593
+ if (isPlatformBrowser(platformId))
1594
+ return response;
1595
+ clearInterval(request.interval);
1596
+ return response;
1597
+ },
1276
1598
  },
1277
1599
  }),
1278
1600
  deps: [HASURA_OPTIONS, PLATFORM_ID],
@@ -1283,11 +1605,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1283
1605
  },
1284
1606
  {
1285
1607
  provide: CategoryHasuraGraphQLRepository,
1286
- useFactory: (options, productRepository, eta) => {
1287
- console.log(eta);
1288
- return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
1608
+ useFactory: (options, productRepository, categoryFilterRepository) => {
1609
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
1289
1610
  },
1290
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
1611
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1291
1612
  },
1292
1613
  {
1293
1614
  provide: 'ProductRepository',
@@ -1295,10 +1616,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1295
1616
  },
1296
1617
  {
1297
1618
  provide: ProductHasuraGraphQLRepository,
1298
- useFactory: (options) => {
1299
- return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
1619
+ useFactory: (hasuraConfig) => {
1620
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1300
1621
  },
1301
- deps: [HASURA_OPTIONS],
1622
+ deps: ['HasuraConfig'],
1302
1623
  },
1303
1624
  {
1304
1625
  provide: 'VariantRepository',
@@ -1306,10 +1627,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1306
1627
  },
1307
1628
  {
1308
1629
  provide: VariantHasuraGraphQLRepository,
1630
+ useFactory: (hasuraConfig) => {
1631
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1632
+ },
1633
+ deps: ['HasuraConfig'],
1634
+ },
1635
+ {
1636
+ provide: 'CategoryFilterRepository',
1637
+ useExisting: CategoryFilterHasuraGraphQLRepository,
1638
+ },
1639
+ {
1640
+ provide: CategoryFilterHasuraGraphQLRepository,
1641
+ useFactory: (options) => {
1642
+ return new CategoryFilterHasuraGraphQLRepository(options);
1643
+ },
1644
+ deps: ['HasuraConfig'],
1645
+ },
1646
+ {
1647
+ provide: 'FilterOptionRepository',
1648
+ useExisting: FilterOptionHasuraGraphQLRepository,
1649
+ },
1650
+ {
1651
+ provide: FilterOptionHasuraGraphQLRepository,
1309
1652
  useFactory: (options) => {
1310
- return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
1653
+ return new FilterOptionHasuraGraphQLRepository(options);
1654
+ },
1655
+ deps: ['HasuraConfig'],
1656
+ },
1657
+ {
1658
+ provide: 'FilterRepository',
1659
+ useExisting: FilterHasuraGraphQLRepository,
1660
+ },
1661
+ {
1662
+ provide: FilterHasuraGraphQLRepository,
1663
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
1664
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
1311
1665
  },
1312
- deps: [HASURA_OPTIONS],
1666
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1313
1667
  },
1314
1668
  ],
1315
1669
  }]
@@ -1325,6 +1679,7 @@ class AngularConnectModule {
1325
1679
  ...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
1326
1680
  ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
1327
1681
  ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
1682
+ ...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
1328
1683
  ],
1329
1684
  };
1330
1685
  }
@@ -1339,6 +1694,7 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
1339
1694
  CouponService,
1340
1695
  HomeShopService,
1341
1696
  OrderService,
1697
+ ShippingService,
1342
1698
  ], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
1343
1699
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
1344
1700
  type: NgModule,
@@ -1352,6 +1708,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1352
1708
  CouponService,
1353
1709
  HomeShopService,
1354
1710
  OrderService,
1711
+ ShippingService,
1355
1712
  ],
1356
1713
  }]
1357
1714
  }] });
@@ -1360,5 +1717,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1360
1717
  * Generated bundle index. Do not edit.
1361
1718
  */
1362
1719
 
1363
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
1720
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService, ShippingService };
1364
1721
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map