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