@infrab4a/connect-angular 4.0.0-beta.11 → 4.0.0-beta.13
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.
- package/angular-firestore.module.d.ts +1 -2
- package/esm2020/angular-connect.module.mjs +1 -1
- package/esm2020/angular-firestore.module.mjs +58 -18
- package/esm2020/angular-hasura-graphql.module.mjs +74 -8
- package/esm2020/services/cart.service.mjs +130 -22
- package/esm2020/services/checkout-subscription.service.mjs +5 -3
- package/esm2020/services/checkout.service.mjs +2 -2
- package/esm2020/services/coupon.service.mjs +20 -37
- package/esm2020/services/shipping.service.mjs +3 -4
- package/fesm2015/infrab4a-connect-angular.mjs +294 -99
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +292 -93
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -3
- package/services/cart.service.d.ts +7 -2
- package/services/coupon.service.d.ts +2 -3
|
@@ -4,14 +4,14 @@ import * as i1 from '@angular/fire/auth';
|
|
|
4
4
|
import { getIdToken, authState, Auth, provideAuth, getAuth } from '@angular/fire/auth';
|
|
5
5
|
import { combineLatest, of, from, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
6
6
|
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
7
|
-
import * as
|
|
8
|
-
import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities,
|
|
7
|
+
import * as i3 from '@infrab4a/connect';
|
|
8
|
+
import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Category, Product, RequiredArgumentError, add, Order, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, VariantHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository } from '@infrab4a/connect';
|
|
9
9
|
import cookie from 'js-cookie';
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
11
|
-
import * as i1$
|
|
12
|
-
import { docSnapshots, doc, Firestore
|
|
13
|
-
import * as i1$
|
|
14
|
-
import * as i1$
|
|
11
|
+
import * as i1$1 from '@angular/fire/firestore';
|
|
12
|
+
import { docSnapshots, doc, Firestore } from '@angular/fire/firestore';
|
|
13
|
+
import * as i1$2 from '@angular/common/http';
|
|
14
|
+
import * as i1$3 from '@angular/fire/app';
|
|
15
15
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
16
16
|
import { isPlatformBrowser } from '@angular/common';
|
|
17
17
|
|
|
@@ -71,11 +71,10 @@ class GroupInvalidCouponError extends CustomError {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
class CouponService {
|
|
74
|
-
constructor(couponRepository, defaultShop, orderRepository,
|
|
74
|
+
constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
75
75
|
this.couponRepository = couponRepository;
|
|
76
76
|
this.defaultShop = defaultShop;
|
|
77
77
|
this.orderRepository = orderRepository;
|
|
78
|
-
this.subscriptionRepository = subscriptionRepository;
|
|
79
78
|
this.categoryRepository = categoryRepository;
|
|
80
79
|
this.emailIsFromCollaborator = (userEmail) => !!userEmail?.match(/@b4a.com.br/g);
|
|
81
80
|
}
|
|
@@ -116,7 +115,7 @@ class CouponService {
|
|
|
116
115
|
const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
117
116
|
// Se não tem valor mínimo atingido, retorna erro
|
|
118
117
|
if (!hasMinSubTotal)
|
|
119
|
-
return throwError(
|
|
118
|
+
return throwError(`Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`);
|
|
120
119
|
return of(coupon);
|
|
121
120
|
}
|
|
122
121
|
isValidCoupon(coupon, userEmail) {
|
|
@@ -143,7 +142,7 @@ class CouponService {
|
|
|
143
142
|
// Verifica o limite de uso geral por usuario
|
|
144
143
|
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
145
144
|
throw new InvalidCouponError('Limite de uso atingido.');
|
|
146
|
-
const validUser =
|
|
145
|
+
const validUser = this.userValidationAndSubscriptionStatus(coupon, checkout?.user);
|
|
147
146
|
if (!validUser)
|
|
148
147
|
throw new InvalidCouponError('Usuário não elegível.');
|
|
149
148
|
const hasProductCategories = await this.hasProductCategories(coupon, checkout);
|
|
@@ -219,37 +218,24 @@ class CouponService {
|
|
|
219
218
|
});
|
|
220
219
|
return hasCategories.length ? true : false;
|
|
221
220
|
}
|
|
222
|
-
|
|
221
|
+
userValidationAndSubscriptionStatus(coupon, user) {
|
|
222
|
+
if (coupon.exclusivityType === Exclusivities.ALL_USERS)
|
|
223
|
+
return true;
|
|
224
|
+
if (!user)
|
|
225
|
+
return true;
|
|
223
226
|
// Verifica se o email do usuário é coorporativo
|
|
224
|
-
if (!this.emailIsFromCollaborator(
|
|
227
|
+
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
225
228
|
throw new InvalidCouponError('Você não é colaborador.');
|
|
226
229
|
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
227
|
-
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !==
|
|
230
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
228
231
|
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
user: {
|
|
237
|
-
email: { operator: Where.EQUALS, value: userEmail },
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
})
|
|
241
|
-
.then((sub) => sub.data);
|
|
242
|
-
const activeSubs = sub?.filter((s) => s.status === Status.ACTIVE);
|
|
243
|
-
switch (coupon.exclusivityType) {
|
|
244
|
-
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
245
|
-
return activeSubs.length > 0;
|
|
246
|
-
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
247
|
-
return activeSubs.length === 0;
|
|
248
|
-
case Exclusivities.NON_SUBSCRIBER:
|
|
249
|
-
return sub.length === 0;
|
|
250
|
-
default:
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
232
|
+
switch (coupon.exclusivityType) {
|
|
233
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
234
|
+
return user.isSubscriber ? true : false;
|
|
235
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
236
|
+
return user.isSubscriber ? false : true;
|
|
237
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
238
|
+
return user.isSubscriber ? false : true;
|
|
253
239
|
}
|
|
254
240
|
return true;
|
|
255
241
|
}
|
|
@@ -264,7 +250,7 @@ class CouponService {
|
|
|
264
250
|
return couponCategories;
|
|
265
251
|
}
|
|
266
252
|
}
|
|
267
|
-
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: '
|
|
253
|
+
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 });
|
|
268
254
|
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
269
255
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
|
|
270
256
|
type: Injectable,
|
|
@@ -274,15 +260,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
274
260
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
275
261
|
type: Inject,
|
|
276
262
|
args: ['CouponRepository']
|
|
277
|
-
}] }, { type:
|
|
263
|
+
}] }, { type: i3.Shops, decorators: [{
|
|
278
264
|
type: Inject,
|
|
279
265
|
args: [DEFAULT_SHOP]
|
|
280
266
|
}] }, { type: undefined, decorators: [{
|
|
281
267
|
type: Inject,
|
|
282
268
|
args: ['OrderRepository']
|
|
283
|
-
}] }, { type: undefined, decorators: [{
|
|
284
|
-
type: Inject,
|
|
285
|
-
args: ['SubscriptionRepository']
|
|
286
269
|
}] }, { type: undefined, decorators: [{
|
|
287
270
|
type: Inject,
|
|
288
271
|
args: ['CategoryRepository']
|
|
@@ -346,21 +329,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
346
329
|
}] }, { type: undefined, decorators: [{
|
|
347
330
|
type: Inject,
|
|
348
331
|
args: ['UserRepository']
|
|
349
|
-
}] }, { type:
|
|
332
|
+
}] }, { type: i3.Shops, decorators: [{
|
|
350
333
|
type: Inject,
|
|
351
334
|
args: [DEFAULT_SHOP]
|
|
352
335
|
}] }]; } });
|
|
353
336
|
|
|
354
337
|
class CartService {
|
|
355
|
-
constructor(authService, checkoutService, defaultShop, productRepository) {
|
|
338
|
+
constructor(authService, checkoutService, defaultShop, productRepository, variantRepository, buy2WinRepository) {
|
|
356
339
|
this.authService = authService;
|
|
357
340
|
this.checkoutService = checkoutService;
|
|
358
341
|
this.defaultShop = defaultShop;
|
|
359
342
|
this.productRepository = productRepository;
|
|
343
|
+
this.variantRepository = variantRepository;
|
|
344
|
+
this.buy2WinRepository = buy2WinRepository;
|
|
360
345
|
this.cartSubject = new Subject();
|
|
361
346
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
362
347
|
const items = [];
|
|
363
|
-
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.
|
|
348
|
+
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
|
|
364
349
|
if (index > -1) {
|
|
365
350
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
366
351
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
@@ -371,21 +356,20 @@ class CartService {
|
|
|
371
356
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
372
357
|
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
373
358
|
}));
|
|
374
|
-
this.generateCartObject = (items) => {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
...(cart[item.
|
|
378
|
-
quantity: (cart[item.
|
|
379
|
-
})
|
|
380
|
-
|
|
381
|
-
};
|
|
359
|
+
this.generateCartObject = (items) => items.reduce((cart, item) => ({
|
|
360
|
+
...cart,
|
|
361
|
+
[item.id]: LineItem.toInstance({
|
|
362
|
+
...(cart[item.id] || item),
|
|
363
|
+
quantity: (cart[item.id]?.quantity || 0) + (item.quantity ? item.quantity : 1),
|
|
364
|
+
}),
|
|
365
|
+
}), {});
|
|
382
366
|
this.buildLineItem = async ({ checkout, item, quantity, }) => {
|
|
383
|
-
const product = await this.
|
|
384
|
-
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.
|
|
367
|
+
const product = await this.getProductData(item.id);
|
|
368
|
+
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.id === item.id)?.quantity || 0;
|
|
385
369
|
if (this.checkMaxStock(item, quantity || 0))
|
|
386
370
|
throw new Error('Desculpe! Temos apenas ' + item.stock?.quantity + ' em estoque.');
|
|
387
371
|
const image = item.image || item.images?.shift();
|
|
388
|
-
const { id, name, EAN,
|
|
372
|
+
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
389
373
|
const isGift = item.isGift || null;
|
|
390
374
|
const pricePaid = this.getProductPrice({
|
|
391
375
|
product: item,
|
|
@@ -431,7 +415,7 @@ class CartService {
|
|
|
431
415
|
}
|
|
432
416
|
decreaseItem(item) {
|
|
433
417
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
434
|
-
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.
|
|
418
|
+
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.id === item.id);
|
|
435
419
|
if (!isNil(checkoutItem))
|
|
436
420
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
437
421
|
return checkout;
|
|
@@ -449,17 +433,21 @@ class CartService {
|
|
|
449
433
|
}
|
|
450
434
|
removeItem(item) {
|
|
451
435
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
452
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.
|
|
436
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.id === item.id);
|
|
453
437
|
if (index >= 0)
|
|
454
438
|
checkout.lineItems.splice(index, 1);
|
|
455
439
|
return checkout;
|
|
456
440
|
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
457
441
|
}
|
|
458
442
|
updateUserCart(user) {
|
|
459
|
-
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService
|
|
443
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService
|
|
444
|
+
.updateCheckoutLineItems(Checkout.toInstance({
|
|
460
445
|
...checkout.toPlain(),
|
|
461
|
-
lineItems: checkout.lineItems?.length
|
|
462
|
-
|
|
446
|
+
lineItems: checkout.lineItems?.length
|
|
447
|
+
? await Promise.all(checkout.lineItems?.map(async (item) => (await this.buildLineItem({ checkout, item })).lineItem))
|
|
448
|
+
: [],
|
|
449
|
+
}))
|
|
450
|
+
.toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
463
451
|
}
|
|
464
452
|
clearCart() {
|
|
465
453
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -470,17 +458,120 @@ class CartService {
|
|
|
470
458
|
buildCartFromCheckout(checkoutData) {
|
|
471
459
|
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
472
460
|
}
|
|
461
|
+
async getProductData(productId) {
|
|
462
|
+
let product;
|
|
463
|
+
let variant;
|
|
464
|
+
try {
|
|
465
|
+
product = await this.productRepository.get({ id: productId });
|
|
466
|
+
}
|
|
467
|
+
catch (error) {
|
|
468
|
+
if (!(error instanceof NotFoundError))
|
|
469
|
+
throw error;
|
|
470
|
+
variant = await this.variantRepository.get({ id: productId });
|
|
471
|
+
product = await this.productRepository.get({ id: variant.productId });
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
...product.toPlain(),
|
|
475
|
+
...(variant && { ...variant.toPlain() }),
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
getGifts() {
|
|
479
|
+
return this.checkoutService.getCheckout().pipe(mergeMap(async (checkout) => {
|
|
480
|
+
const campaigns = await this.buy2WinRepository
|
|
481
|
+
.find({
|
|
482
|
+
filters: {
|
|
483
|
+
active: { operator: Where.EQUALS, value: true },
|
|
484
|
+
shop: { operator: Where.EQUALS, value: this.defaultShop },
|
|
485
|
+
},
|
|
486
|
+
})
|
|
487
|
+
.then((data) => data.data);
|
|
488
|
+
const notGiftItems = checkout.lineItems.filter((item) => !item.isGift);
|
|
489
|
+
if (!campaigns.length)
|
|
490
|
+
return { ...checkout, lineItems: notGiftItems };
|
|
491
|
+
const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
492
|
+
const elegibleCampaigns = [];
|
|
493
|
+
for (const campaign of campaigns) {
|
|
494
|
+
const today = new Date();
|
|
495
|
+
if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
|
|
496
|
+
continue;
|
|
497
|
+
if (campaign.activeCategory) {
|
|
498
|
+
const categoriesCampaing = campaign.categories.map((c) => c.id);
|
|
499
|
+
const filterProductsCategories = checkout.lineItems.filter((l) => {
|
|
500
|
+
if (!l.categories || !l.categories?.length)
|
|
501
|
+
return true;
|
|
502
|
+
return l.categories.some((c) => categoriesCampaing.some((cat) => cat == c));
|
|
503
|
+
});
|
|
504
|
+
if (filterProductsCategories.length) {
|
|
505
|
+
const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
506
|
+
if (cartTotalCategories >= campaign.cartValueMin)
|
|
507
|
+
elegibleCampaigns.push(campaign);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
512
|
+
if (campaign.cartValue <= cartTotal)
|
|
513
|
+
elegibleCampaigns.push(campaign);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (!elegibleCampaigns.length)
|
|
518
|
+
return { ...checkout, lineItems: notGiftItems };
|
|
519
|
+
const campaingnProducts = [];
|
|
520
|
+
for (const campaign of elegibleCampaigns) {
|
|
521
|
+
let elegibleProducts = [];
|
|
522
|
+
for (const product of campaign.products) {
|
|
523
|
+
const productData = await this.productRepository.get({ sku: product });
|
|
524
|
+
if (!productData)
|
|
525
|
+
continue;
|
|
526
|
+
elegibleProducts.push(productData);
|
|
527
|
+
}
|
|
528
|
+
campaingnProducts.push(elegibleProducts);
|
|
529
|
+
}
|
|
530
|
+
if (!campaingnProducts.length)
|
|
531
|
+
return { ...checkout, lineItems: notGiftItems };
|
|
532
|
+
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
533
|
+
return { ...checkout, lineItems: notGiftItems.concat(gifts) };
|
|
534
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
535
|
+
}
|
|
536
|
+
giftToLineItems(items) {
|
|
537
|
+
return items.map((item) => {
|
|
538
|
+
const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
|
|
539
|
+
const image = item?.miniatures?.length ? item.miniatures[0] : item.images[0];
|
|
540
|
+
return LineItem.toInstance({
|
|
541
|
+
brand,
|
|
542
|
+
categories,
|
|
543
|
+
id: id.toString(),
|
|
544
|
+
name,
|
|
545
|
+
price,
|
|
546
|
+
sku,
|
|
547
|
+
slug,
|
|
548
|
+
stock,
|
|
549
|
+
weight,
|
|
550
|
+
EAN,
|
|
551
|
+
image,
|
|
552
|
+
pricePaid: 0,
|
|
553
|
+
quantity: 1,
|
|
554
|
+
isGift: true,
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
}
|
|
473
558
|
}
|
|
474
|
-
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
559
|
+
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
475
560
|
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
|
|
476
561
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
|
|
477
562
|
type: Injectable
|
|
478
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
563
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i3.Shops, decorators: [{
|
|
479
564
|
type: Inject,
|
|
480
565
|
args: [DEFAULT_SHOP]
|
|
481
566
|
}] }, { type: undefined, decorators: [{
|
|
482
567
|
type: Inject,
|
|
483
568
|
args: ['ProductRepository']
|
|
569
|
+
}] }, { type: undefined, decorators: [{
|
|
570
|
+
type: Inject,
|
|
571
|
+
args: ['VariantRepository']
|
|
572
|
+
}] }, { type: i3.Buy2WinFirestoreRepository, decorators: [{
|
|
573
|
+
type: Inject,
|
|
574
|
+
args: ['Buy2WinRepository']
|
|
484
575
|
}] }]; } });
|
|
485
576
|
|
|
486
577
|
class CheckoutSubscriptionService {
|
|
@@ -508,7 +599,9 @@ class CheckoutSubscriptionService {
|
|
|
508
599
|
return of();
|
|
509
600
|
}
|
|
510
601
|
checkCoupon(nickname, userEmail) {
|
|
511
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
602
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
603
|
+
.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
604
|
+
.pipe()));
|
|
512
605
|
}
|
|
513
606
|
calcDiscountSubscription(coupon) {
|
|
514
607
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
@@ -628,7 +721,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
628
721
|
}] }, { type: undefined, decorators: [{
|
|
629
722
|
type: Inject,
|
|
630
723
|
args: ['ProductRepository']
|
|
631
|
-
}] }, { type:
|
|
724
|
+
}] }, { type: i3.Shops, decorators: [{
|
|
632
725
|
type: Inject,
|
|
633
726
|
args: [DEFAULT_SHOP]
|
|
634
727
|
}] }]; } });
|
|
@@ -646,11 +739,11 @@ class OrderService {
|
|
|
646
739
|
return this.orderSubject;
|
|
647
740
|
}
|
|
648
741
|
}
|
|
649
|
-
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$
|
|
742
|
+
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 });
|
|
650
743
|
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
651
744
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
652
745
|
type: Injectable
|
|
653
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
746
|
+
}], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
|
|
654
747
|
type: Inject,
|
|
655
748
|
args: ['OrderRepository']
|
|
656
749
|
}] }]; } });
|
|
@@ -676,7 +769,7 @@ class ShippingService {
|
|
|
676
769
|
});
|
|
677
770
|
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
678
771
|
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
679
|
-
shippingMethods = shippingMethods.filter((method) => method.
|
|
772
|
+
shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
|
|
680
773
|
}
|
|
681
774
|
if (totalPrice >= 200) {
|
|
682
775
|
shippingMethods = shippingMethods.map((s) => {
|
|
@@ -707,9 +800,8 @@ class ShippingService {
|
|
|
707
800
|
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
708
801
|
if (!subscriptionPlan)
|
|
709
802
|
return false;
|
|
710
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
803
|
+
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
711
804
|
return true;
|
|
712
|
-
}
|
|
713
805
|
return false;
|
|
714
806
|
}
|
|
715
807
|
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
@@ -733,11 +825,11 @@ class ShippingService {
|
|
|
733
825
|
return false;
|
|
734
826
|
}
|
|
735
827
|
}
|
|
736
|
-
ShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, deps: [{ token: i1$
|
|
828
|
+
ShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, deps: [{ token: i1$2.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
737
829
|
ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
|
|
738
830
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
|
|
739
831
|
type: Injectable
|
|
740
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
832
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
741
833
|
type: Inject,
|
|
742
834
|
args: [BACKEND_URL]
|
|
743
835
|
}] }, { type: HomeShopService }]; } });
|
|
@@ -754,7 +846,7 @@ class AngularFirebaseAuthModule {
|
|
|
754
846
|
}
|
|
755
847
|
}
|
|
756
848
|
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
757
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$
|
|
849
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$3.FirebaseAppModule, i1.AuthModule] });
|
|
758
850
|
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
759
851
|
{
|
|
760
852
|
provide: 'Authentication',
|
|
@@ -911,7 +1003,7 @@ class AngularFirestoreModule {
|
|
|
911
1003
|
}
|
|
912
1004
|
}
|
|
913
1005
|
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
914
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$
|
|
1006
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$3.FirebaseAppModule] });
|
|
915
1007
|
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
916
1008
|
{
|
|
917
1009
|
provide: 'FirestoreOptions',
|
|
@@ -977,12 +1069,26 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
977
1069
|
},
|
|
978
1070
|
deps: ['FirestoreOptions'],
|
|
979
1071
|
},
|
|
1072
|
+
{
|
|
1073
|
+
provide: 'CampaignHashtagRepository',
|
|
1074
|
+
useFactory: (options) => {
|
|
1075
|
+
return new CampaignHashtagFirestoreRepository(options);
|
|
1076
|
+
},
|
|
1077
|
+
deps: ['FirestoreOptions'],
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
provide: 'CampaignDashboardRepository',
|
|
1081
|
+
useFactory: (options) => {
|
|
1082
|
+
return new CampaignDashboardFirestoreRepository(options);
|
|
1083
|
+
},
|
|
1084
|
+
deps: ['FirestoreOptions'],
|
|
1085
|
+
},
|
|
980
1086
|
{
|
|
981
1087
|
provide: 'EditionRepository',
|
|
982
1088
|
useFactory: (options, subscriptionRepository) => {
|
|
983
1089
|
return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
984
1090
|
},
|
|
985
|
-
deps: [
|
|
1091
|
+
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
986
1092
|
},
|
|
987
1093
|
{
|
|
988
1094
|
provide: 'HomeRepository',
|
|
@@ -1033,12 +1139,19 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
1033
1139
|
},
|
|
1034
1140
|
deps: ['FirestoreOptions'],
|
|
1035
1141
|
},
|
|
1142
|
+
{
|
|
1143
|
+
provide: 'ShopSettingsRepository',
|
|
1144
|
+
useFactory: (options) => {
|
|
1145
|
+
return new ShopSettingsFirestoreRepository(options);
|
|
1146
|
+
},
|
|
1147
|
+
deps: ['FirestoreOptions'],
|
|
1148
|
+
},
|
|
1036
1149
|
{
|
|
1037
1150
|
provide: 'SubscriptionPaymentRepository',
|
|
1038
1151
|
useFactory: (options, subscriptionRepository) => {
|
|
1039
1152
|
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
1040
1153
|
},
|
|
1041
|
-
deps: [
|
|
1154
|
+
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
1042
1155
|
},
|
|
1043
1156
|
{
|
|
1044
1157
|
provide: 'SubscriptionPlanRepository',
|
|
@@ -1073,21 +1186,21 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
1073
1186
|
useFactory: (options, userRepository) => {
|
|
1074
1187
|
return new UserAddressFirestoreRepository(options, userRepository);
|
|
1075
1188
|
},
|
|
1076
|
-
deps: [
|
|
1189
|
+
deps: ['FirestoreOptions', 'UserRepository'],
|
|
1077
1190
|
},
|
|
1078
1191
|
{
|
|
1079
1192
|
provide: 'UserPaymentMethodRepository',
|
|
1080
1193
|
useFactory: (options, userRepository) => {
|
|
1081
1194
|
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
1082
1195
|
},
|
|
1083
|
-
deps: [
|
|
1196
|
+
deps: ['FirestoreOptions', 'UserRepository'],
|
|
1084
1197
|
},
|
|
1085
1198
|
{
|
|
1086
1199
|
provide: ProductVariantFirestoreRepository,
|
|
1087
1200
|
useFactory: (options, productRepository) => {
|
|
1088
1201
|
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
1089
1202
|
},
|
|
1090
|
-
deps: [
|
|
1203
|
+
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
1091
1204
|
},
|
|
1092
1205
|
], imports: [AngularElasticSeachModule,
|
|
1093
1206
|
provideFirebaseApp((injector) => {
|
|
@@ -1095,8 +1208,7 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
1095
1208
|
return appName
|
|
1096
1209
|
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1097
1210
|
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1098
|
-
})
|
|
1099
|
-
provideFirestore(() => getFirestore())] });
|
|
1211
|
+
})] });
|
|
1100
1212
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
1101
1213
|
type: NgModule,
|
|
1102
1214
|
args: [{
|
|
@@ -1108,7 +1220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1108
1220
|
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1109
1221
|
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1110
1222
|
}),
|
|
1111
|
-
provideFirestore(() => getFirestore()),
|
|
1223
|
+
//provideFirestore(() => getFirestore()),
|
|
1112
1224
|
],
|
|
1113
1225
|
providers: [
|
|
1114
1226
|
{
|
|
@@ -1175,12 +1287,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1175
1287
|
},
|
|
1176
1288
|
deps: ['FirestoreOptions'],
|
|
1177
1289
|
},
|
|
1290
|
+
{
|
|
1291
|
+
provide: 'CampaignHashtagRepository',
|
|
1292
|
+
useFactory: (options) => {
|
|
1293
|
+
return new CampaignHashtagFirestoreRepository(options);
|
|
1294
|
+
},
|
|
1295
|
+
deps: ['FirestoreOptions'],
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
provide: 'CampaignDashboardRepository',
|
|
1299
|
+
useFactory: (options) => {
|
|
1300
|
+
return new CampaignDashboardFirestoreRepository(options);
|
|
1301
|
+
},
|
|
1302
|
+
deps: ['FirestoreOptions'],
|
|
1303
|
+
},
|
|
1178
1304
|
{
|
|
1179
1305
|
provide: 'EditionRepository',
|
|
1180
1306
|
useFactory: (options, subscriptionRepository) => {
|
|
1181
1307
|
return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
1182
1308
|
},
|
|
1183
|
-
deps: [
|
|
1309
|
+
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
1184
1310
|
},
|
|
1185
1311
|
{
|
|
1186
1312
|
provide: 'HomeRepository',
|
|
@@ -1231,12 +1357,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1231
1357
|
},
|
|
1232
1358
|
deps: ['FirestoreOptions'],
|
|
1233
1359
|
},
|
|
1360
|
+
{
|
|
1361
|
+
provide: 'ShopSettingsRepository',
|
|
1362
|
+
useFactory: (options) => {
|
|
1363
|
+
return new ShopSettingsFirestoreRepository(options);
|
|
1364
|
+
},
|
|
1365
|
+
deps: ['FirestoreOptions'],
|
|
1366
|
+
},
|
|
1234
1367
|
{
|
|
1235
1368
|
provide: 'SubscriptionPaymentRepository',
|
|
1236
1369
|
useFactory: (options, subscriptionRepository) => {
|
|
1237
1370
|
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
1238
1371
|
},
|
|
1239
|
-
deps: [
|
|
1372
|
+
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
1240
1373
|
},
|
|
1241
1374
|
{
|
|
1242
1375
|
provide: 'SubscriptionPlanRepository',
|
|
@@ -1271,21 +1404,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1271
1404
|
useFactory: (options, userRepository) => {
|
|
1272
1405
|
return new UserAddressFirestoreRepository(options, userRepository);
|
|
1273
1406
|
},
|
|
1274
|
-
deps: [
|
|
1407
|
+
deps: ['FirestoreOptions', 'UserRepository'],
|
|
1275
1408
|
},
|
|
1276
1409
|
{
|
|
1277
1410
|
provide: 'UserPaymentMethodRepository',
|
|
1278
1411
|
useFactory: (options, userRepository) => {
|
|
1279
1412
|
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
1280
1413
|
},
|
|
1281
|
-
deps: [
|
|
1414
|
+
deps: ['FirestoreOptions', 'UserRepository'],
|
|
1282
1415
|
},
|
|
1283
1416
|
{
|
|
1284
1417
|
provide: ProductVariantFirestoreRepository,
|
|
1285
1418
|
useFactory: (options, productRepository) => {
|
|
1286
1419
|
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
1287
1420
|
},
|
|
1288
|
-
deps: [
|
|
1421
|
+
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
1289
1422
|
},
|
|
1290
1423
|
],
|
|
1291
1424
|
}]
|
|
@@ -1331,10 +1464,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1331
1464
|
},
|
|
1332
1465
|
{
|
|
1333
1466
|
provide: CategoryHasuraGraphQLRepository,
|
|
1334
|
-
useFactory: (
|
|
1335
|
-
return new CategoryHasuraGraphQLRepository(
|
|
1467
|
+
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
1468
|
+
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
1336
1469
|
},
|
|
1337
|
-
deps: [
|
|
1470
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1338
1471
|
},
|
|
1339
1472
|
{
|
|
1340
1473
|
provide: 'ProductRepository',
|
|
@@ -1358,6 +1491,39 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1358
1491
|
},
|
|
1359
1492
|
deps: ['HasuraConfig'],
|
|
1360
1493
|
},
|
|
1494
|
+
{
|
|
1495
|
+
provide: 'CategoryFilterRepository',
|
|
1496
|
+
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1500
|
+
useFactory: (options) => {
|
|
1501
|
+
return new CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1502
|
+
},
|
|
1503
|
+
deps: [HASURA_OPTIONS],
|
|
1504
|
+
},
|
|
1505
|
+
{
|
|
1506
|
+
provide: 'FilterOptionRepository',
|
|
1507
|
+
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
provide: FilterOptionHasuraGraphQLRepository,
|
|
1511
|
+
useFactory: (options) => {
|
|
1512
|
+
return new FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1513
|
+
},
|
|
1514
|
+
deps: [HASURA_OPTIONS],
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
provide: 'FilterRepository',
|
|
1518
|
+
useExisting: FilterHasuraGraphQLRepository,
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
provide: FilterHasuraGraphQLRepository,
|
|
1522
|
+
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1523
|
+
return new FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
1524
|
+
},
|
|
1525
|
+
deps: [HASURA_OPTIONS, FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1526
|
+
},
|
|
1361
1527
|
] });
|
|
1362
1528
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
1363
1529
|
type: NgModule,
|
|
@@ -1392,10 +1558,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1392
1558
|
},
|
|
1393
1559
|
{
|
|
1394
1560
|
provide: CategoryHasuraGraphQLRepository,
|
|
1395
|
-
useFactory: (
|
|
1396
|
-
return new CategoryHasuraGraphQLRepository(
|
|
1561
|
+
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
1562
|
+
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
1397
1563
|
},
|
|
1398
|
-
deps: [
|
|
1564
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1399
1565
|
},
|
|
1400
1566
|
{
|
|
1401
1567
|
provide: 'ProductRepository',
|
|
@@ -1419,6 +1585,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1419
1585
|
},
|
|
1420
1586
|
deps: ['HasuraConfig'],
|
|
1421
1587
|
},
|
|
1588
|
+
{
|
|
1589
|
+
provide: 'CategoryFilterRepository',
|
|
1590
|
+
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1594
|
+
useFactory: (options) => {
|
|
1595
|
+
return new CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1596
|
+
},
|
|
1597
|
+
deps: [HASURA_OPTIONS],
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
provide: 'FilterOptionRepository',
|
|
1601
|
+
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
provide: FilterOptionHasuraGraphQLRepository,
|
|
1605
|
+
useFactory: (options) => {
|
|
1606
|
+
return new FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1607
|
+
},
|
|
1608
|
+
deps: [HASURA_OPTIONS],
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
provide: 'FilterRepository',
|
|
1612
|
+
useExisting: FilterHasuraGraphQLRepository,
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
provide: FilterHasuraGraphQLRepository,
|
|
1616
|
+
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1617
|
+
return new FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
1618
|
+
},
|
|
1619
|
+
deps: [HASURA_OPTIONS, FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1620
|
+
},
|
|
1422
1621
|
],
|
|
1423
1622
|
}]
|
|
1424
1623
|
}] });
|