@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,17 +1,19 @@
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
- import * as i2 from '@infrab4a/connect';
8
- 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';
7
+ import * as i1$1 from '@infrab4a/connect';
8
+ 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';
9
9
  import cookie from 'js-cookie';
10
10
  import { CustomError } from 'ts-custom-error';
11
- import * as i1$1 from '@angular/fire/firestore';
11
+ import * as i1$2 from '@angular/fire/firestore';
12
12
  import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
13
- import * as i1$2 from '@angular/fire/app';
13
+ import * as i1$3 from '@angular/common/http';
14
+ import * as i1$4 from '@angular/fire/app';
14
15
  import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
16
+ import { isPlatformBrowser } from '@angular/common';
15
17
 
16
18
  class AuthService {
17
19
  constructor(angularFireAuth, userRepository) {
@@ -44,6 +46,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
44
46
  args: ['UserRepository']
45
47
  }] }]; } });
46
48
 
49
+ const BACKEND_URL = 'BACKEND_URL';
50
+
47
51
  const DEFAULT_SHOP = 'DEFAULT_SHOP';
48
52
 
49
53
  const ES_CONFIG = 'ES_CONFIG';
@@ -270,7 +274,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
270
274
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
271
275
  type: Inject,
272
276
  args: ['CouponRepository']
273
- }] }, { type: i2.Shops, decorators: [{
277
+ }] }, { type: i1$1.Shops, decorators: [{
274
278
  type: Inject,
275
279
  args: [DEFAULT_SHOP]
276
280
  }] }, { type: undefined, decorators: [{
@@ -342,7 +346,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
342
346
  }] }, { type: undefined, decorators: [{
343
347
  type: Inject,
344
348
  args: ['UserRepository']
345
- }] }, { type: i2.Shops, decorators: [{
349
+ }] }, { type: i1$1.Shops, decorators: [{
346
350
  type: Inject,
347
351
  args: [DEFAULT_SHOP]
348
352
  }] }]; } });
@@ -471,7 +475,7 @@ CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15
471
475
  CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
472
476
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
473
477
  type: Injectable
474
- }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
478
+ }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$1.Shops, decorators: [{
475
479
  type: Inject,
476
480
  args: [DEFAULT_SHOP]
477
481
  }] }, { type: undefined, decorators: [{
@@ -522,28 +526,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
522
526
  args: ['SubscriptionRepository']
523
527
  }] }, { type: CouponService }]; } });
524
528
 
525
- class OrderService {
526
- constructor(angularFirestore, orderRepository) {
527
- this.angularFirestore = angularFirestore;
528
- this.orderRepository = orderRepository;
529
- this.orderSubject = new Subject();
530
- }
531
- getOrder(id) {
532
- docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
533
- .pipe(map((doc) => Order.toInstance(doc.data())))
534
- .subscribe((doc) => this.orderSubject.next(doc));
535
- return this.orderSubject;
536
- }
537
- }
538
- 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 });
539
- OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
540
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
541
- type: Injectable
542
- }], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
543
- type: Inject,
544
- args: ['OrderRepository']
545
- }] }]; } });
546
-
547
529
  class HomeShopService {
548
530
  constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
549
531
  this.categoryRepository = categoryRepository;
@@ -646,11 +628,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
646
628
  }] }, { type: undefined, decorators: [{
647
629
  type: Inject,
648
630
  args: ['ProductRepository']
649
- }] }, { type: i2.Shops, decorators: [{
631
+ }] }, { type: i1$1.Shops, decorators: [{
650
632
  type: Inject,
651
633
  args: [DEFAULT_SHOP]
652
634
  }] }]; } });
653
635
 
636
+ class OrderService {
637
+ constructor(angularFirestore, orderRepository) {
638
+ this.angularFirestore = angularFirestore;
639
+ this.orderRepository = orderRepository;
640
+ this.orderSubject = new Subject();
641
+ }
642
+ getOrder(id) {
643
+ docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
644
+ .pipe(map((doc) => Order.toInstance(doc.data())))
645
+ .subscribe((doc) => this.orderSubject.next(doc));
646
+ return this.orderSubject;
647
+ }
648
+ }
649
+ 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 });
650
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
652
+ type: Injectable
653
+ }], ctorParameters: function () { return [{ type: i1$2.Firestore }, { type: i1$1.OrderFirestoreRepository, decorators: [{
654
+ type: Inject,
655
+ args: ['OrderRepository']
656
+ }] }]; } });
657
+
658
+ class ShippingService {
659
+ constructor(http, apiUrl, homeService) {
660
+ this.http = http;
661
+ this.apiUrl = apiUrl;
662
+ this.homeService = homeService;
663
+ }
664
+ getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
665
+ return combineLatest([
666
+ this.homeService.getHomeData(),
667
+ this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
668
+ ]).pipe(map(([datas, shippingMethodsResponse]) => {
669
+ let shippingMethods = shippingMethodsResponse.result;
670
+ if (!shippingMethods.length)
671
+ return [];
672
+ shippingMethods = shippingMethods.map((shippingMethod) => {
673
+ if (shippingMethod.ShippingCompanyName == 'Same Day EG')
674
+ shippingMethod.ShippingCompanyName = 'Same Day';
675
+ return shippingMethod;
676
+ });
677
+ const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
678
+ if (this.isHolidays(datasSameDayNotAvaliable)) {
679
+ shippingMethods = shippingMethods.filter((method) => method.ShippingCompanyName !== 'Same Day');
680
+ }
681
+ if (totalPrice >= 200) {
682
+ shippingMethods = shippingMethods.map((s) => {
683
+ if (s.serviceName !== 'Same Day')
684
+ return { ...s, totalPrice: 0 };
685
+ else
686
+ return s;
687
+ });
688
+ }
689
+ if (shop == Shops.GLAMSHOP)
690
+ return shippingMethods;
691
+ if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
692
+ shippingMethods = shippingMethods.map((s) => {
693
+ if (s.serviceName == 'Same Day')
694
+ return { ...s, totalPrice: s.totalPrice / 2 };
695
+ else
696
+ return { ...s, totalPrice: 0 };
697
+ });
698
+ }
699
+ if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
700
+ shippingMethods = shippingMethods.map((s) => {
701
+ return { ...s, totalPrice: s.totalPrice / 2 };
702
+ });
703
+ }
704
+ return shippingMethods;
705
+ }));
706
+ }
707
+ isFreeShippingBySubscription(shop, subscriptionPlan) {
708
+ if (!subscriptionPlan)
709
+ return false;
710
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
711
+ return true;
712
+ }
713
+ return false;
714
+ }
715
+ isHalfShippingBySubscription(shop, subscriptionPlan) {
716
+ if (!subscriptionPlan)
717
+ return false;
718
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
719
+ return true;
720
+ }
721
+ return false;
722
+ }
723
+ isHolidays(datas) {
724
+ const today = new Date();
725
+ for (const key in datas) {
726
+ let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
727
+ let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
728
+ if (start > end)
729
+ end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
730
+ if (today >= start && today <= end)
731
+ return true;
732
+ }
733
+ return false;
734
+ }
735
+ }
736
+ 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 });
737
+ ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
739
+ type: Injectable
740
+ }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
741
+ type: Inject,
742
+ args: [BACKEND_URL]
743
+ }] }, { type: HomeShopService }]; } });
744
+
654
745
  class AngularFirebaseAuthModule {
655
746
  static initializeApp(options, nameOrConfig) {
656
747
  return {
@@ -663,7 +754,7 @@ class AngularFirebaseAuthModule {
663
754
  }
664
755
  }
665
756
  AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
666
- AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
757
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$4.FirebaseAppModule, i1.AuthModule] });
667
758
  AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
668
759
  {
669
760
  provide: 'Authentication',
@@ -820,159 +911,181 @@ class AngularFirestoreModule {
820
911
  }
821
912
  }
822
913
  AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
823
- AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
914
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$4.FirebaseAppModule, i1$2.FirestoreModule] });
824
915
  AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
916
+ {
917
+ provide: 'FirestoreOptions',
918
+ useFactory: (firestore, platformId) => ({
919
+ firestore,
920
+ interceptors: {
921
+ request: (request) => {
922
+ if (isPlatformBrowser(platformId))
923
+ return request;
924
+ const interval = setInterval(() => { }, 100);
925
+ request.interval = interval;
926
+ return request;
927
+ },
928
+ response: (response, request) => {
929
+ if (isPlatformBrowser(platformId))
930
+ return response;
931
+ clearInterval(request.interval);
932
+ return response;
933
+ },
934
+ },
935
+ }),
936
+ deps: [Firestore, PLATFORM_ID],
937
+ },
825
938
  {
826
939
  provide: 'BeautyProfileRepository',
827
- useFactory: (firestore, userRepository) => {
828
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
940
+ useFactory: (config, userRepository) => {
941
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
829
942
  },
830
- deps: [Firestore, 'UserRepository'],
943
+ deps: ['FirestoreOptions', 'UserRepository'],
831
944
  },
832
945
  {
833
946
  provide: 'Buy2WinRepository',
834
- useFactory: (firestore) => {
835
- return new Buy2WinFirestoreRepository(firestore);
947
+ useFactory: (options) => {
948
+ return new Buy2WinFirestoreRepository(options);
836
949
  },
837
- deps: [Firestore],
950
+ deps: ['FirestoreOptions'],
838
951
  },
839
952
  {
840
953
  provide: CategoryFirestoreRepository,
841
- useFactory: (firestore) => {
842
- return new CategoryFirestoreRepository(firestore);
954
+ useFactory: (options) => {
955
+ return new CategoryFirestoreRepository(options);
843
956
  },
844
- deps: [Firestore],
957
+ deps: ['FirestoreOptions'],
845
958
  },
846
959
  {
847
960
  provide: 'CheckoutRepository',
848
- useFactory: (firestore) => {
849
- return new CheckoutFirestoreRepository(firestore);
961
+ useFactory: (options) => {
962
+ return new CheckoutFirestoreRepository(options);
850
963
  },
851
- deps: [Firestore],
964
+ deps: ['FirestoreOptions'],
852
965
  },
853
966
  {
854
967
  provide: 'CheckoutSubscriptionRepository',
855
- useFactory: (firestore) => {
856
- return new CheckoutSubscriptionFirestoreRepository(firestore);
968
+ useFactory: (options) => {
969
+ return new CheckoutSubscriptionFirestoreRepository(options);
857
970
  },
858
- deps: [Firestore],
971
+ deps: ['FirestoreOptions'],
859
972
  },
860
973
  {
861
974
  provide: 'CouponRepository',
862
- useFactory: (firestore) => {
863
- return new CouponFirestoreRepository(firestore);
975
+ useFactory: (options) => {
976
+ return new CouponFirestoreRepository(options);
864
977
  },
865
- deps: [Firestore],
978
+ deps: ['FirestoreOptions'],
866
979
  },
867
980
  {
868
981
  provide: 'EditionRepository',
869
- useFactory: (firestore, subscriptionRepository) => {
870
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
982
+ useFactory: (options, subscriptionRepository) => {
983
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
871
984
  },
872
985
  deps: [Firestore, 'SubscriptionRepository'],
873
986
  },
874
987
  {
875
988
  provide: 'HomeRepository',
876
- useFactory: (firestore) => {
877
- return new HomeFirestoreRepository(firestore);
989
+ useFactory: (options) => {
990
+ return new HomeFirestoreRepository(options);
878
991
  },
879
- deps: [Firestore],
992
+ deps: ['FirestoreOptions'],
880
993
  },
881
994
  {
882
995
  provide: 'LeadRepository',
883
- useFactory: (firestore) => {
884
- return new LeadFirestoreRepository(firestore);
996
+ useFactory: (options) => {
997
+ return new LeadFirestoreRepository(options);
885
998
  },
886
- deps: [Firestore],
999
+ deps: ['FirestoreOptions'],
887
1000
  },
888
1001
  {
889
1002
  provide: 'LegacyOrderRepository',
890
- useFactory: (firestore) => {
891
- return new LegacyOrderFirestoreRepository(firestore);
1003
+ useFactory: (options) => {
1004
+ return new LegacyOrderFirestoreRepository(options);
892
1005
  },
893
- deps: [Firestore],
1006
+ deps: ['FirestoreOptions'],
894
1007
  },
895
1008
  {
896
1009
  provide: 'ShopMenuRepository',
897
- useFactory: (firestore) => {
898
- return new ShopMenuFirestoreRepository(firestore);
1010
+ useFactory: (options) => {
1011
+ return new ShopMenuFirestoreRepository(options);
899
1012
  },
900
- deps: [Firestore],
1013
+ deps: ['FirestoreOptions'],
901
1014
  },
902
1015
  {
903
1016
  provide: 'OrderRepository',
904
- useFactory: (firestore) => {
905
- return new OrderFirestoreRepository(firestore);
1017
+ useFactory: (options) => {
1018
+ return new OrderFirestoreRepository(options);
906
1019
  },
907
- deps: [Firestore],
1020
+ deps: ['FirestoreOptions'],
908
1021
  },
909
1022
  {
910
1023
  provide: 'PaymentRepository',
911
- useFactory: (firestore) => {
912
- return new PaymentFirestoreRepository(firestore);
1024
+ useFactory: (options) => {
1025
+ return new PaymentFirestoreRepository(options);
913
1026
  },
914
- deps: [Firestore],
1027
+ deps: ['FirestoreOptions'],
915
1028
  },
916
1029
  {
917
1030
  provide: ProductFirestoreRepository,
918
- useFactory: (firestore) => {
919
- return new ProductFirestoreRepository(firestore);
1031
+ useFactory: (options) => {
1032
+ return new ProductFirestoreRepository(options);
920
1033
  },
921
- deps: [Firestore],
1034
+ deps: ['FirestoreOptions'],
922
1035
  },
923
1036
  {
924
1037
  provide: 'SubscriptionPaymentRepository',
925
- useFactory: (firestore, subscriptionRepository) => {
926
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1038
+ useFactory: (options, subscriptionRepository) => {
1039
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
927
1040
  },
928
1041
  deps: [Firestore, 'SubscriptionRepository'],
929
1042
  },
930
1043
  {
931
1044
  provide: 'SubscriptionPlanRepository',
932
- useFactory: (firestore) => {
933
- return new SubscriptionPlanFirestoreRepository(firestore);
1045
+ useFactory: (options) => {
1046
+ return new SubscriptionPlanFirestoreRepository(options);
934
1047
  },
935
- deps: [Firestore],
1048
+ deps: ['FirestoreOptions'],
936
1049
  },
937
1050
  {
938
1051
  provide: 'SubscriptionProductRepository',
939
- useFactory: (firestore) => {
940
- return new SubscriptionProductFirestoreRepository(firestore);
1052
+ useFactory: (options) => {
1053
+ return new SubscriptionProductFirestoreRepository(options);
941
1054
  },
942
- deps: [Firestore],
1055
+ deps: ['FirestoreOptions'],
943
1056
  },
944
1057
  {
945
1058
  provide: 'SubscriptionRepository',
946
- useFactory: (firestore) => {
947
- return new SubscriptionFirestoreRepository(firestore);
1059
+ useFactory: (options) => {
1060
+ return new SubscriptionFirestoreRepository(options);
948
1061
  },
949
- deps: [Firestore],
1062
+ deps: ['FirestoreOptions'],
950
1063
  },
951
1064
  {
952
1065
  provide: 'UserRepository',
953
- useFactory: (firestore) => {
954
- return new UserFirestoreRepository(firestore);
1066
+ useFactory: (options) => {
1067
+ return new UserFirestoreRepository(options);
955
1068
  },
956
- deps: [Firestore],
1069
+ deps: ['FirestoreOptions'],
957
1070
  },
958
1071
  {
959
1072
  provide: 'UserAddressRepository',
960
- useFactory: (firestore, userRepository) => {
961
- return new UserAddressFirestoreRepository(firestore, userRepository);
1073
+ useFactory: (options, userRepository) => {
1074
+ return new UserAddressFirestoreRepository(options, userRepository);
962
1075
  },
963
1076
  deps: [Firestore, 'UserRepository'],
964
1077
  },
965
1078
  {
966
1079
  provide: 'UserPaymentMethodRepository',
967
- useFactory: (firestore, userRepository) => {
968
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1080
+ useFactory: (options, userRepository) => {
1081
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
969
1082
  },
970
1083
  deps: [Firestore, 'UserRepository'],
971
1084
  },
972
1085
  {
973
1086
  provide: ProductVariantFirestoreRepository,
974
- useFactory: (firestore, productRepository) => {
975
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1087
+ useFactory: (options, productRepository) => {
1088
+ return new ProductVariantFirestoreRepository(options, productRepository);
976
1089
  },
977
1090
  deps: [Firestore, ProductFirestoreRepository],
978
1091
  },
@@ -998,157 +1111,179 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
998
1111
  provideFirestore(() => getFirestore()),
999
1112
  ],
1000
1113
  providers: [
1114
+ {
1115
+ provide: 'FirestoreOptions',
1116
+ useFactory: (firestore, platformId) => ({
1117
+ firestore,
1118
+ interceptors: {
1119
+ request: (request) => {
1120
+ if (isPlatformBrowser(platformId))
1121
+ return request;
1122
+ const interval = setInterval(() => { }, 100);
1123
+ request.interval = interval;
1124
+ return request;
1125
+ },
1126
+ response: (response, request) => {
1127
+ if (isPlatformBrowser(platformId))
1128
+ return response;
1129
+ clearInterval(request.interval);
1130
+ return response;
1131
+ },
1132
+ },
1133
+ }),
1134
+ deps: [Firestore, PLATFORM_ID],
1135
+ },
1001
1136
  {
1002
1137
  provide: 'BeautyProfileRepository',
1003
- useFactory: (firestore, userRepository) => {
1004
- return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
1138
+ useFactory: (config, userRepository) => {
1139
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
1005
1140
  },
1006
- deps: [Firestore, 'UserRepository'],
1141
+ deps: ['FirestoreOptions', 'UserRepository'],
1007
1142
  },
1008
1143
  {
1009
1144
  provide: 'Buy2WinRepository',
1010
- useFactory: (firestore) => {
1011
- return new Buy2WinFirestoreRepository(firestore);
1145
+ useFactory: (options) => {
1146
+ return new Buy2WinFirestoreRepository(options);
1012
1147
  },
1013
- deps: [Firestore],
1148
+ deps: ['FirestoreOptions'],
1014
1149
  },
1015
1150
  {
1016
1151
  provide: CategoryFirestoreRepository,
1017
- useFactory: (firestore) => {
1018
- return new CategoryFirestoreRepository(firestore);
1152
+ useFactory: (options) => {
1153
+ return new CategoryFirestoreRepository(options);
1019
1154
  },
1020
- deps: [Firestore],
1155
+ deps: ['FirestoreOptions'],
1021
1156
  },
1022
1157
  {
1023
1158
  provide: 'CheckoutRepository',
1024
- useFactory: (firestore) => {
1025
- return new CheckoutFirestoreRepository(firestore);
1159
+ useFactory: (options) => {
1160
+ return new CheckoutFirestoreRepository(options);
1026
1161
  },
1027
- deps: [Firestore],
1162
+ deps: ['FirestoreOptions'],
1028
1163
  },
1029
1164
  {
1030
1165
  provide: 'CheckoutSubscriptionRepository',
1031
- useFactory: (firestore) => {
1032
- return new CheckoutSubscriptionFirestoreRepository(firestore);
1166
+ useFactory: (options) => {
1167
+ return new CheckoutSubscriptionFirestoreRepository(options);
1033
1168
  },
1034
- deps: [Firestore],
1169
+ deps: ['FirestoreOptions'],
1035
1170
  },
1036
1171
  {
1037
1172
  provide: 'CouponRepository',
1038
- useFactory: (firestore) => {
1039
- return new CouponFirestoreRepository(firestore);
1173
+ useFactory: (options) => {
1174
+ return new CouponFirestoreRepository(options);
1040
1175
  },
1041
- deps: [Firestore],
1176
+ deps: ['FirestoreOptions'],
1042
1177
  },
1043
1178
  {
1044
1179
  provide: 'EditionRepository',
1045
- useFactory: (firestore, subscriptionRepository) => {
1046
- return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1180
+ useFactory: (options, subscriptionRepository) => {
1181
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
1047
1182
  },
1048
1183
  deps: [Firestore, 'SubscriptionRepository'],
1049
1184
  },
1050
1185
  {
1051
1186
  provide: 'HomeRepository',
1052
- useFactory: (firestore) => {
1053
- return new HomeFirestoreRepository(firestore);
1187
+ useFactory: (options) => {
1188
+ return new HomeFirestoreRepository(options);
1054
1189
  },
1055
- deps: [Firestore],
1190
+ deps: ['FirestoreOptions'],
1056
1191
  },
1057
1192
  {
1058
1193
  provide: 'LeadRepository',
1059
- useFactory: (firestore) => {
1060
- return new LeadFirestoreRepository(firestore);
1194
+ useFactory: (options) => {
1195
+ return new LeadFirestoreRepository(options);
1061
1196
  },
1062
- deps: [Firestore],
1197
+ deps: ['FirestoreOptions'],
1063
1198
  },
1064
1199
  {
1065
1200
  provide: 'LegacyOrderRepository',
1066
- useFactory: (firestore) => {
1067
- return new LegacyOrderFirestoreRepository(firestore);
1201
+ useFactory: (options) => {
1202
+ return new LegacyOrderFirestoreRepository(options);
1068
1203
  },
1069
- deps: [Firestore],
1204
+ deps: ['FirestoreOptions'],
1070
1205
  },
1071
1206
  {
1072
1207
  provide: 'ShopMenuRepository',
1073
- useFactory: (firestore) => {
1074
- return new ShopMenuFirestoreRepository(firestore);
1208
+ useFactory: (options) => {
1209
+ return new ShopMenuFirestoreRepository(options);
1075
1210
  },
1076
- deps: [Firestore],
1211
+ deps: ['FirestoreOptions'],
1077
1212
  },
1078
1213
  {
1079
1214
  provide: 'OrderRepository',
1080
- useFactory: (firestore) => {
1081
- return new OrderFirestoreRepository(firestore);
1215
+ useFactory: (options) => {
1216
+ return new OrderFirestoreRepository(options);
1082
1217
  },
1083
- deps: [Firestore],
1218
+ deps: ['FirestoreOptions'],
1084
1219
  },
1085
1220
  {
1086
1221
  provide: 'PaymentRepository',
1087
- useFactory: (firestore) => {
1088
- return new PaymentFirestoreRepository(firestore);
1222
+ useFactory: (options) => {
1223
+ return new PaymentFirestoreRepository(options);
1089
1224
  },
1090
- deps: [Firestore],
1225
+ deps: ['FirestoreOptions'],
1091
1226
  },
1092
1227
  {
1093
1228
  provide: ProductFirestoreRepository,
1094
- useFactory: (firestore) => {
1095
- return new ProductFirestoreRepository(firestore);
1229
+ useFactory: (options) => {
1230
+ return new ProductFirestoreRepository(options);
1096
1231
  },
1097
- deps: [Firestore],
1232
+ deps: ['FirestoreOptions'],
1098
1233
  },
1099
1234
  {
1100
1235
  provide: 'SubscriptionPaymentRepository',
1101
- useFactory: (firestore, subscriptionRepository) => {
1102
- return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1236
+ useFactory: (options, subscriptionRepository) => {
1237
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
1103
1238
  },
1104
1239
  deps: [Firestore, 'SubscriptionRepository'],
1105
1240
  },
1106
1241
  {
1107
1242
  provide: 'SubscriptionPlanRepository',
1108
- useFactory: (firestore) => {
1109
- return new SubscriptionPlanFirestoreRepository(firestore);
1243
+ useFactory: (options) => {
1244
+ return new SubscriptionPlanFirestoreRepository(options);
1110
1245
  },
1111
- deps: [Firestore],
1246
+ deps: ['FirestoreOptions'],
1112
1247
  },
1113
1248
  {
1114
1249
  provide: 'SubscriptionProductRepository',
1115
- useFactory: (firestore) => {
1116
- return new SubscriptionProductFirestoreRepository(firestore);
1250
+ useFactory: (options) => {
1251
+ return new SubscriptionProductFirestoreRepository(options);
1117
1252
  },
1118
- deps: [Firestore],
1253
+ deps: ['FirestoreOptions'],
1119
1254
  },
1120
1255
  {
1121
1256
  provide: 'SubscriptionRepository',
1122
- useFactory: (firestore) => {
1123
- return new SubscriptionFirestoreRepository(firestore);
1257
+ useFactory: (options) => {
1258
+ return new SubscriptionFirestoreRepository(options);
1124
1259
  },
1125
- deps: [Firestore],
1260
+ deps: ['FirestoreOptions'],
1126
1261
  },
1127
1262
  {
1128
1263
  provide: 'UserRepository',
1129
- useFactory: (firestore) => {
1130
- return new UserFirestoreRepository(firestore);
1264
+ useFactory: (options) => {
1265
+ return new UserFirestoreRepository(options);
1131
1266
  },
1132
- deps: [Firestore],
1267
+ deps: ['FirestoreOptions'],
1133
1268
  },
1134
1269
  {
1135
1270
  provide: 'UserAddressRepository',
1136
- useFactory: (firestore, userRepository) => {
1137
- return new UserAddressFirestoreRepository(firestore, userRepository);
1271
+ useFactory: (options, userRepository) => {
1272
+ return new UserAddressFirestoreRepository(options, userRepository);
1138
1273
  },
1139
1274
  deps: [Firestore, 'UserRepository'],
1140
1275
  },
1141
1276
  {
1142
1277
  provide: 'UserPaymentMethodRepository',
1143
- useFactory: (firestore, userRepository) => {
1144
- return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
1278
+ useFactory: (options, userRepository) => {
1279
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
1145
1280
  },
1146
1281
  deps: [Firestore, 'UserRepository'],
1147
1282
  },
1148
1283
  {
1149
1284
  provide: ProductVariantFirestoreRepository,
1150
- useFactory: (firestore, productRepository) => {
1151
- return new ProductVariantFirestoreRepository(firestore, productRepository);
1285
+ useFactory: (options, productRepository) => {
1286
+ return new ProductVariantFirestoreRepository(options, productRepository);
1152
1287
  },
1153
1288
  deps: [Firestore, ProductFirestoreRepository],
1154
1289
  },
@@ -1167,16 +1302,39 @@ class AngularHasuraGraphQLModule {
1167
1302
  AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1168
1303
  AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
1169
1304
  AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
1305
+ {
1306
+ provide: 'HasuraConfig',
1307
+ useFactory: (options, platformId) => ({
1308
+ endpoint: options.endpoint,
1309
+ authOptions: options.credentials,
1310
+ interceptors: {
1311
+ request: (request) => {
1312
+ if (isPlatformBrowser(platformId))
1313
+ return request;
1314
+ const interval = setInterval(() => { }, 100);
1315
+ request.interval = interval;
1316
+ return request;
1317
+ },
1318
+ response: (response, request) => {
1319
+ if (isPlatformBrowser(platformId))
1320
+ return response;
1321
+ clearInterval(request.interval);
1322
+ return response;
1323
+ },
1324
+ },
1325
+ }),
1326
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
1327
+ },
1170
1328
  {
1171
1329
  provide: 'CategoryRepository',
1172
1330
  useExisting: CategoryHasuraGraphQLRepository,
1173
1331
  },
1174
1332
  {
1175
1333
  provide: CategoryHasuraGraphQLRepository,
1176
- useFactory: (options, productRepository) => {
1177
- return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1334
+ useFactory: (hasuraConfig, productRepository) => {
1335
+ return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
1178
1336
  },
1179
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
1337
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
1180
1338
  },
1181
1339
  {
1182
1340
  provide: 'ProductRepository',
@@ -1184,10 +1342,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1184
1342
  },
1185
1343
  {
1186
1344
  provide: ProductHasuraGraphQLRepository,
1187
- useFactory: (options) => {
1188
- return new ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1345
+ useFactory: (hasuraConfig) => {
1346
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1189
1347
  },
1190
- deps: [HASURA_OPTIONS],
1348
+ deps: ['HasuraConfig'],
1191
1349
  },
1192
1350
  {
1193
1351
  provide: 'VariantRepository',
@@ -1195,26 +1353,49 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
1195
1353
  },
1196
1354
  {
1197
1355
  provide: VariantHasuraGraphQLRepository,
1198
- useFactory: (options) => {
1199
- return new VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1356
+ useFactory: (hasuraConfig) => {
1357
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1200
1358
  },
1201
- deps: [HASURA_OPTIONS],
1359
+ deps: ['HasuraConfig'],
1202
1360
  },
1203
1361
  ] });
1204
1362
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
1205
1363
  type: NgModule,
1206
1364
  args: [{
1207
1365
  providers: [
1366
+ {
1367
+ provide: 'HasuraConfig',
1368
+ useFactory: (options, platformId) => ({
1369
+ endpoint: options.endpoint,
1370
+ authOptions: options.credentials,
1371
+ interceptors: {
1372
+ request: (request) => {
1373
+ if (isPlatformBrowser(platformId))
1374
+ return request;
1375
+ const interval = setInterval(() => { }, 100);
1376
+ request.interval = interval;
1377
+ return request;
1378
+ },
1379
+ response: (response, request) => {
1380
+ if (isPlatformBrowser(platformId))
1381
+ return response;
1382
+ clearInterval(request.interval);
1383
+ return response;
1384
+ },
1385
+ },
1386
+ }),
1387
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
1388
+ },
1208
1389
  {
1209
1390
  provide: 'CategoryRepository',
1210
1391
  useExisting: CategoryHasuraGraphQLRepository,
1211
1392
  },
1212
1393
  {
1213
1394
  provide: CategoryHasuraGraphQLRepository,
1214
- useFactory: (options, productRepository) => {
1215
- return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1395
+ useFactory: (hasuraConfig, productRepository) => {
1396
+ return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
1216
1397
  },
1217
- deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
1398
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
1218
1399
  },
1219
1400
  {
1220
1401
  provide: 'ProductRepository',
@@ -1222,10 +1403,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1222
1403
  },
1223
1404
  {
1224
1405
  provide: ProductHasuraGraphQLRepository,
1225
- useFactory: (options) => {
1226
- return new ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1406
+ useFactory: (hasuraConfig) => {
1407
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1227
1408
  },
1228
- deps: [HASURA_OPTIONS],
1409
+ deps: ['HasuraConfig'],
1229
1410
  },
1230
1411
  {
1231
1412
  provide: 'VariantRepository',
@@ -1233,10 +1414,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1233
1414
  },
1234
1415
  {
1235
1416
  provide: VariantHasuraGraphQLRepository,
1236
- useFactory: (options) => {
1237
- return new VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1417
+ useFactory: (hasuraConfig) => {
1418
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1238
1419
  },
1239
- deps: [HASURA_OPTIONS],
1420
+ deps: ['HasuraConfig'],
1240
1421
  },
1241
1422
  ],
1242
1423
  }]
@@ -1252,6 +1433,7 @@ class AngularConnectModule {
1252
1433
  ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
1253
1434
  ...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
1254
1435
  ...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
1436
+ ...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
1255
1437
  ],
1256
1438
  };
1257
1439
  }
@@ -1266,6 +1448,7 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
1266
1448
  CouponService,
1267
1449
  HomeShopService,
1268
1450
  OrderService,
1451
+ ShippingService,
1269
1452
  ], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
1270
1453
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
1271
1454
  type: NgModule,
@@ -1279,6 +1462,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1279
1462
  CouponService,
1280
1463
  HomeShopService,
1281
1464
  OrderService,
1465
+ ShippingService,
1282
1466
  ],
1283
1467
  }]
1284
1468
  }] });
@@ -1287,5 +1471,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
1287
1471
  * Generated bundle index. Do not edit.
1288
1472
  */
1289
1473
 
1290
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
1474
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService, ShippingService };
1291
1475
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map