@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
|
@@ -5,18 +5,14 @@ import { getIdToken, authState, Auth, provideAuth, getAuth } from '@angular/fire
|
|
|
5
5
|
import { combineLatest, of, from, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
6
6
|
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
7
7
|
import { __awaiter } from 'tslib';
|
|
8
|
-
import * as
|
|
9
|
-
import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Category, Product, RequiredArgumentError, add,
|
|
8
|
+
import * as i2 from '@infrab4a/connect';
|
|
9
|
+
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';
|
|
10
10
|
import cookie from 'js-cookie';
|
|
11
11
|
import { CustomError } from 'ts-custom-error';
|
|
12
12
|
import * as i1$1 from '@angular/fire/firestore';
|
|
13
|
-
import { docSnapshots, doc, Firestore, provideFirestore } from '@angular/fire/firestore';
|
|
14
|
-
import * as i1$2 from '@angular/
|
|
15
|
-
import * as i1$3 from '@angular/fire/app';
|
|
13
|
+
import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
|
|
14
|
+
import * as i1$2 from '@angular/fire/app';
|
|
16
15
|
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
17
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
18
|
-
import { initializeApp as initializeApp$1 } from 'firebase/app';
|
|
19
|
-
import { getFirestore } from 'firebase/firestore';
|
|
20
16
|
|
|
21
17
|
class AuthService {
|
|
22
18
|
constructor(angularFireAuth, userRepository) {
|
|
@@ -51,8 +47,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
51
47
|
}] }];
|
|
52
48
|
} });
|
|
53
49
|
|
|
54
|
-
const BACKEND_URL = 'BACKEND_URL';
|
|
55
|
-
|
|
56
50
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
57
51
|
|
|
58
52
|
const ES_CONFIG = 'ES_CONFIG';
|
|
@@ -76,10 +70,11 @@ class GroupInvalidCouponError extends CustomError {
|
|
|
76
70
|
}
|
|
77
71
|
|
|
78
72
|
class CouponService {
|
|
79
|
-
constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
73
|
+
constructor(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
|
|
80
74
|
this.couponRepository = couponRepository;
|
|
81
75
|
this.defaultShop = defaultShop;
|
|
82
76
|
this.orderRepository = orderRepository;
|
|
77
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
83
78
|
this.categoryRepository = categoryRepository;
|
|
84
79
|
this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
|
|
85
80
|
}
|
|
@@ -120,7 +115,7 @@ class CouponService {
|
|
|
120
115
|
const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
121
116
|
// Se não tem valor mínimo atingido, retorna erro
|
|
122
117
|
if (!hasMinSubTotal)
|
|
123
|
-
return throwError(
|
|
118
|
+
return throwError('Valor mínimo não atingido');
|
|
124
119
|
return of(coupon);
|
|
125
120
|
}
|
|
126
121
|
isValidCoupon(coupon, userEmail) {
|
|
@@ -148,7 +143,7 @@ class CouponService {
|
|
|
148
143
|
// Verifica o limite de uso geral por usuario
|
|
149
144
|
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
150
145
|
throw new InvalidCouponError('Limite de uso atingido.');
|
|
151
|
-
const validUser = this.userValidationAndSubscriptionStatus(coupon,
|
|
146
|
+
const validUser = yield this.userValidationAndSubscriptionStatus(coupon, userEmail);
|
|
152
147
|
if (!validUser)
|
|
153
148
|
throw new InvalidCouponError('Usuário não elegível.');
|
|
154
149
|
const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
|
|
@@ -242,26 +237,41 @@ class CouponService {
|
|
|
242
237
|
return hasCategories.length ? true : false;
|
|
243
238
|
});
|
|
244
239
|
}
|
|
245
|
-
userValidationAndSubscriptionStatus(coupon,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
userValidationAndSubscriptionStatus(coupon, userEmail) {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
// Verifica se o email do usuário é coorporativo
|
|
243
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
244
|
+
throw new InvalidCouponError('Você não é colaborador.');
|
|
245
|
+
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
246
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
|
|
247
|
+
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
248
|
+
const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
|
|
249
|
+
coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
|
|
250
|
+
coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
|
|
251
|
+
if (couponRuleSubscription && userEmail) {
|
|
252
|
+
const sub = yield this.subscriptionRepository
|
|
253
|
+
.find({
|
|
254
|
+
filters: {
|
|
255
|
+
user: {
|
|
256
|
+
email: { operator: Where.EQUALS, value: userEmail },
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
})
|
|
260
|
+
.then((sub) => sub.data);
|
|
261
|
+
const activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter((s) => s.status === Status.ACTIVE);
|
|
262
|
+
switch (coupon.exclusivityType) {
|
|
263
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
264
|
+
return activeSubs.length > 0;
|
|
265
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
266
|
+
return activeSubs.length === 0;
|
|
267
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
268
|
+
return sub.length === 0;
|
|
269
|
+
default:
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
249
273
|
return true;
|
|
250
|
-
|
|
251
|
-
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
252
|
-
throw new InvalidCouponError('Você não é colaborador.');
|
|
253
|
-
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
254
|
-
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
255
|
-
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
256
|
-
switch (coupon.exclusivityType) {
|
|
257
|
-
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
258
|
-
return user.isSubscriber ? true : false;
|
|
259
|
-
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
260
|
-
return user.isSubscriber ? false : true;
|
|
261
|
-
case Exclusivities.NON_SUBSCRIBER:
|
|
262
|
-
return user.isSubscriber ? false : true;
|
|
263
|
-
}
|
|
264
|
-
return true;
|
|
274
|
+
});
|
|
265
275
|
}
|
|
266
276
|
getCouponCategoriesId(coupon) {
|
|
267
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -276,7 +286,7 @@ class CouponService {
|
|
|
276
286
|
});
|
|
277
287
|
}
|
|
278
288
|
}
|
|
279
|
-
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 });
|
|
289
|
+
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 });
|
|
280
290
|
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
281
291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
|
|
282
292
|
type: Injectable,
|
|
@@ -287,12 +297,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
287
297
|
return [{ type: undefined, decorators: [{
|
|
288
298
|
type: Inject,
|
|
289
299
|
args: ['CouponRepository']
|
|
290
|
-
}] }, { type:
|
|
300
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
291
301
|
type: Inject,
|
|
292
302
|
args: [DEFAULT_SHOP]
|
|
293
303
|
}] }, { type: undefined, decorators: [{
|
|
294
304
|
type: Inject,
|
|
295
305
|
args: ['OrderRepository']
|
|
306
|
+
}] }, { type: undefined, decorators: [{
|
|
307
|
+
type: Inject,
|
|
308
|
+
args: ['SubscriptionRepository']
|
|
296
309
|
}] }, { type: undefined, decorators: [{
|
|
297
310
|
type: Inject,
|
|
298
311
|
args: ['CategoryRepository']
|
|
@@ -359,25 +372,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
359
372
|
}] }, { type: undefined, decorators: [{
|
|
360
373
|
type: Inject,
|
|
361
374
|
args: ['UserRepository']
|
|
362
|
-
}] }, { type:
|
|
375
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
363
376
|
type: Inject,
|
|
364
377
|
args: [DEFAULT_SHOP]
|
|
365
378
|
}] }];
|
|
366
379
|
} });
|
|
367
380
|
|
|
368
381
|
class CartService {
|
|
369
|
-
constructor(authService, checkoutService, defaultShop, productRepository
|
|
382
|
+
constructor(authService, checkoutService, defaultShop, productRepository) {
|
|
370
383
|
this.authService = authService;
|
|
371
384
|
this.checkoutService = checkoutService;
|
|
372
385
|
this.defaultShop = defaultShop;
|
|
373
386
|
this.productRepository = productRepository;
|
|
374
|
-
this.variantRepository = variantRepository;
|
|
375
|
-
this.buy2WinRepository = buy2WinRepository;
|
|
376
387
|
this.cartSubject = new Subject();
|
|
377
388
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
378
389
|
var _a;
|
|
379
390
|
const items = [];
|
|
380
|
-
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.
|
|
391
|
+
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
381
392
|
if (index > -1) {
|
|
382
393
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
383
394
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
@@ -388,18 +399,22 @@ class CartService {
|
|
|
388
399
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
389
400
|
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
390
401
|
}));
|
|
391
|
-
this.generateCartObject = (items) =>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
402
|
+
this.generateCartObject = (items) => {
|
|
403
|
+
const cart = {};
|
|
404
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
405
|
+
var _a;
|
|
406
|
+
return (cart[item.sku] = LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
|
|
407
|
+
});
|
|
408
|
+
return cart;
|
|
409
|
+
};
|
|
395
410
|
this.buildLineItem = ({ checkout, item, quantity, }) => __awaiter(this, void 0, void 0, function* () {
|
|
396
411
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
397
|
-
const product = yield this.
|
|
398
|
-
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.
|
|
412
|
+
const product = yield this.productRepository.get({ id: item.id });
|
|
413
|
+
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
|
|
399
414
|
if (this.checkMaxStock(item, quantity || 0))
|
|
400
415
|
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
401
416
|
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
402
|
-
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
417
|
+
const { id, name, EAN, brand, slug, stock, price, weight, categories, sku, type } = item;
|
|
403
418
|
const isGift = item.isGift || null;
|
|
404
419
|
const pricePaid = this.getProductPrice({
|
|
405
420
|
product: item,
|
|
@@ -447,7 +462,7 @@ class CartService {
|
|
|
447
462
|
decreaseItem(item) {
|
|
448
463
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
449
464
|
var _a;
|
|
450
|
-
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.
|
|
465
|
+
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
|
|
451
466
|
if (!isNil(checkoutItem))
|
|
452
467
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
453
468
|
return checkout;
|
|
@@ -465,7 +480,7 @@ class CartService {
|
|
|
465
480
|
}
|
|
466
481
|
removeItem(item) {
|
|
467
482
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
468
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.
|
|
483
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
469
484
|
if (index >= 0)
|
|
470
485
|
checkout.lineItems.splice(index, 1);
|
|
471
486
|
return checkout;
|
|
@@ -474,12 +489,8 @@ class CartService {
|
|
|
474
489
|
updateUserCart(user) {
|
|
475
490
|
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => __awaiter(this, void 0, void 0, function* () {
|
|
476
491
|
var _a, _b;
|
|
477
|
-
return this.checkoutService
|
|
478
|
-
|
|
479
|
-
? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; })))
|
|
480
|
-
: [] })))
|
|
481
|
-
.toPromise();
|
|
482
|
-
})), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
492
|
+
return this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length) ? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; }))) : [] }))).toPromise();
|
|
493
|
+
})), map(checkout => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
483
494
|
}
|
|
484
495
|
clearCart() {
|
|
485
496
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -490,122 +501,18 @@ class CartService {
|
|
|
490
501
|
buildCartFromCheckout(checkoutData) {
|
|
491
502
|
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
492
503
|
}
|
|
493
|
-
getProductData(productId) {
|
|
494
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
495
|
-
let product;
|
|
496
|
-
let variant;
|
|
497
|
-
try {
|
|
498
|
-
product = yield this.productRepository.get({ id: productId });
|
|
499
|
-
}
|
|
500
|
-
catch (error) {
|
|
501
|
-
if (!(error instanceof NotFoundError))
|
|
502
|
-
throw error;
|
|
503
|
-
variant = yield this.variantRepository.get({ id: productId });
|
|
504
|
-
product = yield this.productRepository.get({ id: variant.productId });
|
|
505
|
-
}
|
|
506
|
-
return Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())));
|
|
507
|
-
});
|
|
508
|
-
}
|
|
509
|
-
getGifts() {
|
|
510
|
-
return this.checkoutService.getCheckout().pipe(mergeMap((checkout) => __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
const campaigns = yield this.buy2WinRepository
|
|
512
|
-
.find({
|
|
513
|
-
filters: {
|
|
514
|
-
active: { operator: Where.EQUALS, value: true },
|
|
515
|
-
shop: { operator: Where.EQUALS, value: this.defaultShop },
|
|
516
|
-
},
|
|
517
|
-
})
|
|
518
|
-
.then((data) => data.data);
|
|
519
|
-
const notGiftItems = checkout.lineItems.filter((item) => !item.isGift);
|
|
520
|
-
if (!campaigns.length)
|
|
521
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
522
|
-
const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
523
|
-
const elegibleCampaigns = [];
|
|
524
|
-
for (const campaign of campaigns) {
|
|
525
|
-
const today = new Date();
|
|
526
|
-
if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
|
|
527
|
-
continue;
|
|
528
|
-
if (campaign.activeCategory) {
|
|
529
|
-
const categoriesCampaing = campaign.categories.map((c) => c.id);
|
|
530
|
-
const filterProductsCategories = checkout.lineItems.filter((l) => {
|
|
531
|
-
var _a;
|
|
532
|
-
if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
533
|
-
return true;
|
|
534
|
-
return l.categories.some((c) => categoriesCampaing.some((cat) => cat == c));
|
|
535
|
-
});
|
|
536
|
-
if (filterProductsCategories.length) {
|
|
537
|
-
const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
538
|
-
if (cartTotalCategories >= campaign.cartValueMin)
|
|
539
|
-
elegibleCampaigns.push(campaign);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
544
|
-
if (campaign.cartValue <= cartTotal)
|
|
545
|
-
elegibleCampaigns.push(campaign);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
if (!elegibleCampaigns.length)
|
|
550
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
551
|
-
const campaingnProducts = [];
|
|
552
|
-
for (const campaign of elegibleCampaigns) {
|
|
553
|
-
let elegibleProducts = [];
|
|
554
|
-
for (const product of campaign.products) {
|
|
555
|
-
const productData = yield this.productRepository.get({ sku: product });
|
|
556
|
-
if (!productData)
|
|
557
|
-
continue;
|
|
558
|
-
elegibleProducts.push(productData);
|
|
559
|
-
}
|
|
560
|
-
campaingnProducts.push(elegibleProducts);
|
|
561
|
-
}
|
|
562
|
-
if (!campaingnProducts.length)
|
|
563
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
564
|
-
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
565
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) });
|
|
566
|
-
})), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
567
|
-
}
|
|
568
|
-
giftToLineItems(items) {
|
|
569
|
-
return items.map((item) => {
|
|
570
|
-
var _a;
|
|
571
|
-
const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
|
|
572
|
-
const image = ((_a = item === null || item === void 0 ? void 0 : item.miniatures) === null || _a === void 0 ? void 0 : _a.length) ? item.miniatures[0] : item.images[0];
|
|
573
|
-
return LineItem.toInstance({
|
|
574
|
-
brand,
|
|
575
|
-
categories,
|
|
576
|
-
id: id.toString(),
|
|
577
|
-
name,
|
|
578
|
-
price,
|
|
579
|
-
sku,
|
|
580
|
-
slug,
|
|
581
|
-
stock,
|
|
582
|
-
weight,
|
|
583
|
-
EAN,
|
|
584
|
-
image,
|
|
585
|
-
pricePaid: 0,
|
|
586
|
-
quantity: 1,
|
|
587
|
-
isGift: true,
|
|
588
|
-
});
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
504
|
}
|
|
592
|
-
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' }
|
|
505
|
+
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 });
|
|
593
506
|
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
|
|
594
507
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
|
|
595
508
|
type: Injectable
|
|
596
509
|
}], ctorParameters: function () {
|
|
597
|
-
return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
510
|
+
return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
598
511
|
type: Inject,
|
|
599
512
|
args: [DEFAULT_SHOP]
|
|
600
513
|
}] }, { type: undefined, decorators: [{
|
|
601
514
|
type: Inject,
|
|
602
515
|
args: ['ProductRepository']
|
|
603
|
-
}] }, { type: undefined, decorators: [{
|
|
604
|
-
type: Inject,
|
|
605
|
-
args: ['VariantRepository']
|
|
606
|
-
}] }, { type: i3.Buy2WinFirestoreRepository, decorators: [{
|
|
607
|
-
type: Inject,
|
|
608
|
-
args: ['Buy2WinRepository']
|
|
609
516
|
}] }];
|
|
610
517
|
} });
|
|
611
518
|
|
|
@@ -633,9 +540,7 @@ class CheckoutSubscriptionService {
|
|
|
633
540
|
return of();
|
|
634
541
|
}
|
|
635
542
|
checkCoupon(nickname, userEmail) {
|
|
636
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
637
|
-
.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
638
|
-
.pipe()));
|
|
543
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe()));
|
|
639
544
|
}
|
|
640
545
|
calcDiscountSubscription(coupon) {
|
|
641
546
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
@@ -655,6 +560,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
655
560
|
}] }, { type: CouponService }];
|
|
656
561
|
} });
|
|
657
562
|
|
|
563
|
+
class OrderService {
|
|
564
|
+
constructor(angularFirestore, orderRepository) {
|
|
565
|
+
this.angularFirestore = angularFirestore;
|
|
566
|
+
this.orderRepository = orderRepository;
|
|
567
|
+
this.orderSubject = new Subject();
|
|
568
|
+
}
|
|
569
|
+
getOrder(id) {
|
|
570
|
+
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
571
|
+
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
572
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
573
|
+
return this.orderSubject;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
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 });
|
|
577
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
579
|
+
type: Injectable
|
|
580
|
+
}], ctorParameters: function () {
|
|
581
|
+
return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
582
|
+
type: Inject,
|
|
583
|
+
args: ['OrderRepository']
|
|
584
|
+
}] }];
|
|
585
|
+
} });
|
|
586
|
+
|
|
658
587
|
class HomeShopService {
|
|
659
588
|
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
660
589
|
this.categoryRepository = categoryRepository;
|
|
@@ -761,124 +690,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
761
690
|
}] }, { type: undefined, decorators: [{
|
|
762
691
|
type: Inject,
|
|
763
692
|
args: ['ProductRepository']
|
|
764
|
-
}] }, { type:
|
|
693
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
765
694
|
type: Inject,
|
|
766
695
|
args: [DEFAULT_SHOP]
|
|
767
696
|
}] }];
|
|
768
697
|
} });
|
|
769
698
|
|
|
770
|
-
class OrderService {
|
|
771
|
-
constructor(angularFirestore, orderRepository) {
|
|
772
|
-
this.angularFirestore = angularFirestore;
|
|
773
|
-
this.orderRepository = orderRepository;
|
|
774
|
-
this.orderSubject = new Subject();
|
|
775
|
-
}
|
|
776
|
-
getOrder(id) {
|
|
777
|
-
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
778
|
-
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
779
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
780
|
-
return this.orderSubject;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
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 });
|
|
784
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
786
|
-
type: Injectable
|
|
787
|
-
}], ctorParameters: function () {
|
|
788
|
-
return [{ type: i1$1.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
|
|
789
|
-
type: Inject,
|
|
790
|
-
args: ['OrderRepository']
|
|
791
|
-
}] }];
|
|
792
|
-
} });
|
|
793
|
-
|
|
794
|
-
class ShippingService {
|
|
795
|
-
constructor(http, apiUrl, homeService) {
|
|
796
|
-
this.http = http;
|
|
797
|
-
this.apiUrl = apiUrl;
|
|
798
|
-
this.homeService = homeService;
|
|
799
|
-
}
|
|
800
|
-
getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
801
|
-
return combineLatest([
|
|
802
|
-
this.homeService.getHomeData(),
|
|
803
|
-
this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
|
|
804
|
-
]).pipe(map(([datas, shippingMethodsResponse]) => {
|
|
805
|
-
let shippingMethods = shippingMethodsResponse.result;
|
|
806
|
-
if (!shippingMethods.length)
|
|
807
|
-
return [];
|
|
808
|
-
shippingMethods = shippingMethods.map((shippingMethod) => {
|
|
809
|
-
if (shippingMethod.ShippingCompanyName == 'Same Day EG')
|
|
810
|
-
shippingMethod.ShippingCompanyName = 'Same Day';
|
|
811
|
-
return shippingMethod;
|
|
812
|
-
});
|
|
813
|
-
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
814
|
-
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
815
|
-
shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
|
|
816
|
-
}
|
|
817
|
-
if (totalPrice >= 200) {
|
|
818
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
819
|
-
if (s.serviceName !== 'Same Day')
|
|
820
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
821
|
-
else
|
|
822
|
-
return s;
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
if (shop == Shops.GLAMSHOP)
|
|
826
|
-
return shippingMethods;
|
|
827
|
-
if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
828
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
829
|
-
if (s.serviceName == 'Same Day')
|
|
830
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
831
|
-
else
|
|
832
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
836
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
837
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
return shippingMethods;
|
|
841
|
-
}));
|
|
842
|
-
}
|
|
843
|
-
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
844
|
-
if (!subscriptionPlan)
|
|
845
|
-
return false;
|
|
846
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
847
|
-
return true;
|
|
848
|
-
return false;
|
|
849
|
-
}
|
|
850
|
-
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
851
|
-
if (!subscriptionPlan)
|
|
852
|
-
return false;
|
|
853
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
854
|
-
return true;
|
|
855
|
-
}
|
|
856
|
-
return false;
|
|
857
|
-
}
|
|
858
|
-
isHolidays(datas) {
|
|
859
|
-
const today = new Date();
|
|
860
|
-
for (const key in datas) {
|
|
861
|
-
let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
|
|
862
|
-
let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
|
|
863
|
-
if (start > end)
|
|
864
|
-
end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
|
|
865
|
-
if (today >= start && today <= end)
|
|
866
|
-
return true;
|
|
867
|
-
}
|
|
868
|
-
return false;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
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 });
|
|
872
|
-
ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService });
|
|
873
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ShippingService, decorators: [{
|
|
874
|
-
type: Injectable
|
|
875
|
-
}], ctorParameters: function () {
|
|
876
|
-
return [{ type: i1$2.HttpClient }, { type: undefined, decorators: [{
|
|
877
|
-
type: Inject,
|
|
878
|
-
args: [BACKEND_URL]
|
|
879
|
-
}] }, { type: HomeShopService }];
|
|
880
|
-
} });
|
|
881
|
-
|
|
882
699
|
class AngularFirebaseAuthModule {
|
|
883
700
|
static initializeApp(options, nameOrConfig) {
|
|
884
701
|
return {
|
|
@@ -891,7 +708,7 @@ class AngularFirebaseAuthModule {
|
|
|
891
708
|
}
|
|
892
709
|
}
|
|
893
710
|
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
894
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$
|
|
711
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
|
|
895
712
|
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
896
713
|
{
|
|
897
714
|
provide: 'Authentication',
|
|
@@ -1048,211 +865,168 @@ class AngularFirestoreModule {
|
|
|
1048
865
|
}
|
|
1049
866
|
}
|
|
1050
867
|
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1051
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$
|
|
868
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
|
|
1052
869
|
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
1053
|
-
{
|
|
1054
|
-
provide: 'FirestoreOptions',
|
|
1055
|
-
useFactory: (firestore, platformId) => ({
|
|
1056
|
-
firestore,
|
|
1057
|
-
interceptors: {
|
|
1058
|
-
request: (request) => {
|
|
1059
|
-
if (isPlatformBrowser(platformId))
|
|
1060
|
-
return request;
|
|
1061
|
-
const interval = setInterval(() => { }, 100);
|
|
1062
|
-
request.interval = interval;
|
|
1063
|
-
return request;
|
|
1064
|
-
},
|
|
1065
|
-
response: (response, request) => {
|
|
1066
|
-
if (isPlatformBrowser(platformId))
|
|
1067
|
-
return response;
|
|
1068
|
-
clearInterval(request.interval);
|
|
1069
|
-
return response;
|
|
1070
|
-
},
|
|
1071
|
-
},
|
|
1072
|
-
}),
|
|
1073
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1074
|
-
},
|
|
1075
870
|
{
|
|
1076
871
|
provide: 'BeautyProfileRepository',
|
|
1077
|
-
useFactory: (
|
|
1078
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
872
|
+
useFactory: (firestore, userRepository) => {
|
|
873
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1079
874
|
},
|
|
1080
|
-
deps: [
|
|
875
|
+
deps: [Firestore, 'UserRepository'],
|
|
1081
876
|
},
|
|
1082
877
|
{
|
|
1083
878
|
provide: 'Buy2WinRepository',
|
|
1084
|
-
useFactory: (
|
|
1085
|
-
return new Buy2WinFirestoreRepository(
|
|
879
|
+
useFactory: (firestore) => {
|
|
880
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1086
881
|
},
|
|
1087
|
-
deps: [
|
|
882
|
+
deps: [Firestore],
|
|
1088
883
|
},
|
|
1089
884
|
{
|
|
1090
885
|
provide: CategoryFirestoreRepository,
|
|
1091
|
-
useFactory: (
|
|
1092
|
-
return new CategoryFirestoreRepository(
|
|
886
|
+
useFactory: (firestore) => {
|
|
887
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1093
888
|
},
|
|
1094
|
-
deps: [
|
|
889
|
+
deps: [Firestore],
|
|
1095
890
|
},
|
|
1096
891
|
{
|
|
1097
892
|
provide: 'CheckoutRepository',
|
|
1098
|
-
useFactory: (
|
|
1099
|
-
return new CheckoutFirestoreRepository(
|
|
893
|
+
useFactory: (firestore) => {
|
|
894
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1100
895
|
},
|
|
1101
|
-
deps: [
|
|
896
|
+
deps: [Firestore],
|
|
1102
897
|
},
|
|
1103
898
|
{
|
|
1104
899
|
provide: 'CheckoutSubscriptionRepository',
|
|
1105
|
-
useFactory: (
|
|
1106
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
900
|
+
useFactory: (firestore) => {
|
|
901
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1107
902
|
},
|
|
1108
|
-
deps: [
|
|
903
|
+
deps: [Firestore],
|
|
1109
904
|
},
|
|
1110
905
|
{
|
|
1111
906
|
provide: 'CouponRepository',
|
|
1112
|
-
useFactory: (
|
|
1113
|
-
return new CouponFirestoreRepository(
|
|
907
|
+
useFactory: (firestore) => {
|
|
908
|
+
return new CouponFirestoreRepository(firestore);
|
|
1114
909
|
},
|
|
1115
|
-
deps: [
|
|
1116
|
-
},
|
|
1117
|
-
{
|
|
1118
|
-
provide: 'CampaignHashtagRepository',
|
|
1119
|
-
useFactory: (options) => {
|
|
1120
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
1121
|
-
},
|
|
1122
|
-
deps: ['FirestoreOptions'],
|
|
1123
|
-
},
|
|
1124
|
-
{
|
|
1125
|
-
provide: 'CampaignDashboardRepository',
|
|
1126
|
-
useFactory: (options) => {
|
|
1127
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
1128
|
-
},
|
|
1129
|
-
deps: ['FirestoreOptions'],
|
|
910
|
+
deps: [Firestore],
|
|
1130
911
|
},
|
|
1131
912
|
{
|
|
1132
913
|
provide: 'EditionRepository',
|
|
1133
|
-
useFactory: (
|
|
1134
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
914
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
915
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1135
916
|
},
|
|
1136
|
-
deps: [
|
|
917
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1137
918
|
},
|
|
1138
919
|
{
|
|
1139
920
|
provide: 'HomeRepository',
|
|
1140
|
-
useFactory: (
|
|
1141
|
-
return new HomeFirestoreRepository(
|
|
921
|
+
useFactory: (firestore) => {
|
|
922
|
+
return new HomeFirestoreRepository(firestore);
|
|
1142
923
|
},
|
|
1143
|
-
deps: [
|
|
924
|
+
deps: [Firestore],
|
|
1144
925
|
},
|
|
1145
926
|
{
|
|
1146
927
|
provide: 'LeadRepository',
|
|
1147
|
-
useFactory: (
|
|
1148
|
-
return new LeadFirestoreRepository(
|
|
928
|
+
useFactory: (firestore) => {
|
|
929
|
+
return new LeadFirestoreRepository(firestore);
|
|
1149
930
|
},
|
|
1150
|
-
deps: [
|
|
931
|
+
deps: [Firestore],
|
|
1151
932
|
},
|
|
1152
933
|
{
|
|
1153
934
|
provide: 'LegacyOrderRepository',
|
|
1154
|
-
useFactory: (
|
|
1155
|
-
return new LegacyOrderFirestoreRepository(
|
|
935
|
+
useFactory: (firestore) => {
|
|
936
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1156
937
|
},
|
|
1157
|
-
deps: [
|
|
938
|
+
deps: [Firestore],
|
|
1158
939
|
},
|
|
1159
940
|
{
|
|
1160
941
|
provide: 'ShopMenuRepository',
|
|
1161
|
-
useFactory: (
|
|
1162
|
-
return new ShopMenuFirestoreRepository(
|
|
942
|
+
useFactory: (firestore) => {
|
|
943
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1163
944
|
},
|
|
1164
|
-
deps: [
|
|
945
|
+
deps: [Firestore],
|
|
1165
946
|
},
|
|
1166
947
|
{
|
|
1167
948
|
provide: 'OrderRepository',
|
|
1168
|
-
useFactory: (
|
|
1169
|
-
return new OrderFirestoreRepository(
|
|
949
|
+
useFactory: (firestore) => {
|
|
950
|
+
return new OrderFirestoreRepository(firestore);
|
|
1170
951
|
},
|
|
1171
|
-
deps: [
|
|
952
|
+
deps: [Firestore],
|
|
1172
953
|
},
|
|
1173
954
|
{
|
|
1174
955
|
provide: 'PaymentRepository',
|
|
1175
|
-
useFactory: (
|
|
1176
|
-
return new PaymentFirestoreRepository(
|
|
956
|
+
useFactory: (firestore) => {
|
|
957
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1177
958
|
},
|
|
1178
|
-
deps: [
|
|
959
|
+
deps: [Firestore],
|
|
1179
960
|
},
|
|
1180
961
|
{
|
|
1181
962
|
provide: ProductFirestoreRepository,
|
|
1182
|
-
useFactory: (
|
|
1183
|
-
return new ProductFirestoreRepository(
|
|
963
|
+
useFactory: (firestore) => {
|
|
964
|
+
return new ProductFirestoreRepository(firestore);
|
|
1184
965
|
},
|
|
1185
|
-
deps: [
|
|
1186
|
-
},
|
|
1187
|
-
{
|
|
1188
|
-
provide: 'ShopSettingsRepository',
|
|
1189
|
-
useFactory: (options) => {
|
|
1190
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
1191
|
-
},
|
|
1192
|
-
deps: ['FirestoreOptions'],
|
|
966
|
+
deps: [Firestore],
|
|
1193
967
|
},
|
|
1194
968
|
{
|
|
1195
969
|
provide: 'SubscriptionPaymentRepository',
|
|
1196
|
-
useFactory: (
|
|
1197
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
970
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
971
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1198
972
|
},
|
|
1199
|
-
deps: [
|
|
973
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1200
974
|
},
|
|
1201
975
|
{
|
|
1202
976
|
provide: 'SubscriptionPlanRepository',
|
|
1203
|
-
useFactory: (
|
|
1204
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
977
|
+
useFactory: (firestore) => {
|
|
978
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1205
979
|
},
|
|
1206
|
-
deps: [
|
|
980
|
+
deps: [Firestore],
|
|
1207
981
|
},
|
|
1208
982
|
{
|
|
1209
983
|
provide: 'SubscriptionProductRepository',
|
|
1210
|
-
useFactory: (
|
|
1211
|
-
return new SubscriptionProductFirestoreRepository(
|
|
984
|
+
useFactory: (firestore) => {
|
|
985
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1212
986
|
},
|
|
1213
|
-
deps: [
|
|
987
|
+
deps: [Firestore],
|
|
1214
988
|
},
|
|
1215
989
|
{
|
|
1216
990
|
provide: 'SubscriptionRepository',
|
|
1217
|
-
useFactory: (
|
|
1218
|
-
return new SubscriptionFirestoreRepository(
|
|
991
|
+
useFactory: (firestore) => {
|
|
992
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1219
993
|
},
|
|
1220
|
-
deps: [
|
|
994
|
+
deps: [Firestore],
|
|
1221
995
|
},
|
|
1222
996
|
{
|
|
1223
997
|
provide: 'UserRepository',
|
|
1224
|
-
useFactory: (
|
|
1225
|
-
return new UserFirestoreRepository(
|
|
998
|
+
useFactory: (firestore) => {
|
|
999
|
+
return new UserFirestoreRepository(firestore);
|
|
1226
1000
|
},
|
|
1227
|
-
deps: [
|
|
1001
|
+
deps: [Firestore],
|
|
1228
1002
|
},
|
|
1229
1003
|
{
|
|
1230
1004
|
provide: 'UserAddressRepository',
|
|
1231
|
-
useFactory: (
|
|
1232
|
-
return new UserAddressFirestoreRepository(
|
|
1005
|
+
useFactory: (firestore, userRepository) => {
|
|
1006
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1233
1007
|
},
|
|
1234
|
-
deps: [
|
|
1008
|
+
deps: [Firestore, 'UserRepository'],
|
|
1235
1009
|
},
|
|
1236
1010
|
{
|
|
1237
1011
|
provide: 'UserPaymentMethodRepository',
|
|
1238
|
-
useFactory: (
|
|
1239
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
1012
|
+
useFactory: (firestore, userRepository) => {
|
|
1013
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1240
1014
|
},
|
|
1241
|
-
deps: [
|
|
1015
|
+
deps: [Firestore, 'UserRepository'],
|
|
1242
1016
|
},
|
|
1243
1017
|
{
|
|
1244
1018
|
provide: ProductVariantFirestoreRepository,
|
|
1245
|
-
useFactory: (
|
|
1246
|
-
return new ProductVariantFirestoreRepository(
|
|
1019
|
+
useFactory: (firestore, productRepository) => {
|
|
1020
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1247
1021
|
},
|
|
1248
|
-
deps: [
|
|
1022
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1249
1023
|
},
|
|
1250
1024
|
], imports: [AngularElasticSeachModule,
|
|
1251
1025
|
provideFirebaseApp((injector) => {
|
|
1252
1026
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1253
1027
|
return appName
|
|
1254
|
-
? initializeApp
|
|
1255
|
-
: initializeApp
|
|
1028
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1029
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1256
1030
|
}),
|
|
1257
1031
|
provideFirestore(() => getFirestore())] });
|
|
1258
1032
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
@@ -1263,208 +1037,165 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1263
1037
|
provideFirebaseApp((injector) => {
|
|
1264
1038
|
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1265
1039
|
return appName
|
|
1266
|
-
? initializeApp
|
|
1267
|
-
: initializeApp
|
|
1040
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1041
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1268
1042
|
}),
|
|
1269
1043
|
provideFirestore(() => getFirestore()),
|
|
1270
1044
|
],
|
|
1271
1045
|
providers: [
|
|
1272
|
-
{
|
|
1273
|
-
provide: 'FirestoreOptions',
|
|
1274
|
-
useFactory: (firestore, platformId) => ({
|
|
1275
|
-
firestore,
|
|
1276
|
-
interceptors: {
|
|
1277
|
-
request: (request) => {
|
|
1278
|
-
if (isPlatformBrowser(platformId))
|
|
1279
|
-
return request;
|
|
1280
|
-
const interval = setInterval(() => { }, 100);
|
|
1281
|
-
request.interval = interval;
|
|
1282
|
-
return request;
|
|
1283
|
-
},
|
|
1284
|
-
response: (response, request) => {
|
|
1285
|
-
if (isPlatformBrowser(platformId))
|
|
1286
|
-
return response;
|
|
1287
|
-
clearInterval(request.interval);
|
|
1288
|
-
return response;
|
|
1289
|
-
},
|
|
1290
|
-
},
|
|
1291
|
-
}),
|
|
1292
|
-
deps: [Firestore, PLATFORM_ID],
|
|
1293
|
-
},
|
|
1294
1046
|
{
|
|
1295
1047
|
provide: 'BeautyProfileRepository',
|
|
1296
|
-
useFactory: (
|
|
1297
|
-
return new UserBeautyProfileFirestoreRepository(
|
|
1048
|
+
useFactory: (firestore, userRepository) => {
|
|
1049
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1298
1050
|
},
|
|
1299
|
-
deps: [
|
|
1051
|
+
deps: [Firestore, 'UserRepository'],
|
|
1300
1052
|
},
|
|
1301
1053
|
{
|
|
1302
1054
|
provide: 'Buy2WinRepository',
|
|
1303
|
-
useFactory: (
|
|
1304
|
-
return new Buy2WinFirestoreRepository(
|
|
1055
|
+
useFactory: (firestore) => {
|
|
1056
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1305
1057
|
},
|
|
1306
|
-
deps: [
|
|
1058
|
+
deps: [Firestore],
|
|
1307
1059
|
},
|
|
1308
1060
|
{
|
|
1309
1061
|
provide: CategoryFirestoreRepository,
|
|
1310
|
-
useFactory: (
|
|
1311
|
-
return new CategoryFirestoreRepository(
|
|
1062
|
+
useFactory: (firestore) => {
|
|
1063
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1312
1064
|
},
|
|
1313
|
-
deps: [
|
|
1065
|
+
deps: [Firestore],
|
|
1314
1066
|
},
|
|
1315
1067
|
{
|
|
1316
1068
|
provide: 'CheckoutRepository',
|
|
1317
|
-
useFactory: (
|
|
1318
|
-
return new CheckoutFirestoreRepository(
|
|
1069
|
+
useFactory: (firestore) => {
|
|
1070
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1319
1071
|
},
|
|
1320
|
-
deps: [
|
|
1072
|
+
deps: [Firestore],
|
|
1321
1073
|
},
|
|
1322
1074
|
{
|
|
1323
1075
|
provide: 'CheckoutSubscriptionRepository',
|
|
1324
|
-
useFactory: (
|
|
1325
|
-
return new CheckoutSubscriptionFirestoreRepository(
|
|
1076
|
+
useFactory: (firestore) => {
|
|
1077
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1326
1078
|
},
|
|
1327
|
-
deps: [
|
|
1079
|
+
deps: [Firestore],
|
|
1328
1080
|
},
|
|
1329
1081
|
{
|
|
1330
1082
|
provide: 'CouponRepository',
|
|
1331
|
-
useFactory: (
|
|
1332
|
-
return new CouponFirestoreRepository(
|
|
1333
|
-
},
|
|
1334
|
-
deps: ['FirestoreOptions'],
|
|
1335
|
-
},
|
|
1336
|
-
{
|
|
1337
|
-
provide: 'CampaignHashtagRepository',
|
|
1338
|
-
useFactory: (options) => {
|
|
1339
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
1340
|
-
},
|
|
1341
|
-
deps: ['FirestoreOptions'],
|
|
1342
|
-
},
|
|
1343
|
-
{
|
|
1344
|
-
provide: 'CampaignDashboardRepository',
|
|
1345
|
-
useFactory: (options) => {
|
|
1346
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
1083
|
+
useFactory: (firestore) => {
|
|
1084
|
+
return new CouponFirestoreRepository(firestore);
|
|
1347
1085
|
},
|
|
1348
|
-
deps: [
|
|
1086
|
+
deps: [Firestore],
|
|
1349
1087
|
},
|
|
1350
1088
|
{
|
|
1351
1089
|
provide: 'EditionRepository',
|
|
1352
|
-
useFactory: (
|
|
1353
|
-
return new SubscriptionEditionFirestoreRepository(
|
|
1090
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1091
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1354
1092
|
},
|
|
1355
|
-
deps: [
|
|
1093
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1356
1094
|
},
|
|
1357
1095
|
{
|
|
1358
1096
|
provide: 'HomeRepository',
|
|
1359
|
-
useFactory: (
|
|
1360
|
-
return new HomeFirestoreRepository(
|
|
1097
|
+
useFactory: (firestore) => {
|
|
1098
|
+
return new HomeFirestoreRepository(firestore);
|
|
1361
1099
|
},
|
|
1362
|
-
deps: [
|
|
1100
|
+
deps: [Firestore],
|
|
1363
1101
|
},
|
|
1364
1102
|
{
|
|
1365
1103
|
provide: 'LeadRepository',
|
|
1366
|
-
useFactory: (
|
|
1367
|
-
return new LeadFirestoreRepository(
|
|
1104
|
+
useFactory: (firestore) => {
|
|
1105
|
+
return new LeadFirestoreRepository(firestore);
|
|
1368
1106
|
},
|
|
1369
|
-
deps: [
|
|
1107
|
+
deps: [Firestore],
|
|
1370
1108
|
},
|
|
1371
1109
|
{
|
|
1372
1110
|
provide: 'LegacyOrderRepository',
|
|
1373
|
-
useFactory: (
|
|
1374
|
-
return new LegacyOrderFirestoreRepository(
|
|
1111
|
+
useFactory: (firestore) => {
|
|
1112
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1375
1113
|
},
|
|
1376
|
-
deps: [
|
|
1114
|
+
deps: [Firestore],
|
|
1377
1115
|
},
|
|
1378
1116
|
{
|
|
1379
1117
|
provide: 'ShopMenuRepository',
|
|
1380
|
-
useFactory: (
|
|
1381
|
-
return new ShopMenuFirestoreRepository(
|
|
1118
|
+
useFactory: (firestore) => {
|
|
1119
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1382
1120
|
},
|
|
1383
|
-
deps: [
|
|
1121
|
+
deps: [Firestore],
|
|
1384
1122
|
},
|
|
1385
1123
|
{
|
|
1386
1124
|
provide: 'OrderRepository',
|
|
1387
|
-
useFactory: (
|
|
1388
|
-
return new OrderFirestoreRepository(
|
|
1125
|
+
useFactory: (firestore) => {
|
|
1126
|
+
return new OrderFirestoreRepository(firestore);
|
|
1389
1127
|
},
|
|
1390
|
-
deps: [
|
|
1128
|
+
deps: [Firestore],
|
|
1391
1129
|
},
|
|
1392
1130
|
{
|
|
1393
1131
|
provide: 'PaymentRepository',
|
|
1394
|
-
useFactory: (
|
|
1395
|
-
return new PaymentFirestoreRepository(
|
|
1132
|
+
useFactory: (firestore) => {
|
|
1133
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1396
1134
|
},
|
|
1397
|
-
deps: [
|
|
1135
|
+
deps: [Firestore],
|
|
1398
1136
|
},
|
|
1399
1137
|
{
|
|
1400
1138
|
provide: ProductFirestoreRepository,
|
|
1401
|
-
useFactory: (
|
|
1402
|
-
return new ProductFirestoreRepository(
|
|
1139
|
+
useFactory: (firestore) => {
|
|
1140
|
+
return new ProductFirestoreRepository(firestore);
|
|
1403
1141
|
},
|
|
1404
|
-
deps: [
|
|
1405
|
-
},
|
|
1406
|
-
{
|
|
1407
|
-
provide: 'ShopSettingsRepository',
|
|
1408
|
-
useFactory: (options) => {
|
|
1409
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
1410
|
-
},
|
|
1411
|
-
deps: ['FirestoreOptions'],
|
|
1142
|
+
deps: [Firestore],
|
|
1412
1143
|
},
|
|
1413
1144
|
{
|
|
1414
1145
|
provide: 'SubscriptionPaymentRepository',
|
|
1415
|
-
useFactory: (
|
|
1416
|
-
return new SubscriptionPaymentFirestoreRepository(
|
|
1146
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1147
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1417
1148
|
},
|
|
1418
|
-
deps: [
|
|
1149
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1419
1150
|
},
|
|
1420
1151
|
{
|
|
1421
1152
|
provide: 'SubscriptionPlanRepository',
|
|
1422
|
-
useFactory: (
|
|
1423
|
-
return new SubscriptionPlanFirestoreRepository(
|
|
1153
|
+
useFactory: (firestore) => {
|
|
1154
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1424
1155
|
},
|
|
1425
|
-
deps: [
|
|
1156
|
+
deps: [Firestore],
|
|
1426
1157
|
},
|
|
1427
1158
|
{
|
|
1428
1159
|
provide: 'SubscriptionProductRepository',
|
|
1429
|
-
useFactory: (
|
|
1430
|
-
return new SubscriptionProductFirestoreRepository(
|
|
1160
|
+
useFactory: (firestore) => {
|
|
1161
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1431
1162
|
},
|
|
1432
|
-
deps: [
|
|
1163
|
+
deps: [Firestore],
|
|
1433
1164
|
},
|
|
1434
1165
|
{
|
|
1435
1166
|
provide: 'SubscriptionRepository',
|
|
1436
|
-
useFactory: (
|
|
1437
|
-
return new SubscriptionFirestoreRepository(
|
|
1167
|
+
useFactory: (firestore) => {
|
|
1168
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1438
1169
|
},
|
|
1439
|
-
deps: [
|
|
1170
|
+
deps: [Firestore],
|
|
1440
1171
|
},
|
|
1441
1172
|
{
|
|
1442
1173
|
provide: 'UserRepository',
|
|
1443
|
-
useFactory: (
|
|
1444
|
-
return new UserFirestoreRepository(
|
|
1174
|
+
useFactory: (firestore) => {
|
|
1175
|
+
return new UserFirestoreRepository(firestore);
|
|
1445
1176
|
},
|
|
1446
|
-
deps: [
|
|
1177
|
+
deps: [Firestore],
|
|
1447
1178
|
},
|
|
1448
1179
|
{
|
|
1449
1180
|
provide: 'UserAddressRepository',
|
|
1450
|
-
useFactory: (
|
|
1451
|
-
return new UserAddressFirestoreRepository(
|
|
1181
|
+
useFactory: (firestore, userRepository) => {
|
|
1182
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1452
1183
|
},
|
|
1453
|
-
deps: [
|
|
1184
|
+
deps: [Firestore, 'UserRepository'],
|
|
1454
1185
|
},
|
|
1455
1186
|
{
|
|
1456
1187
|
provide: 'UserPaymentMethodRepository',
|
|
1457
|
-
useFactory: (
|
|
1458
|
-
return new UserPaymentMethodFirestoreRepository(
|
|
1188
|
+
useFactory: (firestore, userRepository) => {
|
|
1189
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1459
1190
|
},
|
|
1460
|
-
deps: [
|
|
1191
|
+
deps: [Firestore, 'UserRepository'],
|
|
1461
1192
|
},
|
|
1462
1193
|
{
|
|
1463
1194
|
provide: ProductVariantFirestoreRepository,
|
|
1464
|
-
useFactory: (
|
|
1465
|
-
return new ProductVariantFirestoreRepository(
|
|
1195
|
+
useFactory: (firestore, productRepository) => {
|
|
1196
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1466
1197
|
},
|
|
1467
|
-
deps: [
|
|
1198
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1468
1199
|
},
|
|
1469
1200
|
],
|
|
1470
1201
|
}]
|
|
@@ -1483,23 +1214,13 @@ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.
|
|
|
1483
1214
|
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
1484
1215
|
{
|
|
1485
1216
|
provide: 'HasuraConfig',
|
|
1486
|
-
useFactory: (options
|
|
1217
|
+
useFactory: (options) => ({
|
|
1487
1218
|
endpoint: options.endpoint,
|
|
1488
1219
|
authOptions: options.credentials,
|
|
1489
1220
|
interceptors: {
|
|
1490
1221
|
request: (request) => {
|
|
1491
|
-
if (isPlatformBrowser(platformId))
|
|
1492
|
-
return request;
|
|
1493
|
-
const interval = setInterval(() => { }, 100);
|
|
1494
|
-
request.interval = interval;
|
|
1495
1222
|
return request;
|
|
1496
1223
|
},
|
|
1497
|
-
response: (response, request) => {
|
|
1498
|
-
if (isPlatformBrowser(platformId))
|
|
1499
|
-
return response;
|
|
1500
|
-
clearInterval(request.interval);
|
|
1501
|
-
return response;
|
|
1502
|
-
},
|
|
1503
1224
|
},
|
|
1504
1225
|
}),
|
|
1505
1226
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1510,10 +1231,11 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1510
1231
|
},
|
|
1511
1232
|
{
|
|
1512
1233
|
provide: CategoryHasuraGraphQLRepository,
|
|
1513
|
-
useFactory: (options, productRepository,
|
|
1514
|
-
|
|
1234
|
+
useFactory: (options, productRepository, eta) => {
|
|
1235
|
+
console.log(eta);
|
|
1236
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1515
1237
|
},
|
|
1516
|
-
deps: [
|
|
1238
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1517
1239
|
},
|
|
1518
1240
|
{
|
|
1519
1241
|
provide: 'ProductRepository',
|
|
@@ -1521,10 +1243,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1521
1243
|
},
|
|
1522
1244
|
{
|
|
1523
1245
|
provide: ProductHasuraGraphQLRepository,
|
|
1524
|
-
useFactory: (
|
|
1525
|
-
return new ProductHasuraGraphQLRepository(
|
|
1246
|
+
useFactory: (options) => {
|
|
1247
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1526
1248
|
},
|
|
1527
|
-
deps: [
|
|
1249
|
+
deps: [HASURA_OPTIONS],
|
|
1528
1250
|
},
|
|
1529
1251
|
{
|
|
1530
1252
|
provide: 'VariantRepository',
|
|
@@ -1532,43 +1254,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1532
1254
|
},
|
|
1533
1255
|
{
|
|
1534
1256
|
provide: VariantHasuraGraphQLRepository,
|
|
1535
|
-
useFactory: (hasuraConfig) => {
|
|
1536
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1537
|
-
},
|
|
1538
|
-
deps: ['HasuraConfig'],
|
|
1539
|
-
},
|
|
1540
|
-
{
|
|
1541
|
-
provide: 'CategoryFilterRepository',
|
|
1542
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1543
|
-
},
|
|
1544
|
-
{
|
|
1545
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1546
1257
|
useFactory: (options) => {
|
|
1547
|
-
return new
|
|
1258
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1548
1259
|
},
|
|
1549
|
-
deps: [
|
|
1550
|
-
},
|
|
1551
|
-
{
|
|
1552
|
-
provide: 'FilterOptionRepository',
|
|
1553
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1557
|
-
useFactory: (options) => {
|
|
1558
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
1559
|
-
},
|
|
1560
|
-
deps: ['HasuraConfig'],
|
|
1561
|
-
},
|
|
1562
|
-
{
|
|
1563
|
-
provide: 'FilterRepository',
|
|
1564
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1565
|
-
},
|
|
1566
|
-
{
|
|
1567
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1568
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1569
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1570
|
-
},
|
|
1571
|
-
deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1260
|
+
deps: [HASURA_OPTIONS],
|
|
1572
1261
|
},
|
|
1573
1262
|
] });
|
|
1574
1263
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
@@ -1577,23 +1266,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1577
1266
|
providers: [
|
|
1578
1267
|
{
|
|
1579
1268
|
provide: 'HasuraConfig',
|
|
1580
|
-
useFactory: (options
|
|
1269
|
+
useFactory: (options) => ({
|
|
1581
1270
|
endpoint: options.endpoint,
|
|
1582
1271
|
authOptions: options.credentials,
|
|
1583
1272
|
interceptors: {
|
|
1584
1273
|
request: (request) => {
|
|
1585
|
-
if (isPlatformBrowser(platformId))
|
|
1586
|
-
return request;
|
|
1587
|
-
const interval = setInterval(() => { }, 100);
|
|
1588
|
-
request.interval = interval;
|
|
1589
1274
|
return request;
|
|
1590
1275
|
},
|
|
1591
|
-
response: (response, request) => {
|
|
1592
|
-
if (isPlatformBrowser(platformId))
|
|
1593
|
-
return response;
|
|
1594
|
-
clearInterval(request.interval);
|
|
1595
|
-
return response;
|
|
1596
|
-
},
|
|
1597
1276
|
},
|
|
1598
1277
|
}),
|
|
1599
1278
|
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
@@ -1604,10 +1283,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1604
1283
|
},
|
|
1605
1284
|
{
|
|
1606
1285
|
provide: CategoryHasuraGraphQLRepository,
|
|
1607
|
-
useFactory: (options, productRepository,
|
|
1608
|
-
|
|
1286
|
+
useFactory: (options, productRepository, eta) => {
|
|
1287
|
+
console.log(eta);
|
|
1288
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1609
1289
|
},
|
|
1610
|
-
deps: [
|
|
1290
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository, PLATFORM_ID],
|
|
1611
1291
|
},
|
|
1612
1292
|
{
|
|
1613
1293
|
provide: 'ProductRepository',
|
|
@@ -1615,10 +1295,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1615
1295
|
},
|
|
1616
1296
|
{
|
|
1617
1297
|
provide: ProductHasuraGraphQLRepository,
|
|
1618
|
-
useFactory: (
|
|
1619
|
-
return new ProductHasuraGraphQLRepository(
|
|
1298
|
+
useFactory: (options) => {
|
|
1299
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1620
1300
|
},
|
|
1621
|
-
deps: [
|
|
1301
|
+
deps: [HASURA_OPTIONS],
|
|
1622
1302
|
},
|
|
1623
1303
|
{
|
|
1624
1304
|
provide: 'VariantRepository',
|
|
@@ -1626,43 +1306,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1626
1306
|
},
|
|
1627
1307
|
{
|
|
1628
1308
|
provide: VariantHasuraGraphQLRepository,
|
|
1629
|
-
useFactory: (hasuraConfig) => {
|
|
1630
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1631
|
-
},
|
|
1632
|
-
deps: ['HasuraConfig'],
|
|
1633
|
-
},
|
|
1634
|
-
{
|
|
1635
|
-
provide: 'CategoryFilterRepository',
|
|
1636
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1637
|
-
},
|
|
1638
|
-
{
|
|
1639
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1640
|
-
useFactory: (options) => {
|
|
1641
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
1642
|
-
},
|
|
1643
|
-
deps: ['HasuraConfig'],
|
|
1644
|
-
},
|
|
1645
|
-
{
|
|
1646
|
-
provide: 'FilterOptionRepository',
|
|
1647
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1648
|
-
},
|
|
1649
|
-
{
|
|
1650
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1651
1309
|
useFactory: (options) => {
|
|
1652
|
-
return new
|
|
1653
|
-
},
|
|
1654
|
-
deps: ['HasuraConfig'],
|
|
1655
|
-
},
|
|
1656
|
-
{
|
|
1657
|
-
provide: 'FilterRepository',
|
|
1658
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1659
|
-
},
|
|
1660
|
-
{
|
|
1661
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1662
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1663
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1310
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1664
1311
|
},
|
|
1665
|
-
deps: [
|
|
1312
|
+
deps: [HASURA_OPTIONS],
|
|
1666
1313
|
},
|
|
1667
1314
|
],
|
|
1668
1315
|
}]
|
|
@@ -1678,7 +1325,6 @@ class AngularConnectModule {
|
|
|
1678
1325
|
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1679
1326
|
...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1680
1327
|
...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
1681
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
1682
1328
|
],
|
|
1683
1329
|
};
|
|
1684
1330
|
}
|
|
@@ -1693,7 +1339,6 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
1693
1339
|
CouponService,
|
|
1694
1340
|
HomeShopService,
|
|
1695
1341
|
OrderService,
|
|
1696
|
-
ShippingService,
|
|
1697
1342
|
], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
1698
1343
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1699
1344
|
type: NgModule,
|
|
@@ -1707,7 +1352,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1707
1352
|
CouponService,
|
|
1708
1353
|
HomeShopService,
|
|
1709
1354
|
OrderService,
|
|
1710
|
-
ShippingService,
|
|
1711
1355
|
],
|
|
1712
1356
|
}]
|
|
1713
1357
|
}] });
|
|
@@ -1716,5 +1360,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1716
1360
|
* Generated bundle index. Do not edit.
|
|
1717
1361
|
*/
|
|
1718
1362
|
|
|
1719
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService
|
|
1363
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
1720
1364
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|