@infrab4a/connect-angular 4.0.0-beta.0 → 4.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.
@@ -1,18 +1,20 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Inject, InjectionToken, NgModule } from '@angular/core';
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
5
  import { combineLatest, of, from, 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 i1$1 from '@infrab4a/connect';
9
+ import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, Status, 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, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, VariantHasuraGraphQLRepository } from '@infrab4a/connect';
10
10
  import cookie from 'js-cookie';
11
11
  import { CustomError } from 'ts-custom-error';
12
- import * as i1$1 from '@angular/fire/firestore';
12
+ import * as i1$2 from '@angular/fire/firestore';
13
13
  import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
14
- import * as i1$2 from '@angular/fire/app';
14
+ import * as i1$3 from '@angular/common/http';
15
+ import * as i1$4 from '@angular/fire/app';
15
16
  import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
17
+ import { isPlatformBrowser } from '@angular/common';
16
18
 
17
19
  class AuthService {
18
20
  constructor(angularFireAuth, userRepository) {
@@ -47,6 +49,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
47
49
  }] }];
48
50
  } });
49
51
 
52
+ const BACKEND_URL = 'BACKEND_URL';
53
+
50
54
  const DEFAULT_SHOP = 'DEFAULT_SHOP';
51
55
 
52
56
  const ES_CONFIG = 'ES_CONFIG';
@@ -297,7 +301,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
297
301
  return [{ type: undefined, decorators: [{
298
302
  type: Inject,
299
303
  args: ['CouponRepository']
300
- }] }, { type: i2.Shops, decorators: [{
304
+ }] }, { type: i1$1.Shops, decorators: [{
301
305
  type: Inject,
302
306
  args: [DEFAULT_SHOP]
303
307
  }] }, { type: undefined, decorators: [{
@@ -372,7 +376,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
372
376
  }] }, { type: undefined, decorators: [{
373
377
  type: Inject,
374
378
  args: ['UserRepository']
375
- }] }, { type: i2.Shops, decorators: [{
379
+ }] }, { type: i1$1.Shops, decorators: [{
376
380
  type: Inject,
377
381
  args: [DEFAULT_SHOP]
378
382
  }] }];
@@ -507,7 +511,7 @@ CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version:
507
511
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
508
512
  type: Injectable
509
513
  }], ctorParameters: function () {
510
- return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
514
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i1$1.Shops, decorators: [{
511
515
  type: Inject,
512
516
  args: [DEFAULT_SHOP]
513
517
  }] }, { type: undefined, decorators: [{
@@ -560,30 +564,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
560
564
  }] }, { type: CouponService }];
561
565
  } });
562
566
 
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
567
  class HomeShopService {
588
568
  constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
589
569
  this.categoryRepository = categoryRepository;
@@ -690,12 +670,125 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
690
670
  }] }, { type: undefined, decorators: [{
691
671
  type: Inject,
692
672
  args: ['ProductRepository']
693
- }] }, { type: i2.Shops, decorators: [{
673
+ }] }, { type: i1$1.Shops, decorators: [{
694
674
  type: Inject,
695
675
  args: [DEFAULT_SHOP]
696
676
  }] }];
697
677
  } });
698
678
 
679
+ class OrderService {
680
+ constructor(angularFirestore, orderRepository) {
681
+ this.angularFirestore = angularFirestore;
682
+ this.orderRepository = orderRepository;
683
+ this.orderSubject = new Subject();
684
+ }
685
+ getOrder(id) {
686
+ docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
687
+ .pipe(map((doc) => Order.toInstance(doc.data())))
688
+ .subscribe((doc) => this.orderSubject.next(doc));
689
+ return this.orderSubject;
690
+ }
691
+ }
692
+ OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$2.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
693
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
695
+ type: Injectable
696
+ }], ctorParameters: function () {
697
+ return [{ type: i1$2.Firestore }, { type: i1$1.OrderFirestoreRepository, decorators: [{
698
+ type: Inject,
699
+ args: ['OrderRepository']
700
+ }] }];
701
+ } });
702
+
703
+ class ShippingService {
704
+ constructor(http, apiUrl, homeService) {
705
+ this.http = http;
706
+ this.apiUrl = apiUrl;
707
+ this.homeService = homeService;
708
+ }
709
+ getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
710
+ return combineLatest([
711
+ this.homeService.getHomeData(),
712
+ this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
713
+ ]).pipe(map(([datas, shippingMethodsResponse]) => {
714
+ let shippingMethods = shippingMethodsResponse.result;
715
+ if (!shippingMethods.length)
716
+ return [];
717
+ shippingMethods = shippingMethods.map((shippingMethod) => {
718
+ if (shippingMethod.ShippingCompanyName == 'Same Day EG')
719
+ shippingMethod.ShippingCompanyName = 'Same Day';
720
+ return shippingMethod;
721
+ });
722
+ const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
723
+ if (this.isHolidays(datasSameDayNotAvaliable)) {
724
+ shippingMethods = shippingMethods.filter((method) => method.ShippingCompanyName !== 'Same Day');
725
+ }
726
+ if (totalPrice >= 200) {
727
+ shippingMethods = shippingMethods.map((s) => {
728
+ if (s.serviceName !== 'Same Day')
729
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
730
+ else
731
+ return s;
732
+ });
733
+ }
734
+ if (shop == Shops.GLAMSHOP)
735
+ return shippingMethods;
736
+ if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
737
+ shippingMethods = shippingMethods.map((s) => {
738
+ if (s.serviceName == 'Same Day')
739
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
740
+ else
741
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
742
+ });
743
+ }
744
+ if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
745
+ shippingMethods = shippingMethods.map((s) => {
746
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
747
+ });
748
+ }
749
+ return shippingMethods;
750
+ }));
751
+ }
752
+ isFreeShippingBySubscription(shop, subscriptionPlan) {
753
+ if (!subscriptionPlan)
754
+ return false;
755
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
756
+ return true;
757
+ }
758
+ return false;
759
+ }
760
+ isHalfShippingBySubscription(shop, subscriptionPlan) {
761
+ if (!subscriptionPlan)
762
+ return false;
763
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
764
+ return true;
765
+ }
766
+ return false;
767
+ }
768
+ isHolidays(datas) {
769
+ const today = new Date();
770
+ for (const key in datas) {
771
+ let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
772
+ let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
773
+ if (start > end)
774
+ end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
775
+ if (today >= start && today <= end)
776
+ return true;
777
+ }
778
+ return false;
779
+ }
780
+ }
781
+ ShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, deps: [{ token: i1$3.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0.ɵɵFactoryTarget.Injectable });
782
+ ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
783
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
784
+ type: Injectable
785
+ }], ctorParameters: function () {
786
+ return [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
787
+ type: Inject,
788
+ args: [BACKEND_URL]
789
+ }] }, { type: HomeShopService }];
790
+ } });
791
+
699
792
  class AngularFirebaseAuthModule {
700
793
  static initializeApp(options, nameOrConfig) {
701
794
  return {
@@ -708,7 +801,7 @@ class AngularFirebaseAuthModule {
708
801
  }
709
802
  }
710
803
  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] });
804
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$4.FirebaseAppModule, i1.AuthModule] });
712
805
  AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
713
806
  {
714
807
  provide: 'Authentication',
@@ -865,159 +958,181 @@ class AngularFirestoreModule {
865
958
  }
866
959
  }
867
960
  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] });
961
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$4.FirebaseAppModule, i1$2.FirestoreModule] });
869
962
  AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
963
+ {
964
+ provide: 'FirestoreOptions',
965
+ useFactory: (firestore, platformId) => ({
966
+ firestore,
967
+ interceptors: {
968
+ request: (request) => {
969
+ if (isPlatformBrowser(platformId))
970
+ return request;
971
+ const interval = setInterval(() => { }, 100);
972
+ request.interval = interval;
973
+ return request;
974
+ },
975
+ response: (response, request) => {
976
+ if (isPlatformBrowser(platformId))
977
+ return response;
978
+ clearInterval(request.interval);
979
+ return response;
980
+ },
981
+ },
982
+ }),
983
+ deps: [Firestore, PLATFORM_ID],
984
+ },
870
985
  {
871
986
  provide: 'BeautyProfileRepository',
872
- useFactory: (firestore, userRepository) => {
873
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
987
+ useFactory: (config, userRepository) => {
988
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
874
989
  },
875
- deps: [Firestore, 'UserRepository'],
990
+ deps: ['FirestoreOptions', 'UserRepository'],
876
991
  },
877
992
  {
878
993
  provide: 'Buy2WinRepository',
879
- useFactory: (firestore) => {
880
- return new Buy2WinFirestoreRepository(firestore);
994
+ useFactory: (options) => {
995
+ return new Buy2WinFirestoreRepository(options);
881
996
  },
882
- deps: [Firestore],
997
+ deps: ['FirestoreOptions'],
883
998
  },
884
999
  {
885
1000
  provide: CategoryFirestoreRepository,
886
- useFactory: (firestore) => {
887
- return new CategoryFirestoreRepository(firestore);
1001
+ useFactory: (options) => {
1002
+ return new CategoryFirestoreRepository(options);
888
1003
  },
889
- deps: [Firestore],
1004
+ deps: ['FirestoreOptions'],
890
1005
  },
891
1006
  {
892
1007
  provide: 'CheckoutRepository',
893
- useFactory: (firestore) => {
894
- return new CheckoutFirestoreRepository(firestore);
1008
+ useFactory: (options) => {
1009
+ return new CheckoutFirestoreRepository(options);
895
1010
  },
896
- deps: [Firestore],
1011
+ deps: ['FirestoreOptions'],
897
1012
  },
898
1013
  {
899
1014
  provide: 'CheckoutSubscriptionRepository',
900
- useFactory: (firestore) => {
901
- return new CheckoutSubscriptionFirestoreRepository(firestore);
1015
+ useFactory: (options) => {
1016
+ return new CheckoutSubscriptionFirestoreRepository(options);
902
1017
  },
903
- deps: [Firestore],
1018
+ deps: ['FirestoreOptions'],
904
1019
  },
905
1020
  {
906
1021
  provide: 'CouponRepository',
907
- useFactory: (firestore) => {
908
- return new CouponFirestoreRepository(firestore);
1022
+ useFactory: (options) => {
1023
+ return new CouponFirestoreRepository(options);
909
1024
  },
910
- deps: [Firestore],
1025
+ deps: ['FirestoreOptions'],
911
1026
  },
912
1027
  {
913
1028
  provide: 'EditionRepository',
914
- useFactory: (firestore, subscriptionRepository) => {
915
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1029
+ useFactory: (options, subscriptionRepository) => {
1030
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
916
1031
  },
917
1032
  deps: [Firestore, 'SubscriptionRepository'],
918
1033
  },
919
1034
  {
920
1035
  provide: 'HomeRepository',
921
- useFactory: (firestore) => {
922
- return new HomeFirestoreRepository(firestore);
1036
+ useFactory: (options) => {
1037
+ return new HomeFirestoreRepository(options);
923
1038
  },
924
- deps: [Firestore],
1039
+ deps: ['FirestoreOptions'],
925
1040
  },
926
1041
  {
927
1042
  provide: 'LeadRepository',
928
- useFactory: (firestore) => {
929
- return new LeadFirestoreRepository(firestore);
1043
+ useFactory: (options) => {
1044
+ return new LeadFirestoreRepository(options);
930
1045
  },
931
- deps: [Firestore],
1046
+ deps: ['FirestoreOptions'],
932
1047
  },
933
1048
  {
934
1049
  provide: 'LegacyOrderRepository',
935
- useFactory: (firestore) => {
936
- return new LegacyOrderFirestoreRepository(firestore);
1050
+ useFactory: (options) => {
1051
+ return new LegacyOrderFirestoreRepository(options);
937
1052
  },
938
- deps: [Firestore],
1053
+ deps: ['FirestoreOptions'],
939
1054
  },
940
1055
  {
941
1056
  provide: 'ShopMenuRepository',
942
- useFactory: (firestore) => {
943
- return new ShopMenuFirestoreRepository(firestore);
1057
+ useFactory: (options) => {
1058
+ return new ShopMenuFirestoreRepository(options);
944
1059
  },
945
- deps: [Firestore],
1060
+ deps: ['FirestoreOptions'],
946
1061
  },
947
1062
  {
948
1063
  provide: 'OrderRepository',
949
- useFactory: (firestore) => {
950
- return new OrderFirestoreRepository(firestore);
1064
+ useFactory: (options) => {
1065
+ return new OrderFirestoreRepository(options);
951
1066
  },
952
- deps: [Firestore],
1067
+ deps: ['FirestoreOptions'],
953
1068
  },
954
1069
  {
955
1070
  provide: 'PaymentRepository',
956
- useFactory: (firestore) => {
957
- return new PaymentFirestoreRepository(firestore);
1071
+ useFactory: (options) => {
1072
+ return new PaymentFirestoreRepository(options);
958
1073
  },
959
- deps: [Firestore],
1074
+ deps: ['FirestoreOptions'],
960
1075
  },
961
1076
  {
962
1077
  provide: ProductFirestoreRepository,
963
- useFactory: (firestore) => {
964
- return new ProductFirestoreRepository(firestore);
1078
+ useFactory: (options) => {
1079
+ return new ProductFirestoreRepository(options);
965
1080
  },
966
- deps: [Firestore],
1081
+ deps: ['FirestoreOptions'],
967
1082
  },
968
1083
  {
969
1084
  provide: 'SubscriptionPaymentRepository',
970
- useFactory: (firestore, subscriptionRepository) => {
971
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1085
+ useFactory: (options, subscriptionRepository) => {
1086
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
972
1087
  },
973
1088
  deps: [Firestore, 'SubscriptionRepository'],
974
1089
  },
975
1090
  {
976
1091
  provide: 'SubscriptionPlanRepository',
977
- useFactory: (firestore) => {
978
- return new SubscriptionPlanFirestoreRepository(firestore);
1092
+ useFactory: (options) => {
1093
+ return new SubscriptionPlanFirestoreRepository(options);
979
1094
  },
980
- deps: [Firestore],
1095
+ deps: ['FirestoreOptions'],
981
1096
  },
982
1097
  {
983
1098
  provide: 'SubscriptionProductRepository',
984
- useFactory: (firestore) => {
985
- return new SubscriptionProductFirestoreRepository(firestore);
1099
+ useFactory: (options) => {
1100
+ return new SubscriptionProductFirestoreRepository(options);
986
1101
  },
987
- deps: [Firestore],
1102
+ deps: ['FirestoreOptions'],
988
1103
  },
989
1104
  {
990
1105
  provide: 'SubscriptionRepository',
991
- useFactory: (firestore) => {
992
- return new SubscriptionFirestoreRepository(firestore);
1106
+ useFactory: (options) => {
1107
+ return new SubscriptionFirestoreRepository(options);
993
1108
  },
994
- deps: [Firestore],
1109
+ deps: ['FirestoreOptions'],
995
1110
  },
996
1111
  {
997
1112
  provide: 'UserRepository',
998
- useFactory: (firestore) => {
999
- return new UserFirestoreRepository(firestore);
1113
+ useFactory: (options) => {
1114
+ return new UserFirestoreRepository(options);
1000
1115
  },
1001
- deps: [Firestore],
1116
+ deps: ['FirestoreOptions'],
1002
1117
  },
1003
1118
  {
1004
1119
  provide: 'UserAddressRepository',
1005
- useFactory: (firestore, userRepository) => {
1006
- return new UserAddressFirestoreRepository(firestore, userRepository);
1120
+ useFactory: (options, userRepository) => {
1121
+ return new UserAddressFirestoreRepository(options, userRepository);
1007
1122
  },
1008
1123
  deps: [Firestore, 'UserRepository'],
1009
1124
  },
1010
1125
  {
1011
1126
  provide: 'UserPaymentMethodRepository',
1012
- useFactory: (firestore, userRepository) => {
1013
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1127
+ useFactory: (options, userRepository) => {
1128
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
1014
1129
  },
1015
1130
  deps: [Firestore, 'UserRepository'],
1016
1131
  },
1017
1132
  {
1018
1133
  provide: ProductVariantFirestoreRepository,
1019
- useFactory: (firestore, productRepository) => {
1020
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1134
+ useFactory: (options, productRepository) => {
1135
+ return new ProductVariantFirestoreRepository(options, productRepository);
1021
1136
  },
1022
1137
  deps: [Firestore, ProductFirestoreRepository],
1023
1138
  },
@@ -1043,157 +1158,179 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1043
1158
  provideFirestore(() => getFirestore()),
1044
1159
  ],
1045
1160
  providers: [
1161
+ {
1162
+ provide: 'FirestoreOptions',
1163
+ useFactory: (firestore, platformId) => ({
1164
+ firestore,
1165
+ interceptors: {
1166
+ request: (request) => {
1167
+ if (isPlatformBrowser(platformId))
1168
+ return request;
1169
+ const interval = setInterval(() => { }, 100);
1170
+ request.interval = interval;
1171
+ return request;
1172
+ },
1173
+ response: (response, request) => {
1174
+ if (isPlatformBrowser(platformId))
1175
+ return response;
1176
+ clearInterval(request.interval);
1177
+ return response;
1178
+ },
1179
+ },
1180
+ }),
1181
+ deps: [Firestore, PLATFORM_ID],
1182
+ },
1046
1183
  {
1047
1184
  provide: 'BeautyProfileRepository',
1048
- useFactory: (firestore, userRepository) => {
1049
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
1185
+ useFactory: (config, userRepository) => {
1186
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
1050
1187
  },
1051
- deps: [Firestore, 'UserRepository'],
1188
+ deps: ['FirestoreOptions', 'UserRepository'],
1052
1189
  },
1053
1190
  {
1054
1191
  provide: 'Buy2WinRepository',
1055
- useFactory: (firestore) => {
1056
- return new Buy2WinFirestoreRepository(firestore);
1192
+ useFactory: (options) => {
1193
+ return new Buy2WinFirestoreRepository(options);
1057
1194
  },
1058
- deps: [Firestore],
1195
+ deps: ['FirestoreOptions'],
1059
1196
  },
1060
1197
  {
1061
1198
  provide: CategoryFirestoreRepository,
1062
- useFactory: (firestore) => {
1063
- return new CategoryFirestoreRepository(firestore);
1199
+ useFactory: (options) => {
1200
+ return new CategoryFirestoreRepository(options);
1064
1201
  },
1065
- deps: [Firestore],
1202
+ deps: ['FirestoreOptions'],
1066
1203
  },
1067
1204
  {
1068
1205
  provide: 'CheckoutRepository',
1069
- useFactory: (firestore) => {
1070
- return new CheckoutFirestoreRepository(firestore);
1206
+ useFactory: (options) => {
1207
+ return new CheckoutFirestoreRepository(options);
1071
1208
  },
1072
- deps: [Firestore],
1209
+ deps: ['FirestoreOptions'],
1073
1210
  },
1074
1211
  {
1075
1212
  provide: 'CheckoutSubscriptionRepository',
1076
- useFactory: (firestore) => {
1077
- return new CheckoutSubscriptionFirestoreRepository(firestore);
1213
+ useFactory: (options) => {
1214
+ return new CheckoutSubscriptionFirestoreRepository(options);
1078
1215
  },
1079
- deps: [Firestore],
1216
+ deps: ['FirestoreOptions'],
1080
1217
  },
1081
1218
  {
1082
1219
  provide: 'CouponRepository',
1083
- useFactory: (firestore) => {
1084
- return new CouponFirestoreRepository(firestore);
1220
+ useFactory: (options) => {
1221
+ return new CouponFirestoreRepository(options);
1085
1222
  },
1086
- deps: [Firestore],
1223
+ deps: ['FirestoreOptions'],
1087
1224
  },
1088
1225
  {
1089
1226
  provide: 'EditionRepository',
1090
- useFactory: (firestore, subscriptionRepository) => {
1091
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1227
+ useFactory: (options, subscriptionRepository) => {
1228
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
1092
1229
  },
1093
1230
  deps: [Firestore, 'SubscriptionRepository'],
1094
1231
  },
1095
1232
  {
1096
1233
  provide: 'HomeRepository',
1097
- useFactory: (firestore) => {
1098
- return new HomeFirestoreRepository(firestore);
1234
+ useFactory: (options) => {
1235
+ return new HomeFirestoreRepository(options);
1099
1236
  },
1100
- deps: [Firestore],
1237
+ deps: ['FirestoreOptions'],
1101
1238
  },
1102
1239
  {
1103
1240
  provide: 'LeadRepository',
1104
- useFactory: (firestore) => {
1105
- return new LeadFirestoreRepository(firestore);
1241
+ useFactory: (options) => {
1242
+ return new LeadFirestoreRepository(options);
1106
1243
  },
1107
- deps: [Firestore],
1244
+ deps: ['FirestoreOptions'],
1108
1245
  },
1109
1246
  {
1110
1247
  provide: 'LegacyOrderRepository',
1111
- useFactory: (firestore) => {
1112
- return new LegacyOrderFirestoreRepository(firestore);
1248
+ useFactory: (options) => {
1249
+ return new LegacyOrderFirestoreRepository(options);
1113
1250
  },
1114
- deps: [Firestore],
1251
+ deps: ['FirestoreOptions'],
1115
1252
  },
1116
1253
  {
1117
1254
  provide: 'ShopMenuRepository',
1118
- useFactory: (firestore) => {
1119
- return new ShopMenuFirestoreRepository(firestore);
1255
+ useFactory: (options) => {
1256
+ return new ShopMenuFirestoreRepository(options);
1120
1257
  },
1121
- deps: [Firestore],
1258
+ deps: ['FirestoreOptions'],
1122
1259
  },
1123
1260
  {
1124
1261
  provide: 'OrderRepository',
1125
- useFactory: (firestore) => {
1126
- return new OrderFirestoreRepository(firestore);
1262
+ useFactory: (options) => {
1263
+ return new OrderFirestoreRepository(options);
1127
1264
  },
1128
- deps: [Firestore],
1265
+ deps: ['FirestoreOptions'],
1129
1266
  },
1130
1267
  {
1131
1268
  provide: 'PaymentRepository',
1132
- useFactory: (firestore) => {
1133
- return new PaymentFirestoreRepository(firestore);
1269
+ useFactory: (options) => {
1270
+ return new PaymentFirestoreRepository(options);
1134
1271
  },
1135
- deps: [Firestore],
1272
+ deps: ['FirestoreOptions'],
1136
1273
  },
1137
1274
  {
1138
1275
  provide: ProductFirestoreRepository,
1139
- useFactory: (firestore) => {
1140
- return new ProductFirestoreRepository(firestore);
1276
+ useFactory: (options) => {
1277
+ return new ProductFirestoreRepository(options);
1141
1278
  },
1142
- deps: [Firestore],
1279
+ deps: ['FirestoreOptions'],
1143
1280
  },
1144
1281
  {
1145
1282
  provide: 'SubscriptionPaymentRepository',
1146
- useFactory: (firestore, subscriptionRepository) => {
1147
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1283
+ useFactory: (options, subscriptionRepository) => {
1284
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
1148
1285
  },
1149
1286
  deps: [Firestore, 'SubscriptionRepository'],
1150
1287
  },
1151
1288
  {
1152
1289
  provide: 'SubscriptionPlanRepository',
1153
- useFactory: (firestore) => {
1154
- return new SubscriptionPlanFirestoreRepository(firestore);
1290
+ useFactory: (options) => {
1291
+ return new SubscriptionPlanFirestoreRepository(options);
1155
1292
  },
1156
- deps: [Firestore],
1293
+ deps: ['FirestoreOptions'],
1157
1294
  },
1158
1295
  {
1159
1296
  provide: 'SubscriptionProductRepository',
1160
- useFactory: (firestore) => {
1161
- return new SubscriptionProductFirestoreRepository(firestore);
1297
+ useFactory: (options) => {
1298
+ return new SubscriptionProductFirestoreRepository(options);
1162
1299
  },
1163
- deps: [Firestore],
1300
+ deps: ['FirestoreOptions'],
1164
1301
  },
1165
1302
  {
1166
1303
  provide: 'SubscriptionRepository',
1167
- useFactory: (firestore) => {
1168
- return new SubscriptionFirestoreRepository(firestore);
1304
+ useFactory: (options) => {
1305
+ return new SubscriptionFirestoreRepository(options);
1169
1306
  },
1170
- deps: [Firestore],
1307
+ deps: ['FirestoreOptions'],
1171
1308
  },
1172
1309
  {
1173
1310
  provide: 'UserRepository',
1174
- useFactory: (firestore) => {
1175
- return new UserFirestoreRepository(firestore);
1311
+ useFactory: (options) => {
1312
+ return new UserFirestoreRepository(options);
1176
1313
  },
1177
- deps: [Firestore],
1314
+ deps: ['FirestoreOptions'],
1178
1315
  },
1179
1316
  {
1180
1317
  provide: 'UserAddressRepository',
1181
- useFactory: (firestore, userRepository) => {
1182
- return new UserAddressFirestoreRepository(firestore, userRepository);
1318
+ useFactory: (options, userRepository) => {
1319
+ return new UserAddressFirestoreRepository(options, userRepository);
1183
1320
  },
1184
1321
  deps: [Firestore, 'UserRepository'],
1185
1322
  },
1186
1323
  {
1187
1324
  provide: 'UserPaymentMethodRepository',
1188
- useFactory: (firestore, userRepository) => {
1189
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1325
+ useFactory: (options, userRepository) => {
1326
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
1190
1327
  },
1191
1328
  deps: [Firestore, 'UserRepository'],
1192
1329
  },
1193
1330
  {
1194
1331
  provide: ProductVariantFirestoreRepository,
1195
- useFactory: (firestore, productRepository) => {
1196
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1332
+ useFactory: (options, productRepository) => {
1333
+ return new ProductVariantFirestoreRepository(options, productRepository);
1197
1334
  },
1198
1335
  deps: [Firestore, ProductFirestoreRepository],
1199
1336
  },
@@ -1212,16 +1349,39 @@ class AngularHasuraGraphQLModule {
1212
1349
  AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1213
1350
  AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
1214
1351
  AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
1352
+ {
1353
+ provide: 'HasuraConfig',
1354
+ useFactory: (options, platformId) => ({
1355
+ endpoint: options.endpoint,
1356
+ authOptions: options.credentials,
1357
+ interceptors: {
1358
+ request: (request) => {
1359
+ if (isPlatformBrowser(platformId))
1360
+ return request;
1361
+ const interval = setInterval(() => { }, 100);
1362
+ request.interval = interval;
1363
+ return request;
1364
+ },
1365
+ response: (response, request) => {
1366
+ if (isPlatformBrowser(platformId))
1367
+ return response;
1368
+ clearInterval(request.interval);
1369
+ return response;
1370
+ },
1371
+ },
1372
+ }),
1373
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
1374
+ },
1215
1375
  {
1216
1376
  provide: 'CategoryRepository',
1217
1377
  useExisting: CategoryHasuraGraphQLRepository,
1218
1378
  },
1219
1379
  {
1220
1380
  provide: CategoryHasuraGraphQLRepository,
1221
- useFactory: (options, productRepository) => {
1222
- return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1381
+ useFactory: (hasuraConfig, productRepository) => {
1382
+ return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
1223
1383
  },
1224
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
1384
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
1225
1385
  },
1226
1386
  {
1227
1387
  provide: 'ProductRepository',
@@ -1229,10 +1389,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1229
1389
  },
1230
1390
  {
1231
1391
  provide: ProductHasuraGraphQLRepository,
1232
- useFactory: (options) => {
1233
- return new ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1392
+ useFactory: (hasuraConfig) => {
1393
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1234
1394
  },
1235
- deps: [HASURA_OPTIONS],
1395
+ deps: ['HasuraConfig'],
1236
1396
  },
1237
1397
  {
1238
1398
  provide: 'VariantRepository',
@@ -1240,26 +1400,49 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1240
1400
  },
1241
1401
  {
1242
1402
  provide: VariantHasuraGraphQLRepository,
1243
- useFactory: (options) => {
1244
- return new VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1403
+ useFactory: (hasuraConfig) => {
1404
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1245
1405
  },
1246
- deps: [HASURA_OPTIONS],
1406
+ deps: ['HasuraConfig'],
1247
1407
  },
1248
1408
  ] });
1249
1409
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
1250
1410
  type: NgModule,
1251
1411
  args: [{
1252
1412
  providers: [
1413
+ {
1414
+ provide: 'HasuraConfig',
1415
+ useFactory: (options, platformId) => ({
1416
+ endpoint: options.endpoint,
1417
+ authOptions: options.credentials,
1418
+ interceptors: {
1419
+ request: (request) => {
1420
+ if (isPlatformBrowser(platformId))
1421
+ return request;
1422
+ const interval = setInterval(() => { }, 100);
1423
+ request.interval = interval;
1424
+ return request;
1425
+ },
1426
+ response: (response, request) => {
1427
+ if (isPlatformBrowser(platformId))
1428
+ return response;
1429
+ clearInterval(request.interval);
1430
+ return response;
1431
+ },
1432
+ },
1433
+ }),
1434
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
1435
+ },
1253
1436
  {
1254
1437
  provide: 'CategoryRepository',
1255
1438
  useExisting: CategoryHasuraGraphQLRepository,
1256
1439
  },
1257
1440
  {
1258
1441
  provide: CategoryHasuraGraphQLRepository,
1259
- useFactory: (options, productRepository) => {
1260
- return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1442
+ useFactory: (hasuraConfig, productRepository) => {
1443
+ return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
1261
1444
  },
1262
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
1445
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
1263
1446
  },
1264
1447
  {
1265
1448
  provide: 'ProductRepository',
@@ -1267,10 +1450,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1267
1450
  },
1268
1451
  {
1269
1452
  provide: ProductHasuraGraphQLRepository,
1270
- useFactory: (options) => {
1271
- return new ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1453
+ useFactory: (hasuraConfig) => {
1454
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1272
1455
  },
1273
- deps: [HASURA_OPTIONS],
1456
+ deps: ['HasuraConfig'],
1274
1457
  },
1275
1458
  {
1276
1459
  provide: 'VariantRepository',
@@ -1278,10 +1461,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1278
1461
  },
1279
1462
  {
1280
1463
  provide: VariantHasuraGraphQLRepository,
1281
- useFactory: (options) => {
1282
- return new VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1464
+ useFactory: (hasuraConfig) => {
1465
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1283
1466
  },
1284
- deps: [HASURA_OPTIONS],
1467
+ deps: ['HasuraConfig'],
1285
1468
  },
1286
1469
  ],
1287
1470
  }]
@@ -1297,6 +1480,7 @@ class AngularConnectModule {
1297
1480
  ...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
1298
1481
  ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
1299
1482
  ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
1483
+ ...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
1300
1484
  ],
1301
1485
  };
1302
1486
  }
@@ -1311,6 +1495,7 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
1311
1495
  CouponService,
1312
1496
  HomeShopService,
1313
1497
  OrderService,
1498
+ ShippingService,
1314
1499
  ], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
1315
1500
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
1316
1501
  type: NgModule,
@@ -1324,6 +1509,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1324
1509
  CouponService,
1325
1510
  HomeShopService,
1326
1511
  OrderService,
1512
+ ShippingService,
1327
1513
  ],
1328
1514
  }]
1329
1515
  }] });
@@ -1332,5 +1518,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1332
1518
  * Generated bundle index. Do not edit.
1333
1519
  */
1334
1520
 
1335
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
1521
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService, ShippingService };
1336
1522
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map