@infrab4a/connect-angular 4.10.0-beta.11 → 4.10.0-beta.2

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 (123) hide show
  1. package/angular-connect.module.d.ts +29 -27
  2. package/angular-elastic-search.module.d.ts +9 -9
  3. package/angular-firebase-auth.module.d.ts +11 -11
  4. package/angular-firestore.module.d.ts +17 -17
  5. package/angular-hasura-graphql.module.d.ts +16 -16
  6. package/angular-vertex-search.module.d.ts +9 -0
  7. package/consts/backend-url.const.d.ts +1 -1
  8. package/consts/category-structure.d.ts +1 -1
  9. package/consts/default-shop.const.d.ts +1 -1
  10. package/consts/es-config.const.d.ts +1 -1
  11. package/consts/firebase-const.d.ts +3 -3
  12. package/consts/hasura-options.const.d.ts +1 -1
  13. package/consts/index.d.ts +8 -7
  14. package/consts/persistence.const.d.ts +1 -1
  15. package/consts/storage-base-url.const.d.ts +1 -1
  16. package/consts/vertex-config.const.d.ts +1 -0
  17. package/esm2020/angular-connect.module.mjs +146 -0
  18. package/esm2020/angular-elastic-search.module.mjs +34 -0
  19. package/esm2020/angular-firebase-auth.module.mjs +115 -0
  20. package/esm2020/angular-firestore.module.mjs +499 -0
  21. package/esm2020/angular-hasura-graphql.module.mjs +287 -0
  22. package/esm2020/angular-vertex-search.module.mjs +34 -0
  23. package/{esm2022 → esm2020}/consts/backend-url.const.mjs +1 -1
  24. package/{esm2022 → esm2020}/consts/category-structure.mjs +2 -2
  25. package/{esm2022 → esm2020}/consts/default-shop.const.mjs +2 -2
  26. package/{esm2022 → esm2020}/consts/es-config.const.mjs +2 -2
  27. package/{esm2022 → esm2020}/consts/firebase-const.mjs +4 -4
  28. package/{esm2022 → esm2020}/consts/hasura-options.const.mjs +2 -2
  29. package/{esm2022 → esm2020}/consts/index.mjs +9 -8
  30. package/{esm2022 → esm2020}/consts/persistence.const.mjs +2 -2
  31. package/{esm2022 → esm2020}/consts/storage-base-url.const.mjs +2 -2
  32. package/esm2020/consts/vertex-config.const.mjs +2 -0
  33. package/{esm2022 → esm2020}/helpers/index.mjs +2 -2
  34. package/{esm2022 → esm2020}/helpers/mobile-operation-system-checker.helper.mjs +7 -7
  35. package/{esm2022 → esm2020}/index.mjs +7 -7
  36. package/{esm2022 → esm2020}/infrab4a-connect-angular.mjs +4 -4
  37. package/{esm2022 → esm2020}/persistence/cookie-data-persistence.mjs +22 -22
  38. package/{esm2022 → esm2020}/persistence/data-persistence.mjs +2 -2
  39. package/{esm2022 → esm2020}/persistence/index.mjs +3 -3
  40. package/{esm2022 → esm2020}/services/auth.service.mjs +37 -37
  41. package/esm2020/services/cart.service.mjs +282 -0
  42. package/{esm2022 → esm2020}/services/catalog/adapters/category-structure.adapter.mjs +2 -2
  43. package/{esm2022 → esm2020}/services/catalog/adapters/index.mjs +4 -4
  44. package/{esm2022 → esm2020}/services/catalog/adapters/new-category-structure.adapter.mjs +43 -43
  45. package/{esm2022 → esm2020}/services/catalog/adapters/old-category-structure.adapter.mjs +23 -23
  46. package/esm2020/services/catalog/catalog.service.mjs +252 -0
  47. package/{esm2022 → esm2020}/services/catalog/category.service.mjs +51 -51
  48. package/{esm2022 → esm2020}/services/catalog/enums/index.mjs +2 -2
  49. package/{esm2022 → esm2020}/services/catalog/enums/product-sorts.enum.mjs +11 -11
  50. package/{esm2022 → esm2020}/services/catalog/index.mjs +8 -8
  51. package/{esm2022 → esm2020}/services/catalog/models/category-with-tree.model.mjs +10 -10
  52. package/{esm2022 → esm2020}/services/catalog/models/index.mjs +2 -2
  53. package/{esm2022 → esm2020}/services/catalog/types/index.mjs +2 -2
  54. package/{esm2022 → esm2020}/services/catalog/types/product-sort.type.mjs +2 -2
  55. package/esm2020/services/catalog/wishlist.service.mjs +129 -0
  56. package/{esm2022 → esm2020}/services/checkout-subscription.service.mjs +50 -50
  57. package/{esm2022 → esm2020}/services/checkout.service.mjs +68 -68
  58. package/esm2020/services/coupon.service.mjs +260 -0
  59. package/{esm2022 → esm2020}/services/helpers/index.mjs +2 -2
  60. package/{esm2022 → esm2020}/services/helpers/util.helper.mjs +18 -18
  61. package/{esm2022 → esm2020}/services/home-shop.service.mjs +125 -125
  62. package/{esm2022 → esm2020}/services/index.mjs +11 -11
  63. package/{esm2022 → esm2020}/services/order.service.mjs +30 -30
  64. package/{esm2022 → esm2020}/services/shipping.service.mjs +96 -96
  65. package/{esm2022 → esm2020}/services/types/index.mjs +3 -3
  66. package/{esm2022 → esm2020}/services/types/required-checkout-data.type.mjs +2 -2
  67. package/{esm2022 → esm2020}/services/types/required-checkout-subscription-data.type.mjs +2 -2
  68. package/esm2020/services/types/shipping-methods.type.mjs +2 -0
  69. package/{esm2022 → esm2020}/types/firebase-app-config.type.mjs +2 -2
  70. package/{esm2022 → esm2020}/types/index.mjs +2 -2
  71. package/fesm2015/infrab4a-connect-angular.mjs +2588 -0
  72. package/fesm2015/infrab4a-connect-angular.mjs.map +1 -0
  73. package/{fesm2022 → fesm2020}/infrab4a-connect-angular.mjs +2458 -2404
  74. package/fesm2020/infrab4a-connect-angular.mjs.map +1 -0
  75. package/helpers/index.d.ts +1 -1
  76. package/helpers/mobile-operation-system-checker.helper.d.ts +3 -3
  77. package/index.d.ts +6 -6
  78. package/package.json +12 -6
  79. package/persistence/cookie-data-persistence.d.ts +10 -10
  80. package/persistence/data-persistence.d.ts +6 -6
  81. package/persistence/index.d.ts +2 -2
  82. package/services/auth.service.d.ts +18 -18
  83. package/services/cart.service.d.ts +42 -42
  84. package/services/catalog/adapters/category-structure.adapter.d.ts +4 -4
  85. package/services/catalog/adapters/index.d.ts +3 -3
  86. package/services/catalog/adapters/new-category-structure.adapter.d.ts +12 -12
  87. package/services/catalog/adapters/old-category-structure.adapter.d.ts +10 -10
  88. package/services/catalog/catalog.service.d.ts +89 -89
  89. package/services/catalog/category.service.d.ts +20 -20
  90. package/services/catalog/enums/index.d.ts +1 -1
  91. package/services/catalog/enums/product-sorts.enum.d.ts +9 -9
  92. package/services/catalog/index.d.ts +7 -7
  93. package/services/catalog/models/category-with-tree.model.d.ts +4 -4
  94. package/services/catalog/models/index.d.ts +1 -1
  95. package/services/catalog/types/index.d.ts +1 -1
  96. package/services/catalog/types/product-sort.type.d.ts +2 -2
  97. package/services/catalog/wishlist.service.d.ts +44 -44
  98. package/services/checkout-subscription.service.d.ts +19 -19
  99. package/services/checkout.service.d.ts +27 -27
  100. package/services/coupon.service.d.ts +33 -33
  101. package/services/helpers/index.d.ts +1 -1
  102. package/services/helpers/util.helper.d.ts +3 -3
  103. package/services/home-shop.service.d.ts +26 -26
  104. package/services/index.d.ts +10 -10
  105. package/services/order.service.d.ts +13 -13
  106. package/services/shipping.service.d.ts +19 -19
  107. package/services/types/index.d.ts +2 -2
  108. package/services/types/required-checkout-data.type.d.ts +2 -2
  109. package/services/types/required-checkout-subscription-data.type.d.ts +2 -2
  110. package/services/types/shipping-methods.type.d.ts +12 -12
  111. package/types/firebase-app-config.type.d.ts +1 -1
  112. package/types/index.d.ts +1 -1
  113. package/esm2022/angular-connect.module.mjs +0 -133
  114. package/esm2022/angular-elastic-search.module.mjs +0 -34
  115. package/esm2022/angular-firebase-auth.module.mjs +0 -115
  116. package/esm2022/angular-firestore.module.mjs +0 -499
  117. package/esm2022/angular-hasura-graphql.module.mjs +0 -287
  118. package/esm2022/services/cart.service.mjs +0 -284
  119. package/esm2022/services/catalog/catalog.service.mjs +0 -235
  120. package/esm2022/services/catalog/wishlist.service.mjs +0 -129
  121. package/esm2022/services/coupon.service.mjs +0 -265
  122. package/esm2022/services/types/shipping-methods.type.mjs +0 -2
  123. package/fesm2022/infrab4a-connect-angular.mjs.map +0 -1
@@ -0,0 +1,2588 @@
1
+ import * as i0 from '@angular/core';
2
+ import { NgModule, InjectionToken, PLATFORM_ID, Injectable, Inject } from '@angular/core';
3
+ import * as i1$4 from '@angular/fire/app';
4
+ import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
5
+ import * as i2 from '@angular/fire/storage';
6
+ import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
7
+ import * as i1$2 from '@infrab4a/connect';
8
+ 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, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewsHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, RoundProductPricesHelper, set, InvalidArgumentError, Category, PersonTypes, Wishlist, CheckoutSubscription, Product, RequiredArgumentError, add, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
9
+ import * as i1 from '@angular/fire/auth';
10
+ import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
11
+ import { isPlatformBrowser, isPlatformServer } from '@angular/common';
12
+ import * as i1$1 from '@angular/fire/firestore';
13
+ import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
14
+ import cookie from 'js-cookie';
15
+ import { of, from, combineLatest, throwError, Subject, iif, forkJoin } from 'rxjs';
16
+ import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
17
+ import { __awaiter, __decorate, __metadata } from 'tslib';
18
+ import { Type } from 'class-transformer';
19
+ import * as i1$3 from '@angular/common/http';
20
+
21
+ const ES_CONFIG = 'ES_CONFIG';
22
+
23
+ class AngularElasticSeachModule {
24
+ static initializeApp(options) {
25
+ return {
26
+ ngModule: AngularElasticSeachModule,
27
+ providers: [{ provide: ES_CONFIG, useValue: options }],
28
+ };
29
+ }
30
+ }
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: [{
41
+ type: NgModule,
42
+ args: [{
43
+ providers: [
44
+ {
45
+ provide: ProductsIndex,
46
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
47
+ deps: [ES_CONFIG],
48
+ },
49
+ ],
50
+ }]
51
+ }] });
52
+
53
+ const BACKEND_URL = 'BACKEND_URL';
54
+
55
+ const CATEGORY_STRUCTURE = 'CATEGORY_STRUCTURE';
56
+
57
+ const DEFAULT_SHOP = 'DEFAULT_SHOP';
58
+
59
+ const FIREBASE_APP_NAME = new InjectionToken('firebaseAppName');
60
+ const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
61
+
62
+ const HASURA_OPTIONS = 'HASURA_OPTIONS';
63
+
64
+ const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
65
+
66
+ const VERTEX_CONFIG = 'VERTEX_CONFIG';
67
+
68
+ class AngularFirebaseAuthModule {
69
+ static initializeApp(options, nameOrConfig) {
70
+ return {
71
+ ngModule: AngularFirebaseAuthModule,
72
+ providers: [
73
+ { provide: FIREBASE_OPTIONS, useValue: options },
74
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
75
+ ],
76
+ };
77
+ }
78
+ }
79
+ AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
80
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1.AuthModule] });
81
+ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
82
+ {
83
+ provide: 'Authentication',
84
+ useFactory: (authenticationService, userRepository) => {
85
+ return new Authentication(authenticationService, userRepository);
86
+ },
87
+ deps: ['AuthenticationService', 'UserRepository'],
88
+ },
89
+ {
90
+ provide: 'AuthenticationService',
91
+ useFactory: (angularFireAuth) => {
92
+ return new AuthenticationFirebaseAuthService(angularFireAuth);
93
+ },
94
+ deps: [Auth],
95
+ },
96
+ {
97
+ provide: 'Register',
98
+ useFactory: (registerService, userRepository) => {
99
+ return new Register(registerService, userRepository);
100
+ },
101
+ deps: ['RegisterService', 'UserRepository'],
102
+ },
103
+ {
104
+ provide: 'RegisterService',
105
+ useFactory: (angularFireAuth) => {
106
+ return new RegisterFirebaseAuthService(angularFireAuth);
107
+ },
108
+ deps: [Auth],
109
+ },
110
+ {
111
+ provide: 'SignOut',
112
+ useFactory: (authenticationService) => {
113
+ return new SignOut(authenticationService);
114
+ },
115
+ deps: ['AuthenticationService'],
116
+ },
117
+ {
118
+ provide: 'RecoveryPassword',
119
+ useFactory: (authenticationService) => {
120
+ return new RecoveryPassword(authenticationService);
121
+ },
122
+ deps: ['AuthenticationService'],
123
+ },
124
+ ], imports: [provideAuth((injector) => getAuth(injector.get(FirebaseApp)))] });
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
126
+ type: NgModule,
127
+ args: [{
128
+ imports: [provideAuth((injector) => getAuth(injector.get(FirebaseApp)))],
129
+ providers: [
130
+ {
131
+ provide: 'Authentication',
132
+ useFactory: (authenticationService, userRepository) => {
133
+ return new Authentication(authenticationService, userRepository);
134
+ },
135
+ deps: ['AuthenticationService', 'UserRepository'],
136
+ },
137
+ {
138
+ provide: 'AuthenticationService',
139
+ useFactory: (angularFireAuth) => {
140
+ return new AuthenticationFirebaseAuthService(angularFireAuth);
141
+ },
142
+ deps: [Auth],
143
+ },
144
+ {
145
+ provide: 'Register',
146
+ useFactory: (registerService, userRepository) => {
147
+ return new Register(registerService, userRepository);
148
+ },
149
+ deps: ['RegisterService', 'UserRepository'],
150
+ },
151
+ {
152
+ provide: 'RegisterService',
153
+ useFactory: (angularFireAuth) => {
154
+ return new RegisterFirebaseAuthService(angularFireAuth);
155
+ },
156
+ deps: [Auth],
157
+ },
158
+ {
159
+ provide: 'SignOut',
160
+ useFactory: (authenticationService) => {
161
+ return new SignOut(authenticationService);
162
+ },
163
+ deps: ['AuthenticationService'],
164
+ },
165
+ {
166
+ provide: 'RecoveryPassword',
167
+ useFactory: (authenticationService) => {
168
+ return new RecoveryPassword(authenticationService);
169
+ },
170
+ deps: ['AuthenticationService'],
171
+ },
172
+ ],
173
+ }]
174
+ }] });
175
+
176
+ class MobileOperationSystemCheckerHelper {
177
+ static isAppleDevice() {
178
+ var _a, _b;
179
+ return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator === null || navigator === void 0 ? void 0 : navigator.platform) ||
180
+ (((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, 'Mac')) && 'ontouchend' in (document || {})));
181
+ }
182
+ }
183
+
184
+ class AngularFirestoreModule {
185
+ static initializeApp(options, nameOrConfig) {
186
+ return {
187
+ ngModule: AngularFirestoreModule,
188
+ providers: [
189
+ { provide: FIREBASE_OPTIONS, useValue: options.firebase },
190
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
191
+ { provide: ES_CONFIG, useValue: options.elasticSearch },
192
+ ],
193
+ };
194
+ }
195
+ }
196
+ AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
197
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule] });
198
+ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
199
+ {
200
+ provide: 'FirestoreOptions',
201
+ useFactory: (firestore, platformId) => ({
202
+ firestore: new ConnectFirestoreService(firestore),
203
+ interceptors: {
204
+ request: (request) => {
205
+ if (isPlatformBrowser(platformId))
206
+ return request;
207
+ const interval = setInterval(() => { }, 100);
208
+ request.interval = interval;
209
+ return request;
210
+ },
211
+ response: (response, request) => {
212
+ if (isPlatformBrowser(platformId))
213
+ return response;
214
+ clearInterval(request.interval);
215
+ return response;
216
+ },
217
+ },
218
+ }),
219
+ deps: [Firestore, PLATFORM_ID],
220
+ },
221
+ {
222
+ provide: 'BeautyProfileRepository',
223
+ useFactory: (config, userRepository) => {
224
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
225
+ },
226
+ deps: ['FirestoreOptions', 'UserRepository'],
227
+ },
228
+ {
229
+ provide: 'Buy2WinRepository',
230
+ useFactory: (options) => {
231
+ return new Buy2WinFirestoreRepository(options);
232
+ },
233
+ deps: ['FirestoreOptions'],
234
+ },
235
+ {
236
+ provide: CategoryFirestoreRepository,
237
+ useFactory: (options) => {
238
+ return new CategoryFirestoreRepository(options);
239
+ },
240
+ deps: ['FirestoreOptions'],
241
+ },
242
+ {
243
+ provide: 'CheckoutRepository',
244
+ useFactory: (options) => {
245
+ return new CheckoutFirestoreRepository(options);
246
+ },
247
+ deps: ['FirestoreOptions'],
248
+ },
249
+ {
250
+ provide: 'CheckoutSubscriptionRepository',
251
+ useFactory: (options) => {
252
+ return new CheckoutSubscriptionFirestoreRepository(options);
253
+ },
254
+ deps: ['FirestoreOptions'],
255
+ },
256
+ {
257
+ provide: 'CouponRepository',
258
+ useFactory: (options) => {
259
+ return new CouponFirestoreRepository(options);
260
+ },
261
+ deps: ['FirestoreOptions'],
262
+ },
263
+ {
264
+ provide: 'CampaignHashtagRepository',
265
+ useFactory: (options) => {
266
+ return new CampaignHashtagFirestoreRepository(options);
267
+ },
268
+ deps: ['FirestoreOptions'],
269
+ },
270
+ {
271
+ provide: 'CampaignDashboardRepository',
272
+ useFactory: (options) => {
273
+ return new CampaignDashboardFirestoreRepository(options);
274
+ },
275
+ deps: ['FirestoreOptions'],
276
+ },
277
+ {
278
+ provide: 'EditionRepository',
279
+ useFactory: (options, subscriptionRepository) => {
280
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
281
+ },
282
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
283
+ },
284
+ {
285
+ provide: 'HomeRepository',
286
+ useFactory: (options) => {
287
+ return new HomeFirestoreRepository(options);
288
+ },
289
+ deps: ['FirestoreOptions'],
290
+ },
291
+ {
292
+ provide: 'LeadRepository',
293
+ useFactory: (options) => {
294
+ return new LeadFirestoreRepository(options);
295
+ },
296
+ deps: ['FirestoreOptions'],
297
+ },
298
+ {
299
+ provide: 'LegacyOrderRepository',
300
+ useFactory: (options) => {
301
+ return new LegacyOrderFirestoreRepository(options);
302
+ },
303
+ deps: ['FirestoreOptions'],
304
+ },
305
+ {
306
+ provide: 'ShopMenuRepository',
307
+ useFactory: (options) => {
308
+ return new ShopMenuFirestoreRepository(options);
309
+ },
310
+ deps: ['FirestoreOptions'],
311
+ },
312
+ {
313
+ provide: 'OrderRepository',
314
+ useFactory: (options) => {
315
+ return new OrderFirestoreRepository(options);
316
+ },
317
+ deps: ['FirestoreOptions'],
318
+ },
319
+ {
320
+ provide: 'PaymentRepository',
321
+ useFactory: (options) => {
322
+ return new PaymentFirestoreRepository(options);
323
+ },
324
+ deps: ['FirestoreOptions'],
325
+ },
326
+ {
327
+ provide: ProductFirestoreRepository,
328
+ useFactory: (options) => {
329
+ return new ProductFirestoreRepository(options);
330
+ },
331
+ deps: ['FirestoreOptions'],
332
+ },
333
+ {
334
+ provide: 'ShopSettingsRepository',
335
+ useFactory: (options) => {
336
+ return new ShopSettingsFirestoreRepository(options);
337
+ },
338
+ deps: ['FirestoreOptions'],
339
+ },
340
+ {
341
+ provide: 'SubscriptionPaymentRepository',
342
+ useFactory: (options, subscriptionRepository) => {
343
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
344
+ },
345
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
346
+ },
347
+ {
348
+ provide: 'SubscriptionPlanRepository',
349
+ useFactory: (options) => {
350
+ return new SubscriptionPlanFirestoreRepository(options);
351
+ },
352
+ deps: ['FirestoreOptions'],
353
+ },
354
+ {
355
+ provide: 'SubscriptionProductRepository',
356
+ useFactory: (options) => {
357
+ return new SubscriptionProductFirestoreRepository(options);
358
+ },
359
+ deps: ['FirestoreOptions'],
360
+ },
361
+ {
362
+ provide: 'SubscriptionRepository',
363
+ useFactory: (options) => {
364
+ return new SubscriptionFirestoreRepository(options);
365
+ },
366
+ deps: ['FirestoreOptions'],
367
+ },
368
+ {
369
+ provide: 'UserRepository',
370
+ useFactory: (options) => {
371
+ return new UserFirestoreRepository(options);
372
+ },
373
+ deps: ['FirestoreOptions'],
374
+ },
375
+ {
376
+ provide: 'UserAddressRepository',
377
+ useFactory: (options, userRepository) => {
378
+ return new UserAddressFirestoreRepository(options, userRepository);
379
+ },
380
+ deps: ['FirestoreOptions', 'UserRepository'],
381
+ },
382
+ {
383
+ provide: 'UserPaymentMethodRepository',
384
+ useFactory: (options, userRepository) => {
385
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
386
+ },
387
+ deps: ['FirestoreOptions', 'UserRepository'],
388
+ },
389
+ {
390
+ provide: 'SubscriptionMaterializationRepository',
391
+ useFactory: (options) => {
392
+ return new SubscriptionMaterializationFirestoreRepository(options);
393
+ },
394
+ deps: ['FirestoreOptions'],
395
+ },
396
+ {
397
+ provide: 'SubscriptionSummaryRepository',
398
+ useFactory: (options) => {
399
+ return new SubscriptionSummaryFirestoreRepository(options);
400
+ },
401
+ deps: ['FirestoreOptions'],
402
+ },
403
+ {
404
+ provide: ProductVariantFirestoreRepository,
405
+ useFactory: (options, productRepository) => {
406
+ return new ProductVariantFirestoreRepository(options, productRepository);
407
+ },
408
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
409
+ },
410
+ {
411
+ provide: 'OrderBlockedRepository',
412
+ useFactory: (options) => {
413
+ return new OrderBlockedFirestoreRepository(options);
414
+ },
415
+ deps: ['FirestoreOptions'],
416
+ },
417
+ ], imports: [AngularElasticSeachModule,
418
+ provideFirestore((injector) => {
419
+ const platformId = injector.get(PLATFORM_ID);
420
+ if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
421
+ return initializeFirestore(injector.get(FirebaseApp), {
422
+ ignoreUndefinedProperties: true,
423
+ });
424
+ const firestore = initializeFirestore(injector.get(FirebaseApp), {
425
+ experimentalForceLongPolling: true,
426
+ ignoreUndefinedProperties: true,
427
+ localCache: memoryLocalCache(),
428
+ });
429
+ return firestore;
430
+ })] });
431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
432
+ type: NgModule,
433
+ args: [{
434
+ imports: [
435
+ AngularElasticSeachModule,
436
+ provideFirestore((injector) => {
437
+ const platformId = injector.get(PLATFORM_ID);
438
+ if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
439
+ return initializeFirestore(injector.get(FirebaseApp), {
440
+ ignoreUndefinedProperties: true,
441
+ });
442
+ const firestore = initializeFirestore(injector.get(FirebaseApp), {
443
+ experimentalForceLongPolling: true,
444
+ ignoreUndefinedProperties: true,
445
+ localCache: memoryLocalCache(),
446
+ });
447
+ return firestore;
448
+ }),
449
+ ],
450
+ providers: [
451
+ {
452
+ provide: 'FirestoreOptions',
453
+ useFactory: (firestore, platformId) => ({
454
+ firestore: new ConnectFirestoreService(firestore),
455
+ interceptors: {
456
+ request: (request) => {
457
+ if (isPlatformBrowser(platformId))
458
+ return request;
459
+ const interval = setInterval(() => { }, 100);
460
+ request.interval = interval;
461
+ return request;
462
+ },
463
+ response: (response, request) => {
464
+ if (isPlatformBrowser(platformId))
465
+ return response;
466
+ clearInterval(request.interval);
467
+ return response;
468
+ },
469
+ },
470
+ }),
471
+ deps: [Firestore, PLATFORM_ID],
472
+ },
473
+ {
474
+ provide: 'BeautyProfileRepository',
475
+ useFactory: (config, userRepository) => {
476
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
477
+ },
478
+ deps: ['FirestoreOptions', 'UserRepository'],
479
+ },
480
+ {
481
+ provide: 'Buy2WinRepository',
482
+ useFactory: (options) => {
483
+ return new Buy2WinFirestoreRepository(options);
484
+ },
485
+ deps: ['FirestoreOptions'],
486
+ },
487
+ {
488
+ provide: CategoryFirestoreRepository,
489
+ useFactory: (options) => {
490
+ return new CategoryFirestoreRepository(options);
491
+ },
492
+ deps: ['FirestoreOptions'],
493
+ },
494
+ {
495
+ provide: 'CheckoutRepository',
496
+ useFactory: (options) => {
497
+ return new CheckoutFirestoreRepository(options);
498
+ },
499
+ deps: ['FirestoreOptions'],
500
+ },
501
+ {
502
+ provide: 'CheckoutSubscriptionRepository',
503
+ useFactory: (options) => {
504
+ return new CheckoutSubscriptionFirestoreRepository(options);
505
+ },
506
+ deps: ['FirestoreOptions'],
507
+ },
508
+ {
509
+ provide: 'CouponRepository',
510
+ useFactory: (options) => {
511
+ return new CouponFirestoreRepository(options);
512
+ },
513
+ deps: ['FirestoreOptions'],
514
+ },
515
+ {
516
+ provide: 'CampaignHashtagRepository',
517
+ useFactory: (options) => {
518
+ return new CampaignHashtagFirestoreRepository(options);
519
+ },
520
+ deps: ['FirestoreOptions'],
521
+ },
522
+ {
523
+ provide: 'CampaignDashboardRepository',
524
+ useFactory: (options) => {
525
+ return new CampaignDashboardFirestoreRepository(options);
526
+ },
527
+ deps: ['FirestoreOptions'],
528
+ },
529
+ {
530
+ provide: 'EditionRepository',
531
+ useFactory: (options, subscriptionRepository) => {
532
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
533
+ },
534
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
535
+ },
536
+ {
537
+ provide: 'HomeRepository',
538
+ useFactory: (options) => {
539
+ return new HomeFirestoreRepository(options);
540
+ },
541
+ deps: ['FirestoreOptions'],
542
+ },
543
+ {
544
+ provide: 'LeadRepository',
545
+ useFactory: (options) => {
546
+ return new LeadFirestoreRepository(options);
547
+ },
548
+ deps: ['FirestoreOptions'],
549
+ },
550
+ {
551
+ provide: 'LegacyOrderRepository',
552
+ useFactory: (options) => {
553
+ return new LegacyOrderFirestoreRepository(options);
554
+ },
555
+ deps: ['FirestoreOptions'],
556
+ },
557
+ {
558
+ provide: 'ShopMenuRepository',
559
+ useFactory: (options) => {
560
+ return new ShopMenuFirestoreRepository(options);
561
+ },
562
+ deps: ['FirestoreOptions'],
563
+ },
564
+ {
565
+ provide: 'OrderRepository',
566
+ useFactory: (options) => {
567
+ return new OrderFirestoreRepository(options);
568
+ },
569
+ deps: ['FirestoreOptions'],
570
+ },
571
+ {
572
+ provide: 'PaymentRepository',
573
+ useFactory: (options) => {
574
+ return new PaymentFirestoreRepository(options);
575
+ },
576
+ deps: ['FirestoreOptions'],
577
+ },
578
+ {
579
+ provide: ProductFirestoreRepository,
580
+ useFactory: (options) => {
581
+ return new ProductFirestoreRepository(options);
582
+ },
583
+ deps: ['FirestoreOptions'],
584
+ },
585
+ {
586
+ provide: 'ShopSettingsRepository',
587
+ useFactory: (options) => {
588
+ return new ShopSettingsFirestoreRepository(options);
589
+ },
590
+ deps: ['FirestoreOptions'],
591
+ },
592
+ {
593
+ provide: 'SubscriptionPaymentRepository',
594
+ useFactory: (options, subscriptionRepository) => {
595
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
596
+ },
597
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
598
+ },
599
+ {
600
+ provide: 'SubscriptionPlanRepository',
601
+ useFactory: (options) => {
602
+ return new SubscriptionPlanFirestoreRepository(options);
603
+ },
604
+ deps: ['FirestoreOptions'],
605
+ },
606
+ {
607
+ provide: 'SubscriptionProductRepository',
608
+ useFactory: (options) => {
609
+ return new SubscriptionProductFirestoreRepository(options);
610
+ },
611
+ deps: ['FirestoreOptions'],
612
+ },
613
+ {
614
+ provide: 'SubscriptionRepository',
615
+ useFactory: (options) => {
616
+ return new SubscriptionFirestoreRepository(options);
617
+ },
618
+ deps: ['FirestoreOptions'],
619
+ },
620
+ {
621
+ provide: 'UserRepository',
622
+ useFactory: (options) => {
623
+ return new UserFirestoreRepository(options);
624
+ },
625
+ deps: ['FirestoreOptions'],
626
+ },
627
+ {
628
+ provide: 'UserAddressRepository',
629
+ useFactory: (options, userRepository) => {
630
+ return new UserAddressFirestoreRepository(options, userRepository);
631
+ },
632
+ deps: ['FirestoreOptions', 'UserRepository'],
633
+ },
634
+ {
635
+ provide: 'UserPaymentMethodRepository',
636
+ useFactory: (options, userRepository) => {
637
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
638
+ },
639
+ deps: ['FirestoreOptions', 'UserRepository'],
640
+ },
641
+ {
642
+ provide: 'SubscriptionMaterializationRepository',
643
+ useFactory: (options) => {
644
+ return new SubscriptionMaterializationFirestoreRepository(options);
645
+ },
646
+ deps: ['FirestoreOptions'],
647
+ },
648
+ {
649
+ provide: 'SubscriptionSummaryRepository',
650
+ useFactory: (options) => {
651
+ return new SubscriptionSummaryFirestoreRepository(options);
652
+ },
653
+ deps: ['FirestoreOptions'],
654
+ },
655
+ {
656
+ provide: ProductVariantFirestoreRepository,
657
+ useFactory: (options, productRepository) => {
658
+ return new ProductVariantFirestoreRepository(options, productRepository);
659
+ },
660
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
661
+ },
662
+ {
663
+ provide: 'OrderBlockedRepository',
664
+ useFactory: (options) => {
665
+ return new OrderBlockedFirestoreRepository(options);
666
+ },
667
+ deps: ['FirestoreOptions'],
668
+ },
669
+ ],
670
+ }]
671
+ }] });
672
+
673
+ class AngularHasuraGraphQLModule {
674
+ static initializeApp(options) {
675
+ return {
676
+ ngModule: AngularHasuraGraphQLModule,
677
+ providers: [{ provide: HASURA_OPTIONS, useValue: options }],
678
+ };
679
+ }
680
+ }
681
+ AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
682
+ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
683
+ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
684
+ {
685
+ provide: 'HasuraConfig',
686
+ useFactory: (options, platformId) => ({
687
+ endpoint: options.endpoint,
688
+ authOptions: options.credentials,
689
+ interceptors: {
690
+ request: (request) => {
691
+ if (isPlatformBrowser(platformId))
692
+ return request;
693
+ const interval = setInterval(() => { }, 100);
694
+ request.interval = interval;
695
+ return request;
696
+ },
697
+ response: (response, request) => {
698
+ if (isPlatformBrowser(platformId))
699
+ return response;
700
+ clearInterval(request.interval);
701
+ return response;
702
+ },
703
+ },
704
+ }),
705
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
706
+ },
707
+ {
708
+ provide: 'CategoryRepository',
709
+ useExisting: CategoryHasuraGraphQLRepository,
710
+ },
711
+ {
712
+ provide: CategoryHasuraGraphQLRepository,
713
+ useFactory: (options, productRepository, categoryFilterRepository) => {
714
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
715
+ },
716
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
717
+ },
718
+ {
719
+ provide: 'ProductRepository',
720
+ useExisting: ProductHasuraGraphQLRepository,
721
+ },
722
+ {
723
+ provide: ProductHasuraGraphQLRepository,
724
+ useFactory: (hasuraConfig) => {
725
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
726
+ },
727
+ deps: ['HasuraConfig'],
728
+ },
729
+ {
730
+ provide: 'ProductReviewsRepository',
731
+ useExisting: ProductReviewsHasuraGraphQLRepository,
732
+ },
733
+ {
734
+ provide: ProductReviewsHasuraGraphQLRepository,
735
+ useFactory: (hasuraConfig) => {
736
+ return new ProductReviewsHasuraGraphQLRepository(hasuraConfig);
737
+ },
738
+ deps: ['HasuraConfig'],
739
+ },
740
+ {
741
+ provide: 'VariantRepository',
742
+ useExisting: VariantHasuraGraphQLRepository,
743
+ },
744
+ {
745
+ provide: VariantHasuraGraphQLRepository,
746
+ useFactory: (hasuraConfig) => {
747
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
748
+ },
749
+ deps: ['HasuraConfig'],
750
+ },
751
+ {
752
+ provide: 'ProductStockNotificationRepository',
753
+ useExisting: ProductStockNotificationHasuraGraphQLRepository,
754
+ },
755
+ {
756
+ provide: ProductStockNotificationHasuraGraphQLRepository,
757
+ useFactory: (hasuraConfig) => {
758
+ return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
759
+ },
760
+ deps: ['HasuraConfig'],
761
+ },
762
+ {
763
+ provide: 'CategoryFilterRepository',
764
+ useExisting: CategoryFilterHasuraGraphQLRepository,
765
+ },
766
+ {
767
+ provide: CategoryFilterHasuraGraphQLRepository,
768
+ useFactory: (options) => {
769
+ return new CategoryFilterHasuraGraphQLRepository(options);
770
+ },
771
+ deps: ['HasuraConfig'],
772
+ },
773
+ {
774
+ provide: 'FilterOptionRepository',
775
+ useExisting: FilterOptionHasuraGraphQLRepository,
776
+ },
777
+ {
778
+ provide: FilterOptionHasuraGraphQLRepository,
779
+ useFactory: (options) => {
780
+ return new FilterOptionHasuraGraphQLRepository(options);
781
+ },
782
+ deps: ['HasuraConfig'],
783
+ },
784
+ {
785
+ provide: 'FilterRepository',
786
+ useExisting: FilterHasuraGraphQLRepository,
787
+ },
788
+ {
789
+ provide: FilterHasuraGraphQLRepository,
790
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
791
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
792
+ },
793
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
794
+ },
795
+ {
796
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
797
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
798
+ deps: ['HasuraConfig'],
799
+ },
800
+ {
801
+ provide: 'CategoryCollectionChildrenRepository',
802
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
803
+ },
804
+ {
805
+ provide: WishlistHasuraGraphQLRepository,
806
+ useFactory: (options, categoryFilterRepository) => {
807
+ return new WishlistHasuraGraphQLRepository(options, categoryFilterRepository);
808
+ },
809
+ deps: ['HasuraConfig', CategoryFilterHasuraGraphQLRepository],
810
+ },
811
+ {
812
+ provide: 'WishlistRepository',
813
+ useExisting: WishlistHasuraGraphQLRepository,
814
+ },
815
+ ] });
816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
817
+ type: NgModule,
818
+ args: [{
819
+ providers: [
820
+ {
821
+ provide: 'HasuraConfig',
822
+ useFactory: (options, platformId) => ({
823
+ endpoint: options.endpoint,
824
+ authOptions: options.credentials,
825
+ interceptors: {
826
+ request: (request) => {
827
+ if (isPlatformBrowser(platformId))
828
+ return request;
829
+ const interval = setInterval(() => { }, 100);
830
+ request.interval = interval;
831
+ return request;
832
+ },
833
+ response: (response, request) => {
834
+ if (isPlatformBrowser(platformId))
835
+ return response;
836
+ clearInterval(request.interval);
837
+ return response;
838
+ },
839
+ },
840
+ }),
841
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
842
+ },
843
+ {
844
+ provide: 'CategoryRepository',
845
+ useExisting: CategoryHasuraGraphQLRepository,
846
+ },
847
+ {
848
+ provide: CategoryHasuraGraphQLRepository,
849
+ useFactory: (options, productRepository, categoryFilterRepository) => {
850
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
851
+ },
852
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
853
+ },
854
+ {
855
+ provide: 'ProductRepository',
856
+ useExisting: ProductHasuraGraphQLRepository,
857
+ },
858
+ {
859
+ provide: ProductHasuraGraphQLRepository,
860
+ useFactory: (hasuraConfig) => {
861
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
862
+ },
863
+ deps: ['HasuraConfig'],
864
+ },
865
+ {
866
+ provide: 'ProductReviewsRepository',
867
+ useExisting: ProductReviewsHasuraGraphQLRepository,
868
+ },
869
+ {
870
+ provide: ProductReviewsHasuraGraphQLRepository,
871
+ useFactory: (hasuraConfig) => {
872
+ return new ProductReviewsHasuraGraphQLRepository(hasuraConfig);
873
+ },
874
+ deps: ['HasuraConfig'],
875
+ },
876
+ {
877
+ provide: 'VariantRepository',
878
+ useExisting: VariantHasuraGraphQLRepository,
879
+ },
880
+ {
881
+ provide: VariantHasuraGraphQLRepository,
882
+ useFactory: (hasuraConfig) => {
883
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
884
+ },
885
+ deps: ['HasuraConfig'],
886
+ },
887
+ {
888
+ provide: 'ProductStockNotificationRepository',
889
+ useExisting: ProductStockNotificationHasuraGraphQLRepository,
890
+ },
891
+ {
892
+ provide: ProductStockNotificationHasuraGraphQLRepository,
893
+ useFactory: (hasuraConfig) => {
894
+ return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
895
+ },
896
+ deps: ['HasuraConfig'],
897
+ },
898
+ {
899
+ provide: 'CategoryFilterRepository',
900
+ useExisting: CategoryFilterHasuraGraphQLRepository,
901
+ },
902
+ {
903
+ provide: CategoryFilterHasuraGraphQLRepository,
904
+ useFactory: (options) => {
905
+ return new CategoryFilterHasuraGraphQLRepository(options);
906
+ },
907
+ deps: ['HasuraConfig'],
908
+ },
909
+ {
910
+ provide: 'FilterOptionRepository',
911
+ useExisting: FilterOptionHasuraGraphQLRepository,
912
+ },
913
+ {
914
+ provide: FilterOptionHasuraGraphQLRepository,
915
+ useFactory: (options) => {
916
+ return new FilterOptionHasuraGraphQLRepository(options);
917
+ },
918
+ deps: ['HasuraConfig'],
919
+ },
920
+ {
921
+ provide: 'FilterRepository',
922
+ useExisting: FilterHasuraGraphQLRepository,
923
+ },
924
+ {
925
+ provide: FilterHasuraGraphQLRepository,
926
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
927
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
928
+ },
929
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
930
+ },
931
+ {
932
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
933
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
934
+ deps: ['HasuraConfig'],
935
+ },
936
+ {
937
+ provide: 'CategoryCollectionChildrenRepository',
938
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
939
+ },
940
+ {
941
+ provide: WishlistHasuraGraphQLRepository,
942
+ useFactory: (options, categoryFilterRepository) => {
943
+ return new WishlistHasuraGraphQLRepository(options, categoryFilterRepository);
944
+ },
945
+ deps: ['HasuraConfig', CategoryFilterHasuraGraphQLRepository],
946
+ },
947
+ {
948
+ provide: 'WishlistRepository',
949
+ useExisting: WishlistHasuraGraphQLRepository,
950
+ },
951
+ ],
952
+ }]
953
+ }] });
954
+
955
+ class AngularVertexSeachModule {
956
+ static initializeApp(options) {
957
+ return {
958
+ ngModule: AngularVertexSeachModule,
959
+ providers: [{ provide: VERTEX_CONFIG, useValue: options }],
960
+ };
961
+ }
962
+ }
963
+ AngularVertexSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
964
+ AngularVertexSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule });
965
+ AngularVertexSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, providers: [
966
+ {
967
+ provide: ProductsVertexSearch,
968
+ useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
969
+ deps: [VERTEX_CONFIG],
970
+ },
971
+ ] });
972
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, decorators: [{
973
+ type: NgModule,
974
+ args: [{
975
+ providers: [
976
+ {
977
+ provide: ProductsVertexSearch,
978
+ useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
979
+ deps: [VERTEX_CONFIG],
980
+ },
981
+ ],
982
+ }]
983
+ }] });
984
+
985
+ const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
986
+
987
+ class CookieDataPersistence {
988
+ get(key) {
989
+ return of(cookie.get(key));
990
+ }
991
+ remove(key) {
992
+ return of(cookie.remove(key));
993
+ }
994
+ set(key, value) {
995
+ return from(cookie.set(key, value)).pipe(map(() => { }));
996
+ }
997
+ }
998
+ CookieDataPersistence.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
999
+ CookieDataPersistence.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence });
1000
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, decorators: [{
1001
+ type: Injectable
1002
+ }] });
1003
+
1004
+ class AuthService {
1005
+ constructor(angularFireAuth, userRepository) {
1006
+ this.angularFireAuth = angularFireAuth;
1007
+ this.userRepository = userRepository;
1008
+ }
1009
+ getAuthstate() {
1010
+ const observables = [this.getFireUser(), this.getUser()];
1011
+ return combineLatest(observables).pipe(map(([fireUser, user]) => ({
1012
+ user,
1013
+ isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
1014
+ })));
1015
+ }
1016
+ getUser() {
1017
+ return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? from(this.userRepository.get({ id })).pipe(catchError(() => of(null))) : of(null))));
1018
+ }
1019
+ getTokenId() {
1020
+ return from(getIdToken(this.angularFireAuth.currentUser));
1021
+ }
1022
+ getFireUser() {
1023
+ return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
1024
+ }
1025
+ }
1026
+ 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 });
1027
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
1028
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
1029
+ type: Injectable
1030
+ }], ctorParameters: function () {
1031
+ return [{ type: i1.Auth }, { type: undefined, decorators: [{
1032
+ type: Inject,
1033
+ args: ['UserRepository']
1034
+ }] }];
1035
+ } });
1036
+
1037
+ class CouponService {
1038
+ constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
1039
+ this.couponRepository = couponRepository;
1040
+ this.defaultShop = defaultShop;
1041
+ this.orderRepository = orderRepository;
1042
+ this.categoryRepository = categoryRepository;
1043
+ this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
1044
+ }
1045
+ checkCoupon(nickname, checkoutType, checkout, plan) {
1046
+ return from(this.couponRepository
1047
+ .find({
1048
+ filters: {
1049
+ nickname: { operator: Where.EQUALS, value: nickname },
1050
+ active: { operator: Where.EQUALS, value: true },
1051
+ },
1052
+ })
1053
+ .then((result) => result.data[0])).pipe(concatMap((coupon) => this.couponValidation(coupon, checkoutType)), concatMap((couponValid) => this.couponRulesValidation(couponValid, checkoutType, checkout, plan)), map((couponValidated) => couponValidated));
1054
+ }
1055
+ couponValidation(coupon, checkoutType) {
1056
+ return __awaiter(this, void 0, void 0, function* () {
1057
+ if (!coupon)
1058
+ throw 'Cupom inválido.';
1059
+ if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) && (coupon === null || coupon === void 0 ? void 0 : coupon.beginAt.getTime()) > new Date().getTime())
1060
+ throw 'Cupom inválido.';
1061
+ if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) && (coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn.getTime()) < new Date().getTime())
1062
+ throw 'Cupom expirado.';
1063
+ const isInShop = coupon.shopAvailability === Shops.ALL || coupon.shopAvailability === this.defaultShop;
1064
+ if (!isInShop)
1065
+ throw 'Cupom inválido para loja.';
1066
+ const isCheckoutType = coupon.checkoutType === CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
1067
+ if (!isCheckoutType)
1068
+ throw 'Cupom inválido. Erro de checkout.';
1069
+ return coupon;
1070
+ });
1071
+ }
1072
+ couponRulesValidation(coupon, checkoutType, checkout, plan) {
1073
+ return __awaiter(this, void 0, void 0, function* () {
1074
+ if (checkoutType == CheckoutTypes.SUBSCRIPTION) {
1075
+ if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
1076
+ throw 'Cupom inválido para sua assinatura.';
1077
+ return coupon;
1078
+ }
1079
+ const validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
1080
+ if (!validUser)
1081
+ throw 'Usuário não elegível.';
1082
+ const couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
1083
+ if (couponUseLimits.firstOrder) {
1084
+ const ordersUser = yield this.getOrdersFromUser(checkout.user.email.toLocaleLowerCase());
1085
+ if (couponUseLimits.firstOrder && ordersUser.length >= 1)
1086
+ throw 'Limite de uso atingido';
1087
+ }
1088
+ if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
1089
+ const orders = yield this.getOrdersWithCoupon(coupon);
1090
+ if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
1091
+ throw 'Limite de uso atingido.';
1092
+ if (couponUseLimits.limitedPerUser) {
1093
+ const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
1094
+ if (ordersWithUser > 0)
1095
+ throw 'Limite de uso por usuário atingido.';
1096
+ }
1097
+ }
1098
+ const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
1099
+ if (!hasProductCategories)
1100
+ throw 'Seu carrinho não possui produtos elegíveis para desconto.';
1101
+ const hasMinSubTotal = yield this.hasMinSubTotal(coupon, checkout);
1102
+ if (!hasMinSubTotal)
1103
+ throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`;
1104
+ return coupon;
1105
+ });
1106
+ }
1107
+ calcDiscountSubscription(coupon, checkout) {
1108
+ let discount = 0;
1109
+ if (coupon.discount.subscription.type == CouponTypes.ABSOLUTE)
1110
+ discount = coupon.discount.subscription.value;
1111
+ else
1112
+ discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount.subscription.value / 100);
1113
+ return of(discount);
1114
+ }
1115
+ calcDiscountShopping(coupon, checkout) {
1116
+ return __awaiter(this, void 0, void 0, function* () {
1117
+ let discountInfo = null;
1118
+ if (checkout.user.isSubscriber && coupon.discount.subscriber.value) {
1119
+ discountInfo = yield this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout);
1120
+ }
1121
+ else {
1122
+ discountInfo = yield this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout);
1123
+ }
1124
+ return { discount: discountInfo.discount, lineItems: discountInfo.lineItems };
1125
+ });
1126
+ }
1127
+ calcDiscountByType(type, value, categories, checkout) {
1128
+ return __awaiter(this, void 0, void 0, function* () {
1129
+ let discount = 0;
1130
+ let lineItensElegibleForDiscount = yield this.getLineItensEligebleForDiscount(categories, checkout);
1131
+ const subTotal = this.calcCheckoutSubtotal(lineItensElegibleForDiscount, checkout.user);
1132
+ if (type == CouponTypes.ABSOLUTE) {
1133
+ discount = value > subTotal ? subTotal : value;
1134
+ }
1135
+ else {
1136
+ discount = subTotal * (value / 100);
1137
+ }
1138
+ const lineItems = this.calcLineItenDiscount(type, lineItensElegibleForDiscount, value, subTotal);
1139
+ return { discount, lineItems };
1140
+ });
1141
+ }
1142
+ hasMinSubTotal(coupon, checkout) {
1143
+ return __awaiter(this, void 0, void 0, function* () {
1144
+ if (!coupon.minSubTotalValue)
1145
+ return true;
1146
+ let lineItensDiscount = yield this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout);
1147
+ const subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user);
1148
+ if (coupon.minSubTotalValue <= subTotal)
1149
+ return true;
1150
+ return false;
1151
+ });
1152
+ }
1153
+ hasProductCategories(coupon, checkout) {
1154
+ var _a;
1155
+ return __awaiter(this, void 0, void 0, function* () {
1156
+ if (!coupon.productsCategories || !coupon.productsCategories.length) {
1157
+ return true;
1158
+ }
1159
+ const couponCategories = yield this.getCouponCategoriesId(coupon.productsCategories);
1160
+ const hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter((i) => {
1161
+ var _a;
1162
+ if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
1163
+ return true;
1164
+ return i.categories.some((c) => couponCategories.some((cat) => cat == c));
1165
+ });
1166
+ return hasCategories.length ? true : false;
1167
+ });
1168
+ }
1169
+ coupomUserValidation(coupon, user) {
1170
+ if (!user || coupon.exclusivityType.includes(Exclusivities.ALL_USERS))
1171
+ return true;
1172
+ let userTypes = [];
1173
+ if (coupon.exclusivityType.includes(Exclusivities.COLLABORATORS) &&
1174
+ this.emailIsFromCollaborator(user.email.toLocaleLowerCase()))
1175
+ userTypes.push(Exclusivities.COLLABORATORS);
1176
+ if (coupon.exclusivityType.includes(Exclusivities.SPECIFIC_USER) &&
1177
+ coupon.userExclusiveEmail.includes(user.email.toLocaleLowerCase()))
1178
+ userTypes.push(Exclusivities.SPECIFIC_USER);
1179
+ if (coupon.exclusivityType.includes(Exclusivities.ACTIVE_SUBSCRIBER) &&
1180
+ user.isSubscriber &&
1181
+ user.subscriptionPlan != '')
1182
+ userTypes.push(Exclusivities.ACTIVE_SUBSCRIBER);
1183
+ if (user.isSubscriber &&
1184
+ user.subscriptionPlan == '' &&
1185
+ coupon.exclusivityType.includes(Exclusivities.INACTIVE_SUBSCRIBER))
1186
+ userTypes.push(Exclusivities.INACTIVE_SUBSCRIBER);
1187
+ if (coupon.exclusivityType.includes(Exclusivities.NON_SUBSCRIBER) && !user.isSubscriber)
1188
+ userTypes.push(Exclusivities.NON_SUBSCRIBER);
1189
+ return coupon.exclusivityType.some((r) => userTypes.includes(r));
1190
+ }
1191
+ getCouponCategoriesId(productsCategories) {
1192
+ return __awaiter(this, void 0, void 0, function* () {
1193
+ const couponCategories = [];
1194
+ for (let index = 0; index < productsCategories.length; index++) {
1195
+ const category = yield this.categoryRepository.get({
1196
+ id: productsCategories[index],
1197
+ });
1198
+ if (category) {
1199
+ const children = yield this.categoryRepository.getChildren(parseInt(productsCategories[index]));
1200
+ couponCategories.push(category.id, ...children.map((c) => c.id.toString()));
1201
+ }
1202
+ }
1203
+ return [...new Set(couponCategories)];
1204
+ });
1205
+ }
1206
+ getLineItensEligebleForDiscount(productsCategories, checkout) {
1207
+ var _a;
1208
+ return __awaiter(this, void 0, void 0, function* () {
1209
+ let lineItensDiscount = [];
1210
+ const couponCategories = yield this.getCouponCategoriesId(productsCategories);
1211
+ if (productsCategories && productsCategories.length) {
1212
+ lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter((i) => {
1213
+ var _a;
1214
+ if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
1215
+ return i.categories.some((c) => couponCategories.some((cat) => cat == c));
1216
+ }
1217
+ return true;
1218
+ });
1219
+ }
1220
+ else {
1221
+ lineItensDiscount = checkout.lineItems;
1222
+ }
1223
+ return lineItensDiscount;
1224
+ });
1225
+ }
1226
+ calcCheckoutSubtotal(lineItens, user) {
1227
+ return ((lineItens === null || lineItens === void 0 ? void 0 : lineItens.reduce((acc, curr) => {
1228
+ var _a;
1229
+ return (user === null || user === void 0 ? void 0 : user.isSubscriber) && curr.price.subscriberPrice
1230
+ ? acc + ((_a = curr.price) === null || _a === void 0 ? void 0 : _a.subscriberPrice) * curr.quantity
1231
+ : acc + curr.pricePaid * curr.quantity;
1232
+ }, 0)) || 0);
1233
+ }
1234
+ getOrdersWithCoupon(coupon) {
1235
+ return __awaiter(this, void 0, void 0, function* () {
1236
+ return yield this.orderRepository
1237
+ .find({
1238
+ filters: {
1239
+ coupon: { id: coupon.id },
1240
+ payment: { status: 'paid' },
1241
+ },
1242
+ })
1243
+ .then((result) => result.data);
1244
+ });
1245
+ }
1246
+ getOrdersFromUser(email) {
1247
+ return __awaiter(this, void 0, void 0, function* () {
1248
+ return yield this.orderRepository
1249
+ .find({
1250
+ filters: {
1251
+ user: { email: { operator: Where.EQUALS, value: email } },
1252
+ payment: { status: 'paid' },
1253
+ },
1254
+ })
1255
+ .then((result) => result.data);
1256
+ });
1257
+ }
1258
+ countOrdersWithUser(orders, email) {
1259
+ return orders.filter((o) => o.user.email == email).length;
1260
+ }
1261
+ getCouponUseLimits(coupon, checkoutType, user) {
1262
+ let couponUseLimits;
1263
+ if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
1264
+ couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
1265
+ }
1266
+ else {
1267
+ couponUseLimits = coupon.useLimits.subscription;
1268
+ }
1269
+ return couponUseLimits;
1270
+ }
1271
+ calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
1272
+ let lineItemsDiscount = [];
1273
+ if (type === CouponTypes.ABSOLUTE) {
1274
+ const couponDiscountMax = couponDiscount > subTotal ? subTotal : couponDiscount;
1275
+ lineItemsDiscount = lineItems.map((item) => {
1276
+ const totalItemPercentage = item.pricePaid / subTotal;
1277
+ const discountItem = couponDiscountMax * totalItemPercentage;
1278
+ return Object.assign(Object.assign({}, item), { discount: Number(discountItem.toFixed(2)) });
1279
+ });
1280
+ }
1281
+ else {
1282
+ lineItemsDiscount = lineItems.map((item) => {
1283
+ const discountItem = item.pricePaid * (couponDiscount / 100);
1284
+ return Object.assign(Object.assign({}, item), { discount: Number(discountItem.toFixed(2)) });
1285
+ });
1286
+ }
1287
+ return lineItemsDiscount;
1288
+ }
1289
+ }
1290
+ 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 });
1291
+ CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
1292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
1293
+ type: Injectable,
1294
+ args: [{
1295
+ providedIn: 'root',
1296
+ }]
1297
+ }], ctorParameters: function () {
1298
+ return [{ type: undefined, decorators: [{
1299
+ type: Inject,
1300
+ args: ['CouponRepository']
1301
+ }] }, { type: i1$2.Shops, decorators: [{
1302
+ type: Inject,
1303
+ args: [DEFAULT_SHOP]
1304
+ }] }, { type: undefined, decorators: [{
1305
+ type: Inject,
1306
+ args: ['OrderRepository']
1307
+ }] }, { type: undefined, decorators: [{
1308
+ type: Inject,
1309
+ args: ['CategoryRepository']
1310
+ }] }];
1311
+ } });
1312
+
1313
+ class CheckoutService {
1314
+ constructor(couponService, checkoutRepository, userRepository, defaultShop, dataPersistence) {
1315
+ this.couponService = couponService;
1316
+ this.checkoutRepository = checkoutRepository;
1317
+ this.userRepository = userRepository;
1318
+ this.defaultShop = defaultShop;
1319
+ this.dataPersistence = dataPersistence;
1320
+ }
1321
+ getCheckout(checkoutData) {
1322
+ return this.dataPersistence
1323
+ .get('checkoutId')
1324
+ .pipe(concatMap((id) => (!isNil(id) ? this.checkoutRepository.get({ id }) : this.createCheckout(checkoutData))));
1325
+ }
1326
+ getUserByCheckout(checkoutId) {
1327
+ return from(this.checkoutRepository.get({ id: checkoutId })).pipe(concatMap((checkout) => { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? of(checkout.user) : from(this.userRepository.get({ id: checkout.user.id })); }), concatMap((user) => of(user) || throwError(() => new NotFoundError('User is not found'))));
1328
+ }
1329
+ updateCheckoutLineItems(checkout) {
1330
+ return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
1331
+ }
1332
+ updateCheckoutUser(checkout) {
1333
+ return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
1334
+ }
1335
+ clearCheckoutFromSession() {
1336
+ return this.dataPersistence.remove('checkoutId');
1337
+ }
1338
+ calcDiscount(coupon) {
1339
+ return this.getCheckout().pipe(concatMap((checkout) => __awaiter(this, void 0, void 0, function* () { return yield this.couponService.calcDiscountShopping(coupon, checkout); })));
1340
+ }
1341
+ checkCoupon(nickname, checkoutType) {
1342
+ return this.getCheckout().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, CheckoutTypes.ECOMMERCE, checkout, null).pipe()));
1343
+ }
1344
+ createCheckout(checkoutData) {
1345
+ return __awaiter(this, void 0, void 0, function* () {
1346
+ const checkout = yield this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, Checkout.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }));
1347
+ yield this.dataPersistence.set('checkoutId', checkout.id).toPromise();
1348
+ return checkout;
1349
+ });
1350
+ }
1351
+ }
1352
+ 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 });
1353
+ CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService });
1354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService, decorators: [{
1355
+ type: Injectable
1356
+ }], ctorParameters: function () {
1357
+ return [{ type: CouponService }, { type: undefined, decorators: [{
1358
+ type: Inject,
1359
+ args: ['CheckoutRepository']
1360
+ }] }, { type: undefined, decorators: [{
1361
+ type: Inject,
1362
+ args: ['UserRepository']
1363
+ }] }, { type: i1$2.Shops, decorators: [{
1364
+ type: Inject,
1365
+ args: [DEFAULT_SHOP]
1366
+ }] }, { type: undefined, decorators: [{
1367
+ type: Inject,
1368
+ args: [PERSISTENCE_PROVIDER]
1369
+ }] }];
1370
+ } });
1371
+
1372
+ class CartService {
1373
+ constructor(authService, checkoutService, defaultShop, productRepository, categoryRepository, variantRepository, buy2WinRepository) {
1374
+ this.authService = authService;
1375
+ this.checkoutService = checkoutService;
1376
+ this.defaultShop = defaultShop;
1377
+ this.productRepository = productRepository;
1378
+ this.categoryRepository = categoryRepository;
1379
+ this.variantRepository = variantRepository;
1380
+ this.buy2WinRepository = buy2WinRepository;
1381
+ this.cartSubject = new Subject();
1382
+ this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
1383
+ var _a;
1384
+ const items = [];
1385
+ const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
1386
+ if (index > -1) {
1387
+ checkoutLoaded.lineItems[index].quantity += quantity;
1388
+ checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
1389
+ }
1390
+ else
1391
+ checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
1392
+ return this.checkoutService
1393
+ .updateCheckoutLineItems(checkoutLoaded)
1394
+ .pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
1395
+ }));
1396
+ this.generateCartObject = (items) => (items === null || items === void 0 ? void 0 : items.reduce((cart, item) => {
1397
+ var _a;
1398
+ return (Object.assign(Object.assign({}, cart), { [item.id]: LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.id] || item)), { quantity: (((_a = cart[item.id]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })) }));
1399
+ }, {})) || {};
1400
+ this.buildLineItem = ({ checkout, item, quantity, }) => __awaiter(this, void 0, void 0, function* () {
1401
+ var _a, _b, _c, _d, _e, _f, _g;
1402
+ const product = yield this.getProductData(item.id);
1403
+ item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.id === item.id)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
1404
+ if (this.checkMaxStock(product.stock.quantity, item.quantity || 0, quantity || 0))
1405
+ throw new Error('Desculpe! Temos apenas ' + ((_c = product.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
1406
+ const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
1407
+ const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
1408
+ const isGift = item.isGift || null;
1409
+ const pricePaid = this.getProductPrice({
1410
+ product: item,
1411
+ shop: checkout.shop || this.defaultShop,
1412
+ isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
1413
+ });
1414
+ RoundProductPricesHelper.roundProductPrices(item);
1415
+ return {
1416
+ checkout,
1417
+ lineItem: LineItem.toInstance({
1418
+ id,
1419
+ name: name !== null && name !== void 0 ? name : product.name,
1420
+ EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
1421
+ brand: product.brand,
1422
+ slug: slug !== null && slug !== void 0 ? slug : product.slug,
1423
+ sku: sku !== null && sku !== void 0 ? sku : product.sku,
1424
+ stock,
1425
+ price: this.roundPrice(price),
1426
+ image,
1427
+ weight: weight !== null && weight !== void 0 ? weight : product.weight,
1428
+ quantity: (item.quantity || 0) + (quantity || 0),
1429
+ pricePaid,
1430
+ discount: 0,
1431
+ categories: (_f = product.categories) !== null && _f !== void 0 ? _f : [],
1432
+ isGift: isGift !== null && isGift !== void 0 ? isGift : null,
1433
+ costPrice: (_g = product.costPrice) !== null && _g !== void 0 ? _g : 0,
1434
+ type,
1435
+ }),
1436
+ };
1437
+ });
1438
+ this.getProductPrice = ({ product, isSubscriber, }) => {
1439
+ const info = product.price;
1440
+ if (product.isGift)
1441
+ return 0;
1442
+ return isSubscriber && info.subscriberPrice > 0
1443
+ ? Number(info.subscriberPrice.toFixed(2))
1444
+ : Number(info.price.toFixed(2));
1445
+ };
1446
+ this.checkMaxStock = (currentStock, currentItemQtd, quantityToAdd) => {
1447
+ const maxStock = currentStock || 0;
1448
+ const currentItemAmount = currentItemQtd || 0;
1449
+ return currentItemAmount + quantityToAdd > maxStock;
1450
+ };
1451
+ }
1452
+ addItem(item, quantity = 1) {
1453
+ return from(this.checkoutService.getCheckout()).pipe(concatMap((checkout) => __awaiter(this, void 0, void 0, function* () { return yield this.buildLineItem({ checkout, item, quantity: quantity || 1 }); })), mergeMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
1454
+ }
1455
+ decreaseItem(item) {
1456
+ return this.checkoutService.getCheckout().pipe(map((checkout) => {
1457
+ var _a;
1458
+ const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.id === item.id);
1459
+ if (!isNil(checkoutItem))
1460
+ checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
1461
+ return checkout;
1462
+ }), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1463
+ }
1464
+ getCart(checkout) {
1465
+ this.buildCartFromCheckout(checkout).subscribe((cart) => this.cartSubject.next(cart));
1466
+ return this.cartSubject;
1467
+ }
1468
+ /**
1469
+ * @deprecated The method should not be used
1470
+ */
1471
+ getVariantPriceDiscount(item) {
1472
+ return this.authService.getUser().pipe(concatMap((user) => iif(() => user.isSubscriber && !!item.price.subscriberPrice, of(item.price.subscriberPrice), of(item.price.price))), catchError(() => of(item.price.price)));
1473
+ }
1474
+ removeItem(item) {
1475
+ return this.checkoutService.getCheckout().pipe(map((checkout) => {
1476
+ const index = checkout.lineItems.findIndex((lineItem) => lineItem.id === item.id);
1477
+ if (index >= 0)
1478
+ checkout.lineItems.splice(index, 1);
1479
+ return checkout;
1480
+ }), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1481
+ }
1482
+ updateUserCart(user) {
1483
+ return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => __awaiter(this, void 0, void 0, function* () {
1484
+ var _a, _b;
1485
+ return yield this.checkoutService
1486
+ .updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)
1487
+ ? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; })))
1488
+ : [] })))
1489
+ .toPromise();
1490
+ })), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1491
+ }
1492
+ clearCart() {
1493
+ return this.checkoutService.getCheckout().pipe(map((checkout) => {
1494
+ this.checkoutService.clearCheckoutFromSession();
1495
+ return checkout;
1496
+ }), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
1497
+ }
1498
+ buildCartFromCheckout(checkoutData) {
1499
+ return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
1500
+ }
1501
+ roundPrice(productPrice) {
1502
+ const { price, fullPrice, subscriberPrice } = productPrice;
1503
+ return Object.assign(Object.assign(Object.assign({}, productPrice), { price: Number(price.toFixed(2)), fullPrice: Number(fullPrice.toFixed(2)) }), (subscriberPrice && { subscriberPrice: Number(subscriberPrice.toFixed(2)) }));
1504
+ }
1505
+ getProductData(productId) {
1506
+ return __awaiter(this, void 0, void 0, function* () {
1507
+ let product;
1508
+ let variant;
1509
+ try {
1510
+ product = yield this.productRepository.get({ id: productId });
1511
+ }
1512
+ catch (error) {
1513
+ if (!(error instanceof NotFoundError))
1514
+ throw error;
1515
+ const { data: variants } = yield this.variantRepository.find({ filters: { id: productId } });
1516
+ variant = variants.shift();
1517
+ if (!variant)
1518
+ throw error;
1519
+ product = yield this.productRepository.get({ id: variant.productId });
1520
+ }
1521
+ return Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())));
1522
+ });
1523
+ }
1524
+ getGifts() {
1525
+ return this.checkoutService.getCheckout().pipe(mergeMap((checkout) => __awaiter(this, void 0, void 0, function* () {
1526
+ const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
1527
+ if (!notGiftItems.length)
1528
+ return Object.assign(Object.assign({}, checkout), { lineItems: [] });
1529
+ const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1530
+ const campaigns = yield this.buy2WinRepository
1531
+ .find({
1532
+ filters: {
1533
+ active: { operator: Where.EQUALS, value: true },
1534
+ shop: { operator: Where.EQUALS, value: this.defaultShop },
1535
+ },
1536
+ })
1537
+ .then((data) => data.data);
1538
+ if (!campaigns.length)
1539
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
1540
+ const elegibleCampaigns = [];
1541
+ for (const campaign of campaigns) {
1542
+ const today = new Date().getTime();
1543
+ if (!(campaign.startDate.getTime() <= today) && !(campaign.endDate.getTime() >= today))
1544
+ continue;
1545
+ if (campaign.activeCategory) {
1546
+ const categoriesCampaing = campaign.categories.map((c) => c.id.toString());
1547
+ const categoriesCampaingFullTree = [];
1548
+ for (const id of categoriesCampaing) {
1549
+ const children = yield this.categoryRepository.getChildren(parseInt(id));
1550
+ categoriesCampaingFullTree.push(id, ...children.map((c) => c.id.toString()));
1551
+ }
1552
+ const categoriesCampaingTree = [...new Set(categoriesCampaingFullTree)];
1553
+ const filterProductsCategories = checkout.lineItems.filter((l) => {
1554
+ var _a;
1555
+ if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1556
+ return true;
1557
+ return l.categories.some((c) => categoriesCampaingTree.some((cat) => cat == c));
1558
+ });
1559
+ if (filterProductsCategories.length) {
1560
+ const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
1561
+ if (cartTotalCategories >= campaign.cartValueMin)
1562
+ elegibleCampaigns.push(campaign);
1563
+ }
1564
+ }
1565
+ else {
1566
+ if (campaign.cartValue && campaign.cartValue > 0) {
1567
+ if (campaign.cartValue <= cartTotal)
1568
+ elegibleCampaigns.push(campaign);
1569
+ }
1570
+ }
1571
+ }
1572
+ if (!elegibleCampaigns.length)
1573
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
1574
+ const campaingnProducts = [];
1575
+ for (const campaign of elegibleCampaigns) {
1576
+ let elegibleProducts = [];
1577
+ for (const product of campaign.products) {
1578
+ const { data: productData } = yield this.productRepository.find({ filters: { sku: product } });
1579
+ if (!productData.length)
1580
+ continue;
1581
+ const gift = productData.shift();
1582
+ if (gift.stock.quantity < 1)
1583
+ continue;
1584
+ elegibleProducts.push(gift);
1585
+ }
1586
+ campaingnProducts.push(elegibleProducts);
1587
+ }
1588
+ if (!campaingnProducts.length)
1589
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
1590
+ const gifts = this.giftToLineItems([].concat(...campaingnProducts));
1591
+ return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) });
1592
+ })), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1593
+ }
1594
+ giftToLineItems(items) {
1595
+ return items.map((item) => {
1596
+ var _a;
1597
+ const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
1598
+ const image = ((_a = item === null || item === void 0 ? void 0 : item.miniatures) === null || _a === void 0 ? void 0 : _a.length) ? item.miniatures[0] : item.images[0];
1599
+ return LineItem.toInstance({
1600
+ brand,
1601
+ categories,
1602
+ id: id.toString(),
1603
+ name,
1604
+ price,
1605
+ sku,
1606
+ slug,
1607
+ stock,
1608
+ weight,
1609
+ EAN,
1610
+ image,
1611
+ pricePaid: 0,
1612
+ quantity: 1,
1613
+ isGift: true,
1614
+ });
1615
+ });
1616
+ }
1617
+ }
1618
+ 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 });
1619
+ CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
1620
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
1621
+ type: Injectable
1622
+ }], ctorParameters: function () {
1623
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i1$2.Shops, decorators: [{
1624
+ type: Inject,
1625
+ args: [DEFAULT_SHOP]
1626
+ }] }, { type: undefined, decorators: [{
1627
+ type: Inject,
1628
+ args: ['ProductRepository']
1629
+ }] }, { type: undefined, decorators: [{
1630
+ type: Inject,
1631
+ args: ['CategoryRepository']
1632
+ }] }, { type: undefined, decorators: [{
1633
+ type: Inject,
1634
+ args: ['VariantRepository']
1635
+ }] }, { type: i1$2.Buy2WinFirestoreRepository, decorators: [{
1636
+ type: Inject,
1637
+ args: ['Buy2WinRepository']
1638
+ }] }];
1639
+ } });
1640
+
1641
+ class NewCategoryStructureAdapter {
1642
+ constructor(categoryRepository) {
1643
+ this.categoryRepository = categoryRepository;
1644
+ }
1645
+ buildProductFilterByCategory(category) {
1646
+ return __awaiter(this, void 0, void 0, function* () {
1647
+ const loadedCategory = yield this.getCategory(category);
1648
+ if (loadedCategory.isCollection)
1649
+ return { id: { operator: Where.IN, value: loadedCategory.products } };
1650
+ const categoryIds = [...(yield this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
1651
+ return {
1652
+ category: {
1653
+ id: {
1654
+ operator: Where.IN,
1655
+ value: categoryIds,
1656
+ },
1657
+ },
1658
+ };
1659
+ });
1660
+ }
1661
+ getAllCategoriesIdFromCategory(category) {
1662
+ return __awaiter(this, void 0, void 0, function* () {
1663
+ return this.categoryRepository
1664
+ .getChildren(+category.id)
1665
+ .then((categories) => categories.map((category) => category.id.toString()));
1666
+ });
1667
+ }
1668
+ getCategory(category) {
1669
+ var _a;
1670
+ return __awaiter(this, void 0, void 0, function* () {
1671
+ const collectionCategory = category.isCollection ||
1672
+ (isNil(category.isCollection) && !((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) ||
1673
+ category.isWishlist ||
1674
+ category.brandCategory;
1675
+ return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
1676
+ });
1677
+ }
1678
+ }
1679
+ NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1680
+ NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
1681
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
1682
+ type: Injectable
1683
+ }], ctorParameters: function () {
1684
+ return [{ type: undefined, decorators: [{
1685
+ type: Inject,
1686
+ args: ['CategoryRepository']
1687
+ }] }];
1688
+ } });
1689
+
1690
+ class OldCategoryStructureAdapter {
1691
+ constructor(categoryRepository) {
1692
+ this.categoryRepository = categoryRepository;
1693
+ }
1694
+ buildProductFilterByCategory(category) {
1695
+ var _a;
1696
+ return __awaiter(this, void 0, void 0, function* () {
1697
+ const productsIds = ((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)
1698
+ ? category.products
1699
+ : yield this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
1700
+ return { id: { operator: Where.IN, value: productsIds } };
1701
+ });
1702
+ }
1703
+ }
1704
+ OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1705
+ OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter });
1706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
1707
+ type: Injectable
1708
+ }], ctorParameters: function () {
1709
+ return [{ type: undefined, decorators: [{
1710
+ type: Inject,
1711
+ args: ['CategoryRepository']
1712
+ }] }];
1713
+ } });
1714
+
1715
+ class CatalogService {
1716
+ constructor(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop,
1717
+ // private readonly productIndex: ProductsIndex,
1718
+ // private readonly productVertexSearch: ProductsVertexSearch,
1719
+ productSearch) {
1720
+ this.productRepository = productRepository;
1721
+ this.productStockNotificationRepository = productStockNotificationRepository;
1722
+ this.categoryRepository = categoryRepository;
1723
+ this.categoryStructureAdapter = categoryStructureAdapter;
1724
+ this.shop = shop;
1725
+ this.productSearch = productSearch;
1726
+ this.productsByTerm = {};
1727
+ this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
1728
+ const filters = {};
1729
+ if (clubDiscount === null || clubDiscount === void 0 ? void 0 : clubDiscount.length)
1730
+ set(filters, 'price.subscriberDiscountPercentage', { operator: Where.IN, value: clubDiscount });
1731
+ if (brands === null || brands === void 0 ? void 0 : brands.length)
1732
+ filters.brand = { operator: Where.IN, value: brands };
1733
+ if (gender === null || gender === void 0 ? void 0 : gender.length)
1734
+ filters.gender = { operator: Where.IN, value: gender };
1735
+ if ((prices === null || prices === void 0 ? void 0 : prices.min) || (prices === null || prices === void 0 ? void 0 : prices.max))
1736
+ set(filters, prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price', [
1737
+ ...(prices.min ? [{ operator: Where.GTE, value: Math.round(prices.min) }] : []),
1738
+ ...(prices.max ? [{ operator: Where.LTE, value: Math.ceil(prices.max) }] : []),
1739
+ ]);
1740
+ if (rate)
1741
+ filters.rate = { operator: Where.GTE, value: rate };
1742
+ if (tags === null || tags === void 0 ? void 0 : tags.length)
1743
+ filters.tags = { operator: Where.LIKE, value: tags };
1744
+ if (customOptions === null || customOptions === void 0 ? void 0 : customOptions.length)
1745
+ filters.filters = { operator: Where.LIKE, value: customOptions };
1746
+ return filters;
1747
+ };
1748
+ this.buildSortQuery = (sort) => {
1749
+ if (!sort || sort === 'most-relevant')
1750
+ return {};
1751
+ if (sort === 'best-sellers')
1752
+ return {
1753
+ shoppingCount: 'desc',
1754
+ rate: 'desc',
1755
+ stock: 'desc',
1756
+ name: 'asc',
1757
+ };
1758
+ if (sort === 'biggest-price')
1759
+ return { subscriberPrice: 'desc', rate: 'desc', shoppingCount: 'desc' };
1760
+ if (sort === 'lowest-price')
1761
+ return { subscriberPrice: 'asc', rate: 'desc', shoppingCount: 'desc' };
1762
+ if (sort === 'best-rating')
1763
+ return { rate: 'desc', shoppingCount: 'desc', stock: 'desc', name: 'asc' };
1764
+ if (sort === 'news')
1765
+ return { createdAt: 'desc' };
1766
+ if (sort === 'biggest-discount')
1767
+ return { subscriberDiscountPercentage: 'desc', rate: 'desc', shoppingCount: 'desc' };
1768
+ };
1769
+ this.buildLimitQuery = (options) => {
1770
+ const limit = (options === null || options === void 0 ? void 0 : options.perPage) || 20;
1771
+ return {
1772
+ limit,
1773
+ offset: (((options === null || options === void 0 ? void 0 : options.page) || 1) - 1) * limit,
1774
+ };
1775
+ };
1776
+ this.hasProfile = (options) => 'profile' in options;
1777
+ this.hasTerm = (options) => 'term' in options;
1778
+ this.hasCategory = (options) => 'category' in options;
1779
+ }
1780
+ fetchProducts(options) {
1781
+ var _a, _b, _c;
1782
+ return __awaiter(this, void 0, void 0, function* () {
1783
+ const limits = this.buildLimitQuery(options);
1784
+ if (this.hasProfile(options) && ((_a = options.filters) === null || _a === void 0 ? void 0 : _a.customOptions))
1785
+ throw new InvalidArgumentError(`It couldn't filled customOptions when profile is given`);
1786
+ if (this.hasProfile(options) && ((_b = options.filters) === null || _b === void 0 ? void 0 : _b.tags))
1787
+ throw new InvalidArgumentError(`It couldn't filled tags when profile is given`);
1788
+ if (this.hasTerm(options) && ((_c = options.filters) === null || _c === void 0 ? void 0 : _c.customOptions))
1789
+ throw new InvalidArgumentError(`It couldn't filled customOptions when term is given`);
1790
+ return yield this.findCatalog(options, limits).then(({ data, count: total, maximum, minimal, distinct }) => {
1791
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1792
+ return ({
1793
+ products: { data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)), total },
1794
+ pages: Math.ceil(total / limits.limit),
1795
+ prices: {
1796
+ price: { min: +((_b = (_a = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.toFixed(2)), max: +((_d = (_c = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _c === void 0 ? void 0 : _c.price) === null || _d === void 0 ? void 0 : _d.toFixed(2)) },
1797
+ subscriberPrice: {
1798
+ min: +((_f = (_e = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _e === void 0 ? void 0 : _e.subscriberPrice) === null || _f === void 0 ? void 0 : _f.toFixed(2)),
1799
+ max: +((_h = (_g = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _g === void 0 ? void 0 : _g.subscriberPrice) === null || _h === void 0 ? void 0 : _h.toFixed(2)),
1800
+ },
1801
+ },
1802
+ brands: distinct === null || distinct === void 0 ? void 0 : distinct.brand,
1803
+ });
1804
+ });
1805
+ });
1806
+ }
1807
+ addCustomerToStockNotification(shop, productId, name, email) {
1808
+ return __awaiter(this, void 0, void 0, function* () {
1809
+ return this.productStockNotificationRepository.addCustomerEmail(shop, productId, name, email);
1810
+ });
1811
+ }
1812
+ findCatalog(options, limits) {
1813
+ return __awaiter(this, void 0, void 0, function* () {
1814
+ if (this.hasTerm(options) && options.sort === 'most-relevant') {
1815
+ const productsIds = yield this.findCatalogIdsBySearch(options.term);
1816
+ return this.findCatalogAndSortByMostRevelantByTerm(productsIds, options, limits);
1817
+ }
1818
+ if (this.hasCategory(options) && options.sort === 'most-relevant') {
1819
+ const mostRelevant = options.category.isWishlist ? [] : options.category.getMostRelevantByShop(this.shop);
1820
+ const productsIds = yield this.productRepository
1821
+ .findCatalog({
1822
+ fields: ['id'],
1823
+ filters: Object.assign(Object.assign({}, (yield this.buildMainFilter(options))), this.buildFilterQuery((options === null || options === void 0 ? void 0 : options.filters) || {})),
1824
+ })
1825
+ .then((products) => products.data.map((product) => product.id));
1826
+ return this.findCatalogAndSortByMostRevelant(mostRelevant, productsIds, options, limits);
1827
+ }
1828
+ const repoParams = Object.assign(Object.assign({ filters: Object.assign(Object.assign({}, (yield this.buildMainFilter(options))), this.buildFilterQuery((options === null || options === void 0 ? void 0 : options.filters) || {})) }, ((options === null || options === void 0 ? void 0 : options.sort) ? { orderBy: this.buildSortQuery(options === null || options === void 0 ? void 0 : options.sort) } : {})), { limits, options: Object.assign({ minimal: ['price'], maximum: ['price'] }, (!this.hasCategory(options) ? { distinct: ['brand'] } : {})) });
1829
+ if (['biggest-price', 'lowest-price', 'biggest-discount', 'best-rating'].includes(options.sort))
1830
+ return this.productRepository.findCatalog(repoParams);
1831
+ return this.productRepository.findCatalog(repoParams, (options === null || options === void 0 ? void 0 : options.mainGender) || this.shop === Shops.MENSMARKET ? 'male' : 'female');
1832
+ });
1833
+ }
1834
+ buildMainFilter({ category, profile, term, }) {
1835
+ return __awaiter(this, void 0, void 0, function* () {
1836
+ if (category)
1837
+ return this.categoryStructureAdapter.buildProductFilterByCategory(category);
1838
+ if (profile)
1839
+ return { tags: { operator: Where.LIKE, value: profile } };
1840
+ if (term)
1841
+ return this.productSearch
1842
+ .search(term, 999, this.shop)
1843
+ .then((data) => ({ id: { operator: Where.IN, value: data.map((_source) => _source.id) } }));
1844
+ });
1845
+ }
1846
+ findCatalogAndSortByMostRevelant(mostRelevants, productIds, options, limits) {
1847
+ return __awaiter(this, void 0, void 0, function* () {
1848
+ const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
1849
+ const totalResult = yield this.productRepository.findCatalog({
1850
+ filters: Object.assign({ id: { operator: Where.IN, value: mostRelevantProductsIds } }, this.buildFilterQuery((options === null || options === void 0 ? void 0 : options.filters) || {})),
1851
+ orderBy: this.buildSortQuery('best-sellers'),
1852
+ options: {
1853
+ minimal: ['price'],
1854
+ maximum: ['price'],
1855
+ distinct: ['brand'],
1856
+ },
1857
+ }, (options === null || options === void 0 ? void 0 : options.mainGender) || this.shop === Shops.MENSMARKET ? 'male' : 'female');
1858
+ const mostRelevantWithouyStock = totalResult.data.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity <= 0);
1859
+ const firstProducts = totalResult.data
1860
+ .filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
1861
+ .sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
1862
+ const lastProducts = totalResult.data
1863
+ .filter((product) => !mostRelevants.includes(product.id))
1864
+ .concat(mostRelevantWithouyStock);
1865
+ const categoryMostRelevants = firstProducts.concat(lastProducts);
1866
+ const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
1867
+ return {
1868
+ data: resultFinal,
1869
+ count: totalResult.count,
1870
+ maximum: totalResult.maximum,
1871
+ minimal: totalResult.minimal,
1872
+ distinct: totalResult.distinct,
1873
+ };
1874
+ });
1875
+ }
1876
+ findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
1877
+ return __awaiter(this, void 0, void 0, function* () {
1878
+ const totalResult = yield this.productRepository.findCatalog({
1879
+ fields: ['id', 'stock'],
1880
+ filters: Object.assign({ id: { operator: Where.IN, value: productIds } }, this.buildFilterQuery((options === null || options === void 0 ? void 0 : options.filters) || {})),
1881
+ options: {
1882
+ minimal: ['price'],
1883
+ maximum: ['price'],
1884
+ distinct: ['brand'],
1885
+ },
1886
+ }, (options === null || options === void 0 ? void 0 : options.mainGender) || this.shop === Shops.MENSMARKET ? 'male' : 'female');
1887
+ const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
1888
+ const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
1889
+ const productIdsStock = productIds.filter((product) => stockData.some((result) => result.id == product));
1890
+ const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id == product));
1891
+ const limitedProductId = productIdsStock
1892
+ .concat(productIdsStockOut)
1893
+ .slice(limits.offset, limits.offset + limits.limit);
1894
+ const orderedId = productIds.filter((product) => limitedProductId.includes(product));
1895
+ const productResult = yield this.productRepository.findCatalog({
1896
+ filters: {
1897
+ id: { operator: Where.IN, value: orderedId },
1898
+ },
1899
+ });
1900
+ return {
1901
+ data: limitedProductId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
1902
+ count: totalResult.count,
1903
+ maximum: totalResult.maximum,
1904
+ minimal: totalResult.minimal,
1905
+ distinct: totalResult.distinct,
1906
+ };
1907
+ });
1908
+ }
1909
+ // private async findCatalogIdsByElasticSearch(term: string): Promise<string[]> {
1910
+ // if (this.productsByTerm[term]) return this.productsByTerm[term]
1911
+ // return (this.productsByTerm[term] = await this.productSearch
1912
+ // .search<Product>(term, 999, this.shop)
1913
+ // .then((products) => {
1914
+ // const withStock = products.filter((_source) => _source.stock.quantity > 0)
1915
+ // const withOutStock = products.filter((_source) => _source.stock.quantity <= 0)
1916
+ // const sorted = [...withStock, ...withOutStock]
1917
+ // return [...new Set(sorted.map((_source) => _source.id))]
1918
+ // }))
1919
+ // }
1920
+ findCatalogIdsBySearch(term) {
1921
+ return __awaiter(this, void 0, void 0, function* () {
1922
+ if (this.productsByTerm[term])
1923
+ return this.productsByTerm[term];
1924
+ return (this.productsByTerm[term] = yield this.productSearch
1925
+ .search(term, 999, this.shop)
1926
+ .then((products) => {
1927
+ const withStock = products.filter((_source) => _source.stock > 0);
1928
+ const withOutStock = products.filter((_source) => _source.stock <= 0);
1929
+ const sorted = [...withStock, ...withOutStock];
1930
+ return [...new Set(sorted.map((products) => products.id))];
1931
+ }));
1932
+ });
1933
+ }
1934
+ }
1935
+ CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: 'ProductSearchIndex' }], target: i0.ɵɵFactoryTarget.Injectable });
1936
+ CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
1937
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
1938
+ type: Injectable
1939
+ }], ctorParameters: function () {
1940
+ return [{ type: undefined, decorators: [{
1941
+ type: Inject,
1942
+ args: ['ProductRepository']
1943
+ }] }, { type: undefined, decorators: [{
1944
+ type: Inject,
1945
+ args: ['ProductStockNotificationRepository']
1946
+ }] }, { type: undefined, decorators: [{
1947
+ type: Inject,
1948
+ args: ['CategoryRepository']
1949
+ }] }, { type: undefined, decorators: [{
1950
+ type: Inject,
1951
+ args: [CATEGORY_STRUCTURE]
1952
+ }] }, { type: i1$2.Shops, decorators: [{
1953
+ type: Inject,
1954
+ args: [DEFAULT_SHOP]
1955
+ }] }, { type: undefined, decorators: [{
1956
+ type: Inject,
1957
+ args: ['ProductSearchIndex']
1958
+ }] }];
1959
+ } });
1960
+
1961
+ class CategoryService {
1962
+ constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
1963
+ this.productRepository = productRepository;
1964
+ this.categoryRepository = categoryRepository;
1965
+ this.categoryFilterRepository = categoryFilterRepository;
1966
+ this.categoryStructureAdapter = categoryStructureAdapter;
1967
+ this.shop = shop;
1968
+ }
1969
+ fetchBrands(category, options) {
1970
+ return __awaiter(this, void 0, void 0, function* () {
1971
+ const brands = yield this.productRepository
1972
+ .findCatalog({
1973
+ filters: yield this.categoryStructureAdapter.buildProductFilterByCategory(category),
1974
+ fields: ['brand'],
1975
+ }, (options === null || options === void 0 ? void 0 : options.mainGender) ? options === null || options === void 0 ? void 0 : options.mainGender : this.shop === Shops.MENSMARKET ? 'male' : 'female')
1976
+ .then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => (Object.assign(Object.assign({}, brands), { [brand]: true })), {})));
1977
+ return this.categoryRepository
1978
+ .find({ filters: { brandCategory: true, shop: (options === null || options === void 0 ? void 0 : options.shop) || this.shop }, orderBy: { name: 'asc' } })
1979
+ .then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
1980
+ });
1981
+ }
1982
+ fetchFilterOptions(category) {
1983
+ return __awaiter(this, void 0, void 0, function* () {
1984
+ return yield this.categoryFilterRepository
1985
+ .find({ filters: { categoryId: +category.id } })
1986
+ .then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
1987
+ });
1988
+ }
1989
+ }
1990
+ 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 });
1991
+ CategoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService });
1992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, decorators: [{
1993
+ type: Injectable
1994
+ }], ctorParameters: function () {
1995
+ return [{ type: undefined, decorators: [{
1996
+ type: Inject,
1997
+ args: ['ProductRepository']
1998
+ }] }, { type: undefined, decorators: [{
1999
+ type: Inject,
2000
+ args: ['CategoryRepository']
2001
+ }] }, { type: undefined, decorators: [{
2002
+ type: Inject,
2003
+ args: ['CategoryFilterRepository']
2004
+ }] }, { type: undefined, decorators: [{
2005
+ type: Inject,
2006
+ args: [CATEGORY_STRUCTURE]
2007
+ }] }, { type: i1$2.Shops, decorators: [{
2008
+ type: Inject,
2009
+ args: [DEFAULT_SHOP]
2010
+ }] }];
2011
+ } });
2012
+
2013
+ var ProductSorts;
2014
+ (function (ProductSorts) {
2015
+ ProductSorts["MOST_RELEVANT"] = "most-relevant";
2016
+ ProductSorts["BEST_SELLER"] = "best-sellers";
2017
+ ProductSorts["BIGGEST_PRICE"] = "biggest-price";
2018
+ ProductSorts["LOWEST_PRICE"] = "lowest-price";
2019
+ ProductSorts["BIGGEST_DISCOUNT"] = "biggest-discount";
2020
+ ProductSorts["BEST_RATING"] = "best-rating";
2021
+ ProductSorts["NEWS"] = "news";
2022
+ })(ProductSorts || (ProductSorts = {}));
2023
+
2024
+ class CategoryWithTree extends Category {
2025
+ }
2026
+ __decorate([
2027
+ Type(() => CategoryWithTree),
2028
+ __metadata("design:type", Array)
2029
+ ], CategoryWithTree.prototype, "children", void 0);
2030
+
2031
+ class WishlistService {
2032
+ constructor(wishlistRepository, shop, productRepository, categoryFilterRepository, categoryRepository, productStockNotificationRepository, productVertexSearch) {
2033
+ this.wishlistRepository = wishlistRepository;
2034
+ this.shop = shop;
2035
+ const categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository);
2036
+ this.catalogService = new CatalogService(productRepository, productStockNotificationRepository, categoryRepository, categoryStructureAdapter, shop, productVertexSearch);
2037
+ this.categoryService = new CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop);
2038
+ }
2039
+ getCatalogService() {
2040
+ return this.catalogService;
2041
+ }
2042
+ getCategoryService() {
2043
+ return this.categoryService;
2044
+ }
2045
+ create({ personId, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
2046
+ return __awaiter(this, void 0, void 0, function* () {
2047
+ const data = {
2048
+ slug: '',
2049
+ name: title,
2050
+ description,
2051
+ metadatas: [
2052
+ {
2053
+ shop: this.shop,
2054
+ title: `${userFullName} - ${title}`,
2055
+ description: `${userFullName} - ${description}`,
2056
+ },
2057
+ ],
2058
+ shop: this.shop,
2059
+ shops: [this.shop],
2060
+ personId,
2061
+ personName: userFullName,
2062
+ personPhoto: userPhoto,
2063
+ brandCategory: false,
2064
+ published,
2065
+ theme,
2066
+ bannerUrl,
2067
+ personType: personType !== null && personType !== void 0 ? personType : PersonTypes.NONE,
2068
+ personIsSubscriber: personIsSubscriber !== null && personIsSubscriber !== void 0 ? personIsSubscriber : false,
2069
+ };
2070
+ const newWishlist = yield this.wishlistRepository.create(data);
2071
+ yield this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
2072
+ return Wishlist.toInstance(Object.assign(Object.assign({}, newWishlist.toPlain()), { slug: newWishlist.id }));
2073
+ });
2074
+ }
2075
+ update({ id, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
2076
+ const data = {
2077
+ id,
2078
+ name: title,
2079
+ description,
2080
+ published,
2081
+ metadatas: [
2082
+ {
2083
+ shop: this.shop,
2084
+ title: `${userFullName} - ${title}`,
2085
+ description: `${userFullName} - ${description}`,
2086
+ },
2087
+ ],
2088
+ personName: userFullName,
2089
+ personPhoto: userPhoto,
2090
+ theme,
2091
+ bannerUrl,
2092
+ personType: personType !== null && personType !== void 0 ? personType : PersonTypes.NONE,
2093
+ personIsSubscriber: personIsSubscriber !== null && personIsSubscriber !== void 0 ? personIsSubscriber : false,
2094
+ };
2095
+ return this.wishlistRepository.update(data);
2096
+ }
2097
+ delete(wishlistId) {
2098
+ return this.wishlistRepository.delete({ id: wishlistId });
2099
+ }
2100
+ getWishlistBySlug(slug) {
2101
+ const [id] = slug.split('-');
2102
+ if (+id)
2103
+ return this.wishlistRepository.get({ id });
2104
+ return this.wishlistRepository.getWishlistBySlug(slug);
2105
+ }
2106
+ getWishlistsByPerson(personId) {
2107
+ return this.wishlistRepository.getWishlistByPerson(personId);
2108
+ }
2109
+ addProduct(wishlistId, productId) {
2110
+ return __awaiter(this, void 0, void 0, function* () {
2111
+ const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
2112
+ const hasProduct = wishlist.products.some((p) => p == productId);
2113
+ if (!hasProduct) {
2114
+ wishlist.products = [...wishlist.products, productId];
2115
+ return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
2116
+ }
2117
+ return wishlist;
2118
+ });
2119
+ }
2120
+ removeProduct(wishlistId, productId) {
2121
+ return __awaiter(this, void 0, void 0, function* () {
2122
+ const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
2123
+ const productIndex = wishlist.products.findIndex((p) => p == productId);
2124
+ if (productIndex != -1) {
2125
+ wishlist.products.splice(productIndex, 1);
2126
+ if (!wishlist.products.length)
2127
+ return this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } });
2128
+ return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
2129
+ }
2130
+ return wishlist;
2131
+ });
2132
+ }
2133
+ }
2134
+ 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: 'ProductStockNotificationRepository' }, { token: i1$2.ProductsVertexSearch }], target: i0.ɵɵFactoryTarget.Injectable });
2135
+ WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
2136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
2137
+ type: Injectable
2138
+ }], ctorParameters: function () {
2139
+ return [{ type: undefined, decorators: [{
2140
+ type: Inject,
2141
+ args: ['WishlistRepository']
2142
+ }] }, { type: i1$2.Shops, decorators: [{
2143
+ type: Inject,
2144
+ args: [DEFAULT_SHOP]
2145
+ }] }, { type: undefined, decorators: [{
2146
+ type: Inject,
2147
+ args: ['ProductRepository']
2148
+ }] }, { type: undefined, decorators: [{
2149
+ type: Inject,
2150
+ args: ['CategoryFilterRepository']
2151
+ }] }, { type: undefined, decorators: [{
2152
+ type: Inject,
2153
+ args: ['CategoryRepository']
2154
+ }] }, { type: undefined, decorators: [{
2155
+ type: Inject,
2156
+ args: ['ProductStockNotificationRepository']
2157
+ }] }, { type: i1$2.ProductsVertexSearch }];
2158
+ } });
2159
+
2160
+ class CheckoutSubscriptionService {
2161
+ constructor(checkoutSubscriptionRepository, dataPersistence, couponService) {
2162
+ this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
2163
+ this.dataPersistence = dataPersistence;
2164
+ this.couponService = couponService;
2165
+ }
2166
+ getCheckoutSubscription(checkoutData) {
2167
+ return this.dataPersistence
2168
+ .get('checkoutSubscriptionId')
2169
+ .pipe(concatMap((id) => !isNil(id) ? this.checkoutSubscriptionRepository.get({ id }) : this.createCheckoutSubscription(checkoutData)));
2170
+ }
2171
+ clearCheckoutSubscriptionFromSession() {
2172
+ return this.dataPersistence.remove('checkoutSubscriptionId');
2173
+ }
2174
+ checkCoupon(nickname, userEmail) {
2175
+ return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
2176
+ .checkCoupon(nickname, CheckoutTypes.SUBSCRIPTION, checkout, checkout.subscriptionPlan.name)
2177
+ .pipe()));
2178
+ }
2179
+ calcDiscountSubscription(coupon) {
2180
+ return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
2181
+ }
2182
+ createCheckoutSubscription(checkoutData) {
2183
+ return __awaiter(this, void 0, void 0, function* () {
2184
+ const checkout = yield this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()));
2185
+ yield this.dataPersistence.set('checkoutSubscriptionId', checkout.id).toPromise();
2186
+ return checkout;
2187
+ });
2188
+ }
2189
+ }
2190
+ 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 });
2191
+ CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService });
2192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
2193
+ type: Injectable
2194
+ }], ctorParameters: function () {
2195
+ return [{ type: undefined, decorators: [{
2196
+ type: Inject,
2197
+ args: ['CheckoutSubscriptionRepository']
2198
+ }] }, { type: undefined, decorators: [{
2199
+ type: Inject,
2200
+ args: [PERSISTENCE_PROVIDER]
2201
+ }] }, { type: CouponService }];
2202
+ } });
2203
+
2204
+ class UtilHelper {
2205
+ static createSlug(name) {
2206
+ return name
2207
+ .toLowerCase()
2208
+ .replace(/\s+/g, '-') // Replace spaces with -
2209
+ .replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
2210
+ .replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
2211
+ .replace(/[ìíïî]/g, 'i') // Replace spaces with -
2212
+ .replace(/[õòóöô]/g, 'o') // Replace spaces with -
2213
+ .replace(/[ùúüû]/g, 'u') // Replace spaces with -
2214
+ .replace(/[ñ]/g, 'n') // Replace spaces with -
2215
+ .replace(/[ç]/g, 'c') // Replace spaces with -
2216
+ .replace(/[&]/g, 'and') // Replace spaces with -
2217
+ .replace(/[^\w\-]+/g, '') // Remove all non-word chars
2218
+ .replace(/\-\-+/g, '-'); // Replace multiple - with single -
2219
+ }
2220
+ }
2221
+
2222
+ class HomeShopService {
2223
+ get homeId() {
2224
+ if (this.defaultShop === Shops.GLAMSHOP)
2225
+ return 'glamshop';
2226
+ if (this.defaultShop === Shops.MENSMARKET)
2227
+ return 'mens_market';
2228
+ return null;
2229
+ }
2230
+ constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
2231
+ this.categoryRepository = categoryRepository;
2232
+ this.homeRepository = homeRepository;
2233
+ this.productRepository = productRepository;
2234
+ this.defaultShop = defaultShop;
2235
+ this.buildCategoryGroupWithRequiredData = (group) => {
2236
+ var _a, _b;
2237
+ return ({
2238
+ category: Category.toInstance(pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
2239
+ products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map((product) => Product.toInstance(pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
2240
+ 'id',
2241
+ 'price',
2242
+ 'reviews',
2243
+ 'hasVariants',
2244
+ 'slug',
2245
+ 'sku',
2246
+ 'stock',
2247
+ 'costPrice',
2248
+ 'images',
2249
+ 'miniatures',
2250
+ 'name',
2251
+ 'weight',
2252
+ 'rate',
2253
+ 'type',
2254
+ 'brand',
2255
+ ])))) || [],
2256
+ });
2257
+ };
2258
+ }
2259
+ getHomeData() {
2260
+ return this.getHomeConfiguration().pipe(map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
2261
+ ? of(home)
2262
+ : forkJoin([
2263
+ this.getDiscoverProducts(this.gender),
2264
+ this.getFeaturedProducts(this.gender),
2265
+ this.getVerticalProducts(this.gender),
2266
+ ]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
2267
+ discoverProducts,
2268
+ featuredProducts,
2269
+ verticalProducts,
2270
+ })), concatMap((data) => this.saveHomeData(data)))));
2271
+ }
2272
+ getBanners(type) {
2273
+ return this.getHomeConfiguration().pipe(map((home) => {
2274
+ if (type === 'brand')
2275
+ return home.brandsCarousel;
2276
+ if (type === 'buyToWin')
2277
+ return [home.buyToWinBanner];
2278
+ if (type === 'block')
2279
+ return home.blockBanners;
2280
+ if (type === 'blog')
2281
+ return [home.blogBanner];
2282
+ return [];
2283
+ }));
2284
+ }
2285
+ getMinValueForFreeShipping() {
2286
+ return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
2287
+ }
2288
+ getDiscoverProducts(gender) {
2289
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories, undefined, gender)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2290
+ }
2291
+ getFeaturedProducts(gender) {
2292
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories, undefined, gender)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2293
+ }
2294
+ getVerticalProducts(gender) {
2295
+ 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({
2296
+ filters: Object.assign({ categories: { operator: Where.IN, value: [category.id] } }, (gender ? { tags: { operator: Where.IN, value: [gender] } } : {})),
2297
+ limits: { limit: 12 },
2298
+ })).pipe(map((products) => ({ category, products })))), map(({ category, products }) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
2299
+ }
2300
+ getHomeConfiguration() {
2301
+ return of(this.homeConfiguration).pipe(concatMap((home) => home
2302
+ ? of(home)
2303
+ : !this.homeId
2304
+ ? throwError(new RequiredArgumentError(['homeId']))
2305
+ : from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
2306
+ }
2307
+ saveHomeData(homeData) {
2308
+ const data = {
2309
+ createdAt: new Date(),
2310
+ expiresAt: add(new Date(), { hours: 1 }),
2311
+ data: homeData,
2312
+ };
2313
+ return from(this.homeRepository.update({
2314
+ id: this.homeId,
2315
+ data,
2316
+ })).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
2317
+ }
2318
+ get gender() {
2319
+ return this.homeId === 'mens_market' ? 'masculino' : undefined;
2320
+ }
2321
+ }
2322
+ 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 });
2323
+ HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService });
2324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, decorators: [{
2325
+ type: Injectable
2326
+ }], ctorParameters: function () {
2327
+ return [{ type: undefined, decorators: [{
2328
+ type: Inject,
2329
+ args: ['CategoryRepository']
2330
+ }] }, { type: undefined, decorators: [{
2331
+ type: Inject,
2332
+ args: ['HomeRepository']
2333
+ }] }, { type: undefined, decorators: [{
2334
+ type: Inject,
2335
+ args: ['ProductRepository']
2336
+ }] }, { type: i1$2.Shops, decorators: [{
2337
+ type: Inject,
2338
+ args: [DEFAULT_SHOP]
2339
+ }] }];
2340
+ } });
2341
+
2342
+ class OrderService {
2343
+ constructor(angularFirestore, orderRepository) {
2344
+ this.angularFirestore = angularFirestore;
2345
+ this.orderRepository = orderRepository;
2346
+ this.orderSubject = new Subject();
2347
+ }
2348
+ getOrder(id) {
2349
+ docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
2350
+ .pipe(map((doc) => Order.toInstance(doc.data())))
2351
+ .subscribe((doc) => this.orderSubject.next(doc));
2352
+ return this.orderSubject;
2353
+ }
2354
+ }
2355
+ 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 });
2356
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
2357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
2358
+ type: Injectable
2359
+ }], ctorParameters: function () {
2360
+ return [{ type: i1$1.Firestore }, { type: i1$2.OrderFirestoreRepository, decorators: [{
2361
+ type: Inject,
2362
+ args: ['OrderRepository']
2363
+ }] }];
2364
+ } });
2365
+
2366
+ class ShippingService {
2367
+ constructor(http, apiUrl, homeService) {
2368
+ this.http = http;
2369
+ this.apiUrl = apiUrl;
2370
+ this.homeService = homeService;
2371
+ }
2372
+ getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
2373
+ return combineLatest([
2374
+ this.homeService.getHomeData(),
2375
+ this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
2376
+ ]).pipe(map(([datas, shippingMethodsResponse]) => {
2377
+ let shippingMethods = shippingMethodsResponse.result;
2378
+ if (!shippingMethods.length)
2379
+ return [];
2380
+ shippingMethods = shippingMethods.map((shippingMethod) => {
2381
+ if (shippingMethod.ShippingCompanyName == 'Same Day EG')
2382
+ shippingMethod.ShippingCompanyName = 'Same Day';
2383
+ return shippingMethod;
2384
+ });
2385
+ const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
2386
+ if (this.isHolidays(datasSameDayNotAvaliable)) {
2387
+ shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
2388
+ }
2389
+ if (totalPrice >= 200) {
2390
+ shippingMethods = shippingMethods.map((s) => {
2391
+ if (s.serviceName !== 'Same Day')
2392
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
2393
+ else
2394
+ return s;
2395
+ });
2396
+ }
2397
+ if (shop == Shops.GLAMSHOP)
2398
+ return shippingMethods;
2399
+ if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
2400
+ shippingMethods = shippingMethods.map((s) => {
2401
+ if (s.serviceName == 'Same Day')
2402
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
2403
+ else
2404
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
2405
+ });
2406
+ }
2407
+ if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
2408
+ shippingMethods = shippingMethods.map((s) => {
2409
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
2410
+ });
2411
+ }
2412
+ return shippingMethods;
2413
+ }));
2414
+ }
2415
+ isFreeShippingBySubscription(shop, subscriptionPlan) {
2416
+ if (!subscriptionPlan)
2417
+ return false;
2418
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
2419
+ return true;
2420
+ return false;
2421
+ }
2422
+ isHalfShippingBySubscription(shop, subscriptionPlan) {
2423
+ if (!subscriptionPlan)
2424
+ return false;
2425
+ if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
2426
+ return true;
2427
+ }
2428
+ return false;
2429
+ }
2430
+ isHolidays(datas) {
2431
+ const today = new Date();
2432
+ for (const key in datas) {
2433
+ let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
2434
+ let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
2435
+ if (start > end)
2436
+ end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
2437
+ if (today >= start && today <= end)
2438
+ return true;
2439
+ }
2440
+ return false;
2441
+ }
2442
+ }
2443
+ 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 });
2444
+ ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
2445
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
2446
+ type: Injectable
2447
+ }], ctorParameters: function () {
2448
+ return [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
2449
+ type: Inject,
2450
+ args: [BACKEND_URL]
2451
+ }] }, { type: HomeShopService }];
2452
+ } });
2453
+
2454
+ class AngularConnectModule {
2455
+ static initializeApp(defaultShop, options, nameOrConfig) {
2456
+ return {
2457
+ ngModule: AngularConnectModule,
2458
+ providers: [
2459
+ {
2460
+ provide: CATEGORY_STRUCTURE,
2461
+ useClass: isNil(options === null || options === void 0 ? void 0 : options.oldCategoryStructure) || (options === null || options === void 0 ? void 0 : options.oldCategoryStructure)
2462
+ ? OldCategoryStructureAdapter
2463
+ : NewCategoryStructureAdapter,
2464
+ },
2465
+ { provide: PERSISTENCE_PROVIDER, useClass: (options === null || options === void 0 ? void 0 : options.persistenceProvider) || CookieDataPersistence },
2466
+ ...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
2467
+ ...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]),
2468
+ ...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
2469
+ ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
2470
+ ...(isNil(options === null || options === void 0 ? void 0 : options.vertexConfig) ? [] : [{ provide: VERTEX_CONFIG, useValue: options.vertexConfig }]),
2471
+ ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
2472
+ ...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
2473
+ ...(isNil(options === null || options === void 0 ? void 0 : options.storageBaseUrl) ? [] : [{ provide: STORAGE_BASE_URL, useValue: options.storageBaseUrl }]),
2474
+ ],
2475
+ };
2476
+ }
2477
+ }
2478
+ AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2479
+ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$4.FirebaseAppModule, i2.StorageModule, AngularElasticSeachModule,
2480
+ AngularVertexSeachModule,
2481
+ AngularFirebaseAuthModule,
2482
+ AngularFirestoreModule,
2483
+ AngularHasuraGraphQLModule] });
2484
+ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, providers: [
2485
+ AuthService,
2486
+ CartService,
2487
+ CatalogService,
2488
+ CategoryService,
2489
+ CheckoutService,
2490
+ CheckoutSubscriptionService,
2491
+ CouponService,
2492
+ HomeShopService,
2493
+ OrderService,
2494
+ ShippingService,
2495
+ WishlistService,
2496
+ {
2497
+ provide: UpdateUserImage,
2498
+ useFactory: (userRepository, fileUploader) => {
2499
+ return new UpdateUserImage(userRepository, fileUploader);
2500
+ },
2501
+ deps: ['UserRepository', 'FileUploaderService'],
2502
+ },
2503
+ {
2504
+ provide: 'FileUploaderService',
2505
+ useFactory: (storage, baseUrl) => {
2506
+ return new FirebaseFileUploaderService(storage, baseUrl);
2507
+ },
2508
+ deps: [Storage, STORAGE_BASE_URL],
2509
+ },
2510
+ {
2511
+ provide: 'ProductSearch',
2512
+ useExisting: ProductsVertexSearch,
2513
+ },
2514
+ ], imports: [provideFirebaseApp((injector) => {
2515
+ const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2516
+ try {
2517
+ return getApp(appName);
2518
+ }
2519
+ catch (error) {
2520
+ return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2521
+ }
2522
+ }),
2523
+ provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2524
+ AngularElasticSeachModule,
2525
+ AngularVertexSeachModule,
2526
+ AngularFirebaseAuthModule,
2527
+ AngularFirestoreModule,
2528
+ AngularHasuraGraphQLModule] });
2529
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
2530
+ type: NgModule,
2531
+ args: [{
2532
+ imports: [
2533
+ provideFirebaseApp((injector) => {
2534
+ const appName = injector.get(FIREBASE_APP_NAME) || '[DEFAULT]';
2535
+ try {
2536
+ return getApp(appName);
2537
+ }
2538
+ catch (error) {
2539
+ return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
2540
+ }
2541
+ }),
2542
+ provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
2543
+ AngularElasticSeachModule,
2544
+ AngularVertexSeachModule,
2545
+ AngularFirebaseAuthModule,
2546
+ AngularFirestoreModule,
2547
+ AngularHasuraGraphQLModule,
2548
+ ],
2549
+ providers: [
2550
+ AuthService,
2551
+ CartService,
2552
+ CatalogService,
2553
+ CategoryService,
2554
+ CheckoutService,
2555
+ CheckoutSubscriptionService,
2556
+ CouponService,
2557
+ HomeShopService,
2558
+ OrderService,
2559
+ ShippingService,
2560
+ WishlistService,
2561
+ {
2562
+ provide: UpdateUserImage,
2563
+ useFactory: (userRepository, fileUploader) => {
2564
+ return new UpdateUserImage(userRepository, fileUploader);
2565
+ },
2566
+ deps: ['UserRepository', 'FileUploaderService'],
2567
+ },
2568
+ {
2569
+ provide: 'FileUploaderService',
2570
+ useFactory: (storage, baseUrl) => {
2571
+ return new FirebaseFileUploaderService(storage, baseUrl);
2572
+ },
2573
+ deps: [Storage, STORAGE_BASE_URL],
2574
+ },
2575
+ {
2576
+ provide: 'ProductSearch',
2577
+ useExisting: ProductsVertexSearch,
2578
+ },
2579
+ ],
2580
+ }]
2581
+ }] });
2582
+
2583
+ /**
2584
+ * Generated bundle index. Do not edit.
2585
+ */
2586
+
2587
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, ShippingService, UtilHelper, WishlistService };
2588
+ //# sourceMappingURL=infrab4a-connect-angular.mjs.map