@infrab4a/connect-angular 0.13.0-beta.8 → 0.13.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/bundles/infrab4a-connect-angular.umd.js +434 -299
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/lib/angular-connect.module.js +8 -9
- package/esm2015/lib/angular-firebase-auth.module.js +33 -23
- package/esm2015/lib/angular-firestore.module.js +94 -96
- package/esm2015/lib/services/auth.service.js +13 -16
- package/esm2015/lib/services/cart.service.js +6 -2
- package/esm2015/lib/services/checkout-subscription.service.js +37 -6
- package/esm2015/lib/services/checkout.service.js +3 -3
- package/esm2015/lib/services/coupon.service.js +29 -10
- package/esm2015/lib/services/errors/group-invalid-coupon.error.js +7 -0
- package/esm2015/lib/services/errors/index.js +2 -1
- package/esm2015/lib/services/home-shop.service.js +106 -0
- package/esm2015/lib/services/index.js +2 -1
- package/esm2015/lib/services/order.service.js +13 -11
- package/fesm2015/infrab4a-connect-angular.js +397 -286
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/lib/angular-connect.module.d.ts +4 -4
- package/lib/angular-firebase-auth.module.d.ts +4 -4
- package/lib/angular-firestore.module.d.ts +4 -3
- package/lib/services/auth.service.d.ts +3 -5
- package/lib/services/checkout-subscription.service.d.ts +7 -2
- package/lib/services/coupon.service.d.ts +3 -2
- package/lib/services/errors/group-invalid-coupon.error.d.ts +5 -0
- package/lib/services/errors/index.d.ts +1 -0
- package/lib/services/home-shop.service.d.ts +24 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/order.service.d.ts +3 -3
- package/package.json +4 -3
- package/esm2015/lib/factories/firebase-app.factory.js +0 -18
- package/esm2015/lib/factories/firebase-auth.factory.js +0 -2
- package/esm2015/lib/factories/firebase-firestore.factory.js +0 -2
- package/esm2015/lib/providers/firebase-app.provider.js +0 -12
- package/esm2015/lib/providers/firebase-auth.provider.js +0 -15
- package/esm2015/lib/providers/firebase-firestore.provider.js +0 -14
- package/esm2015/lib/providers/index.js +0 -4
- package/lib/factories/firebase-app.factory.d.ts +0 -4
- package/lib/factories/firebase-auth.factory.d.ts +0 -2
- package/lib/factories/firebase-firestore.factory.d.ts +0 -2
- package/lib/providers/firebase-app.provider.d.ts +0 -17
- package/lib/providers/firebase-auth.provider.d.ts +0 -11
- package/lib/providers/firebase-firestore.provider.d.ts +0 -10
- package/lib/providers/index.d.ts +0 -3
|
@@ -1,65 +1,25 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { Injectable, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/fire/auth';
|
|
4
|
+
import { AngularFireAuth } from '@angular/fire/auth';
|
|
5
|
+
import { of, combineLatest, from, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
4
6
|
import { catchError, map, mergeMap, concatMap, tap } from 'rxjs/operators';
|
|
5
|
-
import firebase$1 from 'firebase';
|
|
6
7
|
import * as i2 from '@infrab4a/connect';
|
|
7
|
-
import {
|
|
8
|
-
import firebase from 'firebase/app';
|
|
8
|
+
import { FinancialCoupon, Where, NotFoundError, Exclusivities, isNil, Checkout, CheckoutTypes, pick, LineItem, CouponTypes, CouponSubtypes, CheckoutSubscription, Order, Category, Product, Shops, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository } from '@infrab4a/connect';
|
|
9
9
|
import { __awaiter } from 'tslib';
|
|
10
10
|
import cookie from 'js-cookie';
|
|
11
|
+
import * as i1$1 from '@angular/fire/firestore';
|
|
12
|
+
import { AngularFirestore } from '@angular/fire/firestore';
|
|
13
|
+
import { FIREBASE_OPTIONS, FIREBASE_APP_NAME, AngularFireModule } from '@angular/fire';
|
|
11
14
|
|
|
12
|
-
const FirebaseAuthFactory = (app) => app.auth();
|
|
13
|
-
|
|
14
|
-
const FirebaseAppFactory = (options, zone, nameOrConfig) => {
|
|
15
|
-
const name = ((isString(nameOrConfig) && nameOrConfig) || '[DEFAULT]').toString();
|
|
16
|
-
const config = ((isObject(nameOrConfig) && nameOrConfig) || {});
|
|
17
|
-
config.name = config.name || name;
|
|
18
|
-
const existingApp = firebase.apps.filter((firebaseApp) => firebaseApp && firebaseApp.name === config.name)[0];
|
|
19
|
-
const app = existingApp || zone.runOutsideAngular(() => firebase.initializeApp(options, config));
|
|
20
|
-
try {
|
|
21
|
-
if (JSON.stringify(options) !== JSON.stringify(app.options)) {
|
|
22
|
-
console.error('error', `${app.name} Firebase App already initialized with different options : '.'
|
|
23
|
-
}`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (e) { }
|
|
27
|
-
return app;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const FIREBASE_OPTIONS = new InjectionToken('connect-angular.app.options');
|
|
31
|
-
const FIREBASE_APP_NAME = new InjectionToken('connect-angular.app.nameOrConfig');
|
|
32
|
-
class ConnectAngularFirebaseApp {
|
|
33
|
-
}
|
|
34
|
-
const FirebaseAppProvider = {
|
|
35
|
-
provide: ConnectAngularFirebaseApp,
|
|
36
|
-
useFactory: FirebaseAppFactory,
|
|
37
|
-
deps: [FIREBASE_OPTIONS, NgZone, [new Optional(), FIREBASE_APP_NAME]],
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
class ConnectAngularFirebaseAuth {
|
|
41
|
-
constructor() {
|
|
42
|
-
this.onAuthStateChanged = firebase$1.auth().onAuthStateChanged;
|
|
43
|
-
this.currentUser = firebase$1.auth().currentUser;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const FirebaseAuthProvider = {
|
|
47
|
-
provide: ConnectAngularFirebaseAuth,
|
|
48
|
-
useFactory: FirebaseAuthFactory,
|
|
49
|
-
deps: [ConnectAngularFirebaseApp],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const fromCallback = (cb, zone) => new Observable((subscriber) => ({ unsubscribe: zone.runOutsideAngular(() => cb(subscriber)) }));
|
|
53
15
|
class AuthService {
|
|
54
|
-
constructor(
|
|
55
|
-
this.
|
|
16
|
+
constructor(angularFireAuth, userRepository) {
|
|
17
|
+
this.angularFireAuth = angularFireAuth;
|
|
56
18
|
this.userRepository = userRepository;
|
|
57
|
-
this.zone = zone;
|
|
58
19
|
}
|
|
59
20
|
getAuthstate() {
|
|
60
|
-
this.firebaseAuth.onAuthStateChanged((user) => user);
|
|
61
21
|
const observables = [
|
|
62
|
-
|
|
22
|
+
this.angularFireAuth.authState.pipe(catchError(() => of(null))),
|
|
63
23
|
this.getUser().pipe(catchError(() => of(null))),
|
|
64
24
|
];
|
|
65
25
|
return combineLatest(observables).pipe(map(([fireUser, user]) => {
|
|
@@ -73,20 +33,20 @@ class AuthService {
|
|
|
73
33
|
return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? this.userRepository.get({ id }) : of(null))));
|
|
74
34
|
}
|
|
75
35
|
getTokenId() {
|
|
76
|
-
return
|
|
36
|
+
return this.angularFireAuth.idToken;
|
|
77
37
|
}
|
|
78
38
|
getFireUser() {
|
|
79
|
-
return
|
|
39
|
+
return this.angularFireAuth.user.pipe(catchError(() => of(null)));
|
|
80
40
|
}
|
|
81
41
|
}
|
|
82
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, deps: [{ token:
|
|
42
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, deps: [{ token: i1.AngularFireAuth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
83
43
|
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService });
|
|
84
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, decorators: [{
|
|
85
45
|
type: Injectable
|
|
86
|
-
}], ctorParameters: function () { return [{ type:
|
|
46
|
+
}], ctorParameters: function () { return [{ type: i1.AngularFireAuth }, { type: undefined, decorators: [{
|
|
87
47
|
type: Inject,
|
|
88
48
|
args: ['UserRepository']
|
|
89
|
-
}] }
|
|
49
|
+
}] }]; } });
|
|
90
50
|
|
|
91
51
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
92
52
|
|
|
@@ -97,25 +57,51 @@ class InvalidCouponError extends Error {
|
|
|
97
57
|
}
|
|
98
58
|
}
|
|
99
59
|
|
|
60
|
+
class GroupInvalidCouponError extends Error {
|
|
61
|
+
constructor(errors) {
|
|
62
|
+
super('Many coupon errors throw');
|
|
63
|
+
this.errors = errors;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
100
67
|
class CouponService {
|
|
101
68
|
constructor(couponRepository, defaultShop) {
|
|
102
69
|
this.couponRepository = couponRepository;
|
|
103
70
|
this.defaultShop = defaultShop;
|
|
104
71
|
this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
|
|
72
|
+
this.separateValidCoupons = (coupons, userEmail) => coupons
|
|
73
|
+
.map((coupon) => {
|
|
74
|
+
try {
|
|
75
|
+
if (!FinancialCoupon.isFinancialCoupon(coupon))
|
|
76
|
+
throw new InvalidCouponError('Coupon is not valid');
|
|
77
|
+
if (this.isValidCoupon(coupon, userEmail))
|
|
78
|
+
return coupon;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return error;
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.reduce((current, coupon) => (Object.assign(Object.assign({}, current), (FinancialCoupon.isFinancialCoupon(coupon)
|
|
85
|
+
? { valids: [...current.valids, coupon] }
|
|
86
|
+
: { invalids: [...current.invalids, coupon] }))), {
|
|
87
|
+
valids: [],
|
|
88
|
+
invalids: [],
|
|
89
|
+
});
|
|
105
90
|
}
|
|
106
|
-
checkCoupon(nickname, userEmail) {
|
|
91
|
+
checkCoupon(nickname, userEmail, checkoutType) {
|
|
107
92
|
return from(this.couponRepository.find([
|
|
108
93
|
{
|
|
109
94
|
nickname: { operator: Where.EQUALS, value: nickname },
|
|
110
95
|
shopAvailability: { operator: Where.EQUALS, value: this.defaultShop },
|
|
96
|
+
checkoutType: { operator: Where.EQUALS, value: checkoutType },
|
|
111
97
|
},
|
|
112
|
-
])).pipe(concatMap((coupons) => coupons.count < 1 ? throwError(() => new NotFoundError('Coupon not found')) : of(coupons.data
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
])).pipe(concatMap((coupons) => coupons.count < 1 ? throwError(() => new NotFoundError('Coupon not found')) : of(coupons.data)), map((coupons) => this.separateValidCoupons(coupons, userEmail)), map(({ valids, invalids }) => {
|
|
99
|
+
if (!valids.length)
|
|
100
|
+
throw new GroupInvalidCouponError(invalids);
|
|
101
|
+
return valids;
|
|
102
|
+
}));
|
|
115
103
|
}
|
|
116
104
|
isValidCoupon(coupon, userEmail) {
|
|
117
|
-
if (coupon.checkoutType !== CheckoutTypes.ECOMMERCE)
|
|
118
|
-
throw new InvalidCouponError('Coupon is not ecommerce valid');
|
|
119
105
|
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
120
106
|
throw new InvalidCouponError('User is not a collaborator');
|
|
121
107
|
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
|
|
@@ -170,7 +156,7 @@ class CheckoutService {
|
|
|
170
156
|
checkCoupon(nickname) {
|
|
171
157
|
return this.getCheckout().pipe(concatMap((checkout) => {
|
|
172
158
|
var _a;
|
|
173
|
-
return this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(concatMap((coupon) => {
|
|
159
|
+
return this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, CheckoutTypes.ECOMMERCE).pipe(concatMap((coupons) => of(coupons.shift())), concatMap((coupon) => {
|
|
174
160
|
var _a, _b;
|
|
175
161
|
return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
|
|
176
162
|
? from(this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(concatMap((orders) => {
|
|
@@ -263,6 +249,7 @@ class CartService {
|
|
|
263
249
|
pricePaid,
|
|
264
250
|
categories,
|
|
265
251
|
isGift,
|
|
252
|
+
costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
|
|
266
253
|
});
|
|
267
254
|
};
|
|
268
255
|
this.getProductPrice = ({ product, shop, isSubscriber, }) => {
|
|
@@ -279,7 +266,10 @@ class CartService {
|
|
|
279
266
|
};
|
|
280
267
|
}
|
|
281
268
|
addItem(item, quantity = 1) {
|
|
282
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => ({
|
|
269
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => ({
|
|
270
|
+
checkout,
|
|
271
|
+
lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }),
|
|
272
|
+
})), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
283
273
|
}
|
|
284
274
|
decreaseItem(item) {
|
|
285
275
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -360,8 +350,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
360
350
|
}] }]; } });
|
|
361
351
|
|
|
362
352
|
class CheckoutSubscriptionService {
|
|
363
|
-
constructor(checkoutSubscriptionRepository) {
|
|
353
|
+
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
364
354
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
355
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
356
|
+
this.couponService = couponService;
|
|
357
|
+
this.checkCouponsWithCheckout = (coupons, checkout) => forkJoin(coupons.map((coupon) => {
|
|
358
|
+
var _a;
|
|
359
|
+
return from(this.subscriptionRepository.find([{ user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } }])).pipe(map((subscriptions) => ({ coupon, subscriptions })));
|
|
360
|
+
})).pipe(map((results) => results.map(({ coupon, subscriptions }) => {
|
|
361
|
+
if (subscriptions.data.length >= (coupon.useLimit || Infinity))
|
|
362
|
+
return new InvalidCouponError('Coupon is already applied');
|
|
363
|
+
return coupon;
|
|
364
|
+
})), map((validatedCoupons) => ({
|
|
365
|
+
valids: validatedCoupons.filter((coupon) => FinancialCoupon.isFinancialCoupon(coupon)),
|
|
366
|
+
invalids: validatedCoupons.filter((coupon) => coupon instanceof InvalidCouponError),
|
|
367
|
+
})), concatMap(({ valids, invalids }) => valids.length ? of(valids) : throwError(new GroupInvalidCouponError(invalids))));
|
|
365
368
|
}
|
|
366
369
|
getCheckoutSubscription(checkoutData) {
|
|
367
370
|
const checkoutId = cookie.get('checkoutSubscriptionId');
|
|
@@ -380,52 +383,261 @@ class CheckoutSubscriptionService {
|
|
|
380
383
|
cookie.remove('checkoutSubscriptionId');
|
|
381
384
|
return of();
|
|
382
385
|
}
|
|
386
|
+
checkCoupon(nickname, userEmail) {
|
|
387
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION).pipe(concatMap((coupons) => {
|
|
388
|
+
const couponsWithSamePlan = coupons.filter((coupon) => checkout.subscriptionPlan.name === coupon.plan);
|
|
389
|
+
const couponsWithNoPlan = coupons.filter((coupon) => !coupon.plan);
|
|
390
|
+
if (couponsWithSamePlan.length > 0)
|
|
391
|
+
return of(couponsWithSamePlan);
|
|
392
|
+
if (couponsWithNoPlan.length > 0)
|
|
393
|
+
return of(couponsWithNoPlan);
|
|
394
|
+
throw new Error(`Coupon subscription plan is invalid.`);
|
|
395
|
+
}), concatMap((coupons) => { var _a; return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email) ? this.checkCouponsWithCheckout(coupons, checkout) : of(coupons); }), map((validatedCoupons) => validatedCoupons.shift()))));
|
|
396
|
+
}
|
|
383
397
|
}
|
|
384
|
-
CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
398
|
+
CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
385
399
|
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService });
|
|
386
400
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
387
401
|
type: Injectable
|
|
388
402
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
389
403
|
type: Inject,
|
|
390
404
|
args: ['CheckoutSubscriptionRepository']
|
|
391
|
-
}] }
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
class ConnectAngularFirebaseFirestore {
|
|
396
|
-
constructor() {
|
|
397
|
-
this.doc = firebase$1.firestore().doc;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
const FirebaseFirestoreProvider = {
|
|
401
|
-
provide: ConnectAngularFirebaseFirestore,
|
|
402
|
-
useFactory: FirebaseFirestoreFactory,
|
|
403
|
-
deps: [ConnectAngularFirebaseApp],
|
|
404
|
-
};
|
|
405
|
+
}] }, { type: undefined, decorators: [{
|
|
406
|
+
type: Inject,
|
|
407
|
+
args: ['SubscriptionRepository']
|
|
408
|
+
}] }, { type: CouponService }]; } });
|
|
405
409
|
|
|
406
410
|
class OrderService {
|
|
407
|
-
constructor(
|
|
408
|
-
this.
|
|
411
|
+
constructor(angularFirestore, orderRepository) {
|
|
412
|
+
this.angularFirestore = angularFirestore;
|
|
409
413
|
this.orderRepository = orderRepository;
|
|
410
414
|
this.orderSubject = new Subject();
|
|
411
415
|
}
|
|
412
416
|
getOrder(id) {
|
|
413
|
-
this.
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
+
this.angularFirestore
|
|
418
|
+
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
419
|
+
.valueChanges()
|
|
420
|
+
.pipe(map((doc) => Order.toInstance(doc)))
|
|
421
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
417
422
|
return this.orderSubject;
|
|
418
423
|
}
|
|
419
424
|
}
|
|
420
|
-
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token:
|
|
425
|
+
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 });
|
|
421
426
|
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
422
427
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
423
428
|
type: Injectable
|
|
424
|
-
}], ctorParameters: function () { return [{ type:
|
|
429
|
+
}], ctorParameters: function () { return [{ type: i1$1.AngularFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
425
430
|
type: Inject,
|
|
426
431
|
args: ['OrderRepository']
|
|
427
432
|
}] }]; } });
|
|
428
433
|
|
|
434
|
+
class HomeShopService {
|
|
435
|
+
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
436
|
+
this.categoryRepository = categoryRepository;
|
|
437
|
+
this.homeRepository = homeRepository;
|
|
438
|
+
this.productRepository = productRepository;
|
|
439
|
+
this.defaultShop = defaultShop;
|
|
440
|
+
this.buildCategoryGroupWithRequiredData = (group) => ({
|
|
441
|
+
category: Category.toInstance(pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
|
|
442
|
+
products: group.products.map((product) => Product.toInstance(pick(product.toPlain(), [
|
|
443
|
+
'id',
|
|
444
|
+
'price',
|
|
445
|
+
'reviews',
|
|
446
|
+
'hasVariants',
|
|
447
|
+
'slug',
|
|
448
|
+
'sku',
|
|
449
|
+
'stock',
|
|
450
|
+
'costPrice',
|
|
451
|
+
'images',
|
|
452
|
+
'miniatures',
|
|
453
|
+
]))),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
get homeId() {
|
|
457
|
+
if (this.defaultShop === Shops.GLAMSHOP)
|
|
458
|
+
return 'glamshop';
|
|
459
|
+
if (this.defaultShop === Shops.MENSMARKET)
|
|
460
|
+
return 'mens_market';
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
getHomeData() {
|
|
464
|
+
return this.getHomeConfiguration().pipe(tap((home) => { var _a; return console.log((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt); }), map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
|
|
465
|
+
? of(home)
|
|
466
|
+
: forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
|
|
467
|
+
discoverProducts,
|
|
468
|
+
featuredProducts,
|
|
469
|
+
verticalProducts,
|
|
470
|
+
})), concatMap((data) => this.saveHomeData(data)))));
|
|
471
|
+
}
|
|
472
|
+
getBanners(type) {
|
|
473
|
+
return this.getHomeConfiguration().pipe(map((home) => {
|
|
474
|
+
if (type === 'brand')
|
|
475
|
+
return home.brandsCarousel;
|
|
476
|
+
if (type === 'buyToWin')
|
|
477
|
+
return [home.buyToWinBanner];
|
|
478
|
+
if (type === 'block')
|
|
479
|
+
return home.blockBanners;
|
|
480
|
+
if (type === 'blog')
|
|
481
|
+
return [home.blogBanner];
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
getDiscoverProducts() {
|
|
485
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
486
|
+
}
|
|
487
|
+
getFeaturedProducts() {
|
|
488
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
489
|
+
}
|
|
490
|
+
getVerticalProducts() {
|
|
491
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.map((id) => forkJoin([
|
|
492
|
+
this.categoryRepository.get({ id }),
|
|
493
|
+
this.productRepository.find([{ categories: { operator: Where.LIKE, value: [id] } }], { limit: 12 }),
|
|
494
|
+
]).pipe(map(([category, products]) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
|
|
495
|
+
}
|
|
496
|
+
getHomeConfiguration() {
|
|
497
|
+
return of(this.homeConfiguration).pipe(concatMap((home) => home
|
|
498
|
+
? of(home)
|
|
499
|
+
: !this.homeId
|
|
500
|
+
? throwError(new RequiredArgumentError(['homeId']))
|
|
501
|
+
: from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
|
|
502
|
+
}
|
|
503
|
+
saveHomeData(homeData) {
|
|
504
|
+
const data = {
|
|
505
|
+
createdAt: new Date(),
|
|
506
|
+
expiresAt: add(new Date(), { hours: 1 }),
|
|
507
|
+
data: homeData,
|
|
508
|
+
};
|
|
509
|
+
return from(this.homeRepository.update({
|
|
510
|
+
id: this.homeId,
|
|
511
|
+
data,
|
|
512
|
+
})).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
516
|
+
HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService });
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, decorators: [{
|
|
518
|
+
type: Injectable
|
|
519
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
520
|
+
type: Inject,
|
|
521
|
+
args: ['CategoryRepository']
|
|
522
|
+
}] }, { type: undefined, decorators: [{
|
|
523
|
+
type: Inject,
|
|
524
|
+
args: ['HomeRepository']
|
|
525
|
+
}] }, { type: undefined, decorators: [{
|
|
526
|
+
type: Inject,
|
|
527
|
+
args: ['ProductRepository']
|
|
528
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
529
|
+
type: Inject,
|
|
530
|
+
args: [DEFAULT_SHOP]
|
|
531
|
+
}] }]; } });
|
|
532
|
+
|
|
533
|
+
class AngularFirebaseAuthModule {
|
|
534
|
+
static initializeApp(options, nameOrConfig) {
|
|
535
|
+
return {
|
|
536
|
+
ngModule: AngularFirebaseAuthModule,
|
|
537
|
+
providers: [
|
|
538
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
539
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
540
|
+
],
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
545
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
|
|
546
|
+
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
547
|
+
{
|
|
548
|
+
provide: 'Authentication',
|
|
549
|
+
useFactory: (authenticationService, userRepository) => {
|
|
550
|
+
return new Authentication(authenticationService, userRepository);
|
|
551
|
+
},
|
|
552
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
provide: 'AuthenticationService',
|
|
556
|
+
useFactory: (angularFireAuth) => {
|
|
557
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
558
|
+
},
|
|
559
|
+
deps: [AngularFireAuth],
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
provide: 'Register',
|
|
563
|
+
useFactory: (registerService, userRepository) => {
|
|
564
|
+
return new Register(registerService, userRepository);
|
|
565
|
+
},
|
|
566
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
provide: 'RegisterService',
|
|
570
|
+
useFactory: (angularFireAuth) => {
|
|
571
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
572
|
+
},
|
|
573
|
+
deps: [AngularFireAuth],
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
provide: 'SignOut',
|
|
577
|
+
useFactory: (authenticationService) => {
|
|
578
|
+
return new SignOut(authenticationService);
|
|
579
|
+
},
|
|
580
|
+
deps: ['AuthenticationService'],
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
provide: 'RecoveryPassword',
|
|
584
|
+
useFactory: (authenticationService) => {
|
|
585
|
+
return new RecoveryPassword(authenticationService);
|
|
586
|
+
},
|
|
587
|
+
deps: ['AuthenticationService'],
|
|
588
|
+
},
|
|
589
|
+
], imports: [[AngularFireModule]] });
|
|
590
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
591
|
+
type: NgModule,
|
|
592
|
+
args: [{
|
|
593
|
+
imports: [AngularFireModule],
|
|
594
|
+
providers: [
|
|
595
|
+
{
|
|
596
|
+
provide: 'Authentication',
|
|
597
|
+
useFactory: (authenticationService, userRepository) => {
|
|
598
|
+
return new Authentication(authenticationService, userRepository);
|
|
599
|
+
},
|
|
600
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
provide: 'AuthenticationService',
|
|
604
|
+
useFactory: (angularFireAuth) => {
|
|
605
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
606
|
+
},
|
|
607
|
+
deps: [AngularFireAuth],
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
provide: 'Register',
|
|
611
|
+
useFactory: (registerService, userRepository) => {
|
|
612
|
+
return new Register(registerService, userRepository);
|
|
613
|
+
},
|
|
614
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
provide: 'RegisterService',
|
|
618
|
+
useFactory: (angularFireAuth) => {
|
|
619
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
620
|
+
},
|
|
621
|
+
deps: [AngularFireAuth],
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
provide: 'SignOut',
|
|
625
|
+
useFactory: (authenticationService) => {
|
|
626
|
+
return new SignOut(authenticationService);
|
|
627
|
+
},
|
|
628
|
+
deps: ['AuthenticationService'],
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
provide: 'RecoveryPassword',
|
|
632
|
+
useFactory: (authenticationService) => {
|
|
633
|
+
return new RecoveryPassword(authenticationService);
|
|
634
|
+
},
|
|
635
|
+
deps: ['AuthenticationService'],
|
|
636
|
+
},
|
|
637
|
+
],
|
|
638
|
+
}]
|
|
639
|
+
}] });
|
|
640
|
+
|
|
429
641
|
class AngularFirestoreModule {
|
|
430
642
|
static initializeApp(options, nameOrConfig) {
|
|
431
643
|
return {
|
|
@@ -438,422 +650,321 @@ class AngularFirestoreModule {
|
|
|
438
650
|
}
|
|
439
651
|
}
|
|
440
652
|
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
441
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule });
|
|
653
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule] });
|
|
442
654
|
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
443
|
-
FirebaseAppProvider,
|
|
444
|
-
FirebaseFirestoreProvider,
|
|
445
655
|
{
|
|
446
656
|
provide: 'BeautyProfileRepository',
|
|
447
657
|
useFactory: (firestore, userRepository) => {
|
|
448
|
-
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
658
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
449
659
|
},
|
|
450
|
-
deps: [
|
|
660
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
451
661
|
},
|
|
452
662
|
{
|
|
453
663
|
provide: 'Buy2WinRepository',
|
|
454
664
|
useFactory: (firestore) => {
|
|
455
|
-
return new Buy2WinFirestoreRepository(firestore);
|
|
665
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
456
666
|
},
|
|
457
|
-
deps: [
|
|
667
|
+
deps: [AngularFirestore],
|
|
458
668
|
},
|
|
459
669
|
{
|
|
460
670
|
provide: 'CategoryRepository',
|
|
461
671
|
useFactory: (firestore) => {
|
|
462
|
-
return new CategoryFirestoreRepository(firestore);
|
|
672
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
463
673
|
},
|
|
464
|
-
deps: [
|
|
674
|
+
deps: [AngularFirestore],
|
|
465
675
|
},
|
|
466
676
|
{
|
|
467
677
|
provide: 'CheckoutRepository',
|
|
468
678
|
useFactory: (firestore) => {
|
|
469
|
-
return new CheckoutFirestoreRepository(firestore);
|
|
679
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
470
680
|
},
|
|
471
|
-
deps: [
|
|
681
|
+
deps: [AngularFirestore],
|
|
472
682
|
},
|
|
473
683
|
{
|
|
474
684
|
provide: 'CheckoutSubscriptionRepository',
|
|
475
685
|
useFactory: (firestore) => {
|
|
476
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
686
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
477
687
|
},
|
|
478
|
-
deps: [
|
|
688
|
+
deps: [AngularFirestore],
|
|
479
689
|
},
|
|
480
690
|
{
|
|
481
691
|
provide: 'CouponRepository',
|
|
482
692
|
useFactory: (firestore) => {
|
|
483
|
-
return new CouponFirestoreRepository(firestore);
|
|
693
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
484
694
|
},
|
|
485
|
-
deps: [
|
|
695
|
+
deps: [AngularFirestore],
|
|
486
696
|
},
|
|
487
697
|
{
|
|
488
698
|
provide: 'EditionRepository',
|
|
489
699
|
useFactory: (firestore, subscriptionRepository) => {
|
|
490
|
-
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
700
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
491
701
|
},
|
|
492
|
-
deps: [
|
|
702
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
493
703
|
},
|
|
494
704
|
{
|
|
495
705
|
provide: 'HomeRepository',
|
|
496
706
|
useFactory: (firestore) => {
|
|
497
|
-
return new HomeFirestoreRepository(firestore);
|
|
707
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
498
708
|
},
|
|
499
|
-
deps: [
|
|
709
|
+
deps: [AngularFirestore],
|
|
500
710
|
},
|
|
501
711
|
{
|
|
502
712
|
provide: 'LeadRepository',
|
|
503
713
|
useFactory: (firestore) => {
|
|
504
|
-
return new LeadFirestoreRepository(firestore);
|
|
714
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
505
715
|
},
|
|
506
|
-
deps: [
|
|
716
|
+
deps: [AngularFirestore],
|
|
507
717
|
},
|
|
508
718
|
{
|
|
509
719
|
provide: 'LegacyOrderRepository',
|
|
510
720
|
useFactory: (firestore) => {
|
|
511
|
-
return new LegacyOrderFirestoreRepository(firestore);
|
|
721
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
512
722
|
},
|
|
513
|
-
deps: [
|
|
723
|
+
deps: [AngularFirestore],
|
|
514
724
|
},
|
|
515
725
|
{
|
|
516
726
|
provide: 'ShopMenuRepository',
|
|
517
727
|
useFactory: (firestore) => {
|
|
518
|
-
return new ShopMenuFirestoreRepository(firestore);
|
|
728
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
519
729
|
},
|
|
520
|
-
deps: [
|
|
730
|
+
deps: [AngularFirestore],
|
|
521
731
|
},
|
|
522
732
|
{
|
|
523
733
|
provide: 'OrderRepository',
|
|
524
734
|
useFactory: (firestore) => {
|
|
525
|
-
return new OrderFirestoreRepository(firestore);
|
|
735
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
526
736
|
},
|
|
527
|
-
deps: [
|
|
737
|
+
deps: [AngularFirestore],
|
|
528
738
|
},
|
|
529
739
|
{
|
|
530
740
|
provide: 'PaymentRepository',
|
|
531
741
|
useFactory: (firestore) => {
|
|
532
|
-
return new PaymentFirestoreRepository(firestore);
|
|
742
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
533
743
|
},
|
|
534
|
-
deps: [
|
|
744
|
+
deps: [AngularFirestore],
|
|
535
745
|
},
|
|
536
746
|
{
|
|
537
747
|
provide: 'ProductRepository',
|
|
538
748
|
useFactory: (firestore) => {
|
|
539
|
-
return new ProductFirestoreRepository(firestore);
|
|
749
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
540
750
|
},
|
|
541
|
-
deps: [
|
|
751
|
+
deps: [AngularFirestore],
|
|
542
752
|
},
|
|
543
753
|
{
|
|
544
754
|
provide: 'SubscriptionPaymentRepository',
|
|
545
755
|
useFactory: (firestore, subscriptionRepository) => {
|
|
546
|
-
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
756
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
547
757
|
},
|
|
548
|
-
deps: [
|
|
758
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
549
759
|
},
|
|
550
760
|
{
|
|
551
761
|
provide: 'SubscriptionPlanRepository',
|
|
552
762
|
useFactory: (firestore) => {
|
|
553
|
-
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
763
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
554
764
|
},
|
|
555
|
-
deps: [
|
|
765
|
+
deps: [AngularFirestore],
|
|
556
766
|
},
|
|
557
767
|
{
|
|
558
768
|
provide: 'SubscriptionProductRepository',
|
|
559
769
|
useFactory: (firestore) => {
|
|
560
|
-
return new SubscriptionProductFirestoreRepository(firestore);
|
|
770
|
+
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
561
771
|
},
|
|
562
|
-
deps: [
|
|
772
|
+
deps: [AngularFirestore],
|
|
563
773
|
},
|
|
564
774
|
{
|
|
565
775
|
provide: 'SubscriptionRepository',
|
|
566
776
|
useFactory: (firestore) => {
|
|
567
|
-
return new SubscriptionFirestoreRepository(firestore);
|
|
777
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
568
778
|
},
|
|
569
|
-
deps: [
|
|
779
|
+
deps: [AngularFirestore],
|
|
570
780
|
},
|
|
571
781
|
{
|
|
572
782
|
provide: 'UserRepository',
|
|
573
783
|
useFactory: (firestore) => {
|
|
574
|
-
return new UserFirestoreRepository(firestore);
|
|
784
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
575
785
|
},
|
|
576
|
-
deps: [
|
|
786
|
+
deps: [AngularFirestore],
|
|
577
787
|
},
|
|
578
788
|
{
|
|
579
789
|
provide: 'UserAddressRepository',
|
|
580
790
|
useFactory: (firestore, userRepository) => {
|
|
581
|
-
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
791
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
582
792
|
},
|
|
583
|
-
deps: [
|
|
793
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
584
794
|
},
|
|
585
795
|
{
|
|
586
796
|
provide: 'UserPaymentMethodRepository',
|
|
587
797
|
useFactory: (firestore, userRepository) => {
|
|
588
|
-
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
798
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
589
799
|
},
|
|
590
|
-
deps: [
|
|
800
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
591
801
|
},
|
|
592
802
|
{
|
|
593
803
|
provide: 'VariantRepository',
|
|
594
804
|
useFactory: (firestore, productRepository) => {
|
|
595
|
-
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
805
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
596
806
|
},
|
|
597
|
-
deps: [
|
|
807
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
598
808
|
},
|
|
599
|
-
] });
|
|
809
|
+
], imports: [[AngularFireModule]] });
|
|
600
810
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
601
811
|
type: NgModule,
|
|
602
812
|
args: [{
|
|
813
|
+
imports: [AngularFireModule],
|
|
603
814
|
providers: [
|
|
604
|
-
FirebaseAppProvider,
|
|
605
|
-
FirebaseFirestoreProvider,
|
|
606
815
|
{
|
|
607
816
|
provide: 'BeautyProfileRepository',
|
|
608
817
|
useFactory: (firestore, userRepository) => {
|
|
609
|
-
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
818
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
610
819
|
},
|
|
611
|
-
deps: [
|
|
820
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
612
821
|
},
|
|
613
822
|
{
|
|
614
823
|
provide: 'Buy2WinRepository',
|
|
615
824
|
useFactory: (firestore) => {
|
|
616
|
-
return new Buy2WinFirestoreRepository(firestore);
|
|
825
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
617
826
|
},
|
|
618
|
-
deps: [
|
|
827
|
+
deps: [AngularFirestore],
|
|
619
828
|
},
|
|
620
829
|
{
|
|
621
830
|
provide: 'CategoryRepository',
|
|
622
831
|
useFactory: (firestore) => {
|
|
623
|
-
return new CategoryFirestoreRepository(firestore);
|
|
832
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
624
833
|
},
|
|
625
|
-
deps: [
|
|
834
|
+
deps: [AngularFirestore],
|
|
626
835
|
},
|
|
627
836
|
{
|
|
628
837
|
provide: 'CheckoutRepository',
|
|
629
838
|
useFactory: (firestore) => {
|
|
630
|
-
return new CheckoutFirestoreRepository(firestore);
|
|
839
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
631
840
|
},
|
|
632
|
-
deps: [
|
|
841
|
+
deps: [AngularFirestore],
|
|
633
842
|
},
|
|
634
843
|
{
|
|
635
844
|
provide: 'CheckoutSubscriptionRepository',
|
|
636
845
|
useFactory: (firestore) => {
|
|
637
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
846
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
638
847
|
},
|
|
639
|
-
deps: [
|
|
848
|
+
deps: [AngularFirestore],
|
|
640
849
|
},
|
|
641
850
|
{
|
|
642
851
|
provide: 'CouponRepository',
|
|
643
852
|
useFactory: (firestore) => {
|
|
644
|
-
return new CouponFirestoreRepository(firestore);
|
|
853
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
645
854
|
},
|
|
646
|
-
deps: [
|
|
855
|
+
deps: [AngularFirestore],
|
|
647
856
|
},
|
|
648
857
|
{
|
|
649
858
|
provide: 'EditionRepository',
|
|
650
859
|
useFactory: (firestore, subscriptionRepository) => {
|
|
651
|
-
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
860
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
652
861
|
},
|
|
653
|
-
deps: [
|
|
862
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
654
863
|
},
|
|
655
864
|
{
|
|
656
865
|
provide: 'HomeRepository',
|
|
657
866
|
useFactory: (firestore) => {
|
|
658
|
-
return new HomeFirestoreRepository(firestore);
|
|
867
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
659
868
|
},
|
|
660
|
-
deps: [
|
|
869
|
+
deps: [AngularFirestore],
|
|
661
870
|
},
|
|
662
871
|
{
|
|
663
872
|
provide: 'LeadRepository',
|
|
664
873
|
useFactory: (firestore) => {
|
|
665
|
-
return new LeadFirestoreRepository(firestore);
|
|
874
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
666
875
|
},
|
|
667
|
-
deps: [
|
|
876
|
+
deps: [AngularFirestore],
|
|
668
877
|
},
|
|
669
878
|
{
|
|
670
879
|
provide: 'LegacyOrderRepository',
|
|
671
880
|
useFactory: (firestore) => {
|
|
672
|
-
return new LegacyOrderFirestoreRepository(firestore);
|
|
881
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
673
882
|
},
|
|
674
|
-
deps: [
|
|
883
|
+
deps: [AngularFirestore],
|
|
675
884
|
},
|
|
676
885
|
{
|
|
677
886
|
provide: 'ShopMenuRepository',
|
|
678
887
|
useFactory: (firestore) => {
|
|
679
|
-
return new ShopMenuFirestoreRepository(firestore);
|
|
888
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
680
889
|
},
|
|
681
|
-
deps: [
|
|
890
|
+
deps: [AngularFirestore],
|
|
682
891
|
},
|
|
683
892
|
{
|
|
684
893
|
provide: 'OrderRepository',
|
|
685
894
|
useFactory: (firestore) => {
|
|
686
|
-
return new OrderFirestoreRepository(firestore);
|
|
895
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
687
896
|
},
|
|
688
|
-
deps: [
|
|
897
|
+
deps: [AngularFirestore],
|
|
689
898
|
},
|
|
690
899
|
{
|
|
691
900
|
provide: 'PaymentRepository',
|
|
692
901
|
useFactory: (firestore) => {
|
|
693
|
-
return new PaymentFirestoreRepository(firestore);
|
|
902
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
694
903
|
},
|
|
695
|
-
deps: [
|
|
904
|
+
deps: [AngularFirestore],
|
|
696
905
|
},
|
|
697
906
|
{
|
|
698
907
|
provide: 'ProductRepository',
|
|
699
908
|
useFactory: (firestore) => {
|
|
700
|
-
return new ProductFirestoreRepository(firestore);
|
|
909
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
701
910
|
},
|
|
702
|
-
deps: [
|
|
911
|
+
deps: [AngularFirestore],
|
|
703
912
|
},
|
|
704
913
|
{
|
|
705
914
|
provide: 'SubscriptionPaymentRepository',
|
|
706
915
|
useFactory: (firestore, subscriptionRepository) => {
|
|
707
|
-
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
916
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
708
917
|
},
|
|
709
|
-
deps: [
|
|
918
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
710
919
|
},
|
|
711
920
|
{
|
|
712
921
|
provide: 'SubscriptionPlanRepository',
|
|
713
922
|
useFactory: (firestore) => {
|
|
714
|
-
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
923
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
715
924
|
},
|
|
716
|
-
deps: [
|
|
925
|
+
deps: [AngularFirestore],
|
|
717
926
|
},
|
|
718
927
|
{
|
|
719
928
|
provide: 'SubscriptionProductRepository',
|
|
720
929
|
useFactory: (firestore) => {
|
|
721
|
-
return new SubscriptionProductFirestoreRepository(firestore);
|
|
930
|
+
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
722
931
|
},
|
|
723
|
-
deps: [
|
|
932
|
+
deps: [AngularFirestore],
|
|
724
933
|
},
|
|
725
934
|
{
|
|
726
935
|
provide: 'SubscriptionRepository',
|
|
727
936
|
useFactory: (firestore) => {
|
|
728
|
-
return new SubscriptionFirestoreRepository(firestore);
|
|
937
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
729
938
|
},
|
|
730
|
-
deps: [
|
|
939
|
+
deps: [AngularFirestore],
|
|
731
940
|
},
|
|
732
941
|
{
|
|
733
942
|
provide: 'UserRepository',
|
|
734
943
|
useFactory: (firestore) => {
|
|
735
|
-
return new UserFirestoreRepository(firestore);
|
|
944
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
736
945
|
},
|
|
737
|
-
deps: [
|
|
946
|
+
deps: [AngularFirestore],
|
|
738
947
|
},
|
|
739
948
|
{
|
|
740
949
|
provide: 'UserAddressRepository',
|
|
741
950
|
useFactory: (firestore, userRepository) => {
|
|
742
|
-
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
951
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
743
952
|
},
|
|
744
|
-
deps: [
|
|
953
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
745
954
|
},
|
|
746
955
|
{
|
|
747
956
|
provide: 'UserPaymentMethodRepository',
|
|
748
957
|
useFactory: (firestore, userRepository) => {
|
|
749
|
-
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
958
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
750
959
|
},
|
|
751
|
-
deps: [
|
|
960
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
752
961
|
},
|
|
753
962
|
{
|
|
754
963
|
provide: 'VariantRepository',
|
|
755
964
|
useFactory: (firestore, productRepository) => {
|
|
756
|
-
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
965
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
757
966
|
},
|
|
758
|
-
deps: [
|
|
759
|
-
},
|
|
760
|
-
],
|
|
761
|
-
}]
|
|
762
|
-
}] });
|
|
763
|
-
|
|
764
|
-
class AngularFirebaseAuthModule {
|
|
765
|
-
static initializeApp(options, nameOrConfig) {
|
|
766
|
-
return {
|
|
767
|
-
ngModule: AngularFirebaseAuthModule,
|
|
768
|
-
providers: [
|
|
769
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
770
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
771
|
-
],
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
776
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFirestoreModule] });
|
|
777
|
-
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
778
|
-
FirebaseAppProvider,
|
|
779
|
-
FirebaseAuthProvider,
|
|
780
|
-
{
|
|
781
|
-
provide: 'Authentication',
|
|
782
|
-
useFactory: (authenticationService, userRepository) => {
|
|
783
|
-
return new Authentication(authenticationService, userRepository);
|
|
784
|
-
},
|
|
785
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
provide: 'AuthenticationService',
|
|
789
|
-
useFactory: (app) => {
|
|
790
|
-
return new AuthenticationFirebaseAuthService(app.auth());
|
|
791
|
-
},
|
|
792
|
-
deps: [FirebaseAppProvider],
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
provide: 'Register',
|
|
796
|
-
useFactory: (registerService, userRepository) => {
|
|
797
|
-
return new Register(registerService, userRepository);
|
|
798
|
-
},
|
|
799
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
800
|
-
},
|
|
801
|
-
{
|
|
802
|
-
provide: 'RegisterService',
|
|
803
|
-
useFactory: (app) => {
|
|
804
|
-
return new RegisterFirebaseAuthService(app.auth());
|
|
805
|
-
},
|
|
806
|
-
deps: [FirebaseAppProvider],
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
provide: 'SignOut',
|
|
810
|
-
useFactory: (authenticationService) => {
|
|
811
|
-
return new SignOut(authenticationService);
|
|
812
|
-
},
|
|
813
|
-
deps: ['AuthenticationService'],
|
|
814
|
-
},
|
|
815
|
-
], imports: [[AngularFirestoreModule]] });
|
|
816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
817
|
-
type: NgModule,
|
|
818
|
-
args: [{
|
|
819
|
-
imports: [AngularFirestoreModule],
|
|
820
|
-
providers: [
|
|
821
|
-
FirebaseAppProvider,
|
|
822
|
-
FirebaseAuthProvider,
|
|
823
|
-
{
|
|
824
|
-
provide: 'Authentication',
|
|
825
|
-
useFactory: (authenticationService, userRepository) => {
|
|
826
|
-
return new Authentication(authenticationService, userRepository);
|
|
827
|
-
},
|
|
828
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
829
|
-
},
|
|
830
|
-
{
|
|
831
|
-
provide: 'AuthenticationService',
|
|
832
|
-
useFactory: (app) => {
|
|
833
|
-
return new AuthenticationFirebaseAuthService(app.auth());
|
|
834
|
-
},
|
|
835
|
-
deps: [FirebaseAppProvider],
|
|
836
|
-
},
|
|
837
|
-
{
|
|
838
|
-
provide: 'Register',
|
|
839
|
-
useFactory: (registerService, userRepository) => {
|
|
840
|
-
return new Register(registerService, userRepository);
|
|
841
|
-
},
|
|
842
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
provide: 'RegisterService',
|
|
846
|
-
useFactory: (app) => {
|
|
847
|
-
return new RegisterFirebaseAuthService(app.auth());
|
|
848
|
-
},
|
|
849
|
-
deps: [FirebaseAppProvider],
|
|
850
|
-
},
|
|
851
|
-
{
|
|
852
|
-
provide: 'SignOut',
|
|
853
|
-
useFactory: (authenticationService) => {
|
|
854
|
-
return new SignOut(authenticationService);
|
|
855
|
-
},
|
|
856
|
-
deps: ['AuthenticationService'],
|
|
967
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
857
968
|
},
|
|
858
969
|
],
|
|
859
970
|
}]
|
|
@@ -872,28 +983,28 @@ class AngularConnectModule {
|
|
|
872
983
|
}
|
|
873
984
|
}
|
|
874
985
|
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
875
|
-
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [
|
|
986
|
+
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
|
|
876
987
|
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [
|
|
877
988
|
AuthService,
|
|
878
989
|
CartService,
|
|
879
990
|
CheckoutService,
|
|
880
991
|
CheckoutSubscriptionService,
|
|
881
992
|
CouponService,
|
|
993
|
+
HomeShopService,
|
|
882
994
|
OrderService,
|
|
883
|
-
|
|
884
|
-
], imports: [[AngularFirebaseAuthModule, AngularFirestoreModule]] });
|
|
995
|
+
], imports: [[AngularFireModule, AngularFirestoreModule]] });
|
|
885
996
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
886
997
|
type: NgModule,
|
|
887
998
|
args: [{
|
|
888
|
-
imports: [
|
|
999
|
+
imports: [AngularFireModule, AngularFirestoreModule],
|
|
889
1000
|
providers: [
|
|
890
1001
|
AuthService,
|
|
891
1002
|
CartService,
|
|
892
1003
|
CheckoutService,
|
|
893
1004
|
CheckoutSubscriptionService,
|
|
894
1005
|
CouponService,
|
|
1006
|
+
HomeShopService,
|
|
895
1007
|
OrderService,
|
|
896
|
-
FirebaseAppProvider,
|
|
897
1008
|
],
|
|
898
1009
|
}]
|
|
899
1010
|
}] });
|
|
@@ -902,5 +1013,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImpo
|
|
|
902
1013
|
* Generated bundle index. Do not edit.
|
|
903
1014
|
*/
|
|
904
1015
|
|
|
905
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService };
|
|
1016
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
906
1017
|
//# sourceMappingURL=infrab4a-connect-angular.js.map
|