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