@infrab4a/connect-angular 5.0.0-beta.78 → 5.0.0-beta.9

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.
Files changed (83) hide show
  1. package/angular-connect.module.d.ts +8 -14
  2. package/angular-firestore.module.d.ts +2 -1
  3. package/angular-hasura-graphql.module.d.ts +1 -1
  4. package/consts/firebase-const.d.ts +0 -1
  5. package/consts/index.d.ts +0 -1
  6. package/esm2020/angular-connect.module.mjs +115 -0
  7. package/esm2020/angular-elastic-search.module.mjs +34 -0
  8. package/esm2020/angular-firebase-auth.module.mjs +115 -0
  9. package/esm2020/angular-firestore.module.mjs +502 -0
  10. package/esm2020/angular-hasura-graphql.module.mjs +265 -0
  11. package/{esm2022 → esm2020}/consts/firebase-const.mjs +1 -2
  12. package/{esm2022 → esm2020}/consts/index.mjs +1 -2
  13. package/esm2020/persistence/cookie-data-persistence.mjs +23 -0
  14. package/{esm2022 → esm2020}/services/auth.service.mjs +6 -6
  15. package/esm2020/services/cart.service.mjs +281 -0
  16. package/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +41 -0
  17. package/{esm2022 → esm2020}/services/catalog/adapters/old-category-structure.adapter.mjs +6 -6
  18. package/esm2020/services/catalog/catalog.service.mjs +185 -0
  19. package/{esm2022 → esm2020}/services/catalog/category.service.mjs +6 -6
  20. package/{esm2022 → esm2020}/services/catalog/models/category-with-tree.model.mjs +1 -1
  21. package/esm2020/services/catalog/wishlist.service.mjs +115 -0
  22. package/{esm2022 → esm2020}/services/checkout-subscription.service.mjs +6 -6
  23. package/{esm2022 → esm2020}/services/checkout.service.mjs +6 -6
  24. package/esm2020/services/coupon.service.mjs +235 -0
  25. package/{esm2022 → esm2020}/services/home-shop.service.mjs +9 -9
  26. package/{esm2022 → esm2020}/services/order.service.mjs +6 -6
  27. package/{esm2022 → esm2020}/services/shipping.service.mjs +6 -6
  28. package/fesm2015/infrab4a-connect-angular.mjs +2408 -0
  29. package/fesm2015/infrab4a-connect-angular.mjs.map +1 -0
  30. package/{fesm2022 → fesm2020}/infrab4a-connect-angular.mjs +670 -1186
  31. package/fesm2020/infrab4a-connect-angular.mjs.map +1 -0
  32. package/package.json +15 -9
  33. package/services/cart.service.d.ts +0 -1
  34. package/services/catalog/catalog.service.d.ts +4 -11
  35. package/services/catalog/wishlist.service.d.ts +4 -16
  36. package/services/checkout.service.d.ts +1 -4
  37. package/services/coupon.service.d.ts +2 -6
  38. package/angular-vertex-search.module.d.ts +0 -9
  39. package/consts/vertex-config.const.d.ts +0 -1
  40. package/esm2022/angular-connect.module.mjs +0 -189
  41. package/esm2022/angular-elastic-search.module.mjs +0 -34
  42. package/esm2022/angular-firebase-auth.module.mjs +0 -141
  43. package/esm2022/angular-firestore.module.mjs +0 -527
  44. package/esm2022/angular-hasura-graphql.module.mjs +0 -331
  45. package/esm2022/angular-vertex-search.module.mjs +0 -34
  46. package/esm2022/consts/vertex-config.const.mjs +0 -2
  47. package/esm2022/persistence/cookie-data-persistence.mjs +0 -22
  48. package/esm2022/services/cart.service.mjs +0 -293
  49. package/esm2022/services/catalog/adapters/new-category-structure.adapter.mjs +0 -43
  50. package/esm2022/services/catalog/catalog.service.mjs +0 -295
  51. package/esm2022/services/catalog/wishlist.service.mjs +0 -235
  52. package/esm2022/services/coupon.service.mjs +0 -284
  53. package/fesm2022/infrab4a-connect-angular.mjs.map +0 -1
  54. /package/{esm2022 → esm2020}/consts/backend-url.const.mjs +0 -0
  55. /package/{esm2022 → esm2020}/consts/category-structure.mjs +0 -0
  56. /package/{esm2022 → esm2020}/consts/default-shop.const.mjs +0 -0
  57. /package/{esm2022 → esm2020}/consts/es-config.const.mjs +0 -0
  58. /package/{esm2022 → esm2020}/consts/hasura-options.const.mjs +0 -0
  59. /package/{esm2022 → esm2020}/consts/persistence.const.mjs +0 -0
  60. /package/{esm2022 → esm2020}/consts/storage-base-url.const.mjs +0 -0
  61. /package/{esm2022 → esm2020}/helpers/index.mjs +0 -0
  62. /package/{esm2022 → esm2020}/helpers/mobile-operation-system-checker.helper.mjs +0 -0
  63. /package/{esm2022 → esm2020}/index.mjs +0 -0
  64. /package/{esm2022 → esm2020}/infrab4a-connect-angular.mjs +0 -0
  65. /package/{esm2022 → esm2020}/persistence/data-persistence.mjs +0 -0
  66. /package/{esm2022 → esm2020}/persistence/index.mjs +0 -0
  67. /package/{esm2022 → esm2020}/services/catalog/adapters/category-structure.adapter.mjs +0 -0
  68. /package/{esm2022 → esm2020}/services/catalog/adapters/index.mjs +0 -0
  69. /package/{esm2022 → esm2020}/services/catalog/enums/index.mjs +0 -0
  70. /package/{esm2022 → esm2020}/services/catalog/enums/product-sorts.enum.mjs +0 -0
  71. /package/{esm2022 → esm2020}/services/catalog/index.mjs +0 -0
  72. /package/{esm2022 → esm2020}/services/catalog/models/index.mjs +0 -0
  73. /package/{esm2022 → esm2020}/services/catalog/types/index.mjs +0 -0
  74. /package/{esm2022 → esm2020}/services/catalog/types/product-sort.type.mjs +0 -0
  75. /package/{esm2022 → esm2020}/services/helpers/index.mjs +0 -0
  76. /package/{esm2022 → esm2020}/services/helpers/util.helper.mjs +0 -0
  77. /package/{esm2022 → esm2020}/services/index.mjs +0 -0
  78. /package/{esm2022 → esm2020}/services/types/index.mjs +0 -0
  79. /package/{esm2022 → esm2020}/services/types/required-checkout-data.type.mjs +0 -0
  80. /package/{esm2022 → esm2020}/services/types/required-checkout-subscription-data.type.mjs +0 -0
  81. /package/{esm2022 → esm2020}/services/types/shipping-methods.type.mjs +0 -0
  82. /package/{esm2022 → esm2020}/types/firebase-app-config.type.mjs +0 -0
  83. /package/{esm2022 → esm2020}/types/index.mjs +0 -0
@@ -2,17 +2,15 @@ import * as i0 from '@angular/core';
2
2
  import { NgModule, InjectionToken, PLATFORM_ID, Injectable, Inject } from '@angular/core';
3
3
  import * as i1$4 from '@angular/fire/app';
4
4
  import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
5
- import * as i2 from '@angular/fire/app-check';
6
- import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
7
- import * as i3 from '@angular/fire/storage';
8
- import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
9
5
  import * as i1$2 from '@infrab4a/connect';
10
- import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, OrderStatus, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, isEmpty, Category, PersonTypes, WishlistLogType, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
6
+ import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, FirebaseFileUploaderService, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage } from '@infrab4a/connect';
11
7
  import * as i1 from '@angular/fire/auth';
12
- import { Auth, provideAuth, initializeAuth, indexedDBLocalPersistence, browserLocalPersistence, getAuth, getIdToken, authState } from '@angular/fire/auth';
8
+ import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
13
9
  import { isPlatformBrowser, isPlatformServer } from '@angular/common';
14
10
  import * as i1$1 from '@angular/fire/firestore';
15
- import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
11
+ import { Firestore, provideFirestore, getFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
12
+ import * as i2 from '@angular/fire/storage';
13
+ import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
16
14
  import cookie from 'js-cookie';
17
15
  import { of, from, combineLatest, throwError, Subject, iif, forkJoin } from 'rxjs';
18
16
  import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
@@ -29,17 +27,17 @@ class AngularElasticSeachModule {
29
27
  providers: [{ provide: ES_CONFIG, useValue: options }],
30
28
  };
31
29
  }
32
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
33
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularElasticSeachModule }); }
34
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularElasticSeachModule, providers: [
35
- {
36
- provide: ProductsIndex,
37
- useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
38
- deps: [ES_CONFIG],
39
- },
40
- ] }); }
41
30
  }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
31
+ AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
32
+ AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
33
+ AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
34
+ {
35
+ provide: ProductsIndex,
36
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
37
+ deps: [ES_CONFIG],
38
+ },
39
+ ] });
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
43
41
  type: NgModule,
44
42
  args: [{
45
43
  providers: [
@@ -60,14 +58,11 @@ const DEFAULT_SHOP = 'DEFAULT_SHOP';
60
58
 
61
59
  const FIREBASE_APP_NAME = new InjectionToken('firebaseAppName');
62
60
  const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
63
- const APP_CHECK_PROVIDER = new InjectionToken('appCheckProvider');
64
61
 
65
62
  const HASURA_OPTIONS = 'HASURA_OPTIONS';
66
63
 
67
64
  const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
68
65
 
69
- const VERTEX_CONFIG = 'VERTEX_CONFIG';
70
-
71
66
  class AngularFirebaseAuthModule {
72
67
  static initializeApp(options, nameOrConfig) {
73
68
  return {
@@ -78,83 +73,57 @@ class AngularFirebaseAuthModule {
78
73
  ],
79
74
  };
80
75
  }
81
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
82
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1.AuthModule] }); }
83
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
84
- {
85
- provide: 'Authentication',
86
- useFactory: (authenticationService, userRepository) => {
87
- return new Authentication(authenticationService, userRepository);
88
- },
89
- deps: ['AuthenticationService', 'UserRepository'],
90
- },
91
- {
92
- provide: 'AuthenticationService',
93
- useFactory: (angularFireAuth) => {
94
- return new AuthenticationFirebaseAuthService(angularFireAuth);
95
- },
96
- deps: [Auth],
97
- },
98
- {
99
- provide: 'Register',
100
- useFactory: (registerService, userRepository) => {
101
- return new Register(registerService, userRepository);
102
- },
103
- deps: ['RegisterService', 'UserRepository'],
104
- },
105
- {
106
- provide: 'RegisterService',
107
- useFactory: (angularFireAuth) => {
108
- return new RegisterFirebaseAuthService(angularFireAuth);
109
- },
110
- deps: [Auth],
111
- },
112
- {
113
- provide: 'SignOut',
114
- useFactory: (authenticationService) => {
115
- return new SignOut(authenticationService);
116
- },
117
- deps: ['AuthenticationService'],
118
- },
119
- {
120
- provide: 'RecoveryPassword',
121
- useFactory: (authenticationService) => {
122
- return new RecoveryPassword(authenticationService);
123
- },
124
- deps: ['AuthenticationService'],
125
- },
126
- ], imports: [provideAuth((injector) => {
127
- const app = injector.get(FirebaseApp);
128
- try {
129
- return initializeAuth(app, {
130
- persistence: [indexedDBLocalPersistence, browserLocalPersistence],
131
- });
132
- }
133
- catch (error) {
134
- if (error instanceof Error)
135
- console.error('Error initializing auth', error.message);
136
- return getAuth(app);
137
- }
138
- })] }); }
139
76
  }
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
77
+ AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
78
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1.AuthModule] });
79
+ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
80
+ {
81
+ provide: 'Authentication',
82
+ useFactory: (authenticationService, userRepository) => {
83
+ return new Authentication(authenticationService, userRepository);
84
+ },
85
+ deps: ['AuthenticationService', 'UserRepository'],
86
+ },
87
+ {
88
+ provide: 'AuthenticationService',
89
+ useFactory: (angularFireAuth) => {
90
+ return new AuthenticationFirebaseAuthService(angularFireAuth);
91
+ },
92
+ deps: [Auth],
93
+ },
94
+ {
95
+ provide: 'Register',
96
+ useFactory: (registerService, userRepository) => {
97
+ return new Register(registerService, userRepository);
98
+ },
99
+ deps: ['RegisterService', 'UserRepository'],
100
+ },
101
+ {
102
+ provide: 'RegisterService',
103
+ useFactory: (angularFireAuth) => {
104
+ return new RegisterFirebaseAuthService(angularFireAuth);
105
+ },
106
+ deps: [Auth],
107
+ },
108
+ {
109
+ provide: 'SignOut',
110
+ useFactory: (authenticationService) => {
111
+ return new SignOut(authenticationService);
112
+ },
113
+ deps: ['AuthenticationService'],
114
+ },
115
+ {
116
+ provide: 'RecoveryPassword',
117
+ useFactory: (authenticationService) => {
118
+ return new RecoveryPassword(authenticationService);
119
+ },
120
+ deps: ['AuthenticationService'],
121
+ },
122
+ ], imports: [provideAuth((injector) => getAuth(injector.get(FirebaseApp)))] });
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
141
124
  type: NgModule,
142
125
  args: [{
143
- imports: [
144
- provideAuth((injector) => {
145
- const app = injector.get(FirebaseApp);
146
- try {
147
- return initializeAuth(app, {
148
- persistence: [indexedDBLocalPersistence, browserLocalPersistence],
149
- });
150
- }
151
- catch (error) {
152
- if (error instanceof Error)
153
- console.error('Error initializing auth', error.message);
154
- return getAuth(app);
155
- }
156
- }),
157
- ],
126
+ imports: [provideAuth((injector) => getAuth(injector.get(FirebaseApp)))],
158
127
  providers: [
159
128
  {
160
129
  provide: 'Authentication',
@@ -202,6 +171,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
202
171
  }]
203
172
  }] });
204
173
 
174
+ const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
175
+
205
176
  class MobileOperationSystemCheckerHelper {
206
177
  static isAppleDevice() {
207
178
  return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator?.platform) ||
@@ -220,280 +191,266 @@ class AngularFirestoreModule {
220
191
  ],
221
192
  };
222
193
  }
223
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
224
- static { thismod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule] }); }
225
- static { thisinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, providers: [
226
- {
227
- provide: 'FirestoreOptions',
228
- useFactory: (firestore, platformId) => ({
229
- firestore: new ConnectFirestoreService(firestore),
230
- interceptors: {
231
- request: (request) => {
232
- if (isPlatformBrowser(platformId))
233
- return request;
234
- const interval = setInterval(() => { }, 100);
235
- request.interval = interval;
194
+ }
195
+ AngularFirestoreModulefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
196
+ AngularFirestoreModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule, i2.StorageModule] });
197
+ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
198
+ {
199
+ provide: 'FirestoreOptions',
200
+ useFactory: (firestore, platformId) => ({
201
+ firestore,
202
+ interceptors: {
203
+ request: (request) => {
204
+ if (isPlatformBrowser(platformId))
236
205
  return request;
237
- },
238
- response: (response, request) => {
239
- if (isPlatformBrowser(platformId))
240
- return response;
241
- clearInterval(request.interval);
206
+ const interval = setInterval(() => { }, 100);
207
+ request.interval = interval;
208
+ return request;
209
+ },
210
+ response: (response, request) => {
211
+ if (isPlatformBrowser(platformId))
242
212
  return response;
243
- },
213
+ clearInterval(request.interval);
214
+ return response;
244
215
  },
245
- }),
246
- deps: [Firestore, PLATFORM_ID],
247
- },
248
- {
249
- provide: 'BeautyProfileRepository',
250
- useFactory: (config, userRepository) => {
251
- return new UserBeautyProfileFirestoreRepository(config, userRepository);
252
- },
253
- deps: ['FirestoreOptions', 'UserRepository'],
254
- },
255
- {
256
- provide: 'Buy2WinRepository',
257
- useFactory: (options) => {
258
- return new Buy2WinFirestoreRepository(options);
259
- },
260
- deps: ['FirestoreOptions'],
261
- },
262
- {
263
- provide: CategoryFirestoreRepository,
264
- useFactory: (options) => {
265
- return new CategoryFirestoreRepository(options);
266
- },
267
- deps: ['FirestoreOptions'],
268
- },
269
- {
270
- provide: 'CheckoutRepository',
271
- useFactory: (options) => {
272
- return new CheckoutFirestoreRepository(options);
273
- },
274
- deps: ['FirestoreOptions'],
275
- },
276
- {
277
- provide: 'CheckoutSubscriptionRepository',
278
- useFactory: (options) => {
279
- return new CheckoutSubscriptionFirestoreRepository(options);
280
- },
281
- deps: ['FirestoreOptions'],
282
- },
283
- {
284
- provide: 'CouponRepository',
285
- useFactory: (options) => {
286
- return new CouponFirestoreRepository(options);
287
- },
288
- deps: ['FirestoreOptions'],
289
- },
290
- {
291
- provide: 'CampaignHashtagRepository',
292
- useFactory: (options) => {
293
- return new CampaignHashtagFirestoreRepository(options);
294
- },
295
- deps: ['FirestoreOptions'],
296
- },
297
- {
298
- provide: 'CampaignDashboardRepository',
299
- useFactory: (options) => {
300
- return new CampaignDashboardFirestoreRepository(options);
301
- },
302
- deps: ['FirestoreOptions'],
303
- },
304
- {
305
- provide: 'EditionRepository',
306
- useFactory: (options, subscriptionRepository) => {
307
- return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
308
- },
309
- deps: ['FirestoreOptions', 'SubscriptionRepository'],
310
- },
311
- {
312
- provide: 'HomeRepository',
313
- useFactory: (options) => {
314
- return new HomeFirestoreRepository(options);
315
- },
316
- deps: ['FirestoreOptions'],
317
- },
318
- {
319
- provide: 'LeadRepository',
320
- useFactory: (options) => {
321
- return new LeadFirestoreRepository(options);
322
- },
323
- deps: ['FirestoreOptions'],
324
- },
325
- {
326
- provide: 'LegacyOrderRepository',
327
- useFactory: (options) => {
328
- return new LegacyOrderFirestoreRepository(options);
329
- },
330
- deps: ['FirestoreOptions'],
331
- },
332
- {
333
- provide: 'ShopMenuRepository',
334
- useFactory: (options) => {
335
- return new ShopMenuFirestoreRepository(options);
336
- },
337
- deps: ['FirestoreOptions'],
338
- },
339
- {
340
- provide: 'OrderRepository',
341
- useFactory: (options) => {
342
- return new OrderFirestoreRepository(options);
343
- },
344
- deps: ['FirestoreOptions'],
345
- },
346
- {
347
- provide: 'PaymentRepository',
348
- useFactory: (options) => {
349
- return new PaymentFirestoreRepository(options);
350
- },
351
- deps: ['FirestoreOptions'],
352
- },
353
- {
354
- provide: ProductFirestoreRepository,
355
- useFactory: (options) => {
356
- return new ProductFirestoreRepository(options);
357
- },
358
- deps: ['FirestoreOptions'],
359
- },
360
- {
361
- provide: 'ShopSettingsRepository',
362
- useFactory: (options) => {
363
- return new ShopSettingsFirestoreRepository(options);
364
- },
365
- deps: ['FirestoreOptions'],
366
- },
367
- {
368
- provide: 'SubscriptionPaymentRepository',
369
- useFactory: (options, subscriptionRepository) => {
370
- return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
371
- },
372
- deps: ['FirestoreOptions', 'SubscriptionRepository'],
373
- },
374
- {
375
- provide: 'SubscriptionPlanRepository',
376
- useFactory: (options) => {
377
- return new SubscriptionPlanFirestoreRepository(options);
378
- },
379
- deps: ['FirestoreOptions'],
380
- },
381
- {
382
- provide: 'SubscriptionProductRepository',
383
- useFactory: (options) => {
384
- return new SubscriptionProductFirestoreRepository(options);
385
- },
386
- deps: ['FirestoreOptions'],
387
- },
388
- {
389
- provide: 'SubscriptionRepository',
390
- useFactory: (options) => {
391
- return new SubscriptionFirestoreRepository(options);
392
- },
393
- deps: ['FirestoreOptions'],
394
- },
395
- {
396
- provide: 'UserRepository',
397
- useFactory: (options) => {
398
- return new UserFirestoreRepository(options);
399
- },
400
- deps: ['FirestoreOptions'],
401
- },
402
- {
403
- provide: 'UserAddressRepository',
404
- useFactory: (options, userRepository) => {
405
- return new UserAddressFirestoreRepository(options, userRepository);
406
- },
407
- deps: ['FirestoreOptions', 'UserRepository'],
408
- },
409
- {
410
- provide: 'UserPaymentMethodRepository',
411
- useFactory: (options, userRepository) => {
412
- return new UserPaymentMethodFirestoreRepository(options, userRepository);
413
216
  },
414
- deps: ['FirestoreOptions', 'UserRepository'],
415
- },
416
- {
417
- provide: 'SubscriptionMaterializationRepository',
418
- useFactory: (options) => {
419
- return new SubscriptionMaterializationFirestoreRepository(options);
420
- },
421
- deps: ['FirestoreOptions'],
422
- },
423
- {
424
- provide: 'SubscriptionSummaryRepository',
425
- useFactory: (options) => {
426
- return new SubscriptionSummaryFirestoreRepository(options);
427
- },
428
- deps: ['FirestoreOptions'],
429
- },
430
- {
431
- provide: ProductVariantFirestoreRepository,
432
- useFactory: (options, productRepository) => {
433
- return new ProductVariantFirestoreRepository(options, productRepository);
434
- },
435
- deps: ['FirestoreOptions', ProductFirestoreRepository],
436
- },
437
- {
438
- provide: 'OrderBlockedRepository',
439
- useFactory: (options) => {
440
- return new OrderBlockedFirestoreRepository(options);
441
- },
442
- deps: ['FirestoreOptions'],
443
- },
444
- {
445
- provide: 'LogRepository',
446
- useFactory: (options) => {
447
- return new LogFirestoreRepository(options);
448
- },
449
- deps: ['FirestoreOptions'],
450
- },
451
- {
452
- provide: 'SequenceRepository',
453
- useFactory: (options) => {
454
- return new SequenceFirestoreRepository(options);
455
- },
456
- deps: ['FirestoreOptions'],
457
- },
458
- ], imports: [AngularElasticSeachModule,
459
- provideFirestore((injector) => {
460
- const platformId = injector.get(PLATFORM_ID);
461
- if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
462
- return initializeFirestore(injector.get(FirebaseApp), {
463
- ignoreUndefinedProperties: true,
464
- });
465
- const firestore = initializeFirestore(injector.get(FirebaseApp), {
466
- experimentalForceLongPolling: true,
467
- ignoreUndefinedProperties: true,
468
- localCache: memoryLocalCache(),
469
- });
470
- return firestore;
471
- })] }); }
472
- }
473
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularFirestoreModule, decorators: [{
217
+ }),
218
+ deps: [Firestore, PLATFORM_ID],
219
+ },
220
+ {
221
+ provide: 'BeautyProfileRepository',
222
+ useFactory: (config, userRepository) => {
223
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
224
+ },
225
+ deps: ['FirestoreOptions', 'UserRepository'],
226
+ },
227
+ {
228
+ provide: 'Buy2WinRepository',
229
+ useFactory: (options) => {
230
+ return new Buy2WinFirestoreRepository(options);
231
+ },
232
+ deps: ['FirestoreOptions'],
233
+ },
234
+ {
235
+ provide: CategoryFirestoreRepository,
236
+ useFactory: (options) => {
237
+ return new CategoryFirestoreRepository(options);
238
+ },
239
+ deps: ['FirestoreOptions'],
240
+ },
241
+ {
242
+ provide: 'CheckoutRepository',
243
+ useFactory: (options) => {
244
+ return new CheckoutFirestoreRepository(options);
245
+ },
246
+ deps: ['FirestoreOptions'],
247
+ },
248
+ {
249
+ provide: 'CheckoutSubscriptionRepository',
250
+ useFactory: (options) => {
251
+ return new CheckoutSubscriptionFirestoreRepository(options);
252
+ },
253
+ deps: ['FirestoreOptions'],
254
+ },
255
+ {
256
+ provide: 'CouponRepository',
257
+ useFactory: (options) => {
258
+ return new CouponFirestoreRepository(options);
259
+ },
260
+ deps: ['FirestoreOptions'],
261
+ },
262
+ {
263
+ provide: 'CampaignHashtagRepository',
264
+ useFactory: (options) => {
265
+ return new CampaignHashtagFirestoreRepository(options);
266
+ },
267
+ deps: ['FirestoreOptions'],
268
+ },
269
+ {
270
+ provide: 'CampaignDashboardRepository',
271
+ useFactory: (options) => {
272
+ return new CampaignDashboardFirestoreRepository(options);
273
+ },
274
+ deps: ['FirestoreOptions'],
275
+ },
276
+ {
277
+ provide: 'EditionRepository',
278
+ useFactory: (options, subscriptionRepository) => {
279
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
280
+ },
281
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
282
+ },
283
+ {
284
+ provide: 'HomeRepository',
285
+ useFactory: (options) => {
286
+ return new HomeFirestoreRepository(options);
287
+ },
288
+ deps: ['FirestoreOptions'],
289
+ },
290
+ {
291
+ provide: 'LeadRepository',
292
+ useFactory: (options) => {
293
+ return new LeadFirestoreRepository(options);
294
+ },
295
+ deps: ['FirestoreOptions'],
296
+ },
297
+ {
298
+ provide: 'LegacyOrderRepository',
299
+ useFactory: (options) => {
300
+ return new LegacyOrderFirestoreRepository(options);
301
+ },
302
+ deps: ['FirestoreOptions'],
303
+ },
304
+ {
305
+ provide: 'ShopMenuRepository',
306
+ useFactory: (options) => {
307
+ return new ShopMenuFirestoreRepository(options);
308
+ },
309
+ deps: ['FirestoreOptions'],
310
+ },
311
+ {
312
+ provide: 'OrderRepository',
313
+ useFactory: (options) => {
314
+ return new OrderFirestoreRepository(options);
315
+ },
316
+ deps: ['FirestoreOptions'],
317
+ },
318
+ {
319
+ provide: 'PaymentRepository',
320
+ useFactory: (options) => {
321
+ return new PaymentFirestoreRepository(options);
322
+ },
323
+ deps: ['FirestoreOptions'],
324
+ },
325
+ {
326
+ provide: ProductFirestoreRepository,
327
+ useFactory: (options) => {
328
+ return new ProductFirestoreRepository(options);
329
+ },
330
+ deps: ['FirestoreOptions'],
331
+ },
332
+ {
333
+ provide: 'ShopSettingsRepository',
334
+ useFactory: (options) => {
335
+ return new ShopSettingsFirestoreRepository(options);
336
+ },
337
+ deps: ['FirestoreOptions'],
338
+ },
339
+ {
340
+ provide: 'SubscriptionPaymentRepository',
341
+ useFactory: (options, subscriptionRepository) => {
342
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
343
+ },
344
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
345
+ },
346
+ {
347
+ provide: 'SubscriptionPlanRepository',
348
+ useFactory: (options) => {
349
+ return new SubscriptionPlanFirestoreRepository(options);
350
+ },
351
+ deps: ['FirestoreOptions'],
352
+ },
353
+ {
354
+ provide: 'SubscriptionProductRepository',
355
+ useFactory: (options) => {
356
+ return new SubscriptionProductFirestoreRepository(options);
357
+ },
358
+ deps: ['FirestoreOptions'],
359
+ },
360
+ {
361
+ provide: 'SubscriptionRepository',
362
+ useFactory: (options) => {
363
+ return new SubscriptionFirestoreRepository(options);
364
+ },
365
+ deps: ['FirestoreOptions'],
366
+ },
367
+ {
368
+ provide: 'UserRepository',
369
+ useFactory: (options) => {
370
+ return new UserFirestoreRepository(options);
371
+ },
372
+ deps: ['FirestoreOptions'],
373
+ },
374
+ {
375
+ provide: 'UserAddressRepository',
376
+ useFactory: (options, userRepository) => {
377
+ return new UserAddressFirestoreRepository(options, userRepository);
378
+ },
379
+ deps: ['FirestoreOptions', 'UserRepository'],
380
+ },
381
+ {
382
+ provide: 'UserPaymentMethodRepository',
383
+ useFactory: (options, userRepository) => {
384
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
385
+ },
386
+ deps: ['FirestoreOptions', 'UserRepository'],
387
+ },
388
+ {
389
+ provide: 'SubscriptionMaterializationRepository',
390
+ useFactory: (options) => {
391
+ return new SubscriptionMaterializationFirestoreRepository(options);
392
+ },
393
+ deps: ['FirestoreOptions'],
394
+ },
395
+ {
396
+ provide: 'SubscriptionSummaryRepository',
397
+ useFactory: (options) => {
398
+ return new SubscriptionSummaryFirestoreRepository(options);
399
+ },
400
+ deps: ['FirestoreOptions'],
401
+ },
402
+ {
403
+ provide: ProductVariantFirestoreRepository,
404
+ useFactory: (options, productRepository) => {
405
+ return new ProductVariantFirestoreRepository(options, productRepository);
406
+ },
407
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
408
+ },
409
+ {
410
+ provide: 'FileUploaderService',
411
+ useFactory: (storage, baseUrl) => {
412
+ return new FirebaseFileUploaderService(storage, baseUrl);
413
+ },
414
+ deps: [Storage, STORAGE_BASE_URL],
415
+ },
416
+ ], imports: [AngularElasticSeachModule,
417
+ provideFirestore((injector) => {
418
+ const platformId = injector.get(PLATFORM_ID);
419
+ if (isPlatformServer(platformId))
420
+ return getFirestore(injector.get(FirebaseApp));
421
+ if (!MobileOperationSystemCheckerHelper.isAppleDevice())
422
+ return getFirestore(injector.get(FirebaseApp));
423
+ const firestore = initializeFirestore(injector.get(FirebaseApp), {
424
+ experimentalForceLongPolling: true,
425
+ localCache: memoryLocalCache(),
426
+ });
427
+ return firestore;
428
+ }),
429
+ provideStorage(() => getStorage())] });
430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
474
431
  type: NgModule,
475
432
  args: [{
476
433
  imports: [
477
434
  AngularElasticSeachModule,
478
435
  provideFirestore((injector) => {
479
436
  const platformId = injector.get(PLATFORM_ID);
480
- if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
481
- return initializeFirestore(injector.get(FirebaseApp), {
482
- ignoreUndefinedProperties: true,
483
- });
437
+ if (isPlatformServer(platformId))
438
+ return getFirestore(injector.get(FirebaseApp));
439
+ if (!MobileOperationSystemCheckerHelper.isAppleDevice())
440
+ return getFirestore(injector.get(FirebaseApp));
484
441
  const firestore = initializeFirestore(injector.get(FirebaseApp), {
485
442
  experimentalForceLongPolling: true,
486
- ignoreUndefinedProperties: true,
487
443
  localCache: memoryLocalCache(),
488
444
  });
489
445
  return firestore;
490
446
  }),
447
+ provideStorage(() => getStorage()),
491
448
  ],
492
449
  providers: [
493
450
  {
494
451
  provide: 'FirestoreOptions',
495
452
  useFactory: (firestore, platformId) => ({
496
- firestore: new ConnectFirestoreService(firestore),
453
+ firestore,
497
454
  interceptors: {
498
455
  request: (request) => {
499
456
  if (isPlatformBrowser(platformId))
@@ -702,25 +659,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
702
659
  deps: ['FirestoreOptions', ProductFirestoreRepository],
703
660
  },
704
661
  {
705
- provide: 'OrderBlockedRepository',
706
- useFactory: (options) => {
707
- return new OrderBlockedFirestoreRepository(options);
708
- },
709
- deps: ['FirestoreOptions'],
710
- },
711
- {
712
- provide: 'LogRepository',
713
- useFactory: (options) => {
714
- return new LogFirestoreRepository(options);
715
- },
716
- deps: ['FirestoreOptions'],
717
- },
718
- {
719
- provide: 'SequenceRepository',
720
- useFactory: (options) => {
721
- return new SequenceFirestoreRepository(options);
662
+ provide: 'FileUploaderService',
663
+ useFactory: (storage, baseUrl) => {
664
+ return new FirebaseFileUploaderService(storage, baseUrl);
722
665
  },
723
- deps: ['FirestoreOptions'],
666
+ deps: [Storage, STORAGE_BASE_URL],
724
667
  },
725
668
  ],
726
669
  }]
@@ -733,165 +676,132 @@ class AngularHasuraGraphQLModule {
733
676
  providers: [{ provide: HASURA_OPTIONS, useValue: options }],
734
677
  };
735
678
  }
736
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
737
- static { thismod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularHasuraGraphQLModule }); }
738
- static { thisinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
739
- {
740
- provide: 'HasuraConfig',
741
- useFactory: (options, platformId) => ({
742
- endpoint: options.endpoint,
743
- authOptions: options.credentials,
744
- interceptors: {
745
- request: (request) => {
746
- if (isPlatformBrowser(platformId))
747
- return request;
748
- const interval = setInterval(() => { }, 100);
749
- request.interval = interval;
679
+ }
680
+ AngularHasuraGraphQLModulefac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
681
+ AngularHasuraGraphQLModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
682
+ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
683
+ {
684
+ provide: 'HasuraConfig',
685
+ useFactory: (options, platformId) => ({
686
+ endpoint: options.endpoint,
687
+ authOptions: options.credentials,
688
+ interceptors: {
689
+ request: (request) => {
690
+ if (isPlatformBrowser(platformId))
750
691
  return request;
751
- },
752
- response: (response, request) => {
753
- if (isPlatformBrowser(platformId))
754
- return response;
755
- clearInterval(request.interval);
692
+ const interval = setInterval(() => { }, 100);
693
+ request.interval = interval;
694
+ return request;
695
+ },
696
+ response: (response, request) => {
697
+ if (isPlatformBrowser(platformId))
756
698
  return response;
757
- },
699
+ clearInterval(request.interval);
700
+ return response;
758
701
  },
759
- }),
760
- deps: [HASURA_OPTIONS, PLATFORM_ID],
761
- },
762
- {
763
- provide: 'CategoryRepository',
764
- useExisting: CategoryHasuraGraphQLRepository,
765
- },
766
- {
767
- provide: CategoryHasuraGraphQLRepository,
768
- useFactory: (options, productRepository, categoryFilterRepository) => {
769
- return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
770
- },
771
- deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
772
- },
773
- {
774
- provide: 'ProductRepository',
775
- useExisting: ProductHasuraGraphQLRepository,
776
- },
777
- {
778
- provide: ProductHasuraGraphQLRepository,
779
- useFactory: (hasuraConfig) => {
780
- return new ProductHasuraGraphQLRepository(hasuraConfig);
781
- },
782
- deps: ['HasuraConfig'],
783
- },
784
- {
785
- provide: 'ProductReviewsRepository',
786
- useExisting: ProductReviewsHasuraGraphQLRepository,
787
- },
788
- {
789
- provide: ProductReviewsHasuraGraphQLRepository,
790
- useFactory: (hasuraConfig) => {
791
- return new ProductReviewsHasuraGraphQLRepository(hasuraConfig);
792
- },
793
- deps: ['HasuraConfig'],
794
- },
795
- {
796
- provide: 'VariantRepository',
797
- useExisting: VariantHasuraGraphQLRepository,
798
- },
799
- {
800
- provide: VariantHasuraGraphQLRepository,
801
- useFactory: (hasuraConfig) => {
802
- return new VariantHasuraGraphQLRepository(hasuraConfig);
803
- },
804
- deps: ['HasuraConfig'],
805
- },
806
- {
807
- provide: 'ProductStockNotificationRepository',
808
- useExisting: ProductStockNotificationHasuraGraphQLRepository,
809
- },
810
- {
811
- provide: ProductStockNotificationHasuraGraphQLRepository,
812
- useFactory: (hasuraConfig) => {
813
- return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
814
- },
815
- deps: ['HasuraConfig'],
816
- },
817
- {
818
- provide: 'CategoryFilterRepository',
819
- useExisting: CategoryFilterHasuraGraphQLRepository,
820
- },
821
- {
822
- provide: CategoryFilterHasuraGraphQLRepository,
823
- useFactory: (options) => {
824
- return new CategoryFilterHasuraGraphQLRepository(options);
825
- },
826
- deps: ['HasuraConfig'],
827
- },
828
- {
829
- provide: 'FilterOptionRepository',
830
- useExisting: FilterOptionHasuraGraphQLRepository,
831
- },
832
- {
833
- provide: FilterOptionHasuraGraphQLRepository,
834
- useFactory: (options) => {
835
- return new FilterOptionHasuraGraphQLRepository(options);
836
- },
837
- deps: ['HasuraConfig'],
838
- },
839
- {
840
- provide: 'FilterRepository',
841
- useExisting: FilterHasuraGraphQLRepository,
842
- },
843
- {
844
- provide: FilterHasuraGraphQLRepository,
845
- useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
846
- return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
847
- },
848
- deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
849
- },
850
- {
851
- provide: CategoryCollectionChildrenHasuraGraphQLRepository,
852
- useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
853
- deps: ['HasuraConfig'],
854
- },
855
- {
856
- provide: 'CategoryCollectionChildrenRepository',
857
- useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
858
- },
859
- {
860
- provide: CategoryProductHasuraGraphQLRepository,
861
- useFactory: (options) => {
862
- return new CategoryProductHasuraGraphQLRepository(options);
863
- },
864
- deps: ['HasuraConfig'],
865
- },
866
- {
867
- provide: 'CategoryProductRepository',
868
- useExisting: CategoryProductHasuraGraphQLRepository,
869
- },
870
- {
871
- provide: WishlistHasuraGraphQLRepository,
872
- useFactory: (options, categoryProductRepository) => {
873
- return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
874
- },
875
- deps: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
876
- },
877
- {
878
- provide: 'WishlistRepository',
879
- useExisting: WishlistHasuraGraphQLRepository,
880
- },
881
- {
882
- provide: ProductErrorsHasuraGraphQLRepository,
883
- useFactory: (options) => {
884
- return new ProductErrorsHasuraGraphQLRepository(options);
885
702
  },
886
- deps: ['HasuraConfig'],
887
- },
888
- {
889
- provide: 'ProductErrorsRepository',
890
- useExisting: ProductErrorsHasuraGraphQLRepository,
891
- },
892
- ] }); }
893
- }
894
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
703
+ }),
704
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
705
+ },
706
+ {
707
+ provide: 'CategoryRepository',
708
+ useExisting: CategoryHasuraGraphQLRepository,
709
+ },
710
+ {
711
+ provide: CategoryHasuraGraphQLRepository,
712
+ useFactory: (options, productRepository, categoryFilterRepository) => {
713
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
714
+ },
715
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
716
+ },
717
+ {
718
+ provide: 'ProductRepository',
719
+ useExisting: ProductHasuraGraphQLRepository,
720
+ },
721
+ {
722
+ provide: ProductHasuraGraphQLRepository,
723
+ useFactory: (hasuraConfig) => {
724
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
725
+ },
726
+ deps: ['HasuraConfig'],
727
+ },
728
+ {
729
+ provide: 'ProductReviewsRepository',
730
+ useExisting: ProductReviewsHasuraGraphQLRepository,
731
+ },
732
+ {
733
+ provide: ProductReviewsHasuraGraphQLRepository,
734
+ useFactory: (hasuraConfig) => {
735
+ return new ProductReviewsHasuraGraphQLRepository(hasuraConfig);
736
+ },
737
+ deps: ['HasuraConfig'],
738
+ },
739
+ {
740
+ provide: 'VariantRepository',
741
+ useExisting: VariantHasuraGraphQLRepository,
742
+ },
743
+ {
744
+ provide: VariantHasuraGraphQLRepository,
745
+ useFactory: (hasuraConfig) => {
746
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
747
+ },
748
+ deps: ['HasuraConfig'],
749
+ },
750
+ {
751
+ provide: 'CategoryFilterRepository',
752
+ useExisting: CategoryFilterHasuraGraphQLRepository,
753
+ },
754
+ {
755
+ provide: CategoryFilterHasuraGraphQLRepository,
756
+ useFactory: (options) => {
757
+ return new CategoryFilterHasuraGraphQLRepository(options);
758
+ },
759
+ deps: ['HasuraConfig'],
760
+ },
761
+ {
762
+ provide: 'FilterOptionRepository',
763
+ useExisting: FilterOptionHasuraGraphQLRepository,
764
+ },
765
+ {
766
+ provide: FilterOptionHasuraGraphQLRepository,
767
+ useFactory: (options) => {
768
+ return new FilterOptionHasuraGraphQLRepository(options);
769
+ },
770
+ deps: ['HasuraConfig'],
771
+ },
772
+ {
773
+ provide: 'FilterRepository',
774
+ useExisting: FilterHasuraGraphQLRepository,
775
+ },
776
+ {
777
+ provide: FilterHasuraGraphQLRepository,
778
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
779
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
780
+ },
781
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
782
+ },
783
+ {
784
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
785
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
786
+ deps: ['HasuraConfig'],
787
+ },
788
+ {
789
+ provide: 'CategoryCollectionChildrenRepository',
790
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
791
+ },
792
+ {
793
+ provide: WishlistHasuraGraphQLRepository,
794
+ useFactory: (options, categoryFilterRepository) => {
795
+ return new WishlistHasuraGraphQLRepository(options, categoryFilterRepository);
796
+ },
797
+ deps: ['HasuraConfig', CategoryFilterHasuraGraphQLRepository],
798
+ },
799
+ {
800
+ provide: 'WishlistRepository',
801
+ useExisting: WishlistHasuraGraphQLRepository,
802
+ },
803
+ ] });
804
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
895
805
  type: NgModule,
896
806
  args: [{
897
807
  providers: [
@@ -962,17 +872,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
962
872
  },
963
873
  deps: ['HasuraConfig'],
964
874
  },
965
- {
966
- provide: 'ProductStockNotificationRepository',
967
- useExisting: ProductStockNotificationHasuraGraphQLRepository,
968
- },
969
- {
970
- provide: ProductStockNotificationHasuraGraphQLRepository,
971
- useFactory: (hasuraConfig) => {
972
- return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
973
- },
974
- deps: ['HasuraConfig'],
975
- },
976
875
  {
977
876
  provide: 'CategoryFilterRepository',
978
877
  useExisting: CategoryFilterHasuraGraphQLRepository,
@@ -1015,89 +914,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1015
914
  provide: 'CategoryCollectionChildrenRepository',
1016
915
  useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
1017
916
  },
1018
- {
1019
- provide: CategoryProductHasuraGraphQLRepository,
1020
- useFactory: (options) => {
1021
- return new CategoryProductHasuraGraphQLRepository(options);
1022
- },
1023
- deps: ['HasuraConfig'],
1024
- },
1025
- {
1026
- provide: 'CategoryProductRepository',
1027
- useExisting: CategoryProductHasuraGraphQLRepository,
1028
- },
1029
917
  {
1030
918
  provide: WishlistHasuraGraphQLRepository,
1031
- useFactory: (options, categoryProductRepository) => {
1032
- return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
919
+ useFactory: (options, categoryFilterRepository) => {
920
+ return new WishlistHasuraGraphQLRepository(options, categoryFilterRepository);
1033
921
  },
1034
- deps: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
922
+ deps: ['HasuraConfig', CategoryFilterHasuraGraphQLRepository],
1035
923
  },
1036
924
  {
1037
925
  provide: 'WishlistRepository',
1038
926
  useExisting: WishlistHasuraGraphQLRepository,
1039
927
  },
1040
- {
1041
- provide: ProductErrorsHasuraGraphQLRepository,
1042
- useFactory: (options) => {
1043
- return new ProductErrorsHasuraGraphQLRepository(options);
1044
- },
1045
- deps: ['HasuraConfig'],
1046
- },
1047
- {
1048
- provide: 'ProductErrorsRepository',
1049
- useExisting: ProductErrorsHasuraGraphQLRepository,
1050
- },
1051
- ],
1052
- }]
1053
- }] });
1054
-
1055
- class AngularVertexSeachModule {
1056
- static initializeApp(options) {
1057
- return {
1058
- ngModule: AngularVertexSeachModule,
1059
- providers: [{ provide: VERTEX_CONFIG, useValue: options }],
1060
- };
1061
- }
1062
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1063
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule }); }
1064
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule, providers: [
1065
- {
1066
- provide: ProductsVertexSearch,
1067
- useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
1068
- deps: [VERTEX_CONFIG],
1069
- },
1070
- ] }); }
1071
- }
1072
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularVertexSeachModule, decorators: [{
1073
- type: NgModule,
1074
- args: [{
1075
- providers: [
1076
- {
1077
- provide: ProductsVertexSearch,
1078
- useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
1079
- deps: [VERTEX_CONFIG],
1080
- },
1081
928
  ],
1082
929
  }]
1083
930
  }] });
1084
931
 
1085
- const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
1086
-
1087
932
  class CookieDataPersistence {
1088
933
  get(key) {
1089
934
  return of(cookie.get(key));
1090
935
  }
1091
936
  remove(key) {
1092
- return of(cookie.remove(key));
937
+ cookie.remove(key);
938
+ return;
1093
939
  }
1094
940
  set(key, value) {
1095
941
  return from(cookie.set(key, value)).pipe(map(() => { }));
1096
942
  }
1097
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1098
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence }); }
1099
943
  }
1100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CookieDataPersistence, decorators: [{
944
+ CookieDataPersistence.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
945
+ CookieDataPersistence.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence });
946
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, decorators: [{
1101
947
  type: Injectable
1102
948
  }] });
1103
949
 
@@ -1122,15 +968,15 @@ class AuthService {
1122
968
  getFireUser() {
1123
969
  return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
1124
970
  }
1125
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AuthService, deps: [{ token: i1.Auth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1126
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AuthService }); }
1127
971
  }
1128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AuthService, decorators: [{
972
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, deps: [{ token: i1.Auth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
973
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
974
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
1129
975
  type: Injectable
1130
- }], ctorParameters: () => [{ type: i1.Auth }, { type: undefined, decorators: [{
976
+ }], ctorParameters: function () { return [{ type: i1.Auth }, { type: undefined, decorators: [{
1131
977
  type: Inject,
1132
978
  args: ['UserRepository']
1133
- }] }] });
979
+ }] }]; } });
1134
980
 
1135
981
  class CouponService {
1136
982
  constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
@@ -1181,11 +1027,11 @@ class CouponService {
1181
1027
  throw 'Limite de uso atingido';
1182
1028
  }
1183
1029
  if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
1184
- const ordersCoupon = await this.getOrdersWithCoupon(coupon);
1185
- if (!couponUseLimits.unlimited && couponUseLimits.total && ordersCoupon.length >= couponUseLimits.total)
1030
+ const orders = await this.getOrdersWithCoupon(coupon);
1031
+ if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
1186
1032
  throw 'Limite de uso atingido.';
1187
1033
  if (couponUseLimits.limitedPerUser) {
1188
- const ordersWithUser = this.countOrdersWithUser(ordersCoupon, checkout.user.email);
1034
+ const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
1189
1035
  if (ordersWithUser > 0)
1190
1036
  throw 'Limite de uso por usuário atingido.';
1191
1037
  }
@@ -1194,12 +1040,8 @@ class CouponService {
1194
1040
  if (!hasProductCategories)
1195
1041
  throw 'Seu carrinho não possui produtos elegíveis para desconto.';
1196
1042
  const hasMinSubTotal = await this.hasMinSubTotal(coupon, checkout);
1197
- if (!hasMinSubTotal) {
1198
- if (coupon.productsCategories?.length) {
1199
- throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido na(s) categoria(s) elegíveis para o desconto.`;
1200
- }
1201
- throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido.`;
1202
- }
1043
+ if (!hasMinSubTotal)
1044
+ throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`;
1203
1045
  return coupon;
1204
1046
  }
1205
1047
  calcDiscountSubscription(coupon, checkout) {
@@ -1211,53 +1053,45 @@ class CouponService {
1211
1053
  return of(discount);
1212
1054
  }
1213
1055
  async calcDiscountShopping(coupon, checkout) {
1214
- let discountInfo = null;
1056
+ let discount = 0;
1215
1057
  if (checkout.user.isSubscriber && coupon.discount.subscriber.value) {
1216
- discountInfo = await this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
1058
+ discount = await this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
1217
1059
  }
1218
1060
  else {
1219
- discountInfo = await this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
1061
+ discount = await this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
1220
1062
  }
1221
- return { discount: discountInfo.discount, lineItems: discountInfo.lineItems };
1063
+ return discount;
1222
1064
  }
1223
1065
  async calcDiscountByType(type, value, categories, checkout) {
1224
1066
  let discount = 0;
1225
- if (type == CouponTypes.SHIPPING) {
1226
- const subTotal = checkout.shipping.ShippingPrice;
1227
- const discount = +(subTotal * ((value > 100 ? 100 : value) / 100)).toFixed(2);
1228
- return { discount, lineItems: checkout.lineItems };
1229
- }
1230
- const lineItensElegibleForDiscount = await this.getLineItensEligebleForDiscount(categories, checkout);
1231
- const subTotal = this.calcCheckoutSubtotal(lineItensElegibleForDiscount, checkout.user);
1067
+ let lineItensDiscount = await this.getLineItensEligebleForDiscount(categories, checkout);
1068
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1232
1069
  if (type == CouponTypes.ABSOLUTE) {
1233
1070
  discount = value > subTotal ? subTotal : value;
1234
1071
  }
1235
1072
  else {
1236
- discount = +(subTotal * ((value > 100 ? 100 : value) / 100)).toFixed(2);
1073
+ discount = subTotal * (value / 100);
1237
1074
  }
1238
- const lineItems = this.calcLineItenDiscount(type, lineItensElegibleForDiscount, value, subTotal);
1239
- return { discount, lineItems };
1075
+ return discount;
1240
1076
  }
1241
1077
  async hasMinSubTotal(coupon, checkout) {
1242
1078
  if (!coupon.minSubTotalValue)
1243
1079
  return true;
1244
- const lineItensDiscount = await this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
1245
- const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user);
1080
+ let lineItensDiscount = await this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
1081
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1246
1082
  if (coupon.minSubTotalValue <= subTotal)
1247
1083
  return true;
1248
1084
  return false;
1249
1085
  }
1250
1086
  async hasProductCategories(coupon, checkout) {
1251
- if (!coupon.productsCategories || !coupon.productsCategories?.length) {
1087
+ if (!coupon.productsCategories || !coupon.productsCategories.length) {
1252
1088
  return true;
1253
1089
  }
1254
1090
  const couponCategories = await this.getCouponCategoriesId(coupon.productsCategories);
1255
- const hasCategories = checkout.lineItems?.filter((item) => {
1256
- if (item.isGift)
1257
- return false;
1258
- if (!item.categories || !item.categories?.length)
1091
+ const hasCategories = checkout.lineItems?.filter((i) => {
1092
+ if (!i.categories || !i.categories?.length)
1259
1093
  return true;
1260
- return item.categories.some((c) => couponCategories.some((cat) => cat == c));
1094
+ return i.categories.some((c) => couponCategories.some((cat) => cat == c));
1261
1095
  });
1262
1096
  return hasCategories.length ? true : false;
1263
1097
  }
@@ -1300,24 +1134,20 @@ class CouponService {
1300
1134
  let lineItensDiscount = [];
1301
1135
  const couponCategories = await this.getCouponCategoriesId(productsCategories);
1302
1136
  if (productsCategories && productsCategories.length) {
1303
- lineItensDiscount = checkout.lineItems?.filter((item) => {
1304
- if (item.isGift)
1305
- return false;
1306
- if (item.categories?.length) {
1307
- return item.categories.some((c) => couponCategories.some((cat) => cat == c));
1137
+ lineItensDiscount = checkout.lineItems?.filter((i) => {
1138
+ if (i.categories?.length) {
1139
+ return i.categories.some((c) => couponCategories.some((cat) => cat == c));
1308
1140
  }
1309
1141
  return true;
1310
1142
  });
1311
1143
  }
1312
1144
  else {
1313
- lineItensDiscount = checkout.lineItems.filter((item) => !item.isGift);
1145
+ lineItensDiscount = checkout.lineItems;
1314
1146
  }
1315
1147
  return lineItensDiscount;
1316
1148
  }
1317
- calcCheckoutSubtotal(lineItens, user) {
1318
- return (lineItens
1319
- ?.filter((item) => !item.isGift)
1320
- .reduce((acc, curr) => user?.isSubscriber && curr.price.subscriberPrice
1149
+ calcCheckoutSubtotal(lineItens, user, shop) {
1150
+ return (lineItens?.reduce((acc, curr) => user?.isSubscriber && curr.price.subscriberPrice
1321
1151
  ? acc + curr.price?.subscriberPrice * curr.quantity
1322
1152
  : acc + curr.pricePaid * curr.quantity, 0) || 0);
1323
1153
  }
@@ -1326,7 +1156,7 @@ class CouponService {
1326
1156
  .find({
1327
1157
  filters: {
1328
1158
  coupon: { id: coupon.id },
1329
- status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
1159
+ payment: { status: 'paid' },
1330
1160
  },
1331
1161
  })
1332
1162
  .then((result) => result.data);
@@ -1336,7 +1166,7 @@ class CouponService {
1336
1166
  .find({
1337
1167
  filters: {
1338
1168
  user: { email: { operator: Where.EQUALS, value: email } },
1339
- status: { operator: Where.NOTEQUALS, value: OrderStatus.CANCELADO },
1169
+ payment: { status: 'paid' },
1340
1170
  },
1341
1171
  })
1342
1172
  .then((result) => result.data);
@@ -1347,55 +1177,22 @@ class CouponService {
1347
1177
  getCouponUseLimits(coupon, checkoutType, user) {
1348
1178
  let couponUseLimits;
1349
1179
  if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
1350
- if (coupon.exclusivityType.length === 1 &&
1351
- (coupon.exclusivityType.at(0) === Exclusivities.SPECIFIC_USER ||
1352
- coupon.exclusivityType.at(0) === Exclusivities.COLLABORATORS))
1353
- couponUseLimits = coupon.useLimits.non_subscriber;
1354
- else
1355
- couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
1180
+ couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
1356
1181
  }
1357
1182
  else {
1358
1183
  couponUseLimits = coupon.useLimits.subscription;
1359
1184
  }
1360
1185
  return couponUseLimits;
1361
1186
  }
1362
- calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
1363
- let lineItemsDiscount = [];
1364
- if (type === CouponTypes.ABSOLUTE) {
1365
- const couponDiscountMax = couponDiscount > subTotal ? subTotal : couponDiscount;
1366
- lineItemsDiscount = lineItems.map((item) => {
1367
- if (item.isGift)
1368
- return item;
1369
- const totalItemPercentage = item.pricePaid / subTotal;
1370
- const discountItem = couponDiscountMax * totalItemPercentage;
1371
- return {
1372
- ...item,
1373
- discount: Number(discountItem.toFixed(2)),
1374
- };
1375
- });
1376
- }
1377
- else {
1378
- lineItemsDiscount = lineItems.map((item) => {
1379
- if (item.isGift)
1380
- return item;
1381
- const discountItem = item.pricePaid * (couponDiscount / 100);
1382
- return {
1383
- ...item,
1384
- discount: Number(discountItem.toFixed(2)),
1385
- };
1386
- });
1387
- }
1388
- return lineItemsDiscount;
1389
- }
1390
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1391
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, providedIn: 'root' }); }
1392
1187
  }
1393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CouponService, decorators: [{
1188
+ 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 });
1189
+ CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
1190
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
1394
1191
  type: Injectable,
1395
1192
  args: [{
1396
1193
  providedIn: 'root',
1397
1194
  }]
1398
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1195
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1399
1196
  type: Inject,
1400
1197
  args: ['CouponRepository']
1401
1198
  }] }, { type: i1$2.Shops, decorators: [{
@@ -1407,7 +1204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1407
1204
  }] }, { type: undefined, decorators: [{
1408
1205
  type: Inject,
1409
1206
  args: ['CategoryRepository']
1410
- }] }] });
1207
+ }] }]; } });
1411
1208
 
1412
1209
  class CheckoutService {
1413
1210
  constructor(couponService, checkoutRepository, userRepository, defaultShop, dataPersistence) {
@@ -1449,12 +1246,12 @@ class CheckoutService {
1449
1246
  await this.dataPersistence.set('checkoutId', checkout.id).toPromise();
1450
1247
  return checkout;
1451
1248
  }
1452
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }, { token: PERSISTENCE_PROVIDER }], target: i0.ɵɵFactoryTarget.Injectable }); }
1453
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService }); }
1454
1249
  }
1455
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutService, decorators: [{
1250
+ CheckoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }, { token: PERSISTENCE_PROVIDER }], target: i0.ɵɵFactoryTarget.Injectable });
1251
+ CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService });
1252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService, decorators: [{
1456
1253
  type: Injectable
1457
- }], ctorParameters: () => [{ type: CouponService }, { type: undefined, decorators: [{
1254
+ }], ctorParameters: function () { return [{ type: CouponService }, { type: undefined, decorators: [{
1458
1255
  type: Inject,
1459
1256
  args: ['CheckoutRepository']
1460
1257
  }] }, { type: undefined, decorators: [{
@@ -1466,7 +1263,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1466
1263
  }] }, { type: undefined, decorators: [{
1467
1264
  type: Inject,
1468
1265
  args: [PERSISTENCE_PROVIDER]
1469
- }] }] });
1266
+ }] }]; } });
1470
1267
 
1471
1268
  class CartService {
1472
1269
  constructor(authService, checkoutService, defaultShop, productRepository, categoryRepository, variantRepository, buy2WinRepository) {
@@ -1481,11 +1278,9 @@ class CartService {
1481
1278
  this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
1482
1279
  const items = [];
1483
1280
  const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
1484
- const isGift = checkoutLoaded.lineItems?.[index]?.isGift;
1485
1281
  if (index > -1) {
1486
1282
  checkoutLoaded.lineItems[index].quantity += quantity;
1487
- checkoutLoaded.lineItems[index].pricePaid = isGift ? 0 : lineItem.pricePaid;
1488
- checkoutLoaded.lineItems[index].price = lineItem.price;
1283
+ checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
1489
1284
  }
1490
1285
  else
1491
1286
  checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
@@ -1503,20 +1298,17 @@ class CartService {
1503
1298
  this.buildLineItem = async ({ checkout, item, quantity, }) => {
1504
1299
  const product = await this.getProductData(item.id);
1505
1300
  item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.id === item.id)?.quantity || 0;
1506
- if (this.checkMaxStock(product.stock.quantity, item.quantity || 0, quantity || 0))
1507
- throw new Error('Desculpe! Temos apenas ' + product.stock?.quantity + ' em estoque.');
1301
+ if (this.checkMaxStock(item, quantity || 0))
1302
+ throw new Error('Desculpe! Temos apenas ' + item.stock?.quantity + ' em estoque.');
1508
1303
  const image = item.image || item.images?.shift();
1509
- const { id, name, EAN, slug, weight, sku, type } = item;
1510
- const isGift = item?.isGift || null;
1511
- const pricePaid = isGift
1512
- ? 0
1513
- : this.getProductPrice({
1514
- product: LineItem.toInstance(product),
1515
- shop: checkout.shop || this.defaultShop,
1516
- isSubscriber: checkout.user?.isSubscriber,
1517
- });
1304
+ const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
1305
+ const isGift = item.isGift || null;
1306
+ const pricePaid = this.getProductPrice({
1307
+ product: item,
1308
+ shop: checkout.shop || this.defaultShop,
1309
+ isSubscriber: checkout.user?.isSubscriber,
1310
+ });
1518
1311
  RoundProductPricesHelper.roundProductPrices(item);
1519
- RoundProductPricesHelper.roundProductPrices(product);
1520
1312
  return {
1521
1313
  checkout,
1522
1314
  lineItem: LineItem.toInstance({
@@ -1526,19 +1318,16 @@ class CartService {
1526
1318
  brand: product.brand,
1527
1319
  slug: slug ?? product.slug,
1528
1320
  sku: sku ?? product.sku,
1529
- stock: product.stock,
1530
- price: this.roundPrice(product.price),
1321
+ stock,
1322
+ price: this.roundPrice(price),
1531
1323
  image,
1532
1324
  weight: weight ?? product.weight,
1533
1325
  quantity: (item.quantity || 0) + (quantity || 0),
1534
1326
  pricePaid,
1535
- discount: 0,
1536
- categories: product.categories || product.category?.id ? [product.category?.id, ...product.categories] : [],
1537
- category: product.category,
1327
+ categories: product.categories ?? [],
1538
1328
  isGift: isGift ?? null,
1539
- costPrice: isGift ? 0 : product.costPrice ?? 0,
1329
+ costPrice: product.costPrice ?? 0,
1540
1330
  type,
1541
- label: product.label,
1542
1331
  }),
1543
1332
  };
1544
1333
  };
@@ -1550,10 +1339,10 @@ class CartService {
1550
1339
  ? Number(info.subscriberPrice.toFixed(2))
1551
1340
  : Number(info.price.toFixed(2));
1552
1341
  };
1553
- this.checkMaxStock = (currentStock, currentItemQtd, quantityToAdd) => {
1554
- const maxStock = currentStock || 0;
1555
- const currentItemAmount = currentItemQtd || 0;
1556
- return currentItemAmount + quantityToAdd > maxStock;
1342
+ this.checkMaxStock = (item, quantity) => {
1343
+ const maxStock = item.stock?.quantity || 0;
1344
+ const currentItemAmount = item.quantity || 0;
1345
+ return currentItemAmount + quantity > maxStock;
1557
1346
  };
1558
1347
  }
1559
1348
  addItem(item, quantity = 1) {
@@ -1593,7 +1382,7 @@ class CartService {
1593
1382
  ? await Promise.all(checkout.lineItems?.map(async (item) => (await this.buildLineItem({ checkout, item })).lineItem))
1594
1383
  : [],
1595
1384
  }))
1596
- .toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => (this.user = user)), tap((cart) => this.cartSubject.next(cart)));
1385
+ .toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1597
1386
  }
1598
1387
  clearCart() {
1599
1388
  return this.checkoutService.getCheckout().pipe(map((checkout) => {
@@ -1638,13 +1427,15 @@ class CartService {
1638
1427
  const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
1639
1428
  if (!notGiftItems.length)
1640
1429
  return { ...checkout, lineItems: [] };
1430
+ const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1641
1431
  const campaigns = await this.buy2WinRepository
1642
1432
  .find({
1643
1433
  filters: {
1644
1434
  active: { operator: Where.EQUALS, value: true },
1435
+ shop: { operator: Where.EQUALS, value: this.defaultShop },
1645
1436
  },
1646
1437
  })
1647
- .then((data) => data.data.filter((campaign) => campaign.shop === Shops.ALL || campaign.shop === this.defaultShop));
1438
+ .then((data) => data.data);
1648
1439
  if (!campaigns.length)
1649
1440
  return { ...checkout, lineItems: notGiftItems };
1650
1441
  const elegibleCampaigns = [];
@@ -1660,27 +1451,22 @@ class CartService {
1660
1451
  categoriesCampaingFullTree.push(id, ...children.map((c) => c.id.toString()));
1661
1452
  }
1662
1453
  const categoriesCampaingTree = [...new Set(categoriesCampaingFullTree)];
1663
- const filterProductsCategories = notGiftItems.filter((l) => {
1454
+ const filterProductsCategories = checkout.lineItems.filter((l) => {
1664
1455
  if (!l.categories || !l.categories?.length)
1665
1456
  return true;
1666
1457
  return l.categories.some((c) => categoriesCampaingTree.some((cat) => cat == c));
1667
1458
  });
1668
1459
  if (filterProductsCategories.length) {
1669
- const cartValuelWithCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1670
- const cartItensQuantityWithCategories = filterProductsCategories.reduce((a, b) => a + b.quantity, 0);
1671
- const hasMinValue = campaign.cartValueMin && cartValuelWithCategories >= campaign.cartValueMin;
1672
- const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantityWithCategories >= campaign.cartItensQuantityMin;
1673
- if (hasMinQuantity || hasMinValue)
1460
+ const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1461
+ if (cartTotalCategories >= campaign.cartValueMin)
1674
1462
  elegibleCampaigns.push(campaign);
1675
1463
  }
1676
1464
  }
1677
1465
  else {
1678
- const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1679
- const cartItensQuantity = notGiftItems.reduce((a, b) => a + b.quantity, 0);
1680
- const hasMinValue = campaign.cartValue && campaign.cartValue > 0 && campaign.cartValue <= cartTotal;
1681
- const hasMinQuantity = campaign.cartItensQuantityMin && cartItensQuantity >= campaign.cartItensQuantityMin;
1682
- if (hasMinQuantity || hasMinValue)
1683
- elegibleCampaigns.push(campaign);
1466
+ if (campaign.cartValue && campaign.cartValue > 0) {
1467
+ if (campaign.cartValue <= cartTotal)
1468
+ elegibleCampaigns.push(campaign);
1469
+ }
1684
1470
  }
1685
1471
  }
1686
1472
  if (!elegibleCampaigns.length)
@@ -1707,12 +1493,11 @@ class CartService {
1707
1493
  }
1708
1494
  giftToLineItems(items) {
1709
1495
  return items.map((item) => {
1710
- const { brand, categories, category, id, name, price, sku, slug, stock, weight, EAN } = item;
1496
+ const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
1711
1497
  const image = item?.miniatures?.length ? item.miniatures[0] : item.images[0];
1712
1498
  return LineItem.toInstance({
1713
1499
  brand,
1714
1500
  categories,
1715
- category,
1716
1501
  id: id.toString(),
1717
1502
  name,
1718
1503
  price,
@@ -1728,12 +1513,12 @@ class CartService {
1728
1513
  });
1729
1514
  });
1730
1515
  }
1731
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1732
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CartService }); }
1733
1516
  }
1734
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CartService, decorators: [{
1517
+ 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: 'CategoryRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1518
+ CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
1519
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
1735
1520
  type: Injectable
1736
- }], ctorParameters: () => [{ type: AuthService }, { type: CheckoutService }, { type: i1$2.Shops, decorators: [{
1521
+ }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$2.Shops, decorators: [{
1737
1522
  type: Inject,
1738
1523
  args: [DEFAULT_SHOP]
1739
1524
  }] }, { type: undefined, decorators: [{
@@ -1748,7 +1533,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
1748
1533
  }] }, { type: i1$2.Buy2WinFirestoreRepository, decorators: [{
1749
1534
  type: Inject,
1750
1535
  args: ['Buy2WinRepository']
1751
- }] }] });
1536
+ }] }]; } });
1752
1537
 
1753
1538
  class NewCategoryStructureAdapter {
1754
1539
  constructor(categoryRepository) {
@@ -1774,21 +1559,19 @@ class NewCategoryStructureAdapter {
1774
1559
  .then((categories) => categories.map((category) => category.id.toString()));
1775
1560
  }
1776
1561
  async getCategory(category) {
1777
- const collectionCategory = category.isCollection ||
1778
- (isNil(category.isCollection) && !category.products?.length) ||
1779
- category.isWishlist ||
1780
- category.brandCategory;
1781
- return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
1782
- }
1783
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1784
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter }); }
1562
+ return isNil(category.isCollection) || (category.isCollection && !category.products?.length)
1563
+ ? this.categoryRepository.get({ id: category.id })
1564
+ : category;
1565
+ }
1785
1566
  }
1786
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
1567
+ NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1568
+ NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
1569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
1787
1570
  type: Injectable
1788
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1571
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1789
1572
  type: Inject,
1790
1573
  args: ['CategoryRepository']
1791
- }] }] });
1574
+ }] }]; } });
1792
1575
 
1793
1576
  class OldCategoryStructureAdapter {
1794
1577
  constructor(categoryRepository) {
@@ -1800,26 +1583,24 @@ class OldCategoryStructureAdapter {
1800
1583
  : await this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
1801
1584
  return { id: { operator: Where.IN, value: productsIds } };
1802
1585
  }
1803
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
1804
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OldCategoryStructureAdapter }); }
1805
1586
  }
1806
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
1587
+ OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1588
+ OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter });
1589
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
1807
1590
  type: Injectable
1808
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1591
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1809
1592
  type: Inject,
1810
1593
  args: ['CategoryRepository']
1811
- }] }] });
1594
+ }] }]; } });
1812
1595
 
1813
1596
  class CatalogService {
1814
- constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch) {
1597
+ constructor(productRepository, categoryRepository, categoryStructureAdapter, shop, productIndex) {
1815
1598
  this.productRepository = productRepository;
1816
- this.productStockNotificationRepository = productStockNotificationRepository;
1817
1599
  this.categoryRepository = categoryRepository;
1818
1600
  this.categoryStructureAdapter = categoryStructureAdapter;
1819
1601
  this.shop = shop;
1820
- this.productSearch = productSearch;
1602
+ this.productIndex = productIndex;
1821
1603
  this.productsByTerm = {};
1822
- this.brandsList = {};
1823
1604
  this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
1824
1605
  const filters = {};
1825
1606
  if (clubDiscount?.length)
@@ -1830,7 +1611,7 @@ class CatalogService {
1830
1611
  filters.gender = { operator: Where.IN, value: gender };
1831
1612
  if (prices?.min || prices?.max)
1832
1613
  set(filters, prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price', [
1833
- ...(prices.min ? [{ operator: Where.GTE, value: Math.floor(prices.min) }] : []),
1614
+ ...(prices.min ? [{ operator: Where.GTE, value: Math.round(prices.min) }] : []),
1834
1615
  ...(prices.max ? [{ operator: Where.LTE, value: Math.ceil(prices.max) }] : []),
1835
1616
  ]);
1836
1617
  if (rate)
@@ -1845,22 +1626,17 @@ class CatalogService {
1845
1626
  if (!sort || sort === 'most-relevant')
1846
1627
  return {};
1847
1628
  if (sort === 'best-sellers')
1848
- return {
1849
- shoppingCount: 'desc',
1850
- rate: 'desc',
1851
- stock: 'desc',
1852
- name: 'asc',
1853
- };
1629
+ return { shoppingCount: 'desc' };
1854
1630
  if (sort === 'biggest-price')
1855
- return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
1631
+ return { subscriberPrice: 'desc' };
1856
1632
  if (sort === 'lowest-price')
1857
- return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
1633
+ return { subscriberPrice: 'asc' };
1858
1634
  if (sort === 'best-rating')
1859
- return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
1635
+ return { rate: 'desc' };
1860
1636
  if (sort === 'news')
1861
1637
  return { createdAt: 'desc' };
1862
1638
  if (sort === 'biggest-discount')
1863
- return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
1639
+ return { subscriberDiscountPercentage: 'desc' };
1864
1640
  };
1865
1641
  this.buildLimitQuery = (options) => {
1866
1642
  const limit = options?.perPage || 20;
@@ -1872,15 +1648,6 @@ class CatalogService {
1872
1648
  this.hasProfile = (options) => 'profile' in options;
1873
1649
  this.hasTerm = (options) => 'term' in options;
1874
1650
  this.hasCategory = (options) => 'category' in options;
1875
- this.buildIndexBrands = (options) => {
1876
- if (this.hasCategory(options))
1877
- return `category-${options.category.id}`;
1878
- if (this.hasTerm(options))
1879
- return `term-${options.term}`;
1880
- if (this.hasProfile(options))
1881
- return `profile-${options.profile.join(',')}`;
1882
- return '';
1883
- };
1884
1651
  }
1885
1652
  async fetchProducts(options) {
1886
1653
  const limits = this.buildLimitQuery(options);
@@ -1890,42 +1657,29 @@ class CatalogService {
1890
1657
  throw new InvalidArgumentError(`It couldn't filled tags when profile is given`);
1891
1658
  if (this.hasTerm(options) && options.filters?.customOptions)
1892
1659
  throw new InvalidArgumentError(`It couldn't filled customOptions when term is given`);
1893
- return await this.findCatalog(options, limits).then(async ({ data, count: total, maximum, minimal, distinct }) => {
1894
- await this.setBrandsList(options, distinct?.brand);
1895
- return {
1896
- products: { data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)), total },
1897
- pages: Math.ceil(total / limits.limit),
1898
- prices: {
1899
- price: { min: +minimal?.price?.price?.toFixed(2), max: +maximum?.price?.price?.toFixed(2) },
1900
- subscriberPrice: {
1901
- min: +minimal?.price?.subscriberPrice?.toFixed(2),
1902
- max: +maximum?.price?.subscriberPrice?.toFixed(2),
1903
- },
1660
+ return await this.findCatalog(options, limits).then(({ data, count: total, maximum, minimal, distinct }) => ({
1661
+ products: { data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)), total },
1662
+ pages: Math.ceil(total / limits.limit),
1663
+ prices: {
1664
+ price: { min: +minimal?.price?.price?.toFixed(2), max: +maximum?.price?.price?.toFixed(2) },
1665
+ subscriberPrice: {
1666
+ min: +minimal?.price?.subscriberPrice?.toFixed(2),
1667
+ max: +maximum?.price?.subscriberPrice?.toFixed(2),
1904
1668
  },
1905
- brands: this.brandsList[this.buildIndexBrands(options)],
1906
- };
1907
- });
1908
- }
1909
- async addCustomerToStockNotification(shop, productId, name, email) {
1910
- return this.productStockNotificationRepository.addCustomerEmail(shop, productId, name, email);
1669
+ },
1670
+ brands: distinct?.brand,
1671
+ }));
1911
1672
  }
1912
1673
  async findCatalog(options, limits) {
1913
1674
  if (this.hasTerm(options) && options.sort === 'most-relevant') {
1914
- const productsIds = await this.findCatalogIdsBySearch(options.term);
1915
- return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
1675
+ const productsIds = await this.findCatalogIdsByElasticSearch(options.term);
1676
+ return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
1916
1677
  }
1917
1678
  if (this.hasCategory(options) && options.sort === 'most-relevant') {
1918
- const mostRelevant = options.category.isWishlist ? [] : options.category.getMostRelevantByShop(this.shop);
1919
- const productsIds = await this.productRepository
1920
- .findCatalog({
1921
- fields: ['id'],
1922
- filters: {
1923
- ...(await this.buildMainFilter(options)),
1924
- ...this.buildFilterQuery(options?.filters || {}),
1925
- },
1926
- })
1927
- .then((products) => products.data.map((product) => product.id));
1928
- return this.findCatalogAndSortByMostRevelant(mostRelevant, productsIds, options, limits);
1679
+ const productsIds = options.category.products?.length
1680
+ ? options.category.products
1681
+ : await this.categoryRepository.get({ id: options.category.id }).then((categoryFound) => categoryFound.products);
1682
+ return this.findCatalogAndSortByMostRevelant(productsIds, options, limits);
1929
1683
  }
1930
1684
  const repoParams = {
1931
1685
  filters: {
@@ -1937,9 +1691,7 @@ class CatalogService {
1937
1691
  options: {
1938
1692
  minimal: ['price'],
1939
1693
  maximum: ['price'],
1940
- ...(!this.brandsList[this.buildIndexBrands(options)] && isEmpty(options.filters?.brands)
1941
- ? { distinct: ['brand'] }
1942
- : {}),
1694
+ ...(!this.hasCategory(options) ? { distinct: ['brand'] } : {}),
1943
1695
  },
1944
1696
  };
1945
1697
  if (['biggest-price', 'lowest-price', 'biggest-discount', 'best-rating'].includes(options.sort))
@@ -1952,72 +1704,27 @@ class CatalogService {
1952
1704
  if (profile)
1953
1705
  return { tags: { operator: Where.LIKE, value: profile } };
1954
1706
  if (term)
1955
- return this.productSearch
1956
- .search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
1957
- .then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
1958
- }
1959
- async findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
1960
- const brandsList = this.brandsList[this.buildIndexBrands(options)];
1961
- const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
1962
- const totalResult = await this.productRepository.findCatalog({
1963
- filters: {
1964
- id: { operator: Where.IN, value: mostRelevantProductsIds },
1965
- ...this.buildFilterQuery(options?.filters || {}),
1966
- },
1967
- orderBy: this.buildSortQuery('best-sellers'),
1968
- options: {
1969
- minimal: ['price'],
1970
- maximum: ['price'],
1971
- ...(!brandsList && isEmpty(options.filters?.brands) ? { distinct: ['brand'] } : {}),
1972
- },
1973
- }, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
1974
- const mostRelevantWithouyStock = totalResult.data.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity <= 0);
1975
- const firstProducts = totalResult.data
1976
- .filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
1977
- .sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
1978
- const lastProducts = totalResult.data
1979
- .filter((product) => !mostRelevants.includes(product.id))
1980
- .concat(mostRelevantWithouyStock);
1981
- const categoryMostRelevants = firstProducts.concat(lastProducts);
1982
- const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
1983
- await this.setBrandsList(options, totalResult.distinct?.brand);
1984
- return {
1985
- data: resultFinal,
1986
- count: totalResult.count,
1987
- maximum: totalResult.maximum,
1988
- minimal: totalResult.minimal,
1989
- distinct: {
1990
- ...totalResult.distinct,
1991
- brand: this.brandsList[this.buildIndexBrands(options)],
1992
- },
1993
- };
1707
+ return this.productIndex
1708
+ .search(term, 999, this.shop)
1709
+ .then((data) => ({ id: { operator: Where.IN, value: data.hits.map(({ _source }) => _source.id) } }));
1994
1710
  }
1995
- async findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
1996
- const brandsList = this.brandsList[this.buildIndexBrands(options)];
1711
+ async findCatalogAndSortByMostRevelant(productIds, options, limits) {
1997
1712
  const totalResult = await this.productRepository.findCatalog({
1998
- fields: ['id', 'stock', 'gender'],
1713
+ fields: ['id', 'stock'],
1999
1714
  filters: {
2000
1715
  id: { operator: Where.IN, value: productIds },
2001
- published: { operator: Where.EQUALS, value: true },
2002
1716
  ...this.buildFilterQuery(options?.filters || {}),
2003
1717
  },
2004
1718
  options: {
2005
1719
  minimal: ['price'],
2006
1720
  maximum: ['price'],
2007
- ...(!brandsList && isEmpty(options.filters?.brands) ? { distinct: ['brand'] } : {}),
1721
+ distinct: ['brand'],
2008
1722
  },
2009
1723
  }, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
2010
- const defaultGender = options?.filters?.gender
2011
- ? options?.filters?.gender.at(0)
2012
- : this.shop === Shops.GLAMSHOP
2013
- ? 'female'
2014
- : 'male';
2015
1724
  const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
2016
1725
  const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
2017
- const productIdsStockGender = productIds.filter((product) => stockData.some((result) => result.id === product && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex'))));
2018
- const productIdsStockNotGender = productIds.filter((product) => stockData.some((result) => result.id === product && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex')));
2019
- const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender);
2020
- const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
1726
+ const productIdsStock = productIds.filter((product) => stockData.some((result) => result.id == product));
1727
+ const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id == product));
2021
1728
  const limitedProductId = productIdsStock
2022
1729
  .concat(productIdsStockOut)
2023
1730
  .slice(limits.offset, limits.offset + limits.limit);
@@ -2027,65 +1734,34 @@ class CatalogService {
2027
1734
  id: { operator: Where.IN, value: orderedId },
2028
1735
  },
2029
1736
  });
2030
- await this.setBrandsList(options, totalResult.distinct?.brand);
2031
1737
  return {
2032
1738
  data: limitedProductId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
2033
1739
  count: totalResult.count,
2034
1740
  maximum: totalResult.maximum,
2035
1741
  minimal: totalResult.minimal,
2036
- distinct: {
2037
- ...totalResult.distinct,
2038
- brand: this.brandsList[this.buildIndexBrands(options)],
2039
- },
1742
+ distinct: totalResult.distinct,
2040
1743
  };
2041
1744
  }
2042
- async findCatalogIdsBySearch(term, preview = false) {
1745
+ async findCatalogIdsByElasticSearch(term) {
2043
1746
  if (this.productsByTerm[term])
2044
1747
  return this.productsByTerm[term];
2045
- return (this.productsByTerm[term] = await this.productSearch
2046
- .search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
2047
- .then((products) => [...new Set(products.map((product) => product.id))]));
2048
- }
2049
- async fetchBrandsOnly(options, productIds = []) {
2050
- return this.productRepository
2051
- .findCatalog({
2052
- fields: ['id'],
2053
- filters: {
2054
- ...(!isEmpty(productIds) ? { id: { operator: Where.IN, value: productIds } } : {}),
2055
- published: { operator: Where.EQUALS, value: true },
2056
- ...this.buildFilterQuery(options?.filters || {}),
2057
- },
2058
- options: {
2059
- distinct: ['brand'],
2060
- },
2061
- }, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female')
2062
- .then((result) => {
2063
- return result.distinct.brand;
2064
- });
2065
- }
2066
- async setBrandsList(options, brands) {
2067
- const filterBrands = options.filters?.brands;
2068
- if (isEmpty(brands))
2069
- delete options.filters?.brands;
2070
- this.brandsList[this.buildIndexBrands(options)] =
2071
- this.brandsList[this.buildIndexBrands(options)] || brands || (await this.fetchBrandsOnly(options));
2072
- this.brandsList[this.buildIndexBrands(options)] = this.brandsList[this.buildIndexBrands(options)].filter(Boolean);
2073
- options.filters = {
2074
- ...options.filters,
2075
- brands: filterBrands,
2076
- };
1748
+ return (this.productsByTerm[term] = await this.productIndex
1749
+ .search(term, 999, this.shop)
1750
+ .then(({ hits: products }) => {
1751
+ const withStock = products.filter(({ _source }) => _source.stock.quantity > 0);
1752
+ const withOutStock = products.filter(({ _source }) => _source.stock.quantity <= 0);
1753
+ const sorted = [...withStock, ...withOutStock];
1754
+ return [...new Set(sorted.map(({ _source }) => _source.id))];
1755
+ }));
2077
1756
  }
2078
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable }); }
2079
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService }); }
2080
1757
  }
2081
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CatalogService, decorators: [{
1758
+ CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable });
1759
+ CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
1760
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
2082
1761
  type: Injectable
2083
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1762
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2084
1763
  type: Inject,
2085
1764
  args: ['ProductRepository']
2086
- }] }, { type: undefined, decorators: [{
2087
- type: Inject,
2088
- args: ['ProductStockNotificationRepository']
2089
1765
  }] }, { type: undefined, decorators: [{
2090
1766
  type: Inject,
2091
1767
  args: ['CategoryRepository']
@@ -2095,10 +1771,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2095
1771
  }] }, { type: i1$2.Shops, decorators: [{
2096
1772
  type: Inject,
2097
1773
  args: [DEFAULT_SHOP]
2098
- }] }, { type: undefined, decorators: [{
2099
- type: Inject,
2100
- args: ['ProductSearch']
2101
- }] }] });
1774
+ }] }, { type: i1$2.ProductsIndex }]; } });
2102
1775
 
2103
1776
  class CategoryService {
2104
1777
  constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
@@ -2124,12 +1797,12 @@ class CategoryService {
2124
1797
  .find({ filters: { categoryId: +category.id } })
2125
1798
  .then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
2126
1799
  }
2127
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CategoryService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable }); }
2128
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CategoryService }); }
2129
1800
  }
2130
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CategoryService, decorators: [{
1801
+ CategoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
1802
+ CategoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService });
1803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, decorators: [{
2131
1804
  type: Injectable
2132
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1805
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2133
1806
  type: Inject,
2134
1807
  args: ['ProductRepository']
2135
1808
  }] }, { type: undefined, decorators: [{
@@ -2144,7 +1817,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2144
1817
  }] }, { type: i1$2.Shops, decorators: [{
2145
1818
  type: Inject,
2146
1819
  args: [DEFAULT_SHOP]
2147
- }] }] });
1820
+ }] }]; } });
2148
1821
 
2149
1822
  var ProductSorts;
2150
1823
  (function (ProductSorts) {
@@ -2165,14 +1838,11 @@ __decorate([
2165
1838
  ], CategoryWithTree.prototype, "children", void 0);
2166
1839
 
2167
1840
  class WishlistService {
2168
- constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productSearch, logRepository) {
1841
+ constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productIndex) {
2169
1842
  this.wishlistRepository = wishlistRepository;
2170
1843
  this.shop = shop;
2171
- this.productRepository = productRepository;
2172
- this.productSearch = productSearch;
2173
- this.logRepository = logRepository;
2174
1844
  const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
2175
- this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productSearch);
1845
+ this.catalogService = new CatalogService(productRepository, categoryRepository, categoryStructureAdapter, shop, productIndex);
2176
1846
  this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
2177
1847
  }
2178
1848
  getCatalogService() {
@@ -2181,76 +1851,46 @@ class WishlistService {
2181
1851
  getCategoryService() {
2182
1852
  return this.categoryService;
2183
1853
  }
2184
- async create({ personId, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
1854
+ async create({ personId, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
2185
1855
  const data = {
2186
1856
  slug: '',
2187
1857
  name: title,
2188
1858
  description,
2189
- metadatas: [
2190
- {
2191
- shop: this.shop,
2192
- title: `${userFullName} - ${title}`,
2193
- description: `${userFullName} - ${description}`,
2194
- },
2195
- ],
1859
+ metadata: {
1860
+ title: `${userFullName} - ${title}`,
1861
+ description: `${userFullName} - ${description}`,
1862
+ },
2196
1863
  shop: this.shop,
2197
1864
  shops: [this.shop],
2198
1865
  personId,
2199
1866
  personName: userFullName,
2200
1867
  personPhoto: userPhoto,
2201
1868
  brandCategory: false,
2202
- published,
1869
+ published: true,
2203
1870
  theme,
2204
1871
  bannerUrl,
2205
- personType: personType ?? PersonTypes.NONE,
2206
- personIsSubscriber: personIsSubscriber ?? false,
2207
1872
  };
2208
- const hasWishlist = await this.wishlistRepository
2209
- .find({
2210
- filters: {
2211
- personId,
2212
- },
2213
- options: {
2214
- enableCount: false,
2215
- },
2216
- orderBy: {
2217
- id: 'asc',
2218
- },
2219
- })
2220
- .then((res) => res.data);
2221
- await this.createWishlistLog(WishlistLogType.CREATE, data);
2222
- if (hasWishlist.length)
2223
- return hasWishlist.at(0);
2224
1873
  const newWishlist = await this.wishlistRepository.create(data);
2225
1874
  await this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
2226
1875
  return Wishlist.toInstance({ ...newWishlist.toPlain(), slug: newWishlist.id });
2227
1876
  }
2228
- async update({ id, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
1877
+ update({ id, title, description, userFullName, userPhoto, theme, bannerUrl, }) {
2229
1878
  const data = {
2230
1879
  id,
2231
1880
  name: title,
2232
1881
  description,
2233
- published,
2234
- metadatas: [
2235
- {
2236
- shop: this.shop,
2237
- title: `${userFullName} - ${title}`,
2238
- description: `${userFullName} - ${description}`,
2239
- },
2240
- ],
1882
+ metadata: {
1883
+ title: `${userFullName} - ${title}`,
1884
+ description: `${userFullName} - ${description}`,
1885
+ },
2241
1886
  personName: userFullName,
2242
1887
  personPhoto: userPhoto,
2243
1888
  theme,
2244
1889
  bannerUrl,
2245
- personType: personType ?? PersonTypes.NONE,
2246
- personIsSubscriber: personIsSubscriber ?? false,
2247
1890
  };
2248
- await this.createWishlistLog(WishlistLogType.UPDATE, data);
2249
1891
  return this.wishlistRepository.update(data);
2250
1892
  }
2251
- async delete(wishlistId) {
2252
- const wishlist = await this.findById(wishlistId);
2253
- await this.createWishlistLog(WishlistLogType.DELETE, wishlist);
1893
+ delete(wishlistId) {
2254
1894
  return this.wishlistRepository.delete({ id: wishlistId });
2255
1895
  }
2256
1896
  getWishlistBySlug(slug) {
@@ -2265,12 +1905,9 @@ class WishlistService {
2265
1905
  async addProduct(wishlistId, productId) {
2266
1906
  const wishlist = await this.wishlistRepository.get({ id: wishlistId });
2267
1907
  const hasProduct = wishlist.products.some((p) => p == productId);
2268
- const wishlistData = await this.findById(wishlistId);
2269
- const productData = await this.findProductById(productId);
2270
- await this.createWishlistLog(WishlistLogType.ADD_PRODUCT, wishlistData, productData);
2271
1908
  if (!hasProduct) {
2272
1909
  wishlist.products = [...wishlist.products, productId];
2273
- await this.wishlistRepository.addProduct(wishlistId, productId);
1910
+ return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
2274
1911
  }
2275
1912
  return wishlist;
2276
1913
  }
@@ -2279,93 +1916,18 @@ class WishlistService {
2279
1916
  const productIndex = wishlist.products.findIndex((p) => p == productId);
2280
1917
  if (productIndex != -1) {
2281
1918
  wishlist.products.splice(productIndex, 1);
2282
- const wishlistData = await this.findById(wishlistId);
2283
- const productData = await this.findProductById(productId);
2284
- await this.createWishlistLog(WishlistLogType.REMOVE_PRODUCT, wishlistData, productData);
2285
- await this.wishlistRepository.removeProduct(wishlistId, productId);
1919
+ if (!wishlist.products.length)
1920
+ return this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } });
1921
+ return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
2286
1922
  }
2287
1923
  return wishlist;
2288
1924
  }
2289
- async findById(id) {
2290
- return this.wishlistRepository
2291
- .find({
2292
- fields: ['id', 'name', 'description', 'personId', 'personIsSubscriber', 'personType', 'personName'],
2293
- filters: {
2294
- id,
2295
- },
2296
- })
2297
- .then((res) => res.data.at(0));
2298
- }
2299
- async findProductById(id) {
2300
- return this.productRepository
2301
- .find({
2302
- fields: ['id', 'sku', 'EAN', 'name', 'brand'],
2303
- filters: {
2304
- id,
2305
- },
2306
- })
2307
- .then((res) => res.data.at(0));
2308
- }
2309
- async createWishlistLog(type, wishlist, product) {
2310
- switch (type) {
2311
- case WishlistLogType.CREATE:
2312
- case WishlistLogType.UPDATE:
2313
- case WishlistLogType.DELETE:
2314
- await this.logRepository.create({
2315
- collection: 'wishlist',
2316
- date: new Date(),
2317
- operation: WishlistLogType.CREATE ? 'CREATE' : WishlistLogType.UPDATE ? 'UPDATE' : 'DELETE',
2318
- documentId: wishlist.id,
2319
- document: {
2320
- id: wishlist.id,
2321
- shop: this.shop,
2322
- name: wishlist.name,
2323
- description: wishlist.description,
2324
- published: wishlist.published,
2325
- type: type,
2326
- personType: wishlist.personType,
2327
- personId: wishlist.personId,
2328
- personName: wishlist.personName,
2329
- personIsSubscriber: wishlist.personIsSubscriber,
2330
- },
2331
- });
2332
- break;
2333
- case WishlistLogType.ADD_PRODUCT:
2334
- case WishlistLogType.REMOVE_PRODUCT:
2335
- await this.logRepository.create({
2336
- collection: 'wishlist',
2337
- date: new Date(),
2338
- operation: 'UPDATE',
2339
- documentId: wishlist.id,
2340
- document: {
2341
- id: wishlist.id,
2342
- shop: this.shop,
2343
- name: wishlist.name,
2344
- description: wishlist.description,
2345
- published: wishlist.published,
2346
- type: type,
2347
- personType: wishlist.personType,
2348
- personId: wishlist.personId,
2349
- personName: wishlist.personName,
2350
- personIsSubscriber: wishlist.personIsSubscriber,
2351
- productId: product.id,
2352
- productEAN: product.EAN,
2353
- productSKU: product.sku,
2354
- productName: product.name,
2355
- productBrand: product.brand,
2356
- },
2357
- });
2358
- break;
2359
- default:
2360
- break;
2361
- }
2362
- }
2363
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'ProductSearch' }, { token: 'LogRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
2364
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService }); }
2365
1925
  }
2366
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: WishlistService, decorators: [{
1926
+ WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryFilterRepository' }, { token: 'CategoryRepository' }, { token: i1$2.ProductsIndex }], target: i0.ɵɵFactoryTarget.Injectable });
1927
+ WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
1928
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
2367
1929
  type: Injectable
2368
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1930
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2369
1931
  type: Inject,
2370
1932
  args: ['WishlistRepository']
2371
1933
  }] }, { type: i1$2.Shops, decorators: [{
@@ -2380,16 +1942,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2380
1942
  }] }, { type: undefined, decorators: [{
2381
1943
  type: Inject,
2382
1944
  args: ['CategoryRepository']
2383
- }] }, { type: undefined, decorators: [{
2384
- type: Inject,
2385
- args: ['ProductStockNotificationRepository']
2386
- }] }, { type: undefined, decorators: [{
2387
- type: Inject,
2388
- args: ['ProductSearch']
2389
- }] }, { type: undefined, decorators: [{
2390
- type: Inject,
2391
- args: ['LogRepository']
2392
- }] }] });
1945
+ }] }, { type: i1$2.ProductsIndex }]; } });
2393
1946
 
2394
1947
  class CheckoutSubscriptionService {
2395
1948
  constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
@@ -2421,18 +1974,18 @@ class CheckoutSubscriptionService {
2421
1974
  await this.dataPersistence.set('checkoutSubscriptionId', checkout.id).toPromise();
2422
1975
  return checkout;
2423
1976
  }
2424
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: PERSISTENCE_PROVIDER }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2425
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService }); }
2426
1977
  }
2427
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
1978
+ CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: PERSISTENCE_PROVIDER }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable });
1979
+ CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService });
1980
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
2428
1981
  type: Injectable
2429
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1982
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2430
1983
  type: Inject,
2431
1984
  args: ['CheckoutSubscriptionRepository']
2432
1985
  }] }, { type: undefined, decorators: [{
2433
1986
  type: Inject,
2434
1987
  args: [PERSISTENCE_PROVIDER]
2435
- }] }, { type: CouponService }] });
1988
+ }] }, { type: CouponService }]; } });
2436
1989
 
2437
1990
  class UtilHelper {
2438
1991
  static createSlug(name) {
@@ -2516,10 +2069,10 @@ class HomeShopService {
2516
2069
  return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
2517
2070
  }
2518
2071
  getDiscoverProducts(gender) {
2519
- return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories, this.defaultShop)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2072
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories, undefined, gender)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2520
2073
  }
2521
2074
  getFeaturedProducts(gender) {
2522
- return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories, this.defaultShop)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2075
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories, undefined, gender)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2523
2076
  }
2524
2077
  getVerticalProducts(gender) {
2525
2078
  return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => from(this.categoryRepository.get({ id })).pipe(concatMap((category) => from(this.productRepository.find({
@@ -2551,12 +2104,12 @@ class HomeShopService {
2551
2104
  get gender() {
2552
2105
  return this.homeId === 'mens_market' ? 'masculino' : undefined;
2553
2106
  }
2554
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable }); }
2555
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: HomeShopService }); }
2556
2107
  }
2557
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: HomeShopService, decorators: [{
2108
+ HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
2109
+ HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService });
2110
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, decorators: [{
2558
2111
  type: Injectable
2559
- }], ctorParameters: () => [{ type: undefined, decorators: [{
2112
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2560
2113
  type: Inject,
2561
2114
  args: ['CategoryRepository']
2562
2115
  }] }, { type: undefined, decorators: [{
@@ -2568,7 +2121,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2568
2121
  }] }, { type: i1$2.Shops, decorators: [{
2569
2122
  type: Inject,
2570
2123
  args: [DEFAULT_SHOP]
2571
- }] }] });
2124
+ }] }]; } });
2572
2125
 
2573
2126
  class OrderService {
2574
2127
  constructor(angularFirestore, orderRepository) {
@@ -2582,15 +2135,15 @@ class OrderService {
2582
2135
  .subscribe((doc) => this.orderSubject.next(doc));
2583
2136
  return this.orderSubject;
2584
2137
  }
2585
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable }); }
2586
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OrderService }); }
2587
2138
  }
2588
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: OrderService, decorators: [{
2139
+ 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 });
2140
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
2141
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
2589
2142
  type: Injectable
2590
- }], ctorParameters: () => [{ type: i1$1.Firestore }, { type: i1$2.OrderFirestoreRepository, decorators: [{
2143
+ }], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i1$2.OrderFirestoreRepository, decorators: [{
2591
2144
  type: Inject,
2592
2145
  args: ['OrderRepository']
2593
- }] }] });
2146
+ }] }]; } });
2594
2147
 
2595
2148
  class ShippingService {
2596
2149
  constructor(http, apiUrl, homeService) {
@@ -2668,23 +2221,21 @@ class ShippingService {
2668
2221
  }
2669
2222
  return false;
2670
2223
  }
2671
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ShippingService, deps: [{ token: i1$3.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2672
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ShippingService }); }
2673
2224
  }
2674
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: ShippingService, decorators: [{
2225
+ 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 });
2226
+ ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
2227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
2675
2228
  type: Injectable
2676
- }], ctorParameters: () => [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
2229
+ }], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
2677
2230
  type: Inject,
2678
2231
  args: [BACKEND_URL]
2679
- }] }, { type: HomeShopService }] });
2232
+ }] }, { type: HomeShopService }]; } });
2680
2233
 
2681
2234
  class AngularConnectModule {
2682
2235
  static initializeApp(defaultShop, options, nameOrConfig) {
2683
2236
  return {
2684
2237
  ngModule: AngularConnectModule,
2685
2238
  providers: [
2686
- { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
2687
- { provide: APP_CHECK_PROVIDER, useValue: options.appCheckProvider },
2688
2239
  {
2689
2240
  provide: CATEGORY_STRUCTURE,
2690
2241
  useClass: isNil(options?.oldCategoryStructure) || options?.oldCategoryStructure
@@ -2694,122 +2245,66 @@ class AngularConnectModule {
2694
2245
  { provide: PERSISTENCE_PROVIDER, useClass: options?.persistenceProvider || CookieDataPersistence },
2695
2246
  ...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
2696
2247
  ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
2248
+ ...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
2697
2249
  ...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
2698
- ...(isNil(options?.vertexConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexConfig }]),
2699
2250
  ...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
2700
2251
  ...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
2701
2252
  ...(isNil(options?.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
2702
2253
  ],
2703
2254
  };
2704
2255
  }
2705
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
2706
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.AppCheckModule, i3.StorageModule, AngularElasticSeachModule,
2707
- AngularVertexSeachModule,
2708
- AngularFirebaseAuthModule,
2709
- AngularFirestoreModule,
2710
- AngularHasuraGraphQLModule] }); }
2711
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, providers: [
2712
- AuthService,
2713
- CartService,
2714
- CatalogService,
2715
- CategoryService,
2716
- CheckoutService,
2717
- CheckoutSubscriptionService,
2718
- CouponService,
2719
- HomeShopService,
2720
- OrderService,
2721
- ShippingService,
2722
- WishlistService,
2723
- {
2724
- provide: UpdateUserImage,
2725
- useFactory: (userRepository, fileUploader) => {
2726
- return new UpdateUserImage(userRepository, fileUploader);
2727
- },
2728
- deps: ['UserRepository', 'FileUploaderService'],
2729
- },
2730
- {
2731
- provide: 'FileUploaderService',
2732
- useFactory: (storage, baseUrl) => {
2733
- return new FirebaseFileUploaderService(storage, baseUrl);
2734
- },
2735
- deps: [Storage, STORAGE_BASE_URL],
2736
- },
2737
- {
2738
- provide: 'ProductSearch',
2739
- useExisting: ProductsVertexSearch,
2740
- },
2741
- ], imports: [provideFirebaseApp((injector) => {
2742
- const appName = injector.get(FIREBASE_APP_NAME);
2743
- try {
2744
- const app = appName ? getApp(appName) : getApp();
2745
- return app;
2746
- }
2747
- catch (error) {
2748
- console.warn('Firebase app not found, initializing new app');
2749
- if (error instanceof Error)
2750
- console.error(error.message);
2751
- return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2752
- }
2753
- }),
2754
- provideAppCheck((injector) => {
2755
- const app = injector.get(FirebaseApp);
2756
- try {
2757
- const provider = injector.get(APP_CHECK_PROVIDER);
2758
- if (provider)
2759
- return initializeAppCheck(app, {
2760
- provider,
2761
- isTokenAutoRefreshEnabled: true,
2762
- });
2763
- }
2764
- catch (error) {
2765
- if (error instanceof Error)
2766
- console.error(error.message);
2767
- return;
2768
- }
2769
- }),
2770
- provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2771
- AngularElasticSeachModule,
2772
- AngularVertexSeachModule,
2773
- AngularFirebaseAuthModule,
2774
- AngularFirestoreModule,
2775
- AngularHasuraGraphQLModule] }); }
2776
2256
  }
2777
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: AngularConnectModule, decorators: [{
2257
+ AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2258
+ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, AngularElasticSeachModule,
2259
+ AngularFirebaseAuthModule,
2260
+ AngularFirestoreModule,
2261
+ AngularHasuraGraphQLModule] });
2262
+ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, providers: [
2263
+ AuthService,
2264
+ CartService,
2265
+ CatalogService,
2266
+ CategoryService,
2267
+ CheckoutService,
2268
+ CheckoutSubscriptionService,
2269
+ CouponService,
2270
+ HomeShopService,
2271
+ OrderService,
2272
+ ShippingService,
2273
+ WishlistService,
2274
+ {
2275
+ provide: UpdateUserImage,
2276
+ useFactory: (userRepository, fileUploader) => {
2277
+ return new UpdateUserImage(userRepository, fileUploader);
2278
+ },
2279
+ deps: ['UserRepository', 'FileUploaderService'],
2280
+ },
2281
+ ], imports: [provideFirebaseApp((injector) => {
2282
+ const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2283
+ try {
2284
+ return getApp(appName);
2285
+ }
2286
+ catch (error) {
2287
+ return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2288
+ }
2289
+ }),
2290
+ AngularElasticSeachModule,
2291
+ AngularFirebaseAuthModule,
2292
+ AngularFirestoreModule,
2293
+ AngularHasuraGraphQLModule] });
2294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
2778
2295
  type: NgModule,
2779
2296
  args: [{
2780
2297
  imports: [
2781
2298
  provideFirebaseApp((injector) => {
2782
- const appName = injector.get(FIREBASE_APP_NAME);
2299
+ const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2783
2300
  try {
2784
- const app = appName ? getApp(appName) : getApp();
2785
- return app;
2301
+ return getApp(appName);
2786
2302
  }
2787
2303
  catch (error) {
2788
- console.warn('Firebase app not found, initializing new app');
2789
- if (error instanceof Error)
2790
- console.error(error.message);
2791
2304
  return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2792
2305
  }
2793
2306
  }),
2794
- provideAppCheck((injector) => {
2795
- const app = injector.get(FirebaseApp);
2796
- try {
2797
- const provider = injector.get(APP_CHECK_PROVIDER);
2798
- if (provider)
2799
- return initializeAppCheck(app, {
2800
- provider,
2801
- isTokenAutoRefreshEnabled: true,
2802
- });
2803
- }
2804
- catch (error) {
2805
- if (error instanceof Error)
2806
- console.error(error.message);
2807
- return;
2808
- }
2809
- }),
2810
- provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2811
2307
  AngularElasticSeachModule,
2812
- AngularVertexSeachModule,
2813
2308
  AngularFirebaseAuthModule,
2814
2309
  AngularFirestoreModule,
2815
2310
  AngularHasuraGraphQLModule,
@@ -2833,17 +2328,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
2833
2328
  },
2834
2329
  deps: ['UserRepository', 'FileUploaderService'],
2835
2330
  },
2836
- {
2837
- provide: 'FileUploaderService',
2838
- useFactory: (storage, baseUrl) => {
2839
- return new FirebaseFileUploaderService(storage, baseUrl);
2840
- },
2841
- deps: [Storage, STORAGE_BASE_URL],
2842
- },
2843
- {
2844
- provide: 'ProductSearch',
2845
- useExisting: ProductsVertexSearch,
2846
- },
2847
2331
  ],
2848
2332
  }]
2849
2333
  }] });