@infrab4a/connect-angular 3.5.3 → 3.6.0-beta.0
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/bundles/infrab4a-connect-angular.umd.js +305 -420
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/consts/index.d.ts +0 -1
- package/esm2015/angular-connect.module.js +3 -6
- package/esm2015/angular-firestore.module.js +31 -3
- package/esm2015/angular-hasura-graphql.module.js +8 -74
- package/esm2015/consts/index.js +1 -2
- package/esm2015/services/coupon.service.js +41 -26
- package/esm2015/services/home-shop.service.js +22 -25
- package/esm2015/services/index.js +3 -4
- package/fesm2015/infrab4a-connect-angular.js +125 -245
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/package.json +2 -2
- package/services/index.d.ts +2 -3
- package/consts/backend-url.const.d.ts +0 -1
- package/esm2015/consts/backend-url.const.js +0 -2
- package/esm2015/services/shipping.service.js +0 -98
- package/esm2015/services/types/shipping-methods.type.js +0 -2
- package/services/shipping.service.d.ts +0 -19
- package/services/types/shipping-methods.type.d.ts +0 -12
|
@@ -5,13 +5,12 @@ import { AngularFireAuth } from '@angular/fire/auth';
|
|
|
5
5
|
import { of, combineLatest, from, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
6
6
|
import { catchError, map, mergeMap, concatMap, tap } from 'rxjs/operators';
|
|
7
7
|
import { __awaiter } from 'tslib';
|
|
8
|
-
import * as
|
|
9
|
-
import { Coupon, Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Category, Product, RequiredArgumentError, add,
|
|
8
|
+
import * as i2 from '@infrab4a/connect';
|
|
9
|
+
import { Coupon, 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, CampaignHashtagFirestoreRepository, CampaignDashboardFirestoreRepository, 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
|
-
import * as i1$
|
|
12
|
+
import * as i1$1 from '@angular/fire/firestore';
|
|
13
13
|
import { AngularFirestore } from '@angular/fire/firestore';
|
|
14
|
-
import * as i1$3 from '@angular/common/http';
|
|
15
14
|
import { FIREBASE_OPTIONS, FIREBASE_APP_NAME, AngularFireModule } from '@angular/fire';
|
|
16
15
|
|
|
17
16
|
class AuthService {
|
|
@@ -50,8 +49,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
50
49
|
args: ['UserRepository']
|
|
51
50
|
}] }]; } });
|
|
52
51
|
|
|
53
|
-
const BACKEND_URL = 'BACKEND_URL';
|
|
54
|
-
|
|
55
52
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
56
53
|
|
|
57
54
|
const ES_CONFIG = 'ES_CONFIG';
|
|
@@ -164,7 +161,7 @@ class CouponService {
|
|
|
164
161
|
// Verifica o limite de uso geral por usuario
|
|
165
162
|
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
166
163
|
throw new InvalidCouponError('Limite de uso atingido.');
|
|
167
|
-
const validUser = this.userValidationAndSubscriptionStatus(coupon,
|
|
164
|
+
const validUser = yield this.userValidationAndSubscriptionStatus(coupon, userEmail);
|
|
168
165
|
if (!validUser)
|
|
169
166
|
throw new InvalidCouponError('Usuário não elegível.');
|
|
170
167
|
const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
|
|
@@ -209,7 +206,7 @@ class CouponService {
|
|
|
209
206
|
lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter((i) => {
|
|
210
207
|
var _a;
|
|
211
208
|
if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
|
|
212
|
-
return i.categories.some((c) => couponCategories.some(
|
|
209
|
+
return i.categories.some((c) => couponCategories.some(cat => (cat.id == c || cat.firestoreId == c)));
|
|
213
210
|
}
|
|
214
211
|
return true;
|
|
215
212
|
});
|
|
@@ -249,41 +246,56 @@ class CouponService {
|
|
|
249
246
|
return true;
|
|
250
247
|
}
|
|
251
248
|
const couponCategories = yield this.getCouponCategoriesId(coupon);
|
|
252
|
-
const hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(
|
|
249
|
+
const hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(i => {
|
|
253
250
|
var _a;
|
|
254
251
|
if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
255
252
|
return true;
|
|
256
|
-
return i.categories.some((c) => couponCategories.some(
|
|
253
|
+
return i.categories.some((c) => couponCategories.some(cat => (cat.id == c || cat.firestoreId == c)));
|
|
257
254
|
});
|
|
258
255
|
return hasCategories.length ? true : false;
|
|
259
256
|
});
|
|
260
257
|
}
|
|
261
|
-
userValidationAndSubscriptionStatus(coupon,
|
|
262
|
-
|
|
258
|
+
userValidationAndSubscriptionStatus(coupon, userEmail) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
// Verifica se o email do usuário é coorporativo
|
|
261
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
262
|
+
throw new InvalidCouponError('Você não é colaborador.');
|
|
263
|
+
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
264
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
|
|
265
|
+
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
266
|
+
const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
|
|
267
|
+
coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
|
|
268
|
+
coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
|
|
269
|
+
if (couponRuleSubscription && userEmail) {
|
|
270
|
+
const sub = yield this.subscriptionRepository
|
|
271
|
+
.find({
|
|
272
|
+
filters: {
|
|
273
|
+
user: {
|
|
274
|
+
email: { operator: Where.EQUALS, value: userEmail },
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
})
|
|
278
|
+
.then((sub) => sub.data);
|
|
279
|
+
const activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter((s) => s.status === Status.ACTIVE);
|
|
280
|
+
switch (coupon.exclusivityType) {
|
|
281
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
282
|
+
return activeSubs.length > 0;
|
|
283
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
284
|
+
return activeSubs.length === 0;
|
|
285
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
286
|
+
return sub.length === 0;
|
|
287
|
+
default:
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
263
291
|
return true;
|
|
264
|
-
|
|
265
|
-
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
266
|
-
throw new InvalidCouponError('Você não é colaborador.');
|
|
267
|
-
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
268
|
-
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
269
|
-
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
270
|
-
switch (coupon.exclusivityType) {
|
|
271
|
-
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
272
|
-
return user.isSubscriber ? true : false;
|
|
273
|
-
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
274
|
-
return user.isSubscriber ? false : true;
|
|
275
|
-
case Exclusivities.NON_SUBSCRIBER:
|
|
276
|
-
return user.isSubscriber ? false : true;
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
292
|
+
});
|
|
279
293
|
}
|
|
280
294
|
getCouponCategoriesId(coupon) {
|
|
281
295
|
return __awaiter(this, void 0, void 0, function* () {
|
|
282
296
|
let couponCategories = [];
|
|
283
297
|
for (let index = 0; index < coupon.productsCategories.length; index++) {
|
|
284
|
-
let c = yield this.categoryRepository.get({
|
|
285
|
-
id: coupon.productsCategories[index],
|
|
286
|
-
});
|
|
298
|
+
let c = yield this.categoryRepository.get({ id: coupon.productsCategories[index] });
|
|
287
299
|
couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
|
|
288
300
|
}
|
|
289
301
|
return couponCategories;
|
|
@@ -300,7 +312,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
300
312
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
301
313
|
type: Inject,
|
|
302
314
|
args: ['CouponRepository']
|
|
303
|
-
}] }, { type:
|
|
315
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
304
316
|
type: Inject,
|
|
305
317
|
args: [DEFAULT_SHOP]
|
|
306
318
|
}] }, { type: undefined, decorators: [{
|
|
@@ -373,7 +385,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
373
385
|
}] }, { type: undefined, decorators: [{
|
|
374
386
|
type: Inject,
|
|
375
387
|
args: ['UserRepository']
|
|
376
|
-
}] }, { type:
|
|
388
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
377
389
|
type: Inject,
|
|
378
390
|
args: [DEFAULT_SHOP]
|
|
379
391
|
}] }]; } });
|
|
@@ -506,7 +518,7 @@ CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12
|
|
|
506
518
|
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService });
|
|
507
519
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, decorators: [{
|
|
508
520
|
type: Injectable
|
|
509
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
521
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
510
522
|
type: Inject,
|
|
511
523
|
args: [DEFAULT_SHOP]
|
|
512
524
|
}] }, { type: undefined, decorators: [{
|
|
@@ -556,34 +568,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
556
568
|
args: ['SubscriptionRepository']
|
|
557
569
|
}] }, { type: CouponService }]; } });
|
|
558
570
|
|
|
571
|
+
class OrderService {
|
|
572
|
+
constructor(angularFirestore, orderRepository) {
|
|
573
|
+
this.angularFirestore = angularFirestore;
|
|
574
|
+
this.orderRepository = orderRepository;
|
|
575
|
+
this.orderSubject = new Subject();
|
|
576
|
+
}
|
|
577
|
+
getOrder(id) {
|
|
578
|
+
this.angularFirestore
|
|
579
|
+
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
580
|
+
.valueChanges()
|
|
581
|
+
.pipe(map((doc) => Order.toInstance(doc)))
|
|
582
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
583
|
+
return this.orderSubject;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: i1$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
587
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
589
|
+
type: Injectable
|
|
590
|
+
}], ctorParameters: function () { return [{ type: i1$1.AngularFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
591
|
+
type: Inject,
|
|
592
|
+
args: ['OrderRepository']
|
|
593
|
+
}] }]; } });
|
|
594
|
+
|
|
559
595
|
class HomeShopService {
|
|
560
596
|
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
561
597
|
this.categoryRepository = categoryRepository;
|
|
562
598
|
this.homeRepository = homeRepository;
|
|
563
599
|
this.productRepository = productRepository;
|
|
564
600
|
this.defaultShop = defaultShop;
|
|
565
|
-
this.buildCategoryGroupWithRequiredData = (group) => {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
])))) || [],
|
|
585
|
-
});
|
|
586
|
-
};
|
|
601
|
+
this.buildCategoryGroupWithRequiredData = (group) => ({
|
|
602
|
+
category: Category.toInstance(pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
|
|
603
|
+
products: group.products.map((product) => Product.toInstance(pick(product.toPlain(), [
|
|
604
|
+
'id',
|
|
605
|
+
'price',
|
|
606
|
+
'reviews',
|
|
607
|
+
'hasVariants',
|
|
608
|
+
'slug',
|
|
609
|
+
'sku',
|
|
610
|
+
'stock',
|
|
611
|
+
'costPrice',
|
|
612
|
+
'images',
|
|
613
|
+
'miniatures',
|
|
614
|
+
'name',
|
|
615
|
+
'weight',
|
|
616
|
+
'rate',
|
|
617
|
+
'type'
|
|
618
|
+
]))),
|
|
619
|
+
});
|
|
587
620
|
}
|
|
588
621
|
get homeId() {
|
|
589
622
|
if (this.defaultShop === Shops.GLAMSHOP)
|
|
@@ -614,7 +647,7 @@ class HomeShopService {
|
|
|
614
647
|
}));
|
|
615
648
|
}
|
|
616
649
|
getMinValueForFreeShipping() {
|
|
617
|
-
return this.getHomeConfiguration().pipe(map(
|
|
650
|
+
return this.getHomeConfiguration().pipe(map(home => home.minValueForFreeShipping));
|
|
618
651
|
}
|
|
619
652
|
getDiscoverProducts() {
|
|
620
653
|
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
@@ -660,123 +693,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
660
693
|
}] }, { type: undefined, decorators: [{
|
|
661
694
|
type: Inject,
|
|
662
695
|
args: ['ProductRepository']
|
|
663
|
-
}] }, { type:
|
|
696
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
664
697
|
type: Inject,
|
|
665
698
|
args: [DEFAULT_SHOP]
|
|
666
699
|
}] }]; } });
|
|
667
700
|
|
|
668
|
-
class OrderService {
|
|
669
|
-
constructor(angularFirestore, orderRepository) {
|
|
670
|
-
this.angularFirestore = angularFirestore;
|
|
671
|
-
this.orderRepository = orderRepository;
|
|
672
|
-
this.orderSubject = new Subject();
|
|
673
|
-
}
|
|
674
|
-
getOrder(id) {
|
|
675
|
-
this.angularFirestore
|
|
676
|
-
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
677
|
-
.valueChanges()
|
|
678
|
-
.pipe(map((doc) => Order.toInstance(doc)))
|
|
679
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
680
|
-
return this.orderSubject;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: i1$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
684
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
685
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
686
|
-
type: Injectable
|
|
687
|
-
}], ctorParameters: function () { return [{ type: i1$2.AngularFirestore }, { type: i1$1.OrderFirestoreRepository, decorators: [{
|
|
688
|
-
type: Inject,
|
|
689
|
-
args: ['OrderRepository']
|
|
690
|
-
}] }]; } });
|
|
691
|
-
|
|
692
|
-
class ShippingService {
|
|
693
|
-
constructor(http, apiUrl, homeService) {
|
|
694
|
-
this.http = http;
|
|
695
|
-
this.apiUrl = apiUrl;
|
|
696
|
-
this.homeService = homeService;
|
|
697
|
-
}
|
|
698
|
-
getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
699
|
-
return combineLatest([
|
|
700
|
-
this.homeService.getHomeData(),
|
|
701
|
-
this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
|
|
702
|
-
]).pipe(map(([datas, shippingMethodsResponse]) => {
|
|
703
|
-
let shippingMethods = shippingMethodsResponse.result;
|
|
704
|
-
if (!shippingMethods.length)
|
|
705
|
-
return [];
|
|
706
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
707
|
-
if (s.ShippingCompanyName == 'Same Day EG')
|
|
708
|
-
s.ShippingCompanyName = 'Same Day';
|
|
709
|
-
else
|
|
710
|
-
return s;
|
|
711
|
-
});
|
|
712
|
-
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
713
|
-
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
714
|
-
shippingMethods = shippingMethods.filter((method) => method.ShippingCompanyName !== 'Same Day');
|
|
715
|
-
}
|
|
716
|
-
if (totalPrice >= 200) {
|
|
717
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
718
|
-
if (s.serviceName !== 'Same Day')
|
|
719
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
720
|
-
else
|
|
721
|
-
return s;
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
if (shop == Shops.GLAMSHOP)
|
|
725
|
-
return shippingMethods;
|
|
726
|
-
if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
727
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
728
|
-
if (s.serviceName == 'Same Day')
|
|
729
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
730
|
-
else
|
|
731
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
735
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
736
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
return shippingMethods;
|
|
740
|
-
}));
|
|
741
|
-
}
|
|
742
|
-
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
743
|
-
if (!subscriptionPlan)
|
|
744
|
-
return false;
|
|
745
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
|
|
746
|
-
return true;
|
|
747
|
-
}
|
|
748
|
-
return false;
|
|
749
|
-
}
|
|
750
|
-
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
751
|
-
if (!subscriptionPlan)
|
|
752
|
-
return false;
|
|
753
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
754
|
-
return true;
|
|
755
|
-
}
|
|
756
|
-
return false;
|
|
757
|
-
}
|
|
758
|
-
isHolidays(datas) {
|
|
759
|
-
const today = new Date();
|
|
760
|
-
for (const key in datas) {
|
|
761
|
-
let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
|
|
762
|
-
let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
|
|
763
|
-
if (start > end)
|
|
764
|
-
end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
|
|
765
|
-
if (today >= start && today <= end)
|
|
766
|
-
return true;
|
|
767
|
-
}
|
|
768
|
-
return false;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
ShippingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: ShippingService, deps: [{ token: i1$3.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
772
|
-
ShippingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: ShippingService });
|
|
773
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: ShippingService, decorators: [{
|
|
774
|
-
type: Injectable
|
|
775
|
-
}], ctorParameters: function () { return [{ type: i1$3.HttpClient }, { type: undefined, decorators: [{
|
|
776
|
-
type: Inject,
|
|
777
|
-
args: [BACKEND_URL]
|
|
778
|
-
}] }, { type: HomeShopService }]; } });
|
|
779
|
-
|
|
780
701
|
class AngularFirebaseAuthModule {
|
|
781
702
|
static initializeApp(options, nameOrConfig) {
|
|
782
703
|
return {
|
|
@@ -976,6 +897,20 @@ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
976
897
|
},
|
|
977
898
|
deps: [AngularFirestore],
|
|
978
899
|
},
|
|
900
|
+
{
|
|
901
|
+
provide: 'CampaignHashtagRepository',
|
|
902
|
+
useFactory: (firestore) => {
|
|
903
|
+
return new CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
904
|
+
},
|
|
905
|
+
deps: [AngularFirestore],
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
provide: 'CampaignDashboardRepository',
|
|
909
|
+
useFactory: (firestore) => {
|
|
910
|
+
return new CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
911
|
+
},
|
|
912
|
+
deps: [AngularFirestore],
|
|
913
|
+
},
|
|
979
914
|
{
|
|
980
915
|
provide: 'EditionRepository',
|
|
981
916
|
useFactory: (firestore, subscriptionRepository) => {
|
|
@@ -1142,6 +1077,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1142
1077
|
},
|
|
1143
1078
|
deps: [AngularFirestore],
|
|
1144
1079
|
},
|
|
1080
|
+
{
|
|
1081
|
+
provide: 'CampaignHashtagRepository',
|
|
1082
|
+
useFactory: (firestore) => {
|
|
1083
|
+
return new CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
1084
|
+
},
|
|
1085
|
+
deps: [AngularFirestore],
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
provide: 'CampaignDashboardRepository',
|
|
1089
|
+
useFactory: (firestore) => {
|
|
1090
|
+
return new CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
1091
|
+
},
|
|
1092
|
+
deps: [AngularFirestore],
|
|
1093
|
+
},
|
|
1145
1094
|
{
|
|
1146
1095
|
provide: 'EditionRepository',
|
|
1147
1096
|
useFactory: (firestore, subscriptionRepository) => {
|
|
@@ -1281,10 +1230,10 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1281
1230
|
},
|
|
1282
1231
|
{
|
|
1283
1232
|
provide: CategoryHasuraGraphQLRepository,
|
|
1284
|
-
useFactory: (options, productRepository
|
|
1285
|
-
return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository
|
|
1233
|
+
useFactory: (options, productRepository) => {
|
|
1234
|
+
return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
|
|
1286
1235
|
},
|
|
1287
|
-
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository
|
|
1236
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
|
|
1288
1237
|
},
|
|
1289
1238
|
{
|
|
1290
1239
|
provide: 'ProductRepository',
|
|
@@ -1308,39 +1257,6 @@ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.
|
|
|
1308
1257
|
},
|
|
1309
1258
|
deps: [HASURA_OPTIONS],
|
|
1310
1259
|
},
|
|
1311
|
-
{
|
|
1312
|
-
provide: 'CategoryFilterRepository',
|
|
1313
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1314
|
-
},
|
|
1315
|
-
{
|
|
1316
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1317
|
-
useFactory: (options) => {
|
|
1318
|
-
return new CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1319
|
-
},
|
|
1320
|
-
deps: [HASURA_OPTIONS],
|
|
1321
|
-
},
|
|
1322
|
-
{
|
|
1323
|
-
provide: 'FilterOptionRepository',
|
|
1324
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1328
|
-
useFactory: (options) => {
|
|
1329
|
-
return new FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1330
|
-
},
|
|
1331
|
-
deps: [HASURA_OPTIONS],
|
|
1332
|
-
},
|
|
1333
|
-
{
|
|
1334
|
-
provide: 'FilterRepository',
|
|
1335
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1336
|
-
},
|
|
1337
|
-
{
|
|
1338
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1339
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1340
|
-
return new FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
1341
|
-
},
|
|
1342
|
-
deps: [HASURA_OPTIONS, FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1343
|
-
},
|
|
1344
1260
|
] });
|
|
1345
1261
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
1346
1262
|
type: NgModule,
|
|
@@ -1352,10 +1268,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1352
1268
|
},
|
|
1353
1269
|
{
|
|
1354
1270
|
provide: CategoryHasuraGraphQLRepository,
|
|
1355
|
-
useFactory: (options, productRepository
|
|
1356
|
-
return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository
|
|
1271
|
+
useFactory: (options, productRepository) => {
|
|
1272
|
+
return new CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
|
|
1357
1273
|
},
|
|
1358
|
-
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository
|
|
1274
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
|
|
1359
1275
|
},
|
|
1360
1276
|
{
|
|
1361
1277
|
provide: 'ProductRepository',
|
|
@@ -1379,39 +1295,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1379
1295
|
},
|
|
1380
1296
|
deps: [HASURA_OPTIONS],
|
|
1381
1297
|
},
|
|
1382
|
-
{
|
|
1383
|
-
provide: 'CategoryFilterRepository',
|
|
1384
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
1385
|
-
},
|
|
1386
|
-
{
|
|
1387
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
1388
|
-
useFactory: (options) => {
|
|
1389
|
-
return new CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1390
|
-
},
|
|
1391
|
-
deps: [HASURA_OPTIONS],
|
|
1392
|
-
},
|
|
1393
|
-
{
|
|
1394
|
-
provide: 'FilterOptionRepository',
|
|
1395
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
1396
|
-
},
|
|
1397
|
-
{
|
|
1398
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
1399
|
-
useFactory: (options) => {
|
|
1400
|
-
return new FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
1401
|
-
},
|
|
1402
|
-
deps: [HASURA_OPTIONS],
|
|
1403
|
-
},
|
|
1404
|
-
{
|
|
1405
|
-
provide: 'FilterRepository',
|
|
1406
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
1407
|
-
},
|
|
1408
|
-
{
|
|
1409
|
-
provide: FilterHasuraGraphQLRepository,
|
|
1410
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1411
|
-
return new FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
1412
|
-
},
|
|
1413
|
-
deps: [HASURA_OPTIONS, FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
1414
|
-
},
|
|
1415
1298
|
],
|
|
1416
1299
|
}]
|
|
1417
1300
|
}] });
|
|
@@ -1426,7 +1309,6 @@ class AngularConnectModule {
|
|
|
1426
1309
|
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1427
1310
|
...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1428
1311
|
...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
1429
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
1430
1312
|
],
|
|
1431
1313
|
};
|
|
1432
1314
|
}
|
|
@@ -1441,7 +1323,6 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
|
|
|
1441
1323
|
CouponService,
|
|
1442
1324
|
HomeShopService,
|
|
1443
1325
|
OrderService,
|
|
1444
|
-
ShippingService,
|
|
1445
1326
|
], imports: [[AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
1446
1327
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1447
1328
|
type: NgModule,
|
|
@@ -1455,7 +1336,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1455
1336
|
CouponService,
|
|
1456
1337
|
HomeShopService,
|
|
1457
1338
|
OrderService,
|
|
1458
|
-
ShippingService,
|
|
1459
1339
|
],
|
|
1460
1340
|
}]
|
|
1461
1341
|
}] });
|
|
@@ -1464,5 +1344,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
1464
1344
|
* Generated bundle index. Do not edit.
|
|
1465
1345
|
*/
|
|
1466
1346
|
|
|
1467
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService
|
|
1347
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
1468
1348
|
//# sourceMappingURL=infrab4a-connect-angular.js.map
|