@infrab4a/connect-angular 4.0.0-beta.19 → 4.0.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.
- package/angular-connect.module.d.ts +0 -1
- package/angular-firestore.module.d.ts +1 -2
- package/consts/index.d.ts +0 -1
- package/esm2020/angular-connect.module.mjs +3 -6
- package/esm2020/angular-firestore.module.mjs +137 -226
- package/esm2020/angular-hasura-graphql.module.mjs +22 -107
- package/esm2020/consts/index.mjs +1 -2
- package/esm2020/services/cart.service.mjs +22 -130
- package/esm2020/services/checkout-subscription.service.mjs +3 -5
- package/esm2020/services/checkout.service.mjs +2 -2
- package/esm2020/services/coupon.service.mjs +37 -20
- package/esm2020/services/index.mjs +3 -4
- package/fesm2015/infrab4a-connect-angular.mjs +252 -608
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +244 -602
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +3 -2
- package/services/cart.service.d.ts +2 -7
- package/services/coupon.service.d.ts +3 -2
- package/services/index.d.ts +2 -3
- package/consts/backend-url.const.d.ts +0 -1
- package/esm2020/consts/backend-url.const.mjs +0 -2
- package/esm2020/services/shipping.service.mjs +0 -96
- package/esm2020/services/types/shipping-methods.type.mjs +0 -2
- package/services/shipping.service.d.ts +0 -19
- package/services/types/shipping-methods.type.d.ts +0 -12
|
@@ -4,18 +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, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Category, Product, RequiredArgumentError, add,
|
|
7
|
+
import * as i2 from '@infrab4a/connect';
|
|
8
|
+
import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, Status, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Order, Category, Product, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, VariantHasuraGraphQLRepository } from '@infrab4a/connect';
|
|
9
9
|
import cookie from 'js-cookie';
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
11
11
|
import * as i1$1 from '@angular/fire/firestore';
|
|
12
|
-
import { docSnapshots, doc, Firestore, provideFirestore } from '@angular/fire/firestore';
|
|
13
|
-
import * as i1$2 from '@angular/
|
|
14
|
-
import * as i1$3 from '@angular/fire/app';
|
|
12
|
+
import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
|
|
13
|
+
import * as i1$2 from '@angular/fire/app';
|
|
15
14
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
16
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
17
|
-
import { initializeApp as initializeApp$1 } from 'firebase/app';
|
|
18
|
-
import { getFirestore } from 'firebase/firestore';
|
|
19
15
|
|
|
20
16
|
class AuthService {
|
|
21
17
|
constructor(angularFireAuth, userRepository) {
|
|
@@ -48,8 +44,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
48
44
|
args: ['UserRepository']
|
|
49
45
|
}] }]; } });
|
|
50
46
|
|
|
51
|
-
const BACKEND_URL = 'BACKEND_URL';
|
|
52
|
-
|
|
53
47
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
54
48
|
|
|
55
49
|
const ES_CONFIG = 'ES_CONFIG';
|
|
@@ -73,10 +67,11 @@ class GroupInvalidCouponError extends CustomError {
|
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
class CouponService {
|
|
76
|
-
constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
70
|
+
constructor(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
|
|
77
71
|
this.couponRepository = couponRepository;
|
|
78
72
|
this.defaultShop = defaultShop;
|
|
79
73
|
this.orderRepository = orderRepository;
|
|
74
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
80
75
|
this.categoryRepository = categoryRepository;
|
|
81
76
|
this.emailIsFromCollaborator = (userEmail) => !!userEmail?.match(/@b4a.com.br/g);
|
|
82
77
|
}
|
|
@@ -117,7 +112,7 @@ class CouponService {
|
|
|
117
112
|
const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
118
113
|
// Se não tem valor mínimo atingido, retorna erro
|
|
119
114
|
if (!hasMinSubTotal)
|
|
120
|
-
return throwError(
|
|
115
|
+
return throwError('Valor mínimo não atingido');
|
|
121
116
|
return of(coupon);
|
|
122
117
|
}
|
|
123
118
|
isValidCoupon(coupon, userEmail) {
|
|
@@ -144,7 +139,7 @@ class CouponService {
|
|
|
144
139
|
// Verifica o limite de uso geral por usuario
|
|
145
140
|
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
146
141
|
throw new InvalidCouponError('Limite de uso atingido.');
|
|
147
|
-
const validUser = this.userValidationAndSubscriptionStatus(coupon,
|
|
142
|
+
const validUser = await this.userValidationAndSubscriptionStatus(coupon, userEmail);
|
|
148
143
|
if (!validUser)
|
|
149
144
|
throw new InvalidCouponError('Usuário não elegível.');
|
|
150
145
|
const hasProductCategories = await this.hasProductCategories(coupon, checkout);
|
|
@@ -220,24 +215,37 @@ class CouponService {
|
|
|
220
215
|
});
|
|
221
216
|
return hasCategories.length ? true : false;
|
|
222
217
|
}
|
|
223
|
-
userValidationAndSubscriptionStatus(coupon,
|
|
224
|
-
if (coupon.exclusivityType === Exclusivities.ALL_USERS)
|
|
225
|
-
return true;
|
|
226
|
-
if (!user)
|
|
227
|
-
return true;
|
|
218
|
+
async userValidationAndSubscriptionStatus(coupon, userEmail) {
|
|
228
219
|
// Verifica se o email do usuário é coorporativo
|
|
229
|
-
if (!this.emailIsFromCollaborator(
|
|
220
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
230
221
|
throw new InvalidCouponError('Você não é colaborador.');
|
|
231
222
|
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
232
|
-
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !==
|
|
223
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
|
|
233
224
|
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
225
|
+
const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
|
|
226
|
+
coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
|
|
227
|
+
coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
|
|
228
|
+
if (couponRuleSubscription && userEmail) {
|
|
229
|
+
const sub = await this.subscriptionRepository
|
|
230
|
+
.find({
|
|
231
|
+
filters: {
|
|
232
|
+
user: {
|
|
233
|
+
email: { operator: Where.EQUALS, value: userEmail },
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
})
|
|
237
|
+
.then((sub) => sub.data);
|
|
238
|
+
const activeSubs = sub?.filter((s) => s.status === Status.ACTIVE);
|
|
239
|
+
switch (coupon.exclusivityType) {
|
|
240
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
241
|
+
return activeSubs.length > 0;
|
|
242
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
243
|
+
return activeSubs.length === 0;
|
|
244
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
245
|
+
return sub.length === 0;
|
|
246
|
+
default:
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
241
249
|
}
|
|
242
250
|
return true;
|
|
243
251
|
}
|
|
@@ -252,7 +260,7 @@ class CouponService {
|
|
|
252
260
|
return couponCategories;
|
|
253
261
|
}
|
|
254
262
|
}
|
|
255
|
-
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 });
|
|
263
|
+
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: 'SubscriptionRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
256
264
|
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
257
265
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
|
|
258
266
|
type: Injectable,
|
|
@@ -262,12 +270,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
262
270
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
263
271
|
type: Inject,
|
|
264
272
|
args: ['CouponRepository']
|
|
265
|
-
}] }, { type:
|
|
273
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
266
274
|
type: Inject,
|
|
267
275
|
args: [DEFAULT_SHOP]
|
|
268
276
|
}] }, { type: undefined, decorators: [{
|
|
269
277
|
type: Inject,
|
|
270
278
|
args: ['OrderRepository']
|
|
279
|
+
}] }, { type: undefined, decorators: [{
|
|
280
|
+
type: Inject,
|
|
281
|
+
args: ['SubscriptionRepository']
|
|
271
282
|
}] }, { type: undefined, decorators: [{
|
|
272
283
|
type: Inject,
|
|
273
284
|
args: ['CategoryRepository']
|
|
@@ -331,23 +342,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
331
342
|
}] }, { type: undefined, decorators: [{
|
|
332
343
|
type: Inject,
|
|
333
344
|
args: ['UserRepository']
|
|
334
|
-
}] }, { type:
|
|
345
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
335
346
|
type: Inject,
|
|
336
347
|
args: [DEFAULT_SHOP]
|
|
337
348
|
}] }]; } });
|
|
338
349
|
|
|
339
350
|
class CartService {
|
|
340
|
-
constructor(authService, checkoutService, defaultShop, productRepository
|
|
351
|
+
constructor(authService, checkoutService, defaultShop, productRepository) {
|
|
341
352
|
this.authService = authService;
|
|
342
353
|
this.checkoutService = checkoutService;
|
|
343
354
|
this.defaultShop = defaultShop;
|
|
344
355
|
this.productRepository = productRepository;
|
|
345
|
-
this.variantRepository = variantRepository;
|
|
346
|
-
this.buy2WinRepository = buy2WinRepository;
|
|
347
356
|
this.cartSubject = new Subject();
|
|
348
357
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
349
358
|
const items = [];
|
|
350
|
-
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.
|
|
359
|
+
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
351
360
|
if (index > -1) {
|
|
352
361
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
353
362
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
@@ -358,20 +367,21 @@ class CartService {
|
|
|
358
367
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
359
368
|
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
360
369
|
}));
|
|
361
|
-
this.generateCartObject = (items) =>
|
|
362
|
-
|
|
363
|
-
[item.
|
|
364
|
-
...(cart[item.
|
|
365
|
-
quantity: (cart[item.
|
|
366
|
-
})
|
|
367
|
-
|
|
370
|
+
this.generateCartObject = (items) => {
|
|
371
|
+
const cart = {};
|
|
372
|
+
items?.forEach((item) => (cart[item.sku] = LineItem.toInstance({
|
|
373
|
+
...(cart[item.sku] || item),
|
|
374
|
+
quantity: (cart[item.sku]?.quantity || 0) + (item.quantity ? item.quantity : 1),
|
|
375
|
+
})));
|
|
376
|
+
return cart;
|
|
377
|
+
};
|
|
368
378
|
this.buildLineItem = async ({ checkout, item, quantity, }) => {
|
|
369
|
-
const product = await this.
|
|
370
|
-
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.
|
|
379
|
+
const product = await this.productRepository.get({ id: item.id });
|
|
380
|
+
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.sku === item.sku)?.quantity || 0;
|
|
371
381
|
if (this.checkMaxStock(item, quantity || 0))
|
|
372
382
|
throw new Error('Desculpe! Temos apenas ' + item.stock?.quantity + ' em estoque.');
|
|
373
383
|
const image = item.image || item.images?.shift();
|
|
374
|
-
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
384
|
+
const { id, name, EAN, brand, slug, stock, price, weight, categories, sku, type } = item;
|
|
375
385
|
const isGift = item.isGift || null;
|
|
376
386
|
const pricePaid = this.getProductPrice({
|
|
377
387
|
product: item,
|
|
@@ -417,7 +427,7 @@ class CartService {
|
|
|
417
427
|
}
|
|
418
428
|
decreaseItem(item) {
|
|
419
429
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
420
|
-
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.
|
|
430
|
+
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.sku === item.sku);
|
|
421
431
|
if (!isNil(checkoutItem))
|
|
422
432
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
423
433
|
return checkout;
|
|
@@ -435,21 +445,17 @@ class CartService {
|
|
|
435
445
|
}
|
|
436
446
|
removeItem(item) {
|
|
437
447
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
438
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.
|
|
448
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
439
449
|
if (index >= 0)
|
|
440
450
|
checkout.lineItems.splice(index, 1);
|
|
441
451
|
return checkout;
|
|
442
452
|
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
443
453
|
}
|
|
444
454
|
updateUserCart(user) {
|
|
445
|
-
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService
|
|
446
|
-
.updateCheckoutLineItems(Checkout.toInstance({
|
|
455
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService.updateCheckoutLineItems(Checkout.toInstance({
|
|
447
456
|
...checkout.toPlain(),
|
|
448
|
-
lineItems: checkout.lineItems?.length
|
|
449
|
-
|
|
450
|
-
: [],
|
|
451
|
-
}))
|
|
452
|
-
.toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
457
|
+
lineItems: checkout.lineItems?.length ? await Promise.all(checkout.lineItems?.map(async (item) => (await this.buildLineItem({ checkout, item })).lineItem)) : [],
|
|
458
|
+
})).toPromise()), map(checkout => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
453
459
|
}
|
|
454
460
|
clearCart() {
|
|
455
461
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -460,120 +466,17 @@ class CartService {
|
|
|
460
466
|
buildCartFromCheckout(checkoutData) {
|
|
461
467
|
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
462
468
|
}
|
|
463
|
-
async getProductData(productId) {
|
|
464
|
-
let product;
|
|
465
|
-
let variant;
|
|
466
|
-
try {
|
|
467
|
-
product = await this.productRepository.get({ id: productId });
|
|
468
|
-
}
|
|
469
|
-
catch (error) {
|
|
470
|
-
if (!(error instanceof NotFoundError))
|
|
471
|
-
throw error;
|
|
472
|
-
variant = await this.variantRepository.get({ id: productId });
|
|
473
|
-
product = await this.productRepository.get({ id: variant.productId });
|
|
474
|
-
}
|
|
475
|
-
return {
|
|
476
|
-
...product.toPlain(),
|
|
477
|
-
...(variant && { ...variant.toPlain() }),
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
getGifts() {
|
|
481
|
-
return this.checkoutService.getCheckout().pipe(mergeMap(async (checkout) => {
|
|
482
|
-
const campaigns = await this.buy2WinRepository
|
|
483
|
-
.find({
|
|
484
|
-
filters: {
|
|
485
|
-
active: { operator: Where.EQUALS, value: true },
|
|
486
|
-
shop: { operator: Where.EQUALS, value: this.defaultShop },
|
|
487
|
-
},
|
|
488
|
-
})
|
|
489
|
-
.then((data) => data.data);
|
|
490
|
-
const notGiftItems = checkout.lineItems.filter((item) => !item.isGift);
|
|
491
|
-
if (!campaigns.length)
|
|
492
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
493
|
-
const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
494
|
-
const elegibleCampaigns = [];
|
|
495
|
-
for (const campaign of campaigns) {
|
|
496
|
-
const today = new Date();
|
|
497
|
-
if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
|
|
498
|
-
continue;
|
|
499
|
-
if (campaign.activeCategory) {
|
|
500
|
-
const categoriesCampaing = campaign.categories.map((c) => c.id);
|
|
501
|
-
const filterProductsCategories = checkout.lineItems.filter((l) => {
|
|
502
|
-
if (!l.categories || !l.categories?.length)
|
|
503
|
-
return true;
|
|
504
|
-
return l.categories.some((c) => categoriesCampaing.some((cat) => cat == c));
|
|
505
|
-
});
|
|
506
|
-
if (filterProductsCategories.length) {
|
|
507
|
-
const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
508
|
-
if (cartTotalCategories >= campaign.cartValueMin)
|
|
509
|
-
elegibleCampaigns.push(campaign);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
514
|
-
if (campaign.cartValue <= cartTotal)
|
|
515
|
-
elegibleCampaigns.push(campaign);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
if (!elegibleCampaigns.length)
|
|
520
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
521
|
-
const campaingnProducts = [];
|
|
522
|
-
for (const campaign of elegibleCampaigns) {
|
|
523
|
-
let elegibleProducts = [];
|
|
524
|
-
for (const product of campaign.products) {
|
|
525
|
-
const productData = await this.productRepository.get({ sku: product });
|
|
526
|
-
if (!productData)
|
|
527
|
-
continue;
|
|
528
|
-
elegibleProducts.push(productData);
|
|
529
|
-
}
|
|
530
|
-
campaingnProducts.push(elegibleProducts);
|
|
531
|
-
}
|
|
532
|
-
if (!campaingnProducts.length)
|
|
533
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
534
|
-
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
535
|
-
return { ...checkout, lineItems: notGiftItems.concat(gifts) };
|
|
536
|
-
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
537
|
-
}
|
|
538
|
-
giftToLineItems(items) {
|
|
539
|
-
return items.map((item) => {
|
|
540
|
-
const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
|
|
541
|
-
const image = item?.miniatures?.length ? item.miniatures[0] : item.images[0];
|
|
542
|
-
return LineItem.toInstance({
|
|
543
|
-
brand,
|
|
544
|
-
categories,
|
|
545
|
-
id: id.toString(),
|
|
546
|
-
name,
|
|
547
|
-
price,
|
|
548
|
-
sku,
|
|
549
|
-
slug,
|
|
550
|
-
stock,
|
|
551
|
-
weight,
|
|
552
|
-
EAN,
|
|
553
|
-
image,
|
|
554
|
-
pricePaid: 0,
|
|
555
|
-
quantity: 1,
|
|
556
|
-
isGift: true,
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
469
|
}
|
|
561
|
-
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' }
|
|
470
|
+
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 });
|
|
562
471
|
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
|
|
563
472
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
|
|
564
473
|
type: Injectable
|
|
565
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
474
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
566
475
|
type: Inject,
|
|
567
476
|
args: [DEFAULT_SHOP]
|
|
568
477
|
}] }, { type: undefined, decorators: [{
|
|
569
478
|
type: Inject,
|
|
570
479
|
args: ['ProductRepository']
|
|
571
|
-
}] }, { type: undefined, decorators: [{
|
|
572
|
-
type: Inject,
|
|
573
|
-
args: ['VariantRepository']
|
|
574
|
-
}] }, { type: i3.Buy2WinFirestoreRepository, decorators: [{
|
|
575
|
-
type: Inject,
|
|
576
|
-
args: ['Buy2WinRepository']
|
|
577
480
|
}] }]; } });
|
|
578
481
|
|
|
579
482
|
class CheckoutSubscriptionService {
|
|
@@ -601,9 +504,7 @@ class CheckoutSubscriptionService {
|
|
|
601
504
|
return of();
|
|
602
505
|
}
|
|
603
506
|
checkCoupon(nickname, userEmail) {
|
|
604
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
605
|
-
.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
606
|
-
.pipe()));
|
|
507
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe()));
|
|
607
508
|
}
|
|
608
509
|
calcDiscountSubscription(coupon) {
|
|
609
510
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
@@ -621,6 +522,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
621
522
|
args: ['SubscriptionRepository']
|
|
622
523
|
}] }, { type: CouponService }]; } });
|
|
623
524
|
|
|
525
|
+
class OrderService {
|
|
526
|
+
constructor(angularFirestore, orderRepository) {
|
|
527
|
+
this.angularFirestore = angularFirestore;
|
|
528
|
+
this.orderRepository = orderRepository;
|
|
529
|
+
this.orderSubject = new Subject();
|
|
530
|
+
}
|
|
531
|
+
getOrder(id) {
|
|
532
|
+
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
533
|
+
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
534
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
535
|
+
return this.orderSubject;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
539
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
540
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
541
|
+
type: Injectable
|
|
542
|
+
}], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
543
|
+
type: Inject,
|
|
544
|
+
args: ['OrderRepository']
|
|
545
|
+
}] }]; } });
|
|
546
|
+
|
|
624
547
|
class HomeShopService {
|
|
625
548
|
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
626
549
|
this.categoryRepository = categoryRepository;
|
|
@@ -723,119 +646,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
723
646
|
}] }, { type: undefined, decorators: [{
|
|
724
647
|
type: Inject,
|
|
725
648
|
args: ['ProductRepository']
|
|
726
|
-
}] }, { type:
|
|
649
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
727
650
|
type: Inject,
|
|
728
651
|
args: [DEFAULT_SHOP]
|
|
729
652
|
}] }]; } });
|
|
730
653
|
|
|
731
|
-
class OrderService {
|
|
732
|
-
constructor(angularFirestore, orderRepository) {
|
|
733
|
-
this.angularFirestore = angularFirestore;
|
|
734
|
-
this.orderRepository = orderRepository;
|
|
735
|
-
this.orderSubject = new Subject();
|
|
736
|
-
}
|
|
737
|
-
getOrder(id) {
|
|
738
|
-
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
739
|
-
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
740
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
741
|
-
return this.orderSubject;
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
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 });
|
|
745
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
747
|
-
type: Injectable
|
|
748
|
-
}], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
|
|
749
|
-
type: Inject,
|
|
750
|
-
args: ['OrderRepository']
|
|
751
|
-
}] }]; } });
|
|
752
|
-
|
|
753
|
-
class ShippingService {
|
|
754
|
-
constructor(http, apiUrl, homeService) {
|
|
755
|
-
this.http = http;
|
|
756
|
-
this.apiUrl = apiUrl;
|
|
757
|
-
this.homeService = homeService;
|
|
758
|
-
}
|
|
759
|
-
getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
760
|
-
return combineLatest([
|
|
761
|
-
this.homeService.getHomeData(),
|
|
762
|
-
this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
|
|
763
|
-
]).pipe(map(([datas, shippingMethodsResponse]) => {
|
|
764
|
-
let shippingMethods = shippingMethodsResponse.result;
|
|
765
|
-
if (!shippingMethods.length)
|
|
766
|
-
return [];
|
|
767
|
-
shippingMethods = shippingMethods.map((shippingMethod) => {
|
|
768
|
-
if (shippingMethod.ShippingCompanyName == 'Same Day EG')
|
|
769
|
-
shippingMethod.ShippingCompanyName = 'Same Day';
|
|
770
|
-
return shippingMethod;
|
|
771
|
-
});
|
|
772
|
-
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
773
|
-
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
774
|
-
shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
|
|
775
|
-
}
|
|
776
|
-
if (totalPrice >= 200) {
|
|
777
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
778
|
-
if (s.serviceName !== 'Same Day')
|
|
779
|
-
return { ...s, totalPrice: 0 };
|
|
780
|
-
else
|
|
781
|
-
return s;
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
if (shop == Shops.GLAMSHOP)
|
|
785
|
-
return shippingMethods;
|
|
786
|
-
if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
787
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
788
|
-
if (s.serviceName == 'Same Day')
|
|
789
|
-
return { ...s, totalPrice: s.totalPrice / 2 };
|
|
790
|
-
else
|
|
791
|
-
return { ...s, totalPrice: 0 };
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
795
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
796
|
-
return { ...s, totalPrice: s.totalPrice / 2 };
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
return shippingMethods;
|
|
800
|
-
}));
|
|
801
|
-
}
|
|
802
|
-
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
803
|
-
if (!subscriptionPlan)
|
|
804
|
-
return false;
|
|
805
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
806
|
-
return true;
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
810
|
-
if (!subscriptionPlan)
|
|
811
|
-
return false;
|
|
812
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
813
|
-
return true;
|
|
814
|
-
}
|
|
815
|
-
return false;
|
|
816
|
-
}
|
|
817
|
-
isHolidays(datas) {
|
|
818
|
-
const today = new Date();
|
|
819
|
-
for (const key in datas) {
|
|
820
|
-
let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
|
|
821
|
-
let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
|
|
822
|
-
if (start > end)
|
|
823
|
-
end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
|
|
824
|
-
if (today >= start && today <= end)
|
|
825
|
-
return true;
|
|
826
|
-
}
|
|
827
|
-
return false;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
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 });
|
|
831
|
-
ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
|
|
832
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
|
|
833
|
-
type: Injectable
|
|
834
|
-
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
835
|
-
type: Inject,
|
|
836
|
-
args: [BACKEND_URL]
|
|
837
|
-
}] }, { type: HomeShopService }]; } });
|
|
838
|
-
|
|
839
654
|
class AngularFirebaseAuthModule {
|
|
840
655
|
static initializeApp(options, nameOrConfig) {
|
|
841
656
|
return {
|
|
@@ -848,7 +663,7 @@ class AngularFirebaseAuthModule {
|
|
|
848
663
|
}
|
|
849
664
|
}
|
|
850
665
|
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
851
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$
|
|
666
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
|
|
852
667
|
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
853
668
|
{
|
|
854
669
|
provide: 'Authentication',
|
|
@@ -1005,211 +820,168 @@ class AngularFirestoreModule {
|
|
|
1005
820
|
}
|
|
1006
821
|
}
|
|
1007
822
|
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1008
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$
|
|
823
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
|
|
1009
824
|
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
1010
|
-
{
|
|
1011
|
-
provide: 'FirestoreOptions',
|
|
1012
|
-
useFactory: (firestore, platformId) => ({
|
|
1013
|
-
firestore,
|
|
1014
|
-
interceptors: {
|
|
1015
|
-
request: (request) => {
|
|
1016
|
-
if (isPlatformBrowser(platformId))
|
|
1017
|
-
return request;
|
|
1018
|
-
const interval = setInterval(() => { }, 100);
|
|
1019
|
-
request.interval = interval;
|
|
1020
|
-
return request;
|
|
1021
|
-
},
|
|
1022
|
-
response: (response, request) => {
|
|
1023
|
-
if (isPlatformBrowser(platformId))
|
|
1024
|
-
return response;
|
|
1025
|
-
clearInterval(request.interval);
|
|
1026
|
-
return response;
|
|
1027
|
-
},
|
|
1028
|
-
},
|
|
1029
|
-
}),
|
|
1030
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1031
|
-
},
|
|
1032
825
|
{
|
|
1033
826
|
provide: 'BeautyProfileRepository',
|
|
1034
|
-
useFactory: (
|
|
1035
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
827
|
+
useFactory: (firestore, userRepository) => {
|
|
828
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1036
829
|
},
|
|
1037
|
-
deps: [
|
|
830
|
+
deps: [Firestore, 'UserRepository'],
|
|
1038
831
|
},
|
|
1039
832
|
{
|
|
1040
833
|
provide: 'Buy2WinRepository',
|
|
1041
|
-
useFactory: (
|
|
1042
|
-
return new Buy2WinFirestoreRepository(
|
|
834
|
+
useFactory: (firestore) => {
|
|
835
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1043
836
|
},
|
|
1044
|
-
deps: [
|
|
837
|
+
deps: [Firestore],
|
|
1045
838
|
},
|
|
1046
839
|
{
|
|
1047
840
|
provide: CategoryFirestoreRepository,
|
|
1048
|
-
useFactory: (
|
|
1049
|
-
return new CategoryFirestoreRepository(
|
|
841
|
+
useFactory: (firestore) => {
|
|
842
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1050
843
|
},
|
|
1051
|
-
deps: [
|
|
844
|
+
deps: [Firestore],
|
|
1052
845
|
},
|
|
1053
846
|
{
|
|
1054
847
|
provide: 'CheckoutRepository',
|
|
1055
|
-
useFactory: (
|
|
1056
|
-
return new CheckoutFirestoreRepository(
|
|
848
|
+
useFactory: (firestore) => {
|
|
849
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1057
850
|
},
|
|
1058
|
-
deps: [
|
|
851
|
+
deps: [Firestore],
|
|
1059
852
|
},
|
|
1060
853
|
{
|
|
1061
854
|
provide: 'CheckoutSubscriptionRepository',
|
|
1062
|
-
useFactory: (
|
|
1063
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
855
|
+
useFactory: (firestore) => {
|
|
856
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1064
857
|
},
|
|
1065
|
-
deps: [
|
|
858
|
+
deps: [Firestore],
|
|
1066
859
|
},
|
|
1067
860
|
{
|
|
1068
861
|
provide: 'CouponRepository',
|
|
1069
|
-
useFactory: (
|
|
1070
|
-
return new CouponFirestoreRepository(
|
|
862
|
+
useFactory: (firestore) => {
|
|
863
|
+
return new CouponFirestoreRepository(firestore);
|
|
1071
864
|
},
|
|
1072
|
-
deps: [
|
|
1073
|
-
},
|
|
1074
|
-
{
|
|
1075
|
-
provide: 'CampaignHashtagRepository',
|
|
1076
|
-
useFactory: (options) => {
|
|
1077
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
1078
|
-
},
|
|
1079
|
-
deps: ['FirestoreOptions'],
|
|
1080
|
-
},
|
|
1081
|
-
{
|
|
1082
|
-
provide: 'CampaignDashboardRepository',
|
|
1083
|
-
useFactory: (options) => {
|
|
1084
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
1085
|
-
},
|
|
1086
|
-
deps: ['FirestoreOptions'],
|
|
865
|
+
deps: [Firestore],
|
|
1087
866
|
},
|
|
1088
867
|
{
|
|
1089
868
|
provide: 'EditionRepository',
|
|
1090
|
-
useFactory: (
|
|
1091
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
869
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
870
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1092
871
|
},
|
|
1093
|
-
deps: [
|
|
872
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1094
873
|
},
|
|
1095
874
|
{
|
|
1096
875
|
provide: 'HomeRepository',
|
|
1097
|
-
useFactory: (
|
|
1098
|
-
return new HomeFirestoreRepository(
|
|
876
|
+
useFactory: (firestore) => {
|
|
877
|
+
return new HomeFirestoreRepository(firestore);
|
|
1099
878
|
},
|
|
1100
|
-
deps: [
|
|
879
|
+
deps: [Firestore],
|
|
1101
880
|
},
|
|
1102
881
|
{
|
|
1103
882
|
provide: 'LeadRepository',
|
|
1104
|
-
useFactory: (
|
|
1105
|
-
return new LeadFirestoreRepository(
|
|
883
|
+
useFactory: (firestore) => {
|
|
884
|
+
return new LeadFirestoreRepository(firestore);
|
|
1106
885
|
},
|
|
1107
|
-
deps: [
|
|
886
|
+
deps: [Firestore],
|
|
1108
887
|
},
|
|
1109
888
|
{
|
|
1110
889
|
provide: 'LegacyOrderRepository',
|
|
1111
|
-
useFactory: (
|
|
1112
|
-
return new LegacyOrderFirestoreRepository(
|
|
890
|
+
useFactory: (firestore) => {
|
|
891
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1113
892
|
},
|
|
1114
|
-
deps: [
|
|
893
|
+
deps: [Firestore],
|
|
1115
894
|
},
|
|
1116
895
|
{
|
|
1117
896
|
provide: 'ShopMenuRepository',
|
|
1118
|
-
useFactory: (
|
|
1119
|
-
return new ShopMenuFirestoreRepository(
|
|
897
|
+
useFactory: (firestore) => {
|
|
898
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1120
899
|
},
|
|
1121
|
-
deps: [
|
|
900
|
+
deps: [Firestore],
|
|
1122
901
|
},
|
|
1123
902
|
{
|
|
1124
903
|
provide: 'OrderRepository',
|
|
1125
|
-
useFactory: (
|
|
1126
|
-
return new OrderFirestoreRepository(
|
|
904
|
+
useFactory: (firestore) => {
|
|
905
|
+
return new OrderFirestoreRepository(firestore);
|
|
1127
906
|
},
|
|
1128
|
-
deps: [
|
|
907
|
+
deps: [Firestore],
|
|
1129
908
|
},
|
|
1130
909
|
{
|
|
1131
910
|
provide: 'PaymentRepository',
|
|
1132
|
-
useFactory: (
|
|
1133
|
-
return new PaymentFirestoreRepository(
|
|
911
|
+
useFactory: (firestore) => {
|
|
912
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1134
913
|
},
|
|
1135
|
-
deps: [
|
|
914
|
+
deps: [Firestore],
|
|
1136
915
|
},
|
|
1137
916
|
{
|
|
1138
917
|
provide: ProductFirestoreRepository,
|
|
1139
|
-
useFactory: (
|
|
1140
|
-
return new ProductFirestoreRepository(
|
|
1141
|
-
},
|
|
1142
|
-
deps: ['FirestoreOptions'],
|
|
1143
|
-
},
|
|
1144
|
-
{
|
|
1145
|
-
provide: 'ShopSettingsRepository',
|
|
1146
|
-
useFactory: (options) => {
|
|
1147
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
918
|
+
useFactory: (firestore) => {
|
|
919
|
+
return new ProductFirestoreRepository(firestore);
|
|
1148
920
|
},
|
|
1149
|
-
deps: [
|
|
921
|
+
deps: [Firestore],
|
|
1150
922
|
},
|
|
1151
923
|
{
|
|
1152
924
|
provide: 'SubscriptionPaymentRepository',
|
|
1153
|
-
useFactory: (
|
|
1154
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
925
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
926
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1155
927
|
},
|
|
1156
|
-
deps: [
|
|
928
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1157
929
|
},
|
|
1158
930
|
{
|
|
1159
931
|
provide: 'SubscriptionPlanRepository',
|
|
1160
|
-
useFactory: (
|
|
1161
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
932
|
+
useFactory: (firestore) => {
|
|
933
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1162
934
|
},
|
|
1163
|
-
deps: [
|
|
935
|
+
deps: [Firestore],
|
|
1164
936
|
},
|
|
1165
937
|
{
|
|
1166
938
|
provide: 'SubscriptionProductRepository',
|
|
1167
|
-
useFactory: (
|
|
1168
|
-
return new SubscriptionProductFirestoreRepository(
|
|
939
|
+
useFactory: (firestore) => {
|
|
940
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1169
941
|
},
|
|
1170
|
-
deps: [
|
|
942
|
+
deps: [Firestore],
|
|
1171
943
|
},
|
|
1172
944
|
{
|
|
1173
945
|
provide: 'SubscriptionRepository',
|
|
1174
|
-
useFactory: (
|
|
1175
|
-
return new SubscriptionFirestoreRepository(
|
|
946
|
+
useFactory: (firestore) => {
|
|
947
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1176
948
|
},
|
|
1177
|
-
deps: [
|
|
949
|
+
deps: [Firestore],
|
|
1178
950
|
},
|
|
1179
951
|
{
|
|
1180
952
|
provide: 'UserRepository',
|
|
1181
|
-
useFactory: (
|
|
1182
|
-
return new UserFirestoreRepository(
|
|
953
|
+
useFactory: (firestore) => {
|
|
954
|
+
return new UserFirestoreRepository(firestore);
|
|
1183
955
|
},
|
|
1184
|
-
deps: [
|
|
956
|
+
deps: [Firestore],
|
|
1185
957
|
},
|
|
1186
958
|
{
|
|
1187
959
|
provide: 'UserAddressRepository',
|
|
1188
|
-
useFactory: (
|
|
1189
|
-
return new UserAddressFirestoreRepository(
|
|
960
|
+
useFactory: (firestore, userRepository) => {
|
|
961
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1190
962
|
},
|
|
1191
|
-
deps: [
|
|
963
|
+
deps: [Firestore, 'UserRepository'],
|
|
1192
964
|
},
|
|
1193
965
|
{
|
|
1194
966
|
provide: 'UserPaymentMethodRepository',
|
|
1195
|
-
useFactory: (
|
|
1196
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
967
|
+
useFactory: (firestore, userRepository) => {
|
|
968
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1197
969
|
},
|
|
1198
|
-
deps: [
|
|
970
|
+
deps: [Firestore, 'UserRepository'],
|
|
1199
971
|
},
|
|
1200
972
|
{
|
|
1201
973
|
provide: ProductVariantFirestoreRepository,
|
|
1202
|
-
useFactory: (
|
|
1203
|
-
return new ProductVariantFirestoreRepository(
|
|
974
|
+
useFactory: (firestore, productRepository) => {
|
|
975
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1204
976
|
},
|
|
1205
|
-
deps: [
|
|
977
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1206
978
|
},
|
|
1207
979
|
], imports: [AngularElasticSeachModule,
|
|
1208
980
|
provideFirebaseApp((injector) => {
|
|
1209
981
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1210
982
|
return appName
|
|
1211
|
-
? initializeApp
|
|
1212
|
-
: initializeApp
|
|
983
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
984
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1213
985
|
}),
|
|
1214
986
|
provideFirestore(() => getFirestore())] });
|
|
1215
987
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
@@ -1220,208 +992,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1220
992
|
provideFirebaseApp((injector) => {
|
|
1221
993
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1222
994
|
return appName
|
|
1223
|
-
? initializeApp
|
|
1224
|
-
: initializeApp
|
|
995
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
996
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1225
997
|
}),
|
|
1226
998
|
provideFirestore(() => getFirestore()),
|
|
1227
999
|
],
|
|
1228
1000
|
providers: [
|
|
1229
|
-
{
|
|
1230
|
-
provide: 'FirestoreOptions',
|
|
1231
|
-
useFactory: (firestore, platformId) => ({
|
|
1232
|
-
firestore,
|
|
1233
|
-
interceptors: {
|
|
1234
|
-
request: (request) => {
|
|
1235
|
-
if (isPlatformBrowser(platformId))
|
|
1236
|
-
return request;
|
|
1237
|
-
const interval = setInterval(() => { }, 100);
|
|
1238
|
-
request.interval = interval;
|
|
1239
|
-
return request;
|
|
1240
|
-
},
|
|
1241
|
-
response: (response, request) => {
|
|
1242
|
-
if (isPlatformBrowser(platformId))
|
|
1243
|
-
return response;
|
|
1244
|
-
clearInterval(request.interval);
|
|
1245
|
-
return response;
|
|
1246
|
-
},
|
|
1247
|
-
},
|
|
1248
|
-
}),
|
|
1249
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1250
|
-
},
|
|
1251
1001
|
{
|
|
1252
1002
|
provide: 'BeautyProfileRepository',
|
|
1253
|
-
useFactory: (
|
|
1254
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
1003
|
+
useFactory: (firestore, userRepository) => {
|
|
1004
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1255
1005
|
},
|
|
1256
|
-
deps: [
|
|
1006
|
+
deps: [Firestore, 'UserRepository'],
|
|
1257
1007
|
},
|
|
1258
1008
|
{
|
|
1259
1009
|
provide: 'Buy2WinRepository',
|
|
1260
|
-
useFactory: (
|
|
1261
|
-
return new Buy2WinFirestoreRepository(
|
|
1010
|
+
useFactory: (firestore) => {
|
|
1011
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1262
1012
|
},
|
|
1263
|
-
deps: [
|
|
1013
|
+
deps: [Firestore],
|
|
1264
1014
|
},
|
|
1265
1015
|
{
|
|
1266
1016
|
provide: CategoryFirestoreRepository,
|
|
1267
|
-
useFactory: (
|
|
1268
|
-
return new CategoryFirestoreRepository(
|
|
1017
|
+
useFactory: (firestore) => {
|
|
1018
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1269
1019
|
},
|
|
1270
|
-
deps: [
|
|
1020
|
+
deps: [Firestore],
|
|
1271
1021
|
},
|
|
1272
1022
|
{
|
|
1273
1023
|
provide: 'CheckoutRepository',
|
|
1274
|
-
useFactory: (
|
|
1275
|
-
return new CheckoutFirestoreRepository(
|
|
1024
|
+
useFactory: (firestore) => {
|
|
1025
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1276
1026
|
},
|
|
1277
|
-
deps: [
|
|
1027
|
+
deps: [Firestore],
|
|
1278
1028
|
},
|
|
1279
1029
|
{
|
|
1280
1030
|
provide: 'CheckoutSubscriptionRepository',
|
|
1281
|
-
useFactory: (
|
|
1282
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
1031
|
+
useFactory: (firestore) => {
|
|
1032
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1283
1033
|
},
|
|
1284
|
-
deps: [
|
|
1034
|
+
deps: [Firestore],
|
|
1285
1035
|
},
|
|
1286
1036
|
{
|
|
1287
1037
|
provide: 'CouponRepository',
|
|
1288
|
-
useFactory: (
|
|
1289
|
-
return new CouponFirestoreRepository(
|
|
1290
|
-
},
|
|
1291
|
-
deps: ['FirestoreOptions'],
|
|
1292
|
-
},
|
|
1293
|
-
{
|
|
1294
|
-
provide: 'CampaignHashtagRepository',
|
|
1295
|
-
useFactory: (options) => {
|
|
1296
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
1297
|
-
},
|
|
1298
|
-
deps: ['FirestoreOptions'],
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
provide: 'CampaignDashboardRepository',
|
|
1302
|
-
useFactory: (options) => {
|
|
1303
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
1038
|
+
useFactory: (firestore) => {
|
|
1039
|
+
return new CouponFirestoreRepository(firestore);
|
|
1304
1040
|
},
|
|
1305
|
-
deps: [
|
|
1041
|
+
deps: [Firestore],
|
|
1306
1042
|
},
|
|
1307
1043
|
{
|
|
1308
1044
|
provide: 'EditionRepository',
|
|
1309
|
-
useFactory: (
|
|
1310
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
1045
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1046
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1311
1047
|
},
|
|
1312
|
-
deps: [
|
|
1048
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1313
1049
|
},
|
|
1314
1050
|
{
|
|
1315
1051
|
provide: 'HomeRepository',
|
|
1316
|
-
useFactory: (
|
|
1317
|
-
return new HomeFirestoreRepository(
|
|
1052
|
+
useFactory: (firestore) => {
|
|
1053
|
+
return new HomeFirestoreRepository(firestore);
|
|
1318
1054
|
},
|
|
1319
|
-
deps: [
|
|
1055
|
+
deps: [Firestore],
|
|
1320
1056
|
},
|
|
1321
1057
|
{
|
|
1322
1058
|
provide: 'LeadRepository',
|
|
1323
|
-
useFactory: (
|
|
1324
|
-
return new LeadFirestoreRepository(
|
|
1059
|
+
useFactory: (firestore) => {
|
|
1060
|
+
return new LeadFirestoreRepository(firestore);
|
|
1325
1061
|
},
|
|
1326
|
-
deps: [
|
|
1062
|
+
deps: [Firestore],
|
|
1327
1063
|
},
|
|
1328
1064
|
{
|
|
1329
1065
|
provide: 'LegacyOrderRepository',
|
|
1330
|
-
useFactory: (
|
|
1331
|
-
return new LegacyOrderFirestoreRepository(
|
|
1066
|
+
useFactory: (firestore) => {
|
|
1067
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1332
1068
|
},
|
|
1333
|
-
deps: [
|
|
1069
|
+
deps: [Firestore],
|
|
1334
1070
|
},
|
|
1335
1071
|
{
|
|
1336
1072
|
provide: 'ShopMenuRepository',
|
|
1337
|
-
useFactory: (
|
|
1338
|
-
return new ShopMenuFirestoreRepository(
|
|
1073
|
+
useFactory: (firestore) => {
|
|
1074
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1339
1075
|
},
|
|
1340
|
-
deps: [
|
|
1076
|
+
deps: [Firestore],
|
|
1341
1077
|
},
|
|
1342
1078
|
{
|
|
1343
1079
|
provide: 'OrderRepository',
|
|
1344
|
-
useFactory: (
|
|
1345
|
-
return new OrderFirestoreRepository(
|
|
1080
|
+
useFactory: (firestore) => {
|
|
1081
|
+
return new OrderFirestoreRepository(firestore);
|
|
1346
1082
|
},
|
|
1347
|
-
deps: [
|
|
1083
|
+
deps: [Firestore],
|
|
1348
1084
|
},
|
|
1349
1085
|
{
|
|
1350
1086
|
provide: 'PaymentRepository',
|
|
1351
|
-
useFactory: (
|
|
1352
|
-
return new PaymentFirestoreRepository(
|
|
1087
|
+
useFactory: (firestore) => {
|
|
1088
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1353
1089
|
},
|
|
1354
|
-
deps: [
|
|
1090
|
+
deps: [Firestore],
|
|
1355
1091
|
},
|
|
1356
1092
|
{
|
|
1357
1093
|
provide: ProductFirestoreRepository,
|
|
1358
|
-
useFactory: (
|
|
1359
|
-
return new ProductFirestoreRepository(
|
|
1360
|
-
},
|
|
1361
|
-
deps: ['FirestoreOptions'],
|
|
1362
|
-
},
|
|
1363
|
-
{
|
|
1364
|
-
provide: 'ShopSettingsRepository',
|
|
1365
|
-
useFactory: (options) => {
|
|
1366
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
1094
|
+
useFactory: (firestore) => {
|
|
1095
|
+
return new ProductFirestoreRepository(firestore);
|
|
1367
1096
|
},
|
|
1368
|
-
deps: [
|
|
1097
|
+
deps: [Firestore],
|
|
1369
1098
|
},
|
|
1370
1099
|
{
|
|
1371
1100
|
provide: 'SubscriptionPaymentRepository',
|
|
1372
|
-
useFactory: (
|
|
1373
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
1101
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1102
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1374
1103
|
},
|
|
1375
|
-
deps: [
|
|
1104
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1376
1105
|
},
|
|
1377
1106
|
{
|
|
1378
1107
|
provide: 'SubscriptionPlanRepository',
|
|
1379
|
-
useFactory: (
|
|
1380
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
1108
|
+
useFactory: (firestore) => {
|
|
1109
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1381
1110
|
},
|
|
1382
|
-
deps: [
|
|
1111
|
+
deps: [Firestore],
|
|
1383
1112
|
},
|
|
1384
1113
|
{
|
|
1385
1114
|
provide: 'SubscriptionProductRepository',
|
|
1386
|
-
useFactory: (
|
|
1387
|
-
return new SubscriptionProductFirestoreRepository(
|
|
1115
|
+
useFactory: (firestore) => {
|
|
1116
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1388
1117
|
},
|
|
1389
|
-
deps: [
|
|
1118
|
+
deps: [Firestore],
|
|
1390
1119
|
},
|
|
1391
1120
|
{
|
|
1392
1121
|
provide: 'SubscriptionRepository',
|
|
1393
|
-
useFactory: (
|
|
1394
|
-
return new SubscriptionFirestoreRepository(
|
|
1122
|
+
useFactory: (firestore) => {
|
|
1123
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1395
1124
|
},
|
|
1396
|
-
deps: [
|
|
1125
|
+
deps: [Firestore],
|
|
1397
1126
|
},
|
|
1398
1127
|
{
|
|
1399
1128
|
provide: 'UserRepository',
|
|
1400
|
-
useFactory: (
|
|
1401
|
-
return new UserFirestoreRepository(
|
|
1129
|
+
useFactory: (firestore) => {
|
|
1130
|
+
return new UserFirestoreRepository(firestore);
|
|
1402
1131
|
},
|
|
1403
|
-
deps: [
|
|
1132
|
+
deps: [Firestore],
|
|
1404
1133
|
},
|
|
1405
1134
|
{
|
|
1406
1135
|
provide: 'UserAddressRepository',
|
|
1407
|
-
useFactory: (
|
|
1408
|
-
return new UserAddressFirestoreRepository(
|
|
1136
|
+
useFactory: (firestore, userRepository) => {
|
|
1137
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1409
1138
|
},
|
|
1410
|
-
deps: [
|
|
1139
|
+
deps: [Firestore, 'UserRepository'],
|
|
1411
1140
|
},
|
|
1412
1141
|
{
|
|
1413
1142
|
provide: 'UserPaymentMethodRepository',
|
|
1414
|
-
useFactory: (
|
|
1415
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
1143
|
+
useFactory: (firestore, userRepository) => {
|
|
1144
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1416
1145
|
},
|
|
1417
|
-
deps: [
|
|
1146
|
+
deps: [Firestore, 'UserRepository'],
|
|
1418
1147
|
},
|
|
1419
1148
|
{
|
|
1420
1149
|
provide: ProductVariantFirestoreRepository,
|
|
1421
|
-
useFactory: (
|
|
1422
|
-
return new ProductVariantFirestoreRepository(
|
|
1150
|
+
useFactory: (firestore, productRepository) => {
|
|
1151
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1423
1152
|
},
|
|
1424
|
-
deps: [
|
|
1153
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1425
1154
|
},
|
|
1426
1155
|
],
|
|
1427
1156
|
}]
|
|
@@ -1440,23 +1169,13 @@ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.
|
|
|
1440
1169
|
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
1441
1170
|
{
|
|
1442
1171
|
provide: 'HasuraConfig',
|
|
1443
|
-
useFactory: (options
|
|
1172
|
+
useFactory: (options) => ({
|
|
1444
1173
|
endpoint: options.endpoint,
|
|
1445
1174
|
authOptions: options.credentials,
|
|
1446
1175
|
interceptors: {
|
|
1447
1176
|
request: (request) => {
|
|
1448
|
-
if (isPlatformBrowser(platformId))
|
|
1449
|
-
return request;
|
|
1450
|
-
const interval = setInterval(() => { }, 100);
|
|
1451
|
-
request.interval = interval;
|
|
1452
1177
|
return request;
|
|
1453
1178
|
},
|
|
1454
|
-
response: (response, request) => {
|
|
1455
|
-
if (isPlatformBrowser(platformId))
|
|
1456
|
-
return response;
|
|
1457
|
-
clearInterval(request.interval);
|
|
1458
|
-
return response;
|
|
1459
|
-
},
|
|
1460
1179
|
},
|
|
1461
1180
|
}),
|
|
1462
1181
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1467,10 +1186,11 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1467
1186
|
},
|
|
1468
1187
|
{
|
|
1469
1188
|
provide: CategoryHasuraGraphQLRepository,
|
|
1470
|
-
useFactory: (options, productRepository,
|
|
1471
|
-
|
|
1189
|
+
useFactory: (options, productRepository, eta) => {
|
|
1190
|
+
console.log(eta);
|
|
1191
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1472
1192
|
},
|
|
1473
|
-
deps: [
|
|
1193
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1474
1194
|
},
|
|
1475
1195
|
{
|
|
1476
1196
|
provide: 'ProductRepository',
|
|
@@ -1478,10 +1198,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1478
1198
|
},
|
|
1479
1199
|
{
|
|
1480
1200
|
provide: ProductHasuraGraphQLRepository,
|
|
1481
|
-
useFactory: (
|
|
1482
|
-
return new ProductHasuraGraphQLRepository(
|
|
1201
|
+
useFactory: (options) => {
|
|
1202
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1483
1203
|
},
|
|
1484
|
-
deps: [
|
|
1204
|
+
deps: [HASURA_OPTIONS],
|
|
1485
1205
|
},
|
|
1486
1206
|
{
|
|
1487
1207
|
provide: 'VariantRepository',
|
|
@@ -1489,43 +1209,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1489
1209
|
},
|
|
1490
1210
|
{
|
|
1491
1211
|
provide: VariantHasuraGraphQLRepository,
|
|
1492
|
-
useFactory: (hasuraConfig) => {
|
|
1493
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1494
|
-
},
|
|
1495
|
-
deps: ['HasuraConfig'],
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
provide: 'CategoryFilterRepository',
|
|
1499
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1500
|
-
},
|
|
1501
|
-
{
|
|
1502
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1503
|
-
useFactory: (options) => {
|
|
1504
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
1505
|
-
},
|
|
1506
|
-
deps: ['HasuraConfig'],
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
provide: 'FilterOptionRepository',
|
|
1510
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1514
1212
|
useFactory: (options) => {
|
|
1515
|
-
return new
|
|
1516
|
-
},
|
|
1517
|
-
deps: ['HasuraConfig'],
|
|
1518
|
-
},
|
|
1519
|
-
{
|
|
1520
|
-
provide: 'FilterRepository',
|
|
1521
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1522
|
-
},
|
|
1523
|
-
{
|
|
1524
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1525
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1526
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1213
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1527
1214
|
},
|
|
1528
|
-
deps: [
|
|
1215
|
+
deps: [HASURA_OPTIONS],
|
|
1529
1216
|
},
|
|
1530
1217
|
] });
|
|
1531
1218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
@@ -1534,23 +1221,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1534
1221
|
providers: [
|
|
1535
1222
|
{
|
|
1536
1223
|
provide: 'HasuraConfig',
|
|
1537
|
-
useFactory: (options
|
|
1224
|
+
useFactory: (options) => ({
|
|
1538
1225
|
endpoint: options.endpoint,
|
|
1539
1226
|
authOptions: options.credentials,
|
|
1540
1227
|
interceptors: {
|
|
1541
1228
|
request: (request) => {
|
|
1542
|
-
if (isPlatformBrowser(platformId))
|
|
1543
|
-
return request;
|
|
1544
|
-
const interval = setInterval(() => { }, 100);
|
|
1545
|
-
request.interval = interval;
|
|
1546
1229
|
return request;
|
|
1547
1230
|
},
|
|
1548
|
-
response: (response, request) => {
|
|
1549
|
-
if (isPlatformBrowser(platformId))
|
|
1550
|
-
return response;
|
|
1551
|
-
clearInterval(request.interval);
|
|
1552
|
-
return response;
|
|
1553
|
-
},
|
|
1554
1231
|
},
|
|
1555
1232
|
}),
|
|
1556
1233
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1561,10 +1238,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1561
1238
|
},
|
|
1562
1239
|
{
|
|
1563
1240
|
provide: CategoryHasuraGraphQLRepository,
|
|
1564
|
-
useFactory: (options, productRepository,
|
|
1565
|
-
|
|
1241
|
+
useFactory: (options, productRepository, eta) => {
|
|
1242
|
+
console.log(eta);
|
|
1243
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1566
1244
|
},
|
|
1567
|
-
deps: [
|
|
1245
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1568
1246
|
},
|
|
1569
1247
|
{
|
|
1570
1248
|
provide: 'ProductRepository',
|
|
@@ -1572,10 +1250,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1572
1250
|
},
|
|
1573
1251
|
{
|
|
1574
1252
|
provide: ProductHasuraGraphQLRepository,
|
|
1575
|
-
useFactory: (
|
|
1576
|
-
return new ProductHasuraGraphQLRepository(
|
|
1253
|
+
useFactory: (options) => {
|
|
1254
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1577
1255
|
},
|
|
1578
|
-
deps: [
|
|
1256
|
+
deps: [HASURA_OPTIONS],
|
|
1579
1257
|
},
|
|
1580
1258
|
{
|
|
1581
1259
|
provide: 'VariantRepository',
|
|
@@ -1583,43 +1261,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1583
1261
|
},
|
|
1584
1262
|
{
|
|
1585
1263
|
provide: VariantHasuraGraphQLRepository,
|
|
1586
|
-
useFactory: (hasuraConfig) => {
|
|
1587
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1588
|
-
},
|
|
1589
|
-
deps: ['HasuraConfig'],
|
|
1590
|
-
},
|
|
1591
|
-
{
|
|
1592
|
-
provide: 'CategoryFilterRepository',
|
|
1593
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1597
1264
|
useFactory: (options) => {
|
|
1598
|
-
return new
|
|
1599
|
-
},
|
|
1600
|
-
deps: ['HasuraConfig'],
|
|
1601
|
-
},
|
|
1602
|
-
{
|
|
1603
|
-
provide: 'FilterOptionRepository',
|
|
1604
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1605
|
-
},
|
|
1606
|
-
{
|
|
1607
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1608
|
-
useFactory: (options) => {
|
|
1609
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
1610
|
-
},
|
|
1611
|
-
deps: ['HasuraConfig'],
|
|
1612
|
-
},
|
|
1613
|
-
{
|
|
1614
|
-
provide: 'FilterRepository',
|
|
1615
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1616
|
-
},
|
|
1617
|
-
{
|
|
1618
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1619
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1620
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1265
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1621
1266
|
},
|
|
1622
|
-
deps: [
|
|
1267
|
+
deps: [HASURA_OPTIONS],
|
|
1623
1268
|
},
|
|
1624
1269
|
],
|
|
1625
1270
|
}]
|
|
@@ -1635,7 +1280,6 @@ class AngularConnectModule {
|
|
|
1635
1280
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1636
1281
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1637
1282
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
1638
|
-
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
1639
1283
|
],
|
|
1640
1284
|
};
|
|
1641
1285
|
}
|
|
@@ -1650,7 +1294,6 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
1650
1294
|
CouponService,
|
|
1651
1295
|
HomeShopService,
|
|
1652
1296
|
OrderService,
|
|
1653
|
-
ShippingService,
|
|
1654
1297
|
], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
1655
1298
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1656
1299
|
type: NgModule,
|
|
@@ -1664,7 +1307,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1664
1307
|
CouponService,
|
|
1665
1308
|
HomeShopService,
|
|
1666
1309
|
OrderService,
|
|
1667
|
-
ShippingService,
|
|
1668
1310
|
],
|
|
1669
1311
|
}]
|
|
1670
1312
|
}] });
|
|
@@ -1673,5 +1315,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1673
1315
|
* Generated bundle index. Do not edit.
|
|
1674
1316
|
*/
|
|
1675
1317
|
|
|
1676
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService
|
|
1318
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
1677
1319
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|