@infrab4a/connect-angular 0.14.2-beta.12 → 0.14.2-beta.3
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 +15 -15
- package/angular-elastic-search.module.d.ts +9 -9
- package/angular-firebase-auth.module.d.ts +10 -10
- package/angular-firestore.module.d.ts +15 -15
- package/bundles/infrab4a-connect-angular.umd.js +1397 -1418
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/consts/default-shop.const.d.ts +1 -1
- package/consts/es-config.const.d.ts +1 -1
- package/consts/index.d.ts +2 -2
- package/esm2015/angular-connect.module.js +47 -47
- package/esm2015/angular-elastic-search.module.js +38 -38
- package/esm2015/angular-firebase-auth.module.js +113 -113
- package/esm2015/angular-firestore.module.js +340 -340
- package/esm2015/consts/default-shop.const.js +2 -2
- package/esm2015/consts/es-config.const.js +2 -2
- package/esm2015/consts/index.js +3 -3
- package/esm2015/index.js +5 -5
- package/esm2015/infrab4a-connect-angular.js +4 -4
- package/esm2015/services/auth.service.js +42 -42
- package/esm2015/services/cart.service.js +150 -167
- package/esm2015/services/checkout-subscription.service.js +44 -68
- package/esm2015/services/checkout.service.js +68 -79
- package/esm2015/services/coupon.service.js +98 -70
- package/esm2015/services/errors/group-invalid-coupon.error.js +7 -7
- package/esm2015/services/errors/index.js +3 -3
- package/esm2015/services/errors/invalid-coupon.error.js +7 -7
- package/esm2015/services/home-shop.service.js +108 -108
- package/esm2015/services/index.js +8 -8
- package/esm2015/services/order.service.js +32 -32
- package/esm2015/services/types/index.js +3 -3
- package/esm2015/services/types/required-checkout-data.type.js +2 -2
- package/esm2015/services/types/required-checkout-subscription-data.type.js +2 -2
- package/fesm2015/infrab4a-connect-angular.js +988 -1011
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/index.d.ts +4 -4
- package/infrab4a-connect-angular.d.ts +5 -5
- package/package.json +2 -2
- package/services/auth.service.d.ts +19 -19
- package/services/cart.service.d.ts +35 -41
- package/services/checkout-subscription.service.d.ts +16 -18
- package/services/checkout.service.d.ts +23 -22
- package/services/coupon.service.d.ts +17 -14
- package/services/errors/group-invalid-coupon.error.d.ts +5 -5
- package/services/errors/index.d.ts +2 -2
- package/services/errors/invalid-coupon.error.d.ts +4 -4
- package/services/home-shop.service.d.ts +24 -24
- package/services/index.d.ts +7 -7
- package/services/order.service.d.ts +13 -13
- package/services/types/index.d.ts +2 -2
- package/services/types/required-checkout-data.type.d.ts +2 -2
- package/services/types/required-checkout-subscription-data.type.d.ts +2 -2
|
@@ -5,1053 +5,1030 @@ 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 * as i2 from '@infrab4a/connect';
|
|
8
|
-
import {
|
|
8
|
+
import { Coupon, Where, Exclusivities, NotFoundError, Shops, CheckoutTypes, isNil, Checkout, pick, LineItem, CouponTypes, CheckoutSubscription, Order, Category, Product, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository } from '@infrab4a/connect';
|
|
9
9
|
import { __awaiter } from 'tslib';
|
|
10
10
|
import cookie from 'js-cookie';
|
|
11
11
|
import * as i1$1 from '@angular/fire/firestore';
|
|
12
12
|
import { AngularFirestore } from '@angular/fire/firestore';
|
|
13
13
|
import { FIREBASE_OPTIONS, FIREBASE_APP_NAME, AngularFireModule } from '@angular/fire';
|
|
14
14
|
|
|
15
|
-
class AuthService {
|
|
16
|
-
constructor(angularFireAuth, userRepository) {
|
|
17
|
-
this.angularFireAuth = angularFireAuth;
|
|
18
|
-
this.userRepository = userRepository;
|
|
19
|
-
}
|
|
20
|
-
getAuthstate() {
|
|
21
|
-
const observables = [
|
|
22
|
-
this.angularFireAuth.authState.pipe(catchError(() => of(null))),
|
|
23
|
-
this.getUser().pipe(catchError(() => of(null))),
|
|
24
|
-
];
|
|
25
|
-
return combineLatest(observables).pipe(map(([fireUser, user]) => {
|
|
26
|
-
return {
|
|
27
|
-
user,
|
|
28
|
-
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
29
|
-
};
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
getUser() {
|
|
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))));
|
|
34
|
-
}
|
|
35
|
-
getTokenId() {
|
|
36
|
-
return this.angularFireAuth.idToken;
|
|
37
|
-
}
|
|
38
|
-
getFireUser() {
|
|
39
|
-
return this.angularFireAuth.user.pipe(catchError(() => of(null)));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
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 });
|
|
43
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService });
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, decorators: [{
|
|
45
|
-
type: Injectable
|
|
46
|
-
}], ctorParameters: function () { return [{ type: i1.AngularFireAuth }, { type: undefined, decorators: [{
|
|
47
|
-
type: Inject,
|
|
48
|
-
args: ['UserRepository']
|
|
15
|
+
class AuthService {
|
|
16
|
+
constructor(angularFireAuth, userRepository) {
|
|
17
|
+
this.angularFireAuth = angularFireAuth;
|
|
18
|
+
this.userRepository = userRepository;
|
|
19
|
+
}
|
|
20
|
+
getAuthstate() {
|
|
21
|
+
const observables = [
|
|
22
|
+
this.angularFireAuth.authState.pipe(catchError(() => of(null))),
|
|
23
|
+
this.getUser().pipe(catchError(() => of(null))),
|
|
24
|
+
];
|
|
25
|
+
return combineLatest(observables).pipe(map(([fireUser, user]) => {
|
|
26
|
+
return {
|
|
27
|
+
user,
|
|
28
|
+
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
29
|
+
};
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
getUser() {
|
|
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))));
|
|
34
|
+
}
|
|
35
|
+
getTokenId() {
|
|
36
|
+
return this.angularFireAuth.idToken;
|
|
37
|
+
}
|
|
38
|
+
getFireUser() {
|
|
39
|
+
return this.angularFireAuth.user.pipe(catchError(() => of(null)));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
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 });
|
|
43
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService });
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AuthService, decorators: [{
|
|
45
|
+
type: Injectable
|
|
46
|
+
}], ctorParameters: function () { return [{ type: i1.AngularFireAuth }, { type: undefined, decorators: [{
|
|
47
|
+
type: Inject,
|
|
48
|
+
args: ['UserRepository']
|
|
49
49
|
}] }]; } });
|
|
50
50
|
|
|
51
51
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
52
52
|
|
|
53
53
|
const ES_CONFIG = 'ES_CONFIG';
|
|
54
54
|
|
|
55
|
-
class InvalidCouponError extends Error {
|
|
56
|
-
constructor(message) {
|
|
57
|
-
super(message);
|
|
58
|
-
this.message = message;
|
|
59
|
-
}
|
|
55
|
+
class InvalidCouponError extends Error {
|
|
56
|
+
constructor(message) {
|
|
57
|
+
super(message);
|
|
58
|
+
this.message = message;
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
class GroupInvalidCouponError extends Error {
|
|
63
|
-
constructor(errors) {
|
|
64
|
-
super('Many coupon errors throw');
|
|
65
|
-
this.errors = errors;
|
|
66
|
-
}
|
|
62
|
+
class GroupInvalidCouponError extends Error {
|
|
63
|
+
constructor(errors) {
|
|
64
|
+
super('Many coupon errors throw');
|
|
65
|
+
this.errors = errors;
|
|
66
|
+
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
class CouponService {
|
|
70
|
-
constructor(couponRepository, defaultShop) {
|
|
71
|
-
this.couponRepository = couponRepository;
|
|
72
|
-
this.defaultShop = defaultShop;
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
69
|
+
class CouponService {
|
|
70
|
+
constructor(couponRepository, defaultShop, orderRepository) {
|
|
71
|
+
this.couponRepository = couponRepository;
|
|
72
|
+
this.defaultShop = defaultShop;
|
|
73
|
+
this.orderRepository = orderRepository;
|
|
74
|
+
this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
|
|
75
|
+
this.separateValidCoupons = (coupons, userEmail) => coupons
|
|
76
|
+
.map((coupon) => {
|
|
77
|
+
try {
|
|
78
|
+
if (!(coupon instanceof Coupon))
|
|
79
|
+
throw new InvalidCouponError('Coupon is not valid');
|
|
80
|
+
if (this.isValidCoupon(coupon, userEmail))
|
|
81
|
+
return coupon;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return error;
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.reduce((current, coupon) => (Object.assign(Object.assign({}, current), (coupon instanceof Coupon
|
|
88
|
+
? { valids: [...current.valids, coupon] }
|
|
89
|
+
: { invalids: [...current.invalids, coupon] }))), {
|
|
90
|
+
valids: [],
|
|
91
|
+
invalids: [],
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
checkCoupon(nickname, userEmail, checkoutType, plan) {
|
|
95
|
+
return from(this.couponRepository.find([
|
|
96
|
+
{
|
|
97
|
+
nickname: { operator: Where.EQUALS, value: nickname },
|
|
98
|
+
// shopAvailability: { operator: Where.EQUALS, value: this.defaultShop },
|
|
99
|
+
// checkoutType: { operator: Where.EQUALS, value: checkoutType },
|
|
100
|
+
},
|
|
101
|
+
])).pipe(concatMap((coupons) => this.checkCouponRules(coupons, checkoutType)), concatMap((coupons) => this.checkCouponUseLimit(coupons, userEmail)), map((coupon) => this.isValidCoupon(coupon, userEmail)));
|
|
102
|
+
}
|
|
103
|
+
isValidCoupon(coupon, userEmail) {
|
|
104
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
105
|
+
throw new InvalidCouponError('User is not a collaborator');
|
|
106
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
|
|
107
|
+
throw new InvalidCouponError('Coupon is not valid for user');
|
|
108
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
109
|
+
throw new InvalidCouponError('Coupon is expired');
|
|
110
|
+
return coupon;
|
|
111
|
+
}
|
|
112
|
+
checkCouponRules(coupons, checkoutType, plan) {
|
|
113
|
+
// coupons.count < 1 ? return throwError(() => new NotFoundError('Coupon not found')) : return of(coupons.data);
|
|
114
|
+
if (coupons.count < 1)
|
|
115
|
+
return throwError(() => new NotFoundError('Coupon not found'));
|
|
116
|
+
const isInShop = coupons.data.find((c) => c.shopAvailability == Shops.ALL || c.shopAvailability == this.defaultShop);
|
|
117
|
+
if (!isInShop)
|
|
118
|
+
return throwError(() => new NotFoundError('Coupon not found'));
|
|
119
|
+
const isCheckoutType = coupons.data.find((c) => c.checkoutType == CheckoutTypes.ALL || c.checkoutType == checkoutType);
|
|
120
|
+
if (!isCheckoutType)
|
|
121
|
+
return throwError(() => new NotFoundError('Coupon not found'));
|
|
122
|
+
if (checkoutType === CheckoutTypes.ALL || checkoutType === CheckoutTypes.SUBSCRIPTION) {
|
|
123
|
+
//regra
|
|
124
|
+
}
|
|
125
|
+
return coupons.data;
|
|
126
|
+
}
|
|
127
|
+
checkCouponUseLimit(coupons, userEmail) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
const coupon = coupons.shift();
|
|
130
|
+
const orders = yield this.orderRepository.find([{ coupon: { id: coupon.id } }]);
|
|
131
|
+
const ordersUserCoupon = orders.data.filter((o) => o.user.email == userEmail);
|
|
132
|
+
if (orders.data.length >= (coupon.useLimit || Infinity))
|
|
133
|
+
return throwError(() => new Error('Coupon já usou tudo'));
|
|
134
|
+
if (ordersUserCoupon.length >= coupon.useLimitPerUser)
|
|
135
|
+
return throwError(() => new Error('Usuário Coupon já usou tudo'));
|
|
136
|
+
return coupon;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
CouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
|
+
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
142
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CouponService, decorators: [{
|
|
143
|
+
type: Injectable,
|
|
144
|
+
args: [{
|
|
145
|
+
providedIn: 'root',
|
|
146
|
+
}]
|
|
147
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
148
|
+
type: Inject,
|
|
149
|
+
args: ['CouponRepository']
|
|
150
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
151
|
+
type: Inject,
|
|
152
|
+
args: [DEFAULT_SHOP]
|
|
153
|
+
}] }, { type: undefined, decorators: [{
|
|
154
|
+
type: Inject,
|
|
155
|
+
args: ['OrderRepository']
|
|
129
156
|
}] }]; } });
|
|
130
157
|
|
|
131
|
-
class CheckoutService {
|
|
132
|
-
constructor(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
|
|
133
|
-
this.couponService = couponService;
|
|
134
|
-
this.checkoutRepository = checkoutRepository;
|
|
135
|
-
this.orderRepository = orderRepository;
|
|
136
|
-
this.userRepository = userRepository;
|
|
137
|
-
this.defaultShop = defaultShop;
|
|
138
|
-
}
|
|
139
|
-
getCheckout(checkoutData) {
|
|
140
|
-
const checkoutId = cookie.get('checkoutId');
|
|
141
|
-
if (!isNil(checkoutId))
|
|
142
|
-
return from(this.checkoutRepository.get({ id: checkoutId }));
|
|
143
|
-
return from(this.createCheckout(checkoutData));
|
|
144
|
-
}
|
|
145
|
-
getUserByCheckout(checkoutId) {
|
|
146
|
-
return from(this.checkoutRepository.get({ id: checkoutId })).pipe(concatMap((checkout) => { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? of(checkout.user) : from(this.userRepository.get({ id: checkout.user.id })); }), concatMap((user) => of(user) || throwError(() => new NotFoundError('User is not found'))));
|
|
147
|
-
}
|
|
148
|
-
updateCheckoutLineItems(checkout) {
|
|
149
|
-
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
150
|
-
}
|
|
151
|
-
updateCheckoutUser(checkout) {
|
|
152
|
-
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
153
|
-
}
|
|
154
|
-
clearCheckoutFromSession() {
|
|
155
|
-
cookie.remove('checkoutId');
|
|
156
|
-
return of();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
type: Inject,
|
|
187
|
-
args: ['CheckoutRepository']
|
|
188
|
-
}] }, { type: undefined, decorators: [{
|
|
189
|
-
type: Inject,
|
|
190
|
-
args: ['OrderRepository']
|
|
191
|
-
}] }, { type: undefined, decorators: [{
|
|
192
|
-
type: Inject,
|
|
193
|
-
args: ['UserRepository']
|
|
194
|
-
}] }, { type: i2.Shops, decorators: [{
|
|
195
|
-
type: Inject,
|
|
196
|
-
args: [DEFAULT_SHOP]
|
|
158
|
+
class CheckoutService {
|
|
159
|
+
constructor(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
|
|
160
|
+
this.couponService = couponService;
|
|
161
|
+
this.checkoutRepository = checkoutRepository;
|
|
162
|
+
this.orderRepository = orderRepository;
|
|
163
|
+
this.userRepository = userRepository;
|
|
164
|
+
this.defaultShop = defaultShop;
|
|
165
|
+
}
|
|
166
|
+
getCheckout(checkoutData) {
|
|
167
|
+
const checkoutId = cookie.get('checkoutId');
|
|
168
|
+
if (!isNil(checkoutId))
|
|
169
|
+
return from(this.checkoutRepository.get({ id: checkoutId }));
|
|
170
|
+
return from(this.createCheckout(checkoutData));
|
|
171
|
+
}
|
|
172
|
+
getUserByCheckout(checkoutId) {
|
|
173
|
+
return from(this.checkoutRepository.get({ id: checkoutId })).pipe(concatMap((checkout) => { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? of(checkout.user) : from(this.userRepository.get({ id: checkout.user.id })); }), concatMap((user) => of(user) || throwError(() => new NotFoundError('User is not found'))));
|
|
174
|
+
}
|
|
175
|
+
updateCheckoutLineItems(checkout) {
|
|
176
|
+
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
177
|
+
}
|
|
178
|
+
updateCheckoutUser(checkout) {
|
|
179
|
+
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
180
|
+
}
|
|
181
|
+
clearCheckoutFromSession() {
|
|
182
|
+
cookie.remove('checkoutId');
|
|
183
|
+
return of();
|
|
184
|
+
}
|
|
185
|
+
applyCupon(coupon) { }
|
|
186
|
+
checkCoupon(nickname) {
|
|
187
|
+
return this.getCheckout().pipe(concatMap((checkout) => { var _a; return this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, CheckoutTypes.ECOMMERCE).pipe(); }));
|
|
188
|
+
}
|
|
189
|
+
createCheckout(checkoutData) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
const checkout = yield this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, Checkout.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }));
|
|
192
|
+
cookie.set('checkoutId', checkout.id);
|
|
193
|
+
return checkout;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
CheckoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
198
|
+
CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService });
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, decorators: [{
|
|
200
|
+
type: Injectable
|
|
201
|
+
}], ctorParameters: function () { return [{ type: CouponService }, { type: undefined, decorators: [{
|
|
202
|
+
type: Inject,
|
|
203
|
+
args: ['CheckoutRepository']
|
|
204
|
+
}] }, { type: undefined, decorators: [{
|
|
205
|
+
type: Inject,
|
|
206
|
+
args: ['OrderRepository']
|
|
207
|
+
}] }, { type: undefined, decorators: [{
|
|
208
|
+
type: Inject,
|
|
209
|
+
args: ['UserRepository']
|
|
210
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
211
|
+
type: Inject,
|
|
212
|
+
args: [DEFAULT_SHOP]
|
|
197
213
|
}] }]; } });
|
|
198
214
|
|
|
199
|
-
class CartService {
|
|
200
|
-
constructor(authService, checkoutService, defaultShop) {
|
|
201
|
-
this.authService = authService;
|
|
202
|
-
this.checkoutService = checkoutService;
|
|
203
|
-
this.defaultShop = defaultShop;
|
|
204
|
-
this.cartSubject = new Subject();
|
|
205
|
-
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
206
|
-
var _a;
|
|
207
|
-
const items = [];
|
|
208
|
-
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
209
|
-
if (index > -1) {
|
|
210
|
-
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
211
|
-
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
212
|
-
}
|
|
213
|
-
else
|
|
214
|
-
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
215
|
-
return this.checkoutService
|
|
216
|
-
.updateCheckoutLineItems(checkoutLoaded)
|
|
217
|
-
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
218
|
-
}));
|
|
219
|
-
this.generateCartObject = (items) => {
|
|
220
|
-
const cart = {};
|
|
221
|
-
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
222
|
-
var _a;
|
|
223
|
-
return (cart[item.sku] = LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
|
|
224
|
-
});
|
|
225
|
-
return cart;
|
|
226
|
-
};
|
|
227
|
-
this.buildLineItem = ({ checkout, item, quantity, }) => {
|
|
228
|
-
var _a, _b, _c, _d, _e;
|
|
229
|
-
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
|
|
230
|
-
if (this.checkMaxStock(item, quantity || 0))
|
|
231
|
-
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
232
|
-
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
233
|
-
const { id, name,
|
|
234
|
-
const isGift = item.isGift || null;
|
|
235
|
-
const pricePaid = this.getProductPrice({
|
|
236
|
-
product: item,
|
|
237
|
-
shop: checkout.shop || this.defaultShop,
|
|
238
|
-
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
239
|
-
});
|
|
240
|
-
return LineItem.toInstance({
|
|
241
|
-
id,
|
|
242
|
-
name,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
checkout,
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (FinancialCoupon.isFinancialCoupon(coupon))
|
|
337
|
-
switch (coupon.subtype) {
|
|
338
|
-
case CouponSubtypes.ABSOLUTE:
|
|
339
|
-
return subTotalPrice - coupon.discount * 100;
|
|
340
|
-
case CouponSubtypes.PERCENTAGE:
|
|
341
|
-
return subTotalPrice * (1 - coupon.discount / 100);
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
347
|
-
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService });
|
|
348
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, decorators: [{
|
|
349
|
-
type: Injectable
|
|
350
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
351
|
-
type: Inject,
|
|
352
|
-
args: [DEFAULT_SHOP]
|
|
215
|
+
class CartService {
|
|
216
|
+
constructor(authService, checkoutService, defaultShop) {
|
|
217
|
+
this.authService = authService;
|
|
218
|
+
this.checkoutService = checkoutService;
|
|
219
|
+
this.defaultShop = defaultShop;
|
|
220
|
+
this.cartSubject = new Subject();
|
|
221
|
+
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
222
|
+
var _a;
|
|
223
|
+
const items = [];
|
|
224
|
+
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
225
|
+
if (index > -1) {
|
|
226
|
+
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
227
|
+
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
228
|
+
}
|
|
229
|
+
else
|
|
230
|
+
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
231
|
+
return this.checkoutService
|
|
232
|
+
.updateCheckoutLineItems(checkoutLoaded)
|
|
233
|
+
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
234
|
+
}));
|
|
235
|
+
this.generateCartObject = (items) => {
|
|
236
|
+
const cart = {};
|
|
237
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
238
|
+
var _a;
|
|
239
|
+
return (cart[item.sku] = LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
|
|
240
|
+
});
|
|
241
|
+
return cart;
|
|
242
|
+
};
|
|
243
|
+
this.buildLineItem = ({ checkout, item, quantity, }) => {
|
|
244
|
+
var _a, _b, _c, _d, _e;
|
|
245
|
+
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
|
|
246
|
+
if (this.checkMaxStock(item, quantity || 0))
|
|
247
|
+
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
248
|
+
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
249
|
+
const { id, name, brand, slug, stock, price, weight, categories, sku } = item;
|
|
250
|
+
const isGift = item.isGift || null;
|
|
251
|
+
const pricePaid = this.getProductPrice({
|
|
252
|
+
product: item,
|
|
253
|
+
shop: checkout.shop || this.defaultShop,
|
|
254
|
+
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
255
|
+
});
|
|
256
|
+
return LineItem.toInstance({
|
|
257
|
+
id,
|
|
258
|
+
name,
|
|
259
|
+
brand,
|
|
260
|
+
slug,
|
|
261
|
+
sku,
|
|
262
|
+
stock,
|
|
263
|
+
price,
|
|
264
|
+
image,
|
|
265
|
+
weight,
|
|
266
|
+
quantity: (item.quantity || 0) + (quantity || 0),
|
|
267
|
+
pricePaid,
|
|
268
|
+
categories,
|
|
269
|
+
isGift,
|
|
270
|
+
costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
this.getProductPrice = ({ product, shop, isSubscriber, }) => {
|
|
274
|
+
const info = product.getInfoByShop(shop);
|
|
275
|
+
if (product.isGift)
|
|
276
|
+
return 0;
|
|
277
|
+
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
278
|
+
};
|
|
279
|
+
this.checkMaxStock = (item, quantity) => {
|
|
280
|
+
var _a;
|
|
281
|
+
const maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
|
|
282
|
+
const currentItemAmount = item.quantity || 0;
|
|
283
|
+
return currentItemAmount + quantity > maxStock;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
addItem(item, quantity = 1) {
|
|
287
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => ({
|
|
288
|
+
checkout,
|
|
289
|
+
lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }),
|
|
290
|
+
})), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
291
|
+
}
|
|
292
|
+
decreaseItem(item) {
|
|
293
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
294
|
+
var _a;
|
|
295
|
+
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
|
|
296
|
+
if (!isNil(checkoutItem))
|
|
297
|
+
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
298
|
+
return checkout;
|
|
299
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
300
|
+
}
|
|
301
|
+
getCart(checkout) {
|
|
302
|
+
this.buildCartFromCheckout(checkout).subscribe((cart) => this.cartSubject.next(cart));
|
|
303
|
+
return this.cartSubject;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated The method should not be used
|
|
307
|
+
*/
|
|
308
|
+
getVariantPriceDiscount(item, shop) {
|
|
309
|
+
return this.authService.getUser().pipe(concatMap((user) => iif(() => user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice, of(item.getInfoByShop(shop).subscriberPrice), of(item.getInfoByShop(shop).price))), catchError(() => of(item.getInfoByShop(shop).price)));
|
|
310
|
+
}
|
|
311
|
+
removeItem(item) {
|
|
312
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
313
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
314
|
+
if (index >= 0)
|
|
315
|
+
checkout.lineItems.splice(index, 1);
|
|
316
|
+
return checkout;
|
|
317
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
318
|
+
}
|
|
319
|
+
updateUserCart(user) {
|
|
320
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => {
|
|
321
|
+
var _a;
|
|
322
|
+
return this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.map((item) => this.buildLineItem({ checkout, item }))) || [] })));
|
|
323
|
+
}), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
324
|
+
}
|
|
325
|
+
clearCart() {
|
|
326
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
327
|
+
this.checkoutService.clearCheckoutFromSession();
|
|
328
|
+
return checkout;
|
|
329
|
+
}), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
|
|
330
|
+
}
|
|
331
|
+
buildCartFromCheckout(checkoutData) {
|
|
332
|
+
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
333
|
+
}
|
|
334
|
+
getSubTotalDiscount(coupon) {
|
|
335
|
+
return (subTotalPrice) => {
|
|
336
|
+
switch (coupon.type) {
|
|
337
|
+
case CouponTypes.ABSOLUTE:
|
|
338
|
+
return subTotalPrice - coupon.discount;
|
|
339
|
+
case CouponTypes.PERCENTAGE:
|
|
340
|
+
return subTotalPrice * (1 - coupon.discount / 100);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
346
|
+
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService });
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, decorators: [{
|
|
348
|
+
type: Injectable
|
|
349
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
350
|
+
type: Inject,
|
|
351
|
+
args: [DEFAULT_SHOP]
|
|
353
352
|
}] }]; } });
|
|
354
353
|
|
|
355
|
-
class CheckoutSubscriptionService {
|
|
356
|
-
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
357
|
-
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
358
|
-
this.subscriptionRepository = subscriptionRepository;
|
|
359
|
-
this.couponService = couponService;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
return
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
})
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
checkCoupon(nickname, userEmail) {
|
|
390
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION).pipe(concatMap((coupons) => {
|
|
391
|
-
const couponsWithSamePlan = coupons.filter((coupon) => checkout.subscriptionPlan.name === coupon.plan);
|
|
392
|
-
const couponsWithNoPlan = coupons.filter((coupon) => !coupon.plan);
|
|
393
|
-
if (couponsWithSamePlan.length > 0)
|
|
394
|
-
return of(couponsWithSamePlan);
|
|
395
|
-
if (couponsWithNoPlan.length > 0)
|
|
396
|
-
return of(couponsWithNoPlan);
|
|
397
|
-
throw new Error(`Coupon subscription plan is invalid.`);
|
|
398
|
-
}), 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()))));
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
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 });
|
|
402
|
-
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService });
|
|
403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
404
|
-
type: Injectable
|
|
405
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
406
|
-
type: Inject,
|
|
407
|
-
args: ['CheckoutSubscriptionRepository']
|
|
408
|
-
}] }, { type: undefined, decorators: [{
|
|
409
|
-
type: Inject,
|
|
410
|
-
args: ['SubscriptionRepository']
|
|
354
|
+
class CheckoutSubscriptionService {
|
|
355
|
+
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
356
|
+
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
357
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
358
|
+
this.couponService = couponService;
|
|
359
|
+
}
|
|
360
|
+
getCheckoutSubscription(checkoutData) {
|
|
361
|
+
const checkoutId = cookie.get('checkoutSubscriptionId');
|
|
362
|
+
if (!isNil(checkoutId))
|
|
363
|
+
return from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
364
|
+
return from(this.createCheckoutSubscription(checkoutData));
|
|
365
|
+
}
|
|
366
|
+
createCheckoutSubscription(checkoutData) {
|
|
367
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
const checkout = yield this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()));
|
|
369
|
+
cookie.set('checkoutSubscriptionId', checkout.id);
|
|
370
|
+
return checkout;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
clearCheckoutSubscriptionFromSession() {
|
|
374
|
+
cookie.remove('checkoutSubscriptionId');
|
|
375
|
+
return of();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
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 });
|
|
379
|
+
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService });
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
381
|
+
type: Injectable
|
|
382
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
383
|
+
type: Inject,
|
|
384
|
+
args: ['CheckoutSubscriptionRepository']
|
|
385
|
+
}] }, { type: undefined, decorators: [{
|
|
386
|
+
type: Inject,
|
|
387
|
+
args: ['SubscriptionRepository']
|
|
411
388
|
}] }, { type: CouponService }]; } });
|
|
412
389
|
|
|
413
|
-
class OrderService {
|
|
414
|
-
constructor(angularFirestore, orderRepository) {
|
|
415
|
-
this.angularFirestore = angularFirestore;
|
|
416
|
-
this.orderRepository = orderRepository;
|
|
417
|
-
this.orderSubject = new Subject();
|
|
418
|
-
}
|
|
419
|
-
getOrder(id) {
|
|
420
|
-
this.angularFirestore
|
|
421
|
-
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
422
|
-
.valueChanges()
|
|
423
|
-
.pipe(map((doc) => Order.toInstance(doc)))
|
|
424
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
425
|
-
return this.orderSubject;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
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 });
|
|
429
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
431
|
-
type: Injectable
|
|
432
|
-
}], ctorParameters: function () { return [{ type: i1$1.AngularFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
433
|
-
type: Inject,
|
|
434
|
-
args: ['OrderRepository']
|
|
390
|
+
class OrderService {
|
|
391
|
+
constructor(angularFirestore, orderRepository) {
|
|
392
|
+
this.angularFirestore = angularFirestore;
|
|
393
|
+
this.orderRepository = orderRepository;
|
|
394
|
+
this.orderSubject = new Subject();
|
|
395
|
+
}
|
|
396
|
+
getOrder(id) {
|
|
397
|
+
this.angularFirestore
|
|
398
|
+
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
399
|
+
.valueChanges()
|
|
400
|
+
.pipe(map((doc) => Order.toInstance(doc)))
|
|
401
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
402
|
+
return this.orderSubject;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
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 });
|
|
406
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
408
|
+
type: Injectable
|
|
409
|
+
}], ctorParameters: function () { return [{ type: i1$1.AngularFirestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
410
|
+
type: Inject,
|
|
411
|
+
args: ['OrderRepository']
|
|
435
412
|
}] }]; } });
|
|
436
413
|
|
|
437
|
-
class HomeShopService {
|
|
438
|
-
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
439
|
-
this.categoryRepository = categoryRepository;
|
|
440
|
-
this.homeRepository = homeRepository;
|
|
441
|
-
this.productRepository = productRepository;
|
|
442
|
-
this.defaultShop = defaultShop;
|
|
443
|
-
this.buildCategoryGroupWithRequiredData = (group) => ({
|
|
444
|
-
category: Category.toInstance(pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
|
|
445
|
-
products: group.products.map((product) => Product.toInstance(pick(product.toPlain(), [
|
|
446
|
-
'id',
|
|
447
|
-
'price',
|
|
448
|
-
'reviews',
|
|
449
|
-
'hasVariants',
|
|
450
|
-
'slug',
|
|
451
|
-
'sku',
|
|
452
|
-
'stock',
|
|
453
|
-
'costPrice',
|
|
454
|
-
'images',
|
|
455
|
-
'miniatures',
|
|
456
|
-
'name',
|
|
457
|
-
'weight',
|
|
458
|
-
]))),
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
get homeId() {
|
|
462
|
-
if (this.defaultShop === Shops.GLAMSHOP)
|
|
463
|
-
return 'glamshop';
|
|
464
|
-
if (this.defaultShop === Shops.MENSMARKET)
|
|
465
|
-
return 'mens_market';
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
getHomeData() {
|
|
469
|
-
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
|
|
470
|
-
? of(home)
|
|
471
|
-
: forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
|
|
472
|
-
discoverProducts,
|
|
473
|
-
featuredProducts,
|
|
474
|
-
verticalProducts,
|
|
475
|
-
})), concatMap((data) => this.saveHomeData(data)))));
|
|
476
|
-
}
|
|
477
|
-
getBanners(type) {
|
|
478
|
-
return this.getHomeConfiguration().pipe(map((home) => {
|
|
479
|
-
if (type === 'brand')
|
|
480
|
-
return home.brandsCarousel;
|
|
481
|
-
if (type === 'buyToWin')
|
|
482
|
-
return [home.buyToWinBanner];
|
|
483
|
-
if (type === 'block')
|
|
484
|
-
return home.blockBanners;
|
|
485
|
-
if (type === 'blog')
|
|
486
|
-
return [home.blogBanner];
|
|
487
|
-
}));
|
|
488
|
-
}
|
|
489
|
-
getDiscoverProducts() {
|
|
490
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
491
|
-
}
|
|
492
|
-
getFeaturedProducts() {
|
|
493
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
494
|
-
}
|
|
495
|
-
getVerticalProducts() {
|
|
496
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => forkJoin([
|
|
497
|
-
this.categoryRepository.get({ id }),
|
|
498
|
-
this.productRepository.find([{ categories: { operator: Where.LIKE, value: [id] } }], { limit: 12 }),
|
|
499
|
-
]).pipe(map(([category, products]) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
|
|
500
|
-
}
|
|
501
|
-
getHomeConfiguration() {
|
|
502
|
-
return of(this.homeConfiguration).pipe(concatMap((home) => home
|
|
503
|
-
? of(home)
|
|
504
|
-
: !this.homeId
|
|
505
|
-
? throwError(new RequiredArgumentError(['homeId']))
|
|
506
|
-
: from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
|
|
507
|
-
}
|
|
508
|
-
saveHomeData(homeData) {
|
|
509
|
-
const data = {
|
|
510
|
-
createdAt: new Date(),
|
|
511
|
-
expiresAt: add(new Date(), { hours: 1 }),
|
|
512
|
-
data: homeData,
|
|
513
|
-
};
|
|
514
|
-
return from(this.homeRepository.update({
|
|
515
|
-
id: this.homeId,
|
|
516
|
-
data,
|
|
517
|
-
})).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
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 });
|
|
521
|
-
HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService });
|
|
522
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, decorators: [{
|
|
523
|
-
type: Injectable
|
|
524
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
525
|
-
type: Inject,
|
|
526
|
-
args: ['CategoryRepository']
|
|
527
|
-
}] }, { type: undefined, decorators: [{
|
|
528
|
-
type: Inject,
|
|
529
|
-
args: ['HomeRepository']
|
|
530
|
-
}] }, { type: undefined, decorators: [{
|
|
531
|
-
type: Inject,
|
|
532
|
-
args: ['ProductRepository']
|
|
533
|
-
}] }, { type: i2.Shops, decorators: [{
|
|
534
|
-
type: Inject,
|
|
535
|
-
args: [DEFAULT_SHOP]
|
|
414
|
+
class HomeShopService {
|
|
415
|
+
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
416
|
+
this.categoryRepository = categoryRepository;
|
|
417
|
+
this.homeRepository = homeRepository;
|
|
418
|
+
this.productRepository = productRepository;
|
|
419
|
+
this.defaultShop = defaultShop;
|
|
420
|
+
this.buildCategoryGroupWithRequiredData = (group) => ({
|
|
421
|
+
category: Category.toInstance(pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
|
|
422
|
+
products: group.products.map((product) => Product.toInstance(pick(product.toPlain(), [
|
|
423
|
+
'id',
|
|
424
|
+
'price',
|
|
425
|
+
'reviews',
|
|
426
|
+
'hasVariants',
|
|
427
|
+
'slug',
|
|
428
|
+
'sku',
|
|
429
|
+
'stock',
|
|
430
|
+
'costPrice',
|
|
431
|
+
'images',
|
|
432
|
+
'miniatures',
|
|
433
|
+
'name',
|
|
434
|
+
'weight',
|
|
435
|
+
]))),
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
get homeId() {
|
|
439
|
+
if (this.defaultShop === Shops.GLAMSHOP)
|
|
440
|
+
return 'glamshop';
|
|
441
|
+
if (this.defaultShop === Shops.MENSMARKET)
|
|
442
|
+
return 'mens_market';
|
|
443
|
+
return null;
|
|
444
|
+
}
|
|
445
|
+
getHomeData() {
|
|
446
|
+
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
|
|
447
|
+
? of(home)
|
|
448
|
+
: forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
|
|
449
|
+
discoverProducts,
|
|
450
|
+
featuredProducts,
|
|
451
|
+
verticalProducts,
|
|
452
|
+
})), concatMap((data) => this.saveHomeData(data)))));
|
|
453
|
+
}
|
|
454
|
+
getBanners(type) {
|
|
455
|
+
return this.getHomeConfiguration().pipe(map((home) => {
|
|
456
|
+
if (type === 'brand')
|
|
457
|
+
return home.brandsCarousel;
|
|
458
|
+
if (type === 'buyToWin')
|
|
459
|
+
return [home.buyToWinBanner];
|
|
460
|
+
if (type === 'block')
|
|
461
|
+
return home.blockBanners;
|
|
462
|
+
if (type === 'blog')
|
|
463
|
+
return [home.blogBanner];
|
|
464
|
+
}));
|
|
465
|
+
}
|
|
466
|
+
getDiscoverProducts() {
|
|
467
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
468
|
+
}
|
|
469
|
+
getFeaturedProducts() {
|
|
470
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
471
|
+
}
|
|
472
|
+
getVerticalProducts() {
|
|
473
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => forkJoin([
|
|
474
|
+
this.categoryRepository.get({ id }),
|
|
475
|
+
this.productRepository.find([{ categories: { operator: Where.LIKE, value: [id] } }], { limit: 12 }),
|
|
476
|
+
]).pipe(map(([category, products]) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
|
|
477
|
+
}
|
|
478
|
+
getHomeConfiguration() {
|
|
479
|
+
return of(this.homeConfiguration).pipe(concatMap((home) => home
|
|
480
|
+
? of(home)
|
|
481
|
+
: !this.homeId
|
|
482
|
+
? throwError(new RequiredArgumentError(['homeId']))
|
|
483
|
+
: from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
|
|
484
|
+
}
|
|
485
|
+
saveHomeData(homeData) {
|
|
486
|
+
const data = {
|
|
487
|
+
createdAt: new Date(),
|
|
488
|
+
expiresAt: add(new Date(), { hours: 1 }),
|
|
489
|
+
data: homeData,
|
|
490
|
+
};
|
|
491
|
+
return from(this.homeRepository.update({
|
|
492
|
+
id: this.homeId,
|
|
493
|
+
data,
|
|
494
|
+
})).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
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 });
|
|
498
|
+
HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService });
|
|
499
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: HomeShopService, decorators: [{
|
|
500
|
+
type: Injectable
|
|
501
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
502
|
+
type: Inject,
|
|
503
|
+
args: ['CategoryRepository']
|
|
504
|
+
}] }, { type: undefined, decorators: [{
|
|
505
|
+
type: Inject,
|
|
506
|
+
args: ['HomeRepository']
|
|
507
|
+
}] }, { type: undefined, decorators: [{
|
|
508
|
+
type: Inject,
|
|
509
|
+
args: ['ProductRepository']
|
|
510
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
511
|
+
type: Inject,
|
|
512
|
+
args: [DEFAULT_SHOP]
|
|
536
513
|
}] }]; } });
|
|
537
514
|
|
|
538
|
-
class AngularFirebaseAuthModule {
|
|
539
|
-
static initializeApp(options, nameOrConfig) {
|
|
540
|
-
return {
|
|
541
|
-
ngModule: AngularFirebaseAuthModule,
|
|
542
|
-
providers: [
|
|
543
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
544
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
545
|
-
],
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
550
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
|
|
551
|
-
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
552
|
-
{
|
|
553
|
-
provide: 'Authentication',
|
|
554
|
-
useFactory: (authenticationService, userRepository) => {
|
|
555
|
-
return new Authentication(authenticationService, userRepository);
|
|
556
|
-
},
|
|
557
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
provide: 'AuthenticationService',
|
|
561
|
-
useFactory: (angularFireAuth) => {
|
|
562
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
563
|
-
},
|
|
564
|
-
deps: [AngularFireAuth],
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
provide: 'Register',
|
|
568
|
-
useFactory: (registerService, userRepository) => {
|
|
569
|
-
return new Register(registerService, userRepository);
|
|
570
|
-
},
|
|
571
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
provide: 'RegisterService',
|
|
575
|
-
useFactory: (angularFireAuth) => {
|
|
576
|
-
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
577
|
-
},
|
|
578
|
-
deps: [AngularFireAuth],
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
provide: 'SignOut',
|
|
582
|
-
useFactory: (authenticationService) => {
|
|
583
|
-
return new SignOut(authenticationService);
|
|
584
|
-
},
|
|
585
|
-
deps: ['AuthenticationService'],
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
provide: 'RecoveryPassword',
|
|
589
|
-
useFactory: (authenticationService) => {
|
|
590
|
-
return new RecoveryPassword(authenticationService);
|
|
591
|
-
},
|
|
592
|
-
deps: ['AuthenticationService'],
|
|
593
|
-
},
|
|
594
|
-
], imports: [[AngularFireModule]] });
|
|
595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
596
|
-
type: NgModule,
|
|
597
|
-
args: [{
|
|
598
|
-
imports: [AngularFireModule],
|
|
599
|
-
providers: [
|
|
600
|
-
{
|
|
601
|
-
provide: 'Authentication',
|
|
602
|
-
useFactory: (authenticationService, userRepository) => {
|
|
603
|
-
return new Authentication(authenticationService, userRepository);
|
|
604
|
-
},
|
|
605
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
provide: 'AuthenticationService',
|
|
609
|
-
useFactory: (angularFireAuth) => {
|
|
610
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
611
|
-
},
|
|
612
|
-
deps: [AngularFireAuth],
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
provide: 'Register',
|
|
616
|
-
useFactory: (registerService, userRepository) => {
|
|
617
|
-
return new Register(registerService, userRepository);
|
|
618
|
-
},
|
|
619
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
620
|
-
},
|
|
621
|
-
{
|
|
622
|
-
provide: 'RegisterService',
|
|
623
|
-
useFactory: (angularFireAuth) => {
|
|
624
|
-
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
625
|
-
},
|
|
626
|
-
deps: [AngularFireAuth],
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
provide: 'SignOut',
|
|
630
|
-
useFactory: (authenticationService) => {
|
|
631
|
-
return new SignOut(authenticationService);
|
|
632
|
-
},
|
|
633
|
-
deps: ['AuthenticationService'],
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
provide: 'RecoveryPassword',
|
|
637
|
-
useFactory: (authenticationService) => {
|
|
638
|
-
return new RecoveryPassword(authenticationService);
|
|
639
|
-
},
|
|
640
|
-
deps: ['AuthenticationService'],
|
|
641
|
-
},
|
|
642
|
-
],
|
|
643
|
-
}]
|
|
515
|
+
class AngularFirebaseAuthModule {
|
|
516
|
+
static initializeApp(options, nameOrConfig) {
|
|
517
|
+
return {
|
|
518
|
+
ngModule: AngularFirebaseAuthModule,
|
|
519
|
+
providers: [
|
|
520
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
521
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
522
|
+
],
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
527
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
|
|
528
|
+
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
529
|
+
{
|
|
530
|
+
provide: 'Authentication',
|
|
531
|
+
useFactory: (authenticationService, userRepository) => {
|
|
532
|
+
return new Authentication(authenticationService, userRepository);
|
|
533
|
+
},
|
|
534
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
provide: 'AuthenticationService',
|
|
538
|
+
useFactory: (angularFireAuth) => {
|
|
539
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
540
|
+
},
|
|
541
|
+
deps: [AngularFireAuth],
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
provide: 'Register',
|
|
545
|
+
useFactory: (registerService, userRepository) => {
|
|
546
|
+
return new Register(registerService, userRepository);
|
|
547
|
+
},
|
|
548
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
provide: 'RegisterService',
|
|
552
|
+
useFactory: (angularFireAuth) => {
|
|
553
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
554
|
+
},
|
|
555
|
+
deps: [AngularFireAuth],
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
provide: 'SignOut',
|
|
559
|
+
useFactory: (authenticationService) => {
|
|
560
|
+
return new SignOut(authenticationService);
|
|
561
|
+
},
|
|
562
|
+
deps: ['AuthenticationService'],
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
provide: 'RecoveryPassword',
|
|
566
|
+
useFactory: (authenticationService) => {
|
|
567
|
+
return new RecoveryPassword(authenticationService);
|
|
568
|
+
},
|
|
569
|
+
deps: ['AuthenticationService'],
|
|
570
|
+
},
|
|
571
|
+
], imports: [[AngularFireModule]] });
|
|
572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
573
|
+
type: NgModule,
|
|
574
|
+
args: [{
|
|
575
|
+
imports: [AngularFireModule],
|
|
576
|
+
providers: [
|
|
577
|
+
{
|
|
578
|
+
provide: 'Authentication',
|
|
579
|
+
useFactory: (authenticationService, userRepository) => {
|
|
580
|
+
return new Authentication(authenticationService, userRepository);
|
|
581
|
+
},
|
|
582
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
provide: 'AuthenticationService',
|
|
586
|
+
useFactory: (angularFireAuth) => {
|
|
587
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
588
|
+
},
|
|
589
|
+
deps: [AngularFireAuth],
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
provide: 'Register',
|
|
593
|
+
useFactory: (registerService, userRepository) => {
|
|
594
|
+
return new Register(registerService, userRepository);
|
|
595
|
+
},
|
|
596
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
provide: 'RegisterService',
|
|
600
|
+
useFactory: (angularFireAuth) => {
|
|
601
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
602
|
+
},
|
|
603
|
+
deps: [AngularFireAuth],
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
provide: 'SignOut',
|
|
607
|
+
useFactory: (authenticationService) => {
|
|
608
|
+
return new SignOut(authenticationService);
|
|
609
|
+
},
|
|
610
|
+
deps: ['AuthenticationService'],
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
provide: 'RecoveryPassword',
|
|
614
|
+
useFactory: (authenticationService) => {
|
|
615
|
+
return new RecoveryPassword(authenticationService);
|
|
616
|
+
},
|
|
617
|
+
deps: ['AuthenticationService'],
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
}]
|
|
644
621
|
}] });
|
|
645
622
|
|
|
646
|
-
class AngularElasticSeachModule {
|
|
647
|
-
static initializeApp(options) {
|
|
648
|
-
return {
|
|
649
|
-
ngModule: AngularElasticSeachModule,
|
|
650
|
-
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
655
|
-
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule });
|
|
656
|
-
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
657
|
-
{
|
|
658
|
-
provide: ProductsIndex,
|
|
659
|
-
useFactory: (configuration) => {
|
|
660
|
-
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
661
|
-
},
|
|
662
|
-
deps: [ES_CONFIG],
|
|
663
|
-
},
|
|
664
|
-
] });
|
|
665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
666
|
-
type: NgModule,
|
|
667
|
-
args: [{
|
|
668
|
-
providers: [
|
|
669
|
-
{
|
|
670
|
-
provide: ProductsIndex,
|
|
671
|
-
useFactory: (configuration) => {
|
|
672
|
-
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
673
|
-
},
|
|
674
|
-
deps: [ES_CONFIG],
|
|
675
|
-
},
|
|
676
|
-
],
|
|
677
|
-
}]
|
|
623
|
+
class AngularElasticSeachModule {
|
|
624
|
+
static initializeApp(options) {
|
|
625
|
+
return {
|
|
626
|
+
ngModule: AngularElasticSeachModule,
|
|
627
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
632
|
+
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule });
|
|
633
|
+
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
634
|
+
{
|
|
635
|
+
provide: ProductsIndex,
|
|
636
|
+
useFactory: (configuration) => {
|
|
637
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
638
|
+
},
|
|
639
|
+
deps: [ES_CONFIG],
|
|
640
|
+
},
|
|
641
|
+
] });
|
|
642
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
643
|
+
type: NgModule,
|
|
644
|
+
args: [{
|
|
645
|
+
providers: [
|
|
646
|
+
{
|
|
647
|
+
provide: ProductsIndex,
|
|
648
|
+
useFactory: (configuration) => {
|
|
649
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
650
|
+
},
|
|
651
|
+
deps: [ES_CONFIG],
|
|
652
|
+
},
|
|
653
|
+
],
|
|
654
|
+
}]
|
|
678
655
|
}] });
|
|
679
656
|
|
|
680
|
-
class AngularFirestoreModule {
|
|
681
|
-
static initializeApp(options, nameOrConfig) {
|
|
682
|
-
return {
|
|
683
|
-
ngModule: AngularFirestoreModule,
|
|
684
|
-
providers: [
|
|
685
|
-
{ provide: FIREBASE_OPTIONS, useValue: options.firebase },
|
|
686
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
687
|
-
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
688
|
-
],
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
693
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule, AngularElasticSeachModule] });
|
|
694
|
-
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
695
|
-
{
|
|
696
|
-
provide: 'BeautyProfileRepository',
|
|
697
|
-
useFactory: (firestore, userRepository) => {
|
|
698
|
-
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
699
|
-
},
|
|
700
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
provide: 'Buy2WinRepository',
|
|
704
|
-
useFactory: (firestore) => {
|
|
705
|
-
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
706
|
-
},
|
|
707
|
-
deps: [AngularFirestore],
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
provide: 'CategoryRepository',
|
|
711
|
-
useFactory: (firestore, productsIndex) => {
|
|
712
|
-
return new CategoryFirestoreRepository(firestore.firestore
|
|
713
|
-
},
|
|
714
|
-
deps: [AngularFirestore, ProductsIndex],
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
provide: 'CheckoutRepository',
|
|
718
|
-
useFactory: (firestore) => {
|
|
719
|
-
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
720
|
-
},
|
|
721
|
-
deps: [AngularFirestore],
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
725
|
-
useFactory: (firestore) => {
|
|
726
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
727
|
-
},
|
|
728
|
-
deps: [AngularFirestore],
|
|
729
|
-
},
|
|
730
|
-
{
|
|
731
|
-
provide: 'CouponRepository',
|
|
732
|
-
useFactory: (firestore) => {
|
|
733
|
-
return new CouponFirestoreRepository(firestore.firestore);
|
|
734
|
-
},
|
|
735
|
-
deps: [AngularFirestore],
|
|
736
|
-
},
|
|
737
|
-
{
|
|
738
|
-
provide: 'EditionRepository',
|
|
739
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
740
|
-
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
741
|
-
},
|
|
742
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
743
|
-
},
|
|
744
|
-
{
|
|
745
|
-
provide: 'HomeRepository',
|
|
746
|
-
useFactory: (firestore) => {
|
|
747
|
-
return new HomeFirestoreRepository(firestore.firestore);
|
|
748
|
-
},
|
|
749
|
-
deps: [AngularFirestore],
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
provide: 'LeadRepository',
|
|
753
|
-
useFactory: (firestore) => {
|
|
754
|
-
return new LeadFirestoreRepository(firestore.firestore);
|
|
755
|
-
},
|
|
756
|
-
deps: [AngularFirestore],
|
|
757
|
-
},
|
|
758
|
-
{
|
|
759
|
-
provide: 'LegacyOrderRepository',
|
|
760
|
-
useFactory: (firestore) => {
|
|
761
|
-
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
762
|
-
},
|
|
763
|
-
deps: [AngularFirestore],
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
provide: 'ShopMenuRepository',
|
|
767
|
-
useFactory: (firestore) => {
|
|
768
|
-
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
769
|
-
},
|
|
770
|
-
deps: [AngularFirestore],
|
|
771
|
-
},
|
|
772
|
-
{
|
|
773
|
-
provide: 'OrderRepository',
|
|
774
|
-
useFactory: (firestore) => {
|
|
775
|
-
return new OrderFirestoreRepository(firestore.firestore);
|
|
776
|
-
},
|
|
777
|
-
deps: [AngularFirestore],
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
provide: 'PaymentRepository',
|
|
781
|
-
useFactory: (firestore) => {
|
|
782
|
-
return new PaymentFirestoreRepository(firestore.firestore);
|
|
783
|
-
},
|
|
784
|
-
deps: [AngularFirestore],
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
provide: 'ProductRepository',
|
|
788
|
-
useFactory: (firestore) => {
|
|
789
|
-
return new ProductFirestoreRepository(firestore.firestore);
|
|
790
|
-
},
|
|
791
|
-
deps: [AngularFirestore],
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
provide: 'SubscriptionPaymentRepository',
|
|
795
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
796
|
-
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
797
|
-
},
|
|
798
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
799
|
-
},
|
|
800
|
-
{
|
|
801
|
-
provide: 'SubscriptionPlanRepository',
|
|
802
|
-
useFactory: (firestore) => {
|
|
803
|
-
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
804
|
-
},
|
|
805
|
-
deps: [AngularFirestore],
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
provide: 'SubscriptionProductRepository',
|
|
809
|
-
useFactory: (firestore) => {
|
|
810
|
-
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
811
|
-
},
|
|
812
|
-
deps: [AngularFirestore],
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
provide: 'SubscriptionRepository',
|
|
816
|
-
useFactory: (firestore) => {
|
|
817
|
-
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
818
|
-
},
|
|
819
|
-
deps: [AngularFirestore],
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
provide: 'UserRepository',
|
|
823
|
-
useFactory: (firestore) => {
|
|
824
|
-
return new UserFirestoreRepository(firestore.firestore);
|
|
825
|
-
},
|
|
826
|
-
deps: [AngularFirestore],
|
|
827
|
-
},
|
|
828
|
-
{
|
|
829
|
-
provide: 'UserAddressRepository',
|
|
830
|
-
useFactory: (firestore, userRepository) => {
|
|
831
|
-
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
832
|
-
},
|
|
833
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
provide: 'UserPaymentMethodRepository',
|
|
837
|
-
useFactory: (firestore, userRepository) => {
|
|
838
|
-
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
839
|
-
},
|
|
840
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
841
|
-
},
|
|
842
|
-
{
|
|
843
|
-
provide: 'VariantRepository',
|
|
844
|
-
useFactory: (firestore, productRepository) => {
|
|
845
|
-
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
846
|
-
},
|
|
847
|
-
deps: [AngularFirestore, 'ProductRepository'],
|
|
848
|
-
},
|
|
849
|
-
], imports: [[AngularFireModule, AngularElasticSeachModule]] });
|
|
850
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
851
|
-
type: NgModule,
|
|
852
|
-
args: [{
|
|
853
|
-
imports: [AngularFireModule, AngularElasticSeachModule],
|
|
854
|
-
providers: [
|
|
855
|
-
{
|
|
856
|
-
provide: 'BeautyProfileRepository',
|
|
857
|
-
useFactory: (firestore, userRepository) => {
|
|
858
|
-
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
859
|
-
},
|
|
860
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
861
|
-
},
|
|
862
|
-
{
|
|
863
|
-
provide: 'Buy2WinRepository',
|
|
864
|
-
useFactory: (firestore) => {
|
|
865
|
-
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
866
|
-
},
|
|
867
|
-
deps: [AngularFirestore],
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
provide: 'CategoryRepository',
|
|
871
|
-
useFactory: (firestore, productsIndex) => {
|
|
872
|
-
return new CategoryFirestoreRepository(firestore.firestore
|
|
873
|
-
},
|
|
874
|
-
deps: [AngularFirestore, ProductsIndex],
|
|
875
|
-
},
|
|
876
|
-
{
|
|
877
|
-
provide: 'CheckoutRepository',
|
|
878
|
-
useFactory: (firestore) => {
|
|
879
|
-
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
880
|
-
},
|
|
881
|
-
deps: [AngularFirestore],
|
|
882
|
-
},
|
|
883
|
-
{
|
|
884
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
885
|
-
useFactory: (firestore) => {
|
|
886
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
887
|
-
},
|
|
888
|
-
deps: [AngularFirestore],
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
provide: 'CouponRepository',
|
|
892
|
-
useFactory: (firestore) => {
|
|
893
|
-
return new CouponFirestoreRepository(firestore.firestore);
|
|
894
|
-
},
|
|
895
|
-
deps: [AngularFirestore],
|
|
896
|
-
},
|
|
897
|
-
{
|
|
898
|
-
provide: 'EditionRepository',
|
|
899
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
900
|
-
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
901
|
-
},
|
|
902
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
903
|
-
},
|
|
904
|
-
{
|
|
905
|
-
provide: 'HomeRepository',
|
|
906
|
-
useFactory: (firestore) => {
|
|
907
|
-
return new HomeFirestoreRepository(firestore.firestore);
|
|
908
|
-
},
|
|
909
|
-
deps: [AngularFirestore],
|
|
910
|
-
},
|
|
911
|
-
{
|
|
912
|
-
provide: 'LeadRepository',
|
|
913
|
-
useFactory: (firestore) => {
|
|
914
|
-
return new LeadFirestoreRepository(firestore.firestore);
|
|
915
|
-
},
|
|
916
|
-
deps: [AngularFirestore],
|
|
917
|
-
},
|
|
918
|
-
{
|
|
919
|
-
provide: 'LegacyOrderRepository',
|
|
920
|
-
useFactory: (firestore) => {
|
|
921
|
-
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
922
|
-
},
|
|
923
|
-
deps: [AngularFirestore],
|
|
924
|
-
},
|
|
925
|
-
{
|
|
926
|
-
provide: 'ShopMenuRepository',
|
|
927
|
-
useFactory: (firestore) => {
|
|
928
|
-
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
929
|
-
},
|
|
930
|
-
deps: [AngularFirestore],
|
|
931
|
-
},
|
|
932
|
-
{
|
|
933
|
-
provide: 'OrderRepository',
|
|
934
|
-
useFactory: (firestore) => {
|
|
935
|
-
return new OrderFirestoreRepository(firestore.firestore);
|
|
936
|
-
},
|
|
937
|
-
deps: [AngularFirestore],
|
|
938
|
-
},
|
|
939
|
-
{
|
|
940
|
-
provide: 'PaymentRepository',
|
|
941
|
-
useFactory: (firestore) => {
|
|
942
|
-
return new PaymentFirestoreRepository(firestore.firestore);
|
|
943
|
-
},
|
|
944
|
-
deps: [AngularFirestore],
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
provide: 'ProductRepository',
|
|
948
|
-
useFactory: (firestore) => {
|
|
949
|
-
return new ProductFirestoreRepository(firestore.firestore);
|
|
950
|
-
},
|
|
951
|
-
deps: [AngularFirestore],
|
|
952
|
-
},
|
|
953
|
-
{
|
|
954
|
-
provide: 'SubscriptionPaymentRepository',
|
|
955
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
956
|
-
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
957
|
-
},
|
|
958
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
959
|
-
},
|
|
960
|
-
{
|
|
961
|
-
provide: 'SubscriptionPlanRepository',
|
|
962
|
-
useFactory: (firestore) => {
|
|
963
|
-
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
964
|
-
},
|
|
965
|
-
deps: [AngularFirestore],
|
|
966
|
-
},
|
|
967
|
-
{
|
|
968
|
-
provide: 'SubscriptionProductRepository',
|
|
969
|
-
useFactory: (firestore) => {
|
|
970
|
-
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
971
|
-
},
|
|
972
|
-
deps: [AngularFirestore],
|
|
973
|
-
},
|
|
974
|
-
{
|
|
975
|
-
provide: 'SubscriptionRepository',
|
|
976
|
-
useFactory: (firestore) => {
|
|
977
|
-
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
978
|
-
},
|
|
979
|
-
deps: [AngularFirestore],
|
|
980
|
-
},
|
|
981
|
-
{
|
|
982
|
-
provide: 'UserRepository',
|
|
983
|
-
useFactory: (firestore) => {
|
|
984
|
-
return new UserFirestoreRepository(firestore.firestore);
|
|
985
|
-
},
|
|
986
|
-
deps: [AngularFirestore],
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
provide: 'UserAddressRepository',
|
|
990
|
-
useFactory: (firestore, userRepository) => {
|
|
991
|
-
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
992
|
-
},
|
|
993
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
994
|
-
},
|
|
995
|
-
{
|
|
996
|
-
provide: 'UserPaymentMethodRepository',
|
|
997
|
-
useFactory: (firestore, userRepository) => {
|
|
998
|
-
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
999
|
-
},
|
|
1000
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
1001
|
-
},
|
|
1002
|
-
{
|
|
1003
|
-
provide: 'VariantRepository',
|
|
1004
|
-
useFactory: (firestore, productRepository) => {
|
|
1005
|
-
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
1006
|
-
},
|
|
1007
|
-
deps: [AngularFirestore, 'ProductRepository'],
|
|
1008
|
-
},
|
|
1009
|
-
],
|
|
1010
|
-
}]
|
|
657
|
+
class AngularFirestoreModule {
|
|
658
|
+
static initializeApp(options, nameOrConfig) {
|
|
659
|
+
return {
|
|
660
|
+
ngModule: AngularFirestoreModule,
|
|
661
|
+
providers: [
|
|
662
|
+
{ provide: FIREBASE_OPTIONS, useValue: options.firebase },
|
|
663
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
664
|
+
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
665
|
+
],
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
670
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule, AngularElasticSeachModule] });
|
|
671
|
+
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
672
|
+
{
|
|
673
|
+
provide: 'BeautyProfileRepository',
|
|
674
|
+
useFactory: (firestore, userRepository) => {
|
|
675
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
676
|
+
},
|
|
677
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
provide: 'Buy2WinRepository',
|
|
681
|
+
useFactory: (firestore) => {
|
|
682
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
683
|
+
},
|
|
684
|
+
deps: [AngularFirestore],
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
provide: 'CategoryRepository',
|
|
688
|
+
useFactory: (firestore, productsIndex) => {
|
|
689
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
690
|
+
},
|
|
691
|
+
deps: [AngularFirestore, ProductsIndex],
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
provide: 'CheckoutRepository',
|
|
695
|
+
useFactory: (firestore) => {
|
|
696
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
697
|
+
},
|
|
698
|
+
deps: [AngularFirestore],
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
702
|
+
useFactory: (firestore) => {
|
|
703
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
704
|
+
},
|
|
705
|
+
deps: [AngularFirestore],
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
provide: 'CouponRepository',
|
|
709
|
+
useFactory: (firestore) => {
|
|
710
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
711
|
+
},
|
|
712
|
+
deps: [AngularFirestore],
|
|
713
|
+
},
|
|
714
|
+
{
|
|
715
|
+
provide: 'EditionRepository',
|
|
716
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
717
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
718
|
+
},
|
|
719
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
provide: 'HomeRepository',
|
|
723
|
+
useFactory: (firestore) => {
|
|
724
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
725
|
+
},
|
|
726
|
+
deps: [AngularFirestore],
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
provide: 'LeadRepository',
|
|
730
|
+
useFactory: (firestore) => {
|
|
731
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
732
|
+
},
|
|
733
|
+
deps: [AngularFirestore],
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
provide: 'LegacyOrderRepository',
|
|
737
|
+
useFactory: (firestore) => {
|
|
738
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
739
|
+
},
|
|
740
|
+
deps: [AngularFirestore],
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
provide: 'ShopMenuRepository',
|
|
744
|
+
useFactory: (firestore) => {
|
|
745
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
746
|
+
},
|
|
747
|
+
deps: [AngularFirestore],
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
provide: 'OrderRepository',
|
|
751
|
+
useFactory: (firestore) => {
|
|
752
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
753
|
+
},
|
|
754
|
+
deps: [AngularFirestore],
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
provide: 'PaymentRepository',
|
|
758
|
+
useFactory: (firestore) => {
|
|
759
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
760
|
+
},
|
|
761
|
+
deps: [AngularFirestore],
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
provide: 'ProductRepository',
|
|
765
|
+
useFactory: (firestore) => {
|
|
766
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
767
|
+
},
|
|
768
|
+
deps: [AngularFirestore],
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
provide: 'SubscriptionPaymentRepository',
|
|
772
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
773
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
774
|
+
},
|
|
775
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
provide: 'SubscriptionPlanRepository',
|
|
779
|
+
useFactory: (firestore) => {
|
|
780
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
781
|
+
},
|
|
782
|
+
deps: [AngularFirestore],
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
provide: 'SubscriptionProductRepository',
|
|
786
|
+
useFactory: (firestore) => {
|
|
787
|
+
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
788
|
+
},
|
|
789
|
+
deps: [AngularFirestore],
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
provide: 'SubscriptionRepository',
|
|
793
|
+
useFactory: (firestore) => {
|
|
794
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
795
|
+
},
|
|
796
|
+
deps: [AngularFirestore],
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
provide: 'UserRepository',
|
|
800
|
+
useFactory: (firestore) => {
|
|
801
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
802
|
+
},
|
|
803
|
+
deps: [AngularFirestore],
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
provide: 'UserAddressRepository',
|
|
807
|
+
useFactory: (firestore, userRepository) => {
|
|
808
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
809
|
+
},
|
|
810
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
provide: 'UserPaymentMethodRepository',
|
|
814
|
+
useFactory: (firestore, userRepository) => {
|
|
815
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
816
|
+
},
|
|
817
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
provide: 'VariantRepository',
|
|
821
|
+
useFactory: (firestore, productRepository) => {
|
|
822
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
823
|
+
},
|
|
824
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
825
|
+
},
|
|
826
|
+
], imports: [[AngularFireModule, AngularElasticSeachModule]] });
|
|
827
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
828
|
+
type: NgModule,
|
|
829
|
+
args: [{
|
|
830
|
+
imports: [AngularFireModule, AngularElasticSeachModule],
|
|
831
|
+
providers: [
|
|
832
|
+
{
|
|
833
|
+
provide: 'BeautyProfileRepository',
|
|
834
|
+
useFactory: (firestore, userRepository) => {
|
|
835
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
836
|
+
},
|
|
837
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
provide: 'Buy2WinRepository',
|
|
841
|
+
useFactory: (firestore) => {
|
|
842
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
843
|
+
},
|
|
844
|
+
deps: [AngularFirestore],
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
provide: 'CategoryRepository',
|
|
848
|
+
useFactory: (firestore, productsIndex) => {
|
|
849
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
850
|
+
},
|
|
851
|
+
deps: [AngularFirestore, ProductsIndex],
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
provide: 'CheckoutRepository',
|
|
855
|
+
useFactory: (firestore) => {
|
|
856
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
857
|
+
},
|
|
858
|
+
deps: [AngularFirestore],
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
862
|
+
useFactory: (firestore) => {
|
|
863
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
864
|
+
},
|
|
865
|
+
deps: [AngularFirestore],
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
provide: 'CouponRepository',
|
|
869
|
+
useFactory: (firestore) => {
|
|
870
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
871
|
+
},
|
|
872
|
+
deps: [AngularFirestore],
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
provide: 'EditionRepository',
|
|
876
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
877
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
878
|
+
},
|
|
879
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
provide: 'HomeRepository',
|
|
883
|
+
useFactory: (firestore) => {
|
|
884
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
885
|
+
},
|
|
886
|
+
deps: [AngularFirestore],
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
provide: 'LeadRepository',
|
|
890
|
+
useFactory: (firestore) => {
|
|
891
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
892
|
+
},
|
|
893
|
+
deps: [AngularFirestore],
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
provide: 'LegacyOrderRepository',
|
|
897
|
+
useFactory: (firestore) => {
|
|
898
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
899
|
+
},
|
|
900
|
+
deps: [AngularFirestore],
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
provide: 'ShopMenuRepository',
|
|
904
|
+
useFactory: (firestore) => {
|
|
905
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
906
|
+
},
|
|
907
|
+
deps: [AngularFirestore],
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
provide: 'OrderRepository',
|
|
911
|
+
useFactory: (firestore) => {
|
|
912
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
913
|
+
},
|
|
914
|
+
deps: [AngularFirestore],
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
provide: 'PaymentRepository',
|
|
918
|
+
useFactory: (firestore) => {
|
|
919
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
920
|
+
},
|
|
921
|
+
deps: [AngularFirestore],
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
provide: 'ProductRepository',
|
|
925
|
+
useFactory: (firestore) => {
|
|
926
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
927
|
+
},
|
|
928
|
+
deps: [AngularFirestore],
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
provide: 'SubscriptionPaymentRepository',
|
|
932
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
933
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
934
|
+
},
|
|
935
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
provide: 'SubscriptionPlanRepository',
|
|
939
|
+
useFactory: (firestore) => {
|
|
940
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
941
|
+
},
|
|
942
|
+
deps: [AngularFirestore],
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
provide: 'SubscriptionProductRepository',
|
|
946
|
+
useFactory: (firestore) => {
|
|
947
|
+
return new SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
948
|
+
},
|
|
949
|
+
deps: [AngularFirestore],
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
provide: 'SubscriptionRepository',
|
|
953
|
+
useFactory: (firestore) => {
|
|
954
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
955
|
+
},
|
|
956
|
+
deps: [AngularFirestore],
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
provide: 'UserRepository',
|
|
960
|
+
useFactory: (firestore) => {
|
|
961
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
962
|
+
},
|
|
963
|
+
deps: [AngularFirestore],
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
provide: 'UserAddressRepository',
|
|
967
|
+
useFactory: (firestore, userRepository) => {
|
|
968
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
969
|
+
},
|
|
970
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
971
|
+
},
|
|
972
|
+
{
|
|
973
|
+
provide: 'UserPaymentMethodRepository',
|
|
974
|
+
useFactory: (firestore, userRepository) => {
|
|
975
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
976
|
+
},
|
|
977
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
provide: 'VariantRepository',
|
|
981
|
+
useFactory: (firestore, productRepository) => {
|
|
982
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
983
|
+
},
|
|
984
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
985
|
+
},
|
|
986
|
+
],
|
|
987
|
+
}]
|
|
1011
988
|
}] });
|
|
1012
989
|
|
|
1013
|
-
class AngularConnectModule {
|
|
1014
|
-
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
1015
|
-
return {
|
|
1016
|
-
ngModule: AngularConnectModule,
|
|
1017
|
-
providers: [
|
|
1018
|
-
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
1019
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]),
|
|
1020
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1021
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1022
|
-
],
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1027
|
-
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
|
|
1028
|
-
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [
|
|
1029
|
-
AuthService,
|
|
1030
|
-
CartService,
|
|
1031
|
-
CheckoutService,
|
|
1032
|
-
CheckoutSubscriptionService,
|
|
1033
|
-
CouponService,
|
|
1034
|
-
HomeShopService,
|
|
1035
|
-
OrderService,
|
|
1036
|
-
], imports: [[AngularFireModule, AngularFirestoreModule]] });
|
|
1037
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1038
|
-
type: NgModule,
|
|
1039
|
-
args: [{
|
|
1040
|
-
imports: [AngularFireModule, AngularFirestoreModule],
|
|
1041
|
-
providers: [
|
|
1042
|
-
AuthService,
|
|
1043
|
-
CartService,
|
|
1044
|
-
CheckoutService,
|
|
1045
|
-
CheckoutSubscriptionService,
|
|
1046
|
-
CouponService,
|
|
1047
|
-
HomeShopService,
|
|
1048
|
-
OrderService,
|
|
1049
|
-
],
|
|
1050
|
-
}]
|
|
990
|
+
class AngularConnectModule {
|
|
991
|
+
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
992
|
+
return {
|
|
993
|
+
ngModule: AngularConnectModule,
|
|
994
|
+
providers: [
|
|
995
|
+
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
996
|
+
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]),
|
|
997
|
+
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
998
|
+
...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
999
|
+
],
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1004
|
+
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
|
|
1005
|
+
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [
|
|
1006
|
+
AuthService,
|
|
1007
|
+
CartService,
|
|
1008
|
+
CheckoutService,
|
|
1009
|
+
CheckoutSubscriptionService,
|
|
1010
|
+
CouponService,
|
|
1011
|
+
HomeShopService,
|
|
1012
|
+
OrderService,
|
|
1013
|
+
], imports: [[AngularFireModule, AngularFirestoreModule]] });
|
|
1014
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1015
|
+
type: NgModule,
|
|
1016
|
+
args: [{
|
|
1017
|
+
imports: [AngularFireModule, AngularFirestoreModule],
|
|
1018
|
+
providers: [
|
|
1019
|
+
AuthService,
|
|
1020
|
+
CartService,
|
|
1021
|
+
CheckoutService,
|
|
1022
|
+
CheckoutSubscriptionService,
|
|
1023
|
+
CouponService,
|
|
1024
|
+
HomeShopService,
|
|
1025
|
+
OrderService,
|
|
1026
|
+
],
|
|
1027
|
+
}]
|
|
1051
1028
|
}] });
|
|
1052
1029
|
|
|
1053
|
-
/**
|
|
1054
|
-
* Generated bundle index. Do not edit.
|
|
1030
|
+
/**
|
|
1031
|
+
* Generated bundle index. Do not edit.
|
|
1055
1032
|
*/
|
|
1056
1033
|
|
|
1057
1034
|
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|