@infrab4a/connect-angular 4.0.0-beta.18 → 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 -221
- 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 -604
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +244 -598
- 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 { initializeApp as initializeApp$1 } from 'firebase/app';
|
|
17
|
-
import { getFirestore } from 'firebase/firestore';
|
|
18
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
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,209 +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)) return request
|
|
1017
|
-
// const interval = setInterval(() => {}, 100)
|
|
1018
|
-
// request.interval = interval
|
|
1019
|
-
return request;
|
|
1020
|
-
},
|
|
1021
|
-
response: (response, request) => {
|
|
1022
|
-
// if (isPlatformBrowser(platformId)) return response
|
|
1023
|
-
// clearInterval(request.interval)
|
|
1024
|
-
return response;
|
|
1025
|
-
},
|
|
1026
|
-
},
|
|
1027
|
-
}),
|
|
1028
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1029
|
-
},
|
|
1030
825
|
{
|
|
1031
826
|
provide: 'BeautyProfileRepository',
|
|
1032
|
-
useFactory: (
|
|
1033
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
827
|
+
useFactory: (firestore, userRepository) => {
|
|
828
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1034
829
|
},
|
|
1035
|
-
deps: [
|
|
830
|
+
deps: [Firestore, 'UserRepository'],
|
|
1036
831
|
},
|
|
1037
832
|
{
|
|
1038
833
|
provide: 'Buy2WinRepository',
|
|
1039
|
-
useFactory: (
|
|
1040
|
-
return new Buy2WinFirestoreRepository(
|
|
834
|
+
useFactory: (firestore) => {
|
|
835
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1041
836
|
},
|
|
1042
|
-
deps: [
|
|
837
|
+
deps: [Firestore],
|
|
1043
838
|
},
|
|
1044
839
|
{
|
|
1045
840
|
provide: CategoryFirestoreRepository,
|
|
1046
|
-
useFactory: (
|
|
1047
|
-
return new CategoryFirestoreRepository(
|
|
841
|
+
useFactory: (firestore) => {
|
|
842
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1048
843
|
},
|
|
1049
|
-
deps: [
|
|
844
|
+
deps: [Firestore],
|
|
1050
845
|
},
|
|
1051
846
|
{
|
|
1052
847
|
provide: 'CheckoutRepository',
|
|
1053
|
-
useFactory: (
|
|
1054
|
-
return new CheckoutFirestoreRepository(
|
|
848
|
+
useFactory: (firestore) => {
|
|
849
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1055
850
|
},
|
|
1056
|
-
deps: [
|
|
851
|
+
deps: [Firestore],
|
|
1057
852
|
},
|
|
1058
853
|
{
|
|
1059
854
|
provide: 'CheckoutSubscriptionRepository',
|
|
1060
|
-
useFactory: (
|
|
1061
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
855
|
+
useFactory: (firestore) => {
|
|
856
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1062
857
|
},
|
|
1063
|
-
deps: [
|
|
858
|
+
deps: [Firestore],
|
|
1064
859
|
},
|
|
1065
860
|
{
|
|
1066
861
|
provide: 'CouponRepository',
|
|
1067
|
-
useFactory: (
|
|
1068
|
-
return new CouponFirestoreRepository(
|
|
862
|
+
useFactory: (firestore) => {
|
|
863
|
+
return new CouponFirestoreRepository(firestore);
|
|
1069
864
|
},
|
|
1070
|
-
deps: [
|
|
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'],
|
|
865
|
+
deps: [Firestore],
|
|
1085
866
|
},
|
|
1086
867
|
{
|
|
1087
868
|
provide: 'EditionRepository',
|
|
1088
|
-
useFactory: (
|
|
1089
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
869
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
870
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1090
871
|
},
|
|
1091
|
-
deps: [
|
|
872
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1092
873
|
},
|
|
1093
874
|
{
|
|
1094
875
|
provide: 'HomeRepository',
|
|
1095
|
-
useFactory: (
|
|
1096
|
-
return new HomeFirestoreRepository(
|
|
876
|
+
useFactory: (firestore) => {
|
|
877
|
+
return new HomeFirestoreRepository(firestore);
|
|
1097
878
|
},
|
|
1098
|
-
deps: [
|
|
879
|
+
deps: [Firestore],
|
|
1099
880
|
},
|
|
1100
881
|
{
|
|
1101
882
|
provide: 'LeadRepository',
|
|
1102
|
-
useFactory: (
|
|
1103
|
-
return new LeadFirestoreRepository(
|
|
883
|
+
useFactory: (firestore) => {
|
|
884
|
+
return new LeadFirestoreRepository(firestore);
|
|
1104
885
|
},
|
|
1105
|
-
deps: [
|
|
886
|
+
deps: [Firestore],
|
|
1106
887
|
},
|
|
1107
888
|
{
|
|
1108
889
|
provide: 'LegacyOrderRepository',
|
|
1109
|
-
useFactory: (
|
|
1110
|
-
return new LegacyOrderFirestoreRepository(
|
|
890
|
+
useFactory: (firestore) => {
|
|
891
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1111
892
|
},
|
|
1112
|
-
deps: [
|
|
893
|
+
deps: [Firestore],
|
|
1113
894
|
},
|
|
1114
895
|
{
|
|
1115
896
|
provide: 'ShopMenuRepository',
|
|
1116
|
-
useFactory: (
|
|
1117
|
-
return new ShopMenuFirestoreRepository(
|
|
897
|
+
useFactory: (firestore) => {
|
|
898
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1118
899
|
},
|
|
1119
|
-
deps: [
|
|
900
|
+
deps: [Firestore],
|
|
1120
901
|
},
|
|
1121
902
|
{
|
|
1122
903
|
provide: 'OrderRepository',
|
|
1123
|
-
useFactory: (
|
|
1124
|
-
return new OrderFirestoreRepository(
|
|
904
|
+
useFactory: (firestore) => {
|
|
905
|
+
return new OrderFirestoreRepository(firestore);
|
|
1125
906
|
},
|
|
1126
|
-
deps: [
|
|
907
|
+
deps: [Firestore],
|
|
1127
908
|
},
|
|
1128
909
|
{
|
|
1129
910
|
provide: 'PaymentRepository',
|
|
1130
|
-
useFactory: (
|
|
1131
|
-
return new PaymentFirestoreRepository(
|
|
911
|
+
useFactory: (firestore) => {
|
|
912
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1132
913
|
},
|
|
1133
|
-
deps: [
|
|
914
|
+
deps: [Firestore],
|
|
1134
915
|
},
|
|
1135
916
|
{
|
|
1136
917
|
provide: ProductFirestoreRepository,
|
|
1137
|
-
useFactory: (
|
|
1138
|
-
return new ProductFirestoreRepository(
|
|
1139
|
-
},
|
|
1140
|
-
deps: ['FirestoreOptions'],
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
provide: 'ShopSettingsRepository',
|
|
1144
|
-
useFactory: (options) => {
|
|
1145
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
918
|
+
useFactory: (firestore) => {
|
|
919
|
+
return new ProductFirestoreRepository(firestore);
|
|
1146
920
|
},
|
|
1147
|
-
deps: [
|
|
921
|
+
deps: [Firestore],
|
|
1148
922
|
},
|
|
1149
923
|
{
|
|
1150
924
|
provide: 'SubscriptionPaymentRepository',
|
|
1151
|
-
useFactory: (
|
|
1152
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
925
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
926
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1153
927
|
},
|
|
1154
|
-
deps: [
|
|
928
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1155
929
|
},
|
|
1156
930
|
{
|
|
1157
931
|
provide: 'SubscriptionPlanRepository',
|
|
1158
|
-
useFactory: (
|
|
1159
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
932
|
+
useFactory: (firestore) => {
|
|
933
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1160
934
|
},
|
|
1161
|
-
deps: [
|
|
935
|
+
deps: [Firestore],
|
|
1162
936
|
},
|
|
1163
937
|
{
|
|
1164
938
|
provide: 'SubscriptionProductRepository',
|
|
1165
|
-
useFactory: (
|
|
1166
|
-
return new SubscriptionProductFirestoreRepository(
|
|
939
|
+
useFactory: (firestore) => {
|
|
940
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1167
941
|
},
|
|
1168
|
-
deps: [
|
|
942
|
+
deps: [Firestore],
|
|
1169
943
|
},
|
|
1170
944
|
{
|
|
1171
945
|
provide: 'SubscriptionRepository',
|
|
1172
|
-
useFactory: (
|
|
1173
|
-
return new SubscriptionFirestoreRepository(
|
|
946
|
+
useFactory: (firestore) => {
|
|
947
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1174
948
|
},
|
|
1175
|
-
deps: [
|
|
949
|
+
deps: [Firestore],
|
|
1176
950
|
},
|
|
1177
951
|
{
|
|
1178
952
|
provide: 'UserRepository',
|
|
1179
|
-
useFactory: (
|
|
1180
|
-
return new UserFirestoreRepository(
|
|
953
|
+
useFactory: (firestore) => {
|
|
954
|
+
return new UserFirestoreRepository(firestore);
|
|
1181
955
|
},
|
|
1182
|
-
deps: [
|
|
956
|
+
deps: [Firestore],
|
|
1183
957
|
},
|
|
1184
958
|
{
|
|
1185
959
|
provide: 'UserAddressRepository',
|
|
1186
|
-
useFactory: (
|
|
1187
|
-
return new UserAddressFirestoreRepository(
|
|
960
|
+
useFactory: (firestore, userRepository) => {
|
|
961
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1188
962
|
},
|
|
1189
|
-
deps: [
|
|
963
|
+
deps: [Firestore, 'UserRepository'],
|
|
1190
964
|
},
|
|
1191
965
|
{
|
|
1192
966
|
provide: 'UserPaymentMethodRepository',
|
|
1193
|
-
useFactory: (
|
|
1194
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
967
|
+
useFactory: (firestore, userRepository) => {
|
|
968
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1195
969
|
},
|
|
1196
|
-
deps: [
|
|
970
|
+
deps: [Firestore, 'UserRepository'],
|
|
1197
971
|
},
|
|
1198
972
|
{
|
|
1199
973
|
provide: ProductVariantFirestoreRepository,
|
|
1200
|
-
useFactory: (
|
|
1201
|
-
return new ProductVariantFirestoreRepository(
|
|
974
|
+
useFactory: (firestore, productRepository) => {
|
|
975
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1202
976
|
},
|
|
1203
|
-
deps: [
|
|
977
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1204
978
|
},
|
|
1205
979
|
], imports: [AngularElasticSeachModule,
|
|
1206
980
|
provideFirebaseApp((injector) => {
|
|
1207
981
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1208
982
|
return appName
|
|
1209
|
-
? initializeApp
|
|
1210
|
-
: initializeApp
|
|
983
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
984
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1211
985
|
}),
|
|
1212
986
|
provideFirestore(() => getFirestore())] });
|
|
1213
987
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
@@ -1218,206 +992,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1218
992
|
provideFirebaseApp((injector) => {
|
|
1219
993
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1220
994
|
return appName
|
|
1221
|
-
? initializeApp
|
|
1222
|
-
: initializeApp
|
|
995
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
996
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1223
997
|
}),
|
|
1224
998
|
provideFirestore(() => getFirestore()),
|
|
1225
999
|
],
|
|
1226
1000
|
providers: [
|
|
1227
|
-
{
|
|
1228
|
-
provide: 'FirestoreOptions',
|
|
1229
|
-
useFactory: (firestore, platformId) => ({
|
|
1230
|
-
firestore,
|
|
1231
|
-
interceptors: {
|
|
1232
|
-
request: (request) => {
|
|
1233
|
-
// if (isPlatformBrowser(platformId)) return request
|
|
1234
|
-
// const interval = setInterval(() => {}, 100)
|
|
1235
|
-
// request.interval = interval
|
|
1236
|
-
return request;
|
|
1237
|
-
},
|
|
1238
|
-
response: (response, request) => {
|
|
1239
|
-
// if (isPlatformBrowser(platformId)) return response
|
|
1240
|
-
// clearInterval(request.interval)
|
|
1241
|
-
return response;
|
|
1242
|
-
},
|
|
1243
|
-
},
|
|
1244
|
-
}),
|
|
1245
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1246
|
-
},
|
|
1247
1001
|
{
|
|
1248
1002
|
provide: 'BeautyProfileRepository',
|
|
1249
|
-
useFactory: (
|
|
1250
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
1003
|
+
useFactory: (firestore, userRepository) => {
|
|
1004
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1251
1005
|
},
|
|
1252
|
-
deps: [
|
|
1006
|
+
deps: [Firestore, 'UserRepository'],
|
|
1253
1007
|
},
|
|
1254
1008
|
{
|
|
1255
1009
|
provide: 'Buy2WinRepository',
|
|
1256
|
-
useFactory: (
|
|
1257
|
-
return new Buy2WinFirestoreRepository(
|
|
1010
|
+
useFactory: (firestore) => {
|
|
1011
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1258
1012
|
},
|
|
1259
|
-
deps: [
|
|
1013
|
+
deps: [Firestore],
|
|
1260
1014
|
},
|
|
1261
1015
|
{
|
|
1262
1016
|
provide: CategoryFirestoreRepository,
|
|
1263
|
-
useFactory: (
|
|
1264
|
-
return new CategoryFirestoreRepository(
|
|
1017
|
+
useFactory: (firestore) => {
|
|
1018
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1265
1019
|
},
|
|
1266
|
-
deps: [
|
|
1020
|
+
deps: [Firestore],
|
|
1267
1021
|
},
|
|
1268
1022
|
{
|
|
1269
1023
|
provide: 'CheckoutRepository',
|
|
1270
|
-
useFactory: (
|
|
1271
|
-
return new CheckoutFirestoreRepository(
|
|
1024
|
+
useFactory: (firestore) => {
|
|
1025
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1272
1026
|
},
|
|
1273
|
-
deps: [
|
|
1027
|
+
deps: [Firestore],
|
|
1274
1028
|
},
|
|
1275
1029
|
{
|
|
1276
1030
|
provide: 'CheckoutSubscriptionRepository',
|
|
1277
|
-
useFactory: (
|
|
1278
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
1031
|
+
useFactory: (firestore) => {
|
|
1032
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1279
1033
|
},
|
|
1280
|
-
deps: [
|
|
1034
|
+
deps: [Firestore],
|
|
1281
1035
|
},
|
|
1282
1036
|
{
|
|
1283
1037
|
provide: 'CouponRepository',
|
|
1284
|
-
useFactory: (
|
|
1285
|
-
return new CouponFirestoreRepository(
|
|
1286
|
-
},
|
|
1287
|
-
deps: ['FirestoreOptions'],
|
|
1288
|
-
},
|
|
1289
|
-
{
|
|
1290
|
-
provide: 'CampaignHashtagRepository',
|
|
1291
|
-
useFactory: (options) => {
|
|
1292
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
1293
|
-
},
|
|
1294
|
-
deps: ['FirestoreOptions'],
|
|
1295
|
-
},
|
|
1296
|
-
{
|
|
1297
|
-
provide: 'CampaignDashboardRepository',
|
|
1298
|
-
useFactory: (options) => {
|
|
1299
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
1038
|
+
useFactory: (firestore) => {
|
|
1039
|
+
return new CouponFirestoreRepository(firestore);
|
|
1300
1040
|
},
|
|
1301
|
-
deps: [
|
|
1041
|
+
deps: [Firestore],
|
|
1302
1042
|
},
|
|
1303
1043
|
{
|
|
1304
1044
|
provide: 'EditionRepository',
|
|
1305
|
-
useFactory: (
|
|
1306
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
1045
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1046
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1307
1047
|
},
|
|
1308
|
-
deps: [
|
|
1048
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1309
1049
|
},
|
|
1310
1050
|
{
|
|
1311
1051
|
provide: 'HomeRepository',
|
|
1312
|
-
useFactory: (
|
|
1313
|
-
return new HomeFirestoreRepository(
|
|
1052
|
+
useFactory: (firestore) => {
|
|
1053
|
+
return new HomeFirestoreRepository(firestore);
|
|
1314
1054
|
},
|
|
1315
|
-
deps: [
|
|
1055
|
+
deps: [Firestore],
|
|
1316
1056
|
},
|
|
1317
1057
|
{
|
|
1318
1058
|
provide: 'LeadRepository',
|
|
1319
|
-
useFactory: (
|
|
1320
|
-
return new LeadFirestoreRepository(
|
|
1059
|
+
useFactory: (firestore) => {
|
|
1060
|
+
return new LeadFirestoreRepository(firestore);
|
|
1321
1061
|
},
|
|
1322
|
-
deps: [
|
|
1062
|
+
deps: [Firestore],
|
|
1323
1063
|
},
|
|
1324
1064
|
{
|
|
1325
1065
|
provide: 'LegacyOrderRepository',
|
|
1326
|
-
useFactory: (
|
|
1327
|
-
return new LegacyOrderFirestoreRepository(
|
|
1066
|
+
useFactory: (firestore) => {
|
|
1067
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1328
1068
|
},
|
|
1329
|
-
deps: [
|
|
1069
|
+
deps: [Firestore],
|
|
1330
1070
|
},
|
|
1331
1071
|
{
|
|
1332
1072
|
provide: 'ShopMenuRepository',
|
|
1333
|
-
useFactory: (
|
|
1334
|
-
return new ShopMenuFirestoreRepository(
|
|
1073
|
+
useFactory: (firestore) => {
|
|
1074
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1335
1075
|
},
|
|
1336
|
-
deps: [
|
|
1076
|
+
deps: [Firestore],
|
|
1337
1077
|
},
|
|
1338
1078
|
{
|
|
1339
1079
|
provide: 'OrderRepository',
|
|
1340
|
-
useFactory: (
|
|
1341
|
-
return new OrderFirestoreRepository(
|
|
1080
|
+
useFactory: (firestore) => {
|
|
1081
|
+
return new OrderFirestoreRepository(firestore);
|
|
1342
1082
|
},
|
|
1343
|
-
deps: [
|
|
1083
|
+
deps: [Firestore],
|
|
1344
1084
|
},
|
|
1345
1085
|
{
|
|
1346
1086
|
provide: 'PaymentRepository',
|
|
1347
|
-
useFactory: (
|
|
1348
|
-
return new PaymentFirestoreRepository(
|
|
1087
|
+
useFactory: (firestore) => {
|
|
1088
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1349
1089
|
},
|
|
1350
|
-
deps: [
|
|
1090
|
+
deps: [Firestore],
|
|
1351
1091
|
},
|
|
1352
1092
|
{
|
|
1353
1093
|
provide: ProductFirestoreRepository,
|
|
1354
|
-
useFactory: (
|
|
1355
|
-
return new ProductFirestoreRepository(
|
|
1356
|
-
},
|
|
1357
|
-
deps: ['FirestoreOptions'],
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
provide: 'ShopSettingsRepository',
|
|
1361
|
-
useFactory: (options) => {
|
|
1362
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
1094
|
+
useFactory: (firestore) => {
|
|
1095
|
+
return new ProductFirestoreRepository(firestore);
|
|
1363
1096
|
},
|
|
1364
|
-
deps: [
|
|
1097
|
+
deps: [Firestore],
|
|
1365
1098
|
},
|
|
1366
1099
|
{
|
|
1367
1100
|
provide: 'SubscriptionPaymentRepository',
|
|
1368
|
-
useFactory: (
|
|
1369
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
1101
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1102
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1370
1103
|
},
|
|
1371
|
-
deps: [
|
|
1104
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1372
1105
|
},
|
|
1373
1106
|
{
|
|
1374
1107
|
provide: 'SubscriptionPlanRepository',
|
|
1375
|
-
useFactory: (
|
|
1376
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
1108
|
+
useFactory: (firestore) => {
|
|
1109
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1377
1110
|
},
|
|
1378
|
-
deps: [
|
|
1111
|
+
deps: [Firestore],
|
|
1379
1112
|
},
|
|
1380
1113
|
{
|
|
1381
1114
|
provide: 'SubscriptionProductRepository',
|
|
1382
|
-
useFactory: (
|
|
1383
|
-
return new SubscriptionProductFirestoreRepository(
|
|
1115
|
+
useFactory: (firestore) => {
|
|
1116
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1384
1117
|
},
|
|
1385
|
-
deps: [
|
|
1118
|
+
deps: [Firestore],
|
|
1386
1119
|
},
|
|
1387
1120
|
{
|
|
1388
1121
|
provide: 'SubscriptionRepository',
|
|
1389
|
-
useFactory: (
|
|
1390
|
-
return new SubscriptionFirestoreRepository(
|
|
1122
|
+
useFactory: (firestore) => {
|
|
1123
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1391
1124
|
},
|
|
1392
|
-
deps: [
|
|
1125
|
+
deps: [Firestore],
|
|
1393
1126
|
},
|
|
1394
1127
|
{
|
|
1395
1128
|
provide: 'UserRepository',
|
|
1396
|
-
useFactory: (
|
|
1397
|
-
return new UserFirestoreRepository(
|
|
1129
|
+
useFactory: (firestore) => {
|
|
1130
|
+
return new UserFirestoreRepository(firestore);
|
|
1398
1131
|
},
|
|
1399
|
-
deps: [
|
|
1132
|
+
deps: [Firestore],
|
|
1400
1133
|
},
|
|
1401
1134
|
{
|
|
1402
1135
|
provide: 'UserAddressRepository',
|
|
1403
|
-
useFactory: (
|
|
1404
|
-
return new UserAddressFirestoreRepository(
|
|
1136
|
+
useFactory: (firestore, userRepository) => {
|
|
1137
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1405
1138
|
},
|
|
1406
|
-
deps: [
|
|
1139
|
+
deps: [Firestore, 'UserRepository'],
|
|
1407
1140
|
},
|
|
1408
1141
|
{
|
|
1409
1142
|
provide: 'UserPaymentMethodRepository',
|
|
1410
|
-
useFactory: (
|
|
1411
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
1143
|
+
useFactory: (firestore, userRepository) => {
|
|
1144
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1412
1145
|
},
|
|
1413
|
-
deps: [
|
|
1146
|
+
deps: [Firestore, 'UserRepository'],
|
|
1414
1147
|
},
|
|
1415
1148
|
{
|
|
1416
1149
|
provide: ProductVariantFirestoreRepository,
|
|
1417
|
-
useFactory: (
|
|
1418
|
-
return new ProductVariantFirestoreRepository(
|
|
1150
|
+
useFactory: (firestore, productRepository) => {
|
|
1151
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1419
1152
|
},
|
|
1420
|
-
deps: [
|
|
1153
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1421
1154
|
},
|
|
1422
1155
|
],
|
|
1423
1156
|
}]
|
|
@@ -1436,23 +1169,13 @@ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.
|
|
|
1436
1169
|
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
1437
1170
|
{
|
|
1438
1171
|
provide: 'HasuraConfig',
|
|
1439
|
-
useFactory: (options
|
|
1172
|
+
useFactory: (options) => ({
|
|
1440
1173
|
endpoint: options.endpoint,
|
|
1441
1174
|
authOptions: options.credentials,
|
|
1442
1175
|
interceptors: {
|
|
1443
1176
|
request: (request) => {
|
|
1444
|
-
if (isPlatformBrowser(platformId))
|
|
1445
|
-
return request;
|
|
1446
|
-
const interval = setInterval(() => { }, 100);
|
|
1447
|
-
request.interval = interval;
|
|
1448
1177
|
return request;
|
|
1449
1178
|
},
|
|
1450
|
-
response: (response, request) => {
|
|
1451
|
-
if (isPlatformBrowser(platformId))
|
|
1452
|
-
return response;
|
|
1453
|
-
clearInterval(request.interval);
|
|
1454
|
-
return response;
|
|
1455
|
-
},
|
|
1456
1179
|
},
|
|
1457
1180
|
}),
|
|
1458
1181
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1463,10 +1186,11 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1463
1186
|
},
|
|
1464
1187
|
{
|
|
1465
1188
|
provide: CategoryHasuraGraphQLRepository,
|
|
1466
|
-
useFactory: (options, productRepository,
|
|
1467
|
-
|
|
1189
|
+
useFactory: (options, productRepository, eta) => {
|
|
1190
|
+
console.log(eta);
|
|
1191
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1468
1192
|
},
|
|
1469
|
-
deps: [
|
|
1193
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1470
1194
|
},
|
|
1471
1195
|
{
|
|
1472
1196
|
provide: 'ProductRepository',
|
|
@@ -1474,10 +1198,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1474
1198
|
},
|
|
1475
1199
|
{
|
|
1476
1200
|
provide: ProductHasuraGraphQLRepository,
|
|
1477
|
-
useFactory: (
|
|
1478
|
-
return new ProductHasuraGraphQLRepository(
|
|
1201
|
+
useFactory: (options) => {
|
|
1202
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1479
1203
|
},
|
|
1480
|
-
deps: [
|
|
1204
|
+
deps: [HASURA_OPTIONS],
|
|
1481
1205
|
},
|
|
1482
1206
|
{
|
|
1483
1207
|
provide: 'VariantRepository',
|
|
@@ -1485,43 +1209,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1485
1209
|
},
|
|
1486
1210
|
{
|
|
1487
1211
|
provide: VariantHasuraGraphQLRepository,
|
|
1488
|
-
useFactory: (hasuraConfig) => {
|
|
1489
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1490
|
-
},
|
|
1491
|
-
deps: ['HasuraConfig'],
|
|
1492
|
-
},
|
|
1493
|
-
{
|
|
1494
|
-
provide: 'CategoryFilterRepository',
|
|
1495
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1496
|
-
},
|
|
1497
|
-
{
|
|
1498
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1499
|
-
useFactory: (options) => {
|
|
1500
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
1501
|
-
},
|
|
1502
|
-
deps: ['HasuraConfig'],
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
provide: 'FilterOptionRepository',
|
|
1506
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1510
1212
|
useFactory: (options) => {
|
|
1511
|
-
return new
|
|
1512
|
-
},
|
|
1513
|
-
deps: ['HasuraConfig'],
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
provide: 'FilterRepository',
|
|
1517
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1518
|
-
},
|
|
1519
|
-
{
|
|
1520
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1521
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1522
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1213
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1523
1214
|
},
|
|
1524
|
-
deps: [
|
|
1215
|
+
deps: [HASURA_OPTIONS],
|
|
1525
1216
|
},
|
|
1526
1217
|
] });
|
|
1527
1218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
@@ -1530,23 +1221,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1530
1221
|
providers: [
|
|
1531
1222
|
{
|
|
1532
1223
|
provide: 'HasuraConfig',
|
|
1533
|
-
useFactory: (options
|
|
1224
|
+
useFactory: (options) => ({
|
|
1534
1225
|
endpoint: options.endpoint,
|
|
1535
1226
|
authOptions: options.credentials,
|
|
1536
1227
|
interceptors: {
|
|
1537
1228
|
request: (request) => {
|
|
1538
|
-
if (isPlatformBrowser(platformId))
|
|
1539
|
-
return request;
|
|
1540
|
-
const interval = setInterval(() => { }, 100);
|
|
1541
|
-
request.interval = interval;
|
|
1542
1229
|
return request;
|
|
1543
1230
|
},
|
|
1544
|
-
response: (response, request) => {
|
|
1545
|
-
if (isPlatformBrowser(platformId))
|
|
1546
|
-
return response;
|
|
1547
|
-
clearInterval(request.interval);
|
|
1548
|
-
return response;
|
|
1549
|
-
},
|
|
1550
1231
|
},
|
|
1551
1232
|
}),
|
|
1552
1233
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1557,10 +1238,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1557
1238
|
},
|
|
1558
1239
|
{
|
|
1559
1240
|
provide: CategoryHasuraGraphQLRepository,
|
|
1560
|
-
useFactory: (options, productRepository,
|
|
1561
|
-
|
|
1241
|
+
useFactory: (options, productRepository, eta) => {
|
|
1242
|
+
console.log(eta);
|
|
1243
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1562
1244
|
},
|
|
1563
|
-
deps: [
|
|
1245
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1564
1246
|
},
|
|
1565
1247
|
{
|
|
1566
1248
|
provide: 'ProductRepository',
|
|
@@ -1568,10 +1250,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1568
1250
|
},
|
|
1569
1251
|
{
|
|
1570
1252
|
provide: ProductHasuraGraphQLRepository,
|
|
1571
|
-
useFactory: (
|
|
1572
|
-
return new ProductHasuraGraphQLRepository(
|
|
1253
|
+
useFactory: (options) => {
|
|
1254
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1573
1255
|
},
|
|
1574
|
-
deps: [
|
|
1256
|
+
deps: [HASURA_OPTIONS],
|
|
1575
1257
|
},
|
|
1576
1258
|
{
|
|
1577
1259
|
provide: 'VariantRepository',
|
|
@@ -1579,43 +1261,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1579
1261
|
},
|
|
1580
1262
|
{
|
|
1581
1263
|
provide: VariantHasuraGraphQLRepository,
|
|
1582
|
-
useFactory: (hasuraConfig) => {
|
|
1583
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1584
|
-
},
|
|
1585
|
-
deps: ['HasuraConfig'],
|
|
1586
|
-
},
|
|
1587
|
-
{
|
|
1588
|
-
provide: 'CategoryFilterRepository',
|
|
1589
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1590
|
-
},
|
|
1591
|
-
{
|
|
1592
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1593
1264
|
useFactory: (options) => {
|
|
1594
|
-
return new
|
|
1595
|
-
},
|
|
1596
|
-
deps: ['HasuraConfig'],
|
|
1597
|
-
},
|
|
1598
|
-
{
|
|
1599
|
-
provide: 'FilterOptionRepository',
|
|
1600
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1601
|
-
},
|
|
1602
|
-
{
|
|
1603
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1604
|
-
useFactory: (options) => {
|
|
1605
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
1606
|
-
},
|
|
1607
|
-
deps: ['HasuraConfig'],
|
|
1608
|
-
},
|
|
1609
|
-
{
|
|
1610
|
-
provide: 'FilterRepository',
|
|
1611
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1612
|
-
},
|
|
1613
|
-
{
|
|
1614
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1615
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1616
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1265
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1617
1266
|
},
|
|
1618
|
-
deps: [
|
|
1267
|
+
deps: [HASURA_OPTIONS],
|
|
1619
1268
|
},
|
|
1620
1269
|
],
|
|
1621
1270
|
}]
|
|
@@ -1631,7 +1280,6 @@ class AngularConnectModule {
|
|
|
1631
1280
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1632
1281
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1633
1282
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
1634
|
-
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
1635
1283
|
],
|
|
1636
1284
|
};
|
|
1637
1285
|
}
|
|
@@ -1646,7 +1294,6 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
1646
1294
|
CouponService,
|
|
1647
1295
|
HomeShopService,
|
|
1648
1296
|
OrderService,
|
|
1649
|
-
ShippingService,
|
|
1650
1297
|
], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
1651
1298
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1652
1299
|
type: NgModule,
|
|
@@ -1660,7 +1307,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1660
1307
|
CouponService,
|
|
1661
1308
|
HomeShopService,
|
|
1662
1309
|
OrderService,
|
|
1663
|
-
ShippingService,
|
|
1664
1310
|
],
|
|
1665
1311
|
}]
|
|
1666
1312
|
}] });
|
|
@@ -1669,5 +1315,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1669
1315
|
* Generated bundle index. Do not edit.
|
|
1670
1316
|
*/
|
|
1671
1317
|
|
|
1672
|
-
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 };
|
|
1673
1319
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|