@infrab4a/connect-angular 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/infrab4a-connect-angular.umd.js +1044 -1035
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/infrab4a-connect-angular.js +4 -4
- package/esm2015/lib/angular-connect.module.js +30 -30
- package/esm2015/lib/angular-firebase-auth.module.js +71 -71
- package/esm2015/lib/angular-firestore.module.js +323 -323
- package/esm2015/lib/consts/default-shop.const.js +2 -2
- package/esm2015/lib/consts/index.js +2 -2
- package/esm2015/lib/index.js +5 -5
- package/esm2015/lib/services/auth.service.js +42 -33
- package/esm2015/lib/services/cart.service.js +153 -153
- package/esm2015/lib/services/checkout-subscription.service.js +37 -37
- package/esm2015/lib/services/checkout.service.js +57 -57
- package/esm2015/lib/services/index.js +6 -6
- package/esm2015/lib/services/order.service.js +32 -32
- package/esm2015/lib/services/types/index.js +3 -3
- package/esm2015/lib/services/types/required-checkout-data.type.js +2 -2
- package/esm2015/lib/services/types/required-checkout-subscription-data.type.js +2 -2
- package/esm2015/public-api.js +2 -2
- package/fesm2015/infrab4a-connect-angular.js +676 -667
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/infrab4a-connect-angular.d.ts +5 -5
- package/lib/angular-connect.module.d.ts +12 -12
- package/lib/angular-firebase-auth.module.d.ts +10 -10
- package/lib/angular-firestore.module.d.ts +10 -10
- package/lib/consts/default-shop.const.d.ts +1 -1
- package/lib/consts/index.d.ts +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/services/auth.service.d.ts +19 -16
- package/lib/services/cart.service.d.ts +35 -35
- package/lib/services/checkout-subscription.service.d.ts +13 -13
- package/lib/services/checkout.service.d.ts +18 -18
- package/lib/services/index.d.ts +5 -5
- package/lib/services/order.service.d.ts +13 -13
- package/lib/services/types/index.d.ts +2 -2
- package/lib/services/types/required-checkout-data.type.d.ts +2 -2
- package/lib/services/types/required-checkout-subscription-data.type.d.ts +2 -2
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
|
@@ -2,8 +2,8 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/fire/auth';
|
|
4
4
|
import { AngularFireAuth } from '@angular/fire/auth';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { of, combineLatest, from, throwError, Subject, iif } from 'rxjs';
|
|
6
|
+
import { catchError, map, mergeMap, concatMap, tap } from 'rxjs/operators';
|
|
7
7
|
import * as i1$1 from '@infrab4a/connect';
|
|
8
8
|
import { isNil, NotFoundError, Checkout, pick, LineItem, CouponTypes, FinancialCoupon, CouponSubtypes, CheckoutSubscription, Order, Authentication, AuthenticationFirebaseAuthService, SignOut, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository } from '@infrab4a/connect';
|
|
9
9
|
import { __awaiter } from 'tslib';
|
|
@@ -12,689 +12,698 @@ import * as i1$2 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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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']
|
|
40
49
|
}] }]; } });
|
|
41
50
|
|
|
42
51
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
43
52
|
|
|
44
|
-
class CheckoutService {
|
|
45
|
-
constructor(checkoutRepository, userRepository, defaultShop) {
|
|
46
|
-
this.checkoutRepository = checkoutRepository;
|
|
47
|
-
this.userRepository = userRepository;
|
|
48
|
-
this.defaultShop = defaultShop;
|
|
49
|
-
}
|
|
50
|
-
getCheckout(checkoutData) {
|
|
51
|
-
const checkoutId = cookie.get('checkoutId');
|
|
52
|
-
if (!isNil(checkoutId))
|
|
53
|
-
return from(this.checkoutRepository.get({ id: checkoutId }));
|
|
54
|
-
return from(this.createCheckout(checkoutData));
|
|
55
|
-
}
|
|
56
|
-
getUserByCheckout(checkoutId) {
|
|
57
|
-
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'))));
|
|
58
|
-
}
|
|
59
|
-
updateCheckoutLineItems(checkout) {
|
|
60
|
-
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
61
|
-
}
|
|
62
|
-
updateCheckoutUser(checkout) {
|
|
63
|
-
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
64
|
-
}
|
|
65
|
-
clearCheckoutFromSession() {
|
|
66
|
-
cookie.remove('checkoutId');
|
|
67
|
-
return of();
|
|
68
|
-
}
|
|
69
|
-
createCheckout(checkoutData) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
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 }));
|
|
72
|
-
cookie.set('checkoutId', checkout.id);
|
|
73
|
-
return checkout;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
CheckoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
78
|
-
CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService });
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, decorators: [{
|
|
80
|
-
type: Injectable
|
|
81
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
82
|
-
type: Inject,
|
|
83
|
-
args: ['CheckoutRepository']
|
|
84
|
-
}] }, { type: undefined, decorators: [{
|
|
85
|
-
type: Inject,
|
|
86
|
-
args: ['UserRepository']
|
|
87
|
-
}] }, { type: i1$1.Shops, decorators: [{
|
|
88
|
-
type: Inject,
|
|
89
|
-
args: [DEFAULT_SHOP]
|
|
53
|
+
class CheckoutService {
|
|
54
|
+
constructor(checkoutRepository, userRepository, defaultShop) {
|
|
55
|
+
this.checkoutRepository = checkoutRepository;
|
|
56
|
+
this.userRepository = userRepository;
|
|
57
|
+
this.defaultShop = defaultShop;
|
|
58
|
+
}
|
|
59
|
+
getCheckout(checkoutData) {
|
|
60
|
+
const checkoutId = cookie.get('checkoutId');
|
|
61
|
+
if (!isNil(checkoutId))
|
|
62
|
+
return from(this.checkoutRepository.get({ id: checkoutId }));
|
|
63
|
+
return from(this.createCheckout(checkoutData));
|
|
64
|
+
}
|
|
65
|
+
getUserByCheckout(checkoutId) {
|
|
66
|
+
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'))));
|
|
67
|
+
}
|
|
68
|
+
updateCheckoutLineItems(checkout) {
|
|
69
|
+
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
70
|
+
}
|
|
71
|
+
updateCheckoutUser(checkout) {
|
|
72
|
+
return from(this.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
73
|
+
}
|
|
74
|
+
clearCheckoutFromSession() {
|
|
75
|
+
cookie.remove('checkoutId');
|
|
76
|
+
return of();
|
|
77
|
+
}
|
|
78
|
+
createCheckout(checkoutData) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
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 }));
|
|
81
|
+
cookie.set('checkoutId', checkout.id);
|
|
82
|
+
return checkout;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
CheckoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
87
|
+
CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService });
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutService, decorators: [{
|
|
89
|
+
type: Injectable
|
|
90
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
91
|
+
type: Inject,
|
|
92
|
+
args: ['CheckoutRepository']
|
|
93
|
+
}] }, { type: undefined, decorators: [{
|
|
94
|
+
type: Inject,
|
|
95
|
+
args: ['UserRepository']
|
|
96
|
+
}] }, { type: i1$1.Shops, decorators: [{
|
|
97
|
+
type: Inject,
|
|
98
|
+
args: [DEFAULT_SHOP]
|
|
90
99
|
}] }]; } });
|
|
91
100
|
|
|
92
|
-
class CartService {
|
|
93
|
-
constructor(authService, checkoutService, defaultShop) {
|
|
94
|
-
this.authService = authService;
|
|
95
|
-
this.checkoutService = checkoutService;
|
|
96
|
-
this.defaultShop = defaultShop;
|
|
97
|
-
this.cartSubject = new Subject();
|
|
98
|
-
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
99
|
-
var _a;
|
|
100
|
-
const items = [];
|
|
101
|
-
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
102
|
-
if (index > -1) {
|
|
103
|
-
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
104
|
-
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
105
|
-
}
|
|
106
|
-
else
|
|
107
|
-
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
108
|
-
return this.checkoutService
|
|
109
|
-
.updateCheckoutLineItems(checkoutLoaded)
|
|
110
|
-
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
111
|
-
}));
|
|
112
|
-
this.generateCartObject = (items) => {
|
|
113
|
-
const cart = {};
|
|
114
|
-
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
115
|
-
var _a;
|
|
116
|
-
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) })));
|
|
117
|
-
});
|
|
118
|
-
return cart;
|
|
119
|
-
};
|
|
120
|
-
this.buildLineItem = ({ checkout, item, quantity, }) => {
|
|
121
|
-
var _a, _b, _c, _d, _e;
|
|
122
|
-
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;
|
|
123
|
-
if (this.checkMaxStock(item, quantity || 0))
|
|
124
|
-
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
125
|
-
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
126
|
-
const { id, name, brand, slug, stock, price, weight, categories, sku } = item;
|
|
127
|
-
const isGift = item.isGift || null;
|
|
128
|
-
const pricePaid = this.getProductPrice({
|
|
129
|
-
product: item,
|
|
130
|
-
shop: checkout.shop || this.defaultShop,
|
|
131
|
-
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
132
|
-
});
|
|
133
|
-
return LineItem.toInstance({
|
|
134
|
-
id,
|
|
135
|
-
name,
|
|
136
|
-
brand,
|
|
137
|
-
slug,
|
|
138
|
-
sku,
|
|
139
|
-
stock,
|
|
140
|
-
price,
|
|
141
|
-
image,
|
|
142
|
-
weight,
|
|
143
|
-
quantity: (item.quantity || 0) + (quantity || 0),
|
|
144
|
-
pricePaid,
|
|
145
|
-
categories,
|
|
146
|
-
isGift,
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
this.getProductPrice = ({ product, shop, isSubscriber, }) => {
|
|
150
|
-
const info = product.getInfoByShop(shop);
|
|
151
|
-
if (product.isGift)
|
|
152
|
-
return 0;
|
|
153
|
-
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
154
|
-
};
|
|
155
|
-
this.checkMaxStock = (item, quantity) => {
|
|
156
|
-
var _a;
|
|
157
|
-
const maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
|
|
158
|
-
const currentItemAmount = item.quantity || 0;
|
|
159
|
-
return currentItemAmount + quantity > maxStock;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
addItem(item, quantity = 1) {
|
|
163
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => ({ checkout, lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }) })), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
164
|
-
}
|
|
165
|
-
decreaseItem(item) {
|
|
166
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
167
|
-
var _a;
|
|
168
|
-
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
|
|
169
|
-
if (!isNil(checkoutItem))
|
|
170
|
-
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
171
|
-
return checkout;
|
|
172
|
-
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
173
|
-
}
|
|
174
|
-
getCart(checkout) {
|
|
175
|
-
this.buildCartFromCheckout(checkout).subscribe((cart) => this.cartSubject.next(cart));
|
|
176
|
-
return this.cartSubject;
|
|
177
|
-
}
|
|
178
|
-
getDiscount(coupon) {
|
|
179
|
-
switch (coupon.type) {
|
|
180
|
-
case CouponTypes.FINANCIAL:
|
|
181
|
-
return this.getFinancialDiscount(coupon);
|
|
182
|
-
case CouponTypes.PRODUCT:
|
|
183
|
-
return (subTotalPrice) => subTotalPrice;
|
|
184
|
-
case CouponTypes.GIFTCARD:
|
|
185
|
-
return this.getFinancialDiscount(coupon);
|
|
186
|
-
case CouponTypes.VOUCHER:
|
|
187
|
-
return (subTotalPrice) => subTotalPrice;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
getVariantPriceDiscount(item, shop) {
|
|
191
|
-
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)));
|
|
192
|
-
}
|
|
193
|
-
removeItem(item) {
|
|
194
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
195
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
196
|
-
if (index >= 0)
|
|
197
|
-
checkout.lineItems.splice(index, 1);
|
|
198
|
-
return checkout;
|
|
199
|
-
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
200
|
-
}
|
|
201
|
-
updateUserCart(user) {
|
|
202
|
-
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: checkout.lineItems.map((item) => this.buildLineItem({ checkout, item })) })))), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
203
|
-
}
|
|
204
|
-
clearCart() {
|
|
205
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
206
|
-
this.checkoutService.clearCheckoutFromSession();
|
|
207
|
-
return checkout;
|
|
208
|
-
}), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
|
|
209
|
-
}
|
|
210
|
-
buildCartFromCheckout(checkoutData) {
|
|
211
|
-
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
212
|
-
}
|
|
213
|
-
getFinancialDiscount(coupon) {
|
|
214
|
-
return (subTotalPrice) => {
|
|
215
|
-
if (FinancialCoupon.isFinancialCoupon(coupon))
|
|
216
|
-
switch (coupon.subtype) {
|
|
217
|
-
case CouponSubtypes.ABSOLUTE:
|
|
218
|
-
return subTotalPrice - coupon.discount * 100;
|
|
219
|
-
case CouponSubtypes.PERCENTAGE:
|
|
220
|
-
return subTotalPrice * (1 - coupon.discount / 100);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
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 });
|
|
226
|
-
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService });
|
|
227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, decorators: [{
|
|
228
|
-
type: Injectable
|
|
229
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$1.Shops, decorators: [{
|
|
230
|
-
type: Inject,
|
|
231
|
-
args: [DEFAULT_SHOP]
|
|
101
|
+
class CartService {
|
|
102
|
+
constructor(authService, checkoutService, defaultShop) {
|
|
103
|
+
this.authService = authService;
|
|
104
|
+
this.checkoutService = checkoutService;
|
|
105
|
+
this.defaultShop = defaultShop;
|
|
106
|
+
this.cartSubject = new Subject();
|
|
107
|
+
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
108
|
+
var _a;
|
|
109
|
+
const items = [];
|
|
110
|
+
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
111
|
+
if (index > -1) {
|
|
112
|
+
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
113
|
+
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
114
|
+
}
|
|
115
|
+
else
|
|
116
|
+
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
117
|
+
return this.checkoutService
|
|
118
|
+
.updateCheckoutLineItems(checkoutLoaded)
|
|
119
|
+
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
120
|
+
}));
|
|
121
|
+
this.generateCartObject = (items) => {
|
|
122
|
+
const cart = {};
|
|
123
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
124
|
+
var _a;
|
|
125
|
+
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) })));
|
|
126
|
+
});
|
|
127
|
+
return cart;
|
|
128
|
+
};
|
|
129
|
+
this.buildLineItem = ({ checkout, item, quantity, }) => {
|
|
130
|
+
var _a, _b, _c, _d, _e;
|
|
131
|
+
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;
|
|
132
|
+
if (this.checkMaxStock(item, quantity || 0))
|
|
133
|
+
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
134
|
+
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
135
|
+
const { id, name, brand, slug, stock, price, weight, categories, sku } = item;
|
|
136
|
+
const isGift = item.isGift || null;
|
|
137
|
+
const pricePaid = this.getProductPrice({
|
|
138
|
+
product: item,
|
|
139
|
+
shop: checkout.shop || this.defaultShop,
|
|
140
|
+
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
141
|
+
});
|
|
142
|
+
return LineItem.toInstance({
|
|
143
|
+
id,
|
|
144
|
+
name,
|
|
145
|
+
brand,
|
|
146
|
+
slug,
|
|
147
|
+
sku,
|
|
148
|
+
stock,
|
|
149
|
+
price,
|
|
150
|
+
image,
|
|
151
|
+
weight,
|
|
152
|
+
quantity: (item.quantity || 0) + (quantity || 0),
|
|
153
|
+
pricePaid,
|
|
154
|
+
categories,
|
|
155
|
+
isGift,
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
this.getProductPrice = ({ product, shop, isSubscriber, }) => {
|
|
159
|
+
const info = product.getInfoByShop(shop);
|
|
160
|
+
if (product.isGift)
|
|
161
|
+
return 0;
|
|
162
|
+
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
163
|
+
};
|
|
164
|
+
this.checkMaxStock = (item, quantity) => {
|
|
165
|
+
var _a;
|
|
166
|
+
const maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
|
|
167
|
+
const currentItemAmount = item.quantity || 0;
|
|
168
|
+
return currentItemAmount + quantity > maxStock;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
addItem(item, quantity = 1) {
|
|
172
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => ({ checkout, lineItem: this.buildLineItem({ checkout, item, quantity: quantity || 1 }) })), concatMap(({ checkout, lineItem }) => this.updateLineItemInCart(lineItem, quantity || 1, checkout)), tap((cart) => this.cartSubject.next(cart)));
|
|
173
|
+
}
|
|
174
|
+
decreaseItem(item) {
|
|
175
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
176
|
+
var _a;
|
|
177
|
+
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
|
|
178
|
+
if (!isNil(checkoutItem))
|
|
179
|
+
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
180
|
+
return checkout;
|
|
181
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
182
|
+
}
|
|
183
|
+
getCart(checkout) {
|
|
184
|
+
this.buildCartFromCheckout(checkout).subscribe((cart) => this.cartSubject.next(cart));
|
|
185
|
+
return this.cartSubject;
|
|
186
|
+
}
|
|
187
|
+
getDiscount(coupon) {
|
|
188
|
+
switch (coupon.type) {
|
|
189
|
+
case CouponTypes.FINANCIAL:
|
|
190
|
+
return this.getFinancialDiscount(coupon);
|
|
191
|
+
case CouponTypes.PRODUCT:
|
|
192
|
+
return (subTotalPrice) => subTotalPrice;
|
|
193
|
+
case CouponTypes.GIFTCARD:
|
|
194
|
+
return this.getFinancialDiscount(coupon);
|
|
195
|
+
case CouponTypes.VOUCHER:
|
|
196
|
+
return (subTotalPrice) => subTotalPrice;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
getVariantPriceDiscount(item, shop) {
|
|
200
|
+
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)));
|
|
201
|
+
}
|
|
202
|
+
removeItem(item) {
|
|
203
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
204
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
205
|
+
if (index >= 0)
|
|
206
|
+
checkout.lineItems.splice(index, 1);
|
|
207
|
+
return checkout;
|
|
208
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
209
|
+
}
|
|
210
|
+
updateUserCart(user) {
|
|
211
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: checkout.lineItems.map((item) => this.buildLineItem({ checkout, item })) })))), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
212
|
+
}
|
|
213
|
+
clearCart() {
|
|
214
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
215
|
+
this.checkoutService.clearCheckoutFromSession();
|
|
216
|
+
return checkout;
|
|
217
|
+
}), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
|
|
218
|
+
}
|
|
219
|
+
buildCartFromCheckout(checkoutData) {
|
|
220
|
+
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
221
|
+
}
|
|
222
|
+
getFinancialDiscount(coupon) {
|
|
223
|
+
return (subTotalPrice) => {
|
|
224
|
+
if (FinancialCoupon.isFinancialCoupon(coupon))
|
|
225
|
+
switch (coupon.subtype) {
|
|
226
|
+
case CouponSubtypes.ABSOLUTE:
|
|
227
|
+
return subTotalPrice - coupon.discount * 100;
|
|
228
|
+
case CouponSubtypes.PERCENTAGE:
|
|
229
|
+
return subTotalPrice * (1 - coupon.discount / 100);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
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 });
|
|
235
|
+
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService });
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CartService, decorators: [{
|
|
237
|
+
type: Injectable
|
|
238
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$1.Shops, decorators: [{
|
|
239
|
+
type: Inject,
|
|
240
|
+
args: [DEFAULT_SHOP]
|
|
232
241
|
}] }]; } });
|
|
233
242
|
|
|
234
|
-
class CheckoutSubscriptionService {
|
|
235
|
-
constructor(checkoutSubscriptionRepository
|
|
236
|
-
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
type: Inject,
|
|
262
|
-
args: ['
|
|
243
|
+
class CheckoutSubscriptionService {
|
|
244
|
+
constructor(checkoutSubscriptionRepository) {
|
|
245
|
+
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
246
|
+
}
|
|
247
|
+
getCheckoutSubscription(checkoutData) {
|
|
248
|
+
const checkoutId = cookie.get('checkoutSubscriptionId');
|
|
249
|
+
if (!isNil(checkoutId))
|
|
250
|
+
return from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
251
|
+
return from(this.createCheckoutSubscription(checkoutData));
|
|
252
|
+
}
|
|
253
|
+
createCheckoutSubscription(checkoutData) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
const checkout = yield this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()));
|
|
256
|
+
cookie.set('checkoutSubscriptionId', checkout.id);
|
|
257
|
+
return checkout;
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
clearCheckoutSubscriptionFromSession() {
|
|
261
|
+
cookie.remove('checkoutSubscriptionId');
|
|
262
|
+
return of();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
266
|
+
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService });
|
|
267
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
268
|
+
type: Injectable
|
|
269
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
270
|
+
type: Inject,
|
|
271
|
+
args: ['CheckoutSubscriptionRepository']
|
|
263
272
|
}] }]; } });
|
|
264
273
|
|
|
265
|
-
class OrderService {
|
|
266
|
-
constructor(angularFirestore, orderRepository) {
|
|
267
|
-
this.angularFirestore = angularFirestore;
|
|
268
|
-
this.orderRepository = orderRepository;
|
|
269
|
-
this.orderSubject = new Subject();
|
|
270
|
-
}
|
|
271
|
-
getOrder(id) {
|
|
272
|
-
this.angularFirestore
|
|
273
|
-
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
274
|
-
.valueChanges()
|
|
275
|
-
.pipe(map((doc) => Order.toInstance(doc)))
|
|
276
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
277
|
-
return this.orderSubject;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: i1$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
281
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
282
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
283
|
-
type: Injectable
|
|
284
|
-
}], ctorParameters: function () { return [{ type: i1$2.AngularFirestore }, { type: i1$1.OrderFirestoreRepository, decorators: [{
|
|
285
|
-
type: Inject,
|
|
286
|
-
args: ['OrderRepository']
|
|
274
|
+
class OrderService {
|
|
275
|
+
constructor(angularFirestore, orderRepository) {
|
|
276
|
+
this.angularFirestore = angularFirestore;
|
|
277
|
+
this.orderRepository = orderRepository;
|
|
278
|
+
this.orderSubject = new Subject();
|
|
279
|
+
}
|
|
280
|
+
getOrder(id) {
|
|
281
|
+
this.angularFirestore
|
|
282
|
+
.doc(`${this.orderRepository.collectionName}/${id}`)
|
|
283
|
+
.valueChanges()
|
|
284
|
+
.pipe(map((doc) => Order.toInstance(doc)))
|
|
285
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
286
|
+
return this.orderSubject;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, deps: [{ token: i1$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
290
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService });
|
|
291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: OrderService, decorators: [{
|
|
292
|
+
type: Injectable
|
|
293
|
+
}], ctorParameters: function () { return [{ type: i1$2.AngularFirestore }, { type: i1$1.OrderFirestoreRepository, decorators: [{
|
|
294
|
+
type: Inject,
|
|
295
|
+
args: ['OrderRepository']
|
|
287
296
|
}] }]; } });
|
|
288
297
|
|
|
289
|
-
class AngularFirebaseAuthModule {
|
|
290
|
-
static initializeApp(options, nameOrConfig) {
|
|
291
|
-
return {
|
|
292
|
-
ngModule: AngularFirebaseAuthModule,
|
|
293
|
-
providers: [
|
|
294
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
295
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
296
|
-
],
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
301
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
|
|
302
|
-
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
303
|
-
{
|
|
304
|
-
provide: 'Authentication',
|
|
305
|
-
useFactory: (authenticationService, userRepository) => {
|
|
306
|
-
return new Authentication(authenticationService, userRepository);
|
|
307
|
-
},
|
|
308
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
provide: 'AuthenticationService',
|
|
312
|
-
useFactory: (angularFireAuth) => {
|
|
313
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
314
|
-
},
|
|
315
|
-
deps: [AngularFireAuth],
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
provide: 'SignOut',
|
|
319
|
-
useFactory: (authenticationService) => {
|
|
320
|
-
return new SignOut(authenticationService);
|
|
321
|
-
},
|
|
322
|
-
deps: ['AuthenticationService'],
|
|
323
|
-
},
|
|
324
|
-
], imports: [[AngularFireModule]] });
|
|
325
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
326
|
-
type: NgModule,
|
|
327
|
-
args: [{
|
|
328
|
-
imports: [AngularFireModule],
|
|
329
|
-
providers: [
|
|
330
|
-
{
|
|
331
|
-
provide: 'Authentication',
|
|
332
|
-
useFactory: (authenticationService, userRepository) => {
|
|
333
|
-
return new Authentication(authenticationService, userRepository);
|
|
334
|
-
},
|
|
335
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
provide: 'AuthenticationService',
|
|
339
|
-
useFactory: (angularFireAuth) => {
|
|
340
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
341
|
-
},
|
|
342
|
-
deps: [AngularFireAuth],
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
provide: 'SignOut',
|
|
346
|
-
useFactory: (authenticationService) => {
|
|
347
|
-
return new SignOut(authenticationService);
|
|
348
|
-
},
|
|
349
|
-
deps: ['AuthenticationService'],
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
}]
|
|
298
|
+
class AngularFirebaseAuthModule {
|
|
299
|
+
static initializeApp(options, nameOrConfig) {
|
|
300
|
+
return {
|
|
301
|
+
ngModule: AngularFirebaseAuthModule,
|
|
302
|
+
providers: [
|
|
303
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
304
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
305
|
+
],
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
310
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, imports: [AngularFireModule] });
|
|
311
|
+
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
312
|
+
{
|
|
313
|
+
provide: 'Authentication',
|
|
314
|
+
useFactory: (authenticationService, userRepository) => {
|
|
315
|
+
return new Authentication(authenticationService, userRepository);
|
|
316
|
+
},
|
|
317
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
provide: 'AuthenticationService',
|
|
321
|
+
useFactory: (angularFireAuth) => {
|
|
322
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
323
|
+
},
|
|
324
|
+
deps: [AngularFireAuth],
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
provide: 'SignOut',
|
|
328
|
+
useFactory: (authenticationService) => {
|
|
329
|
+
return new SignOut(authenticationService);
|
|
330
|
+
},
|
|
331
|
+
deps: ['AuthenticationService'],
|
|
332
|
+
},
|
|
333
|
+
], imports: [[AngularFireModule]] });
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
335
|
+
type: NgModule,
|
|
336
|
+
args: [{
|
|
337
|
+
imports: [AngularFireModule],
|
|
338
|
+
providers: [
|
|
339
|
+
{
|
|
340
|
+
provide: 'Authentication',
|
|
341
|
+
useFactory: (authenticationService, userRepository) => {
|
|
342
|
+
return new Authentication(authenticationService, userRepository);
|
|
343
|
+
},
|
|
344
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
provide: 'AuthenticationService',
|
|
348
|
+
useFactory: (angularFireAuth) => {
|
|
349
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
350
|
+
},
|
|
351
|
+
deps: [AngularFireAuth],
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
provide: 'SignOut',
|
|
355
|
+
useFactory: (authenticationService) => {
|
|
356
|
+
return new SignOut(authenticationService);
|
|
357
|
+
},
|
|
358
|
+
deps: ['AuthenticationService'],
|
|
359
|
+
},
|
|
360
|
+
],
|
|
361
|
+
}]
|
|
353
362
|
}] });
|
|
354
363
|
|
|
355
|
-
class AngularFirestoreModule {
|
|
356
|
-
static initializeApp(options, nameOrConfig) {
|
|
357
|
-
return {
|
|
358
|
-
ngModule: AngularFirestoreModule,
|
|
359
|
-
providers: [
|
|
360
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
361
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
362
|
-
],
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
367
|
-
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule] });
|
|
368
|
-
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
369
|
-
{
|
|
370
|
-
provide: 'BeautyProfileRepository',
|
|
371
|
-
useFactory: (firestore, userRepository) => {
|
|
372
|
-
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
373
|
-
},
|
|
374
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
provide: 'Buy2WinRepository',
|
|
378
|
-
useFactory: (firestore) => {
|
|
379
|
-
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
380
|
-
},
|
|
381
|
-
deps: [AngularFirestore],
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
provide: 'CategoryRepository',
|
|
385
|
-
useFactory: (firestore) => {
|
|
386
|
-
return new CategoryFirestoreRepository(firestore.firestore);
|
|
387
|
-
},
|
|
388
|
-
deps: [AngularFirestore],
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
provide: 'CheckoutRepository',
|
|
392
|
-
useFactory: (firestore) => {
|
|
393
|
-
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
394
|
-
},
|
|
395
|
-
deps: [AngularFirestore],
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
399
|
-
useFactory: (firestore) => {
|
|
400
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
401
|
-
},
|
|
402
|
-
deps: [AngularFirestore],
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
provide: 'CouponRepository',
|
|
406
|
-
useFactory: (firestore) => {
|
|
407
|
-
return new CouponFirestoreRepository(firestore.firestore);
|
|
408
|
-
},
|
|
409
|
-
deps: [AngularFirestore],
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
provide: 'EditionRepository',
|
|
413
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
414
|
-
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
415
|
-
},
|
|
416
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
provide: 'HomeRepository',
|
|
420
|
-
useFactory: (firestore) => {
|
|
421
|
-
return new HomeFirestoreRepository(firestore.firestore);
|
|
422
|
-
},
|
|
423
|
-
deps: [AngularFirestore],
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
provide: 'LeadRepository',
|
|
427
|
-
useFactory: (firestore) => {
|
|
428
|
-
return new LeadFirestoreRepository(firestore.firestore);
|
|
429
|
-
},
|
|
430
|
-
deps: [AngularFirestore],
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
provide: 'LegacyOrderRepository',
|
|
434
|
-
useFactory: (firestore) => {
|
|
435
|
-
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
436
|
-
},
|
|
437
|
-
deps: [AngularFirestore],
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
provide: 'ShopMenuRepository',
|
|
441
|
-
useFactory: (firestore) => {
|
|
442
|
-
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
443
|
-
},
|
|
444
|
-
deps: [AngularFirestore],
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
provide: 'OrderRepository',
|
|
448
|
-
useFactory: (firestore) => {
|
|
449
|
-
return new OrderFirestoreRepository(firestore.firestore);
|
|
450
|
-
},
|
|
451
|
-
deps: [AngularFirestore],
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
provide: 'PaymentRepository',
|
|
455
|
-
useFactory: (firestore) => {
|
|
456
|
-
return new PaymentFirestoreRepository(firestore.firestore);
|
|
457
|
-
},
|
|
458
|
-
deps: [AngularFirestore],
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
provide: 'ProductRepository',
|
|
462
|
-
useFactory: (firestore) => {
|
|
463
|
-
return new ProductFirestoreRepository(firestore.firestore);
|
|
464
|
-
},
|
|
465
|
-
deps: [AngularFirestore],
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
provide: 'SubscriptionPaymentRepository',
|
|
469
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
470
|
-
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
471
|
-
},
|
|
472
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
provide: 'SubscriptionPlanRepository',
|
|
476
|
-
useFactory: (firestore) => {
|
|
477
|
-
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
478
|
-
},
|
|
479
|
-
deps: [AngularFirestore],
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
provide: 'SubscriptionRepository',
|
|
483
|
-
useFactory: (firestore) => {
|
|
484
|
-
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
485
|
-
},
|
|
486
|
-
deps: [AngularFirestore],
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
provide: 'UserRepository',
|
|
490
|
-
useFactory: (firestore) => {
|
|
491
|
-
return new UserFirestoreRepository(firestore.firestore);
|
|
492
|
-
},
|
|
493
|
-
deps: [AngularFirestore],
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
provide: 'UserAddressRepository',
|
|
497
|
-
useFactory: (firestore, userRepository) => {
|
|
498
|
-
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
499
|
-
},
|
|
500
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
provide: 'UserPaymentMethodRepository',
|
|
504
|
-
useFactory: (firestore, userRepository) => {
|
|
505
|
-
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
506
|
-
},
|
|
507
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
provide: 'VariantRepository',
|
|
511
|
-
useFactory: (firestore, productRepository) => {
|
|
512
|
-
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
513
|
-
},
|
|
514
|
-
deps: [AngularFirestore, 'ProductRepository'],
|
|
515
|
-
},
|
|
516
|
-
], imports: [[AngularFireModule]] });
|
|
517
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
518
|
-
type: NgModule,
|
|
519
|
-
args: [{
|
|
520
|
-
imports: [AngularFireModule],
|
|
521
|
-
providers: [
|
|
522
|
-
{
|
|
523
|
-
provide: 'BeautyProfileRepository',
|
|
524
|
-
useFactory: (firestore, userRepository) => {
|
|
525
|
-
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
526
|
-
},
|
|
527
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
provide: 'Buy2WinRepository',
|
|
531
|
-
useFactory: (firestore) => {
|
|
532
|
-
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
533
|
-
},
|
|
534
|
-
deps: [AngularFirestore],
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
provide: 'CategoryRepository',
|
|
538
|
-
useFactory: (firestore) => {
|
|
539
|
-
return new CategoryFirestoreRepository(firestore.firestore);
|
|
540
|
-
},
|
|
541
|
-
deps: [AngularFirestore],
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
provide: 'CheckoutRepository',
|
|
545
|
-
useFactory: (firestore) => {
|
|
546
|
-
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
547
|
-
},
|
|
548
|
-
deps: [AngularFirestore],
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
552
|
-
useFactory: (firestore) => {
|
|
553
|
-
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
554
|
-
},
|
|
555
|
-
deps: [AngularFirestore],
|
|
556
|
-
},
|
|
557
|
-
{
|
|
558
|
-
provide: 'CouponRepository',
|
|
559
|
-
useFactory: (firestore) => {
|
|
560
|
-
return new CouponFirestoreRepository(firestore.firestore);
|
|
561
|
-
},
|
|
562
|
-
deps: [AngularFirestore],
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
provide: 'EditionRepository',
|
|
566
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
567
|
-
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
568
|
-
},
|
|
569
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
570
|
-
},
|
|
571
|
-
{
|
|
572
|
-
provide: 'HomeRepository',
|
|
573
|
-
useFactory: (firestore) => {
|
|
574
|
-
return new HomeFirestoreRepository(firestore.firestore);
|
|
575
|
-
},
|
|
576
|
-
deps: [AngularFirestore],
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
provide: 'LeadRepository',
|
|
580
|
-
useFactory: (firestore) => {
|
|
581
|
-
return new LeadFirestoreRepository(firestore.firestore);
|
|
582
|
-
},
|
|
583
|
-
deps: [AngularFirestore],
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
provide: 'LegacyOrderRepository',
|
|
587
|
-
useFactory: (firestore) => {
|
|
588
|
-
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
589
|
-
},
|
|
590
|
-
deps: [AngularFirestore],
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
provide: 'ShopMenuRepository',
|
|
594
|
-
useFactory: (firestore) => {
|
|
595
|
-
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
596
|
-
},
|
|
597
|
-
deps: [AngularFirestore],
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
provide: 'OrderRepository',
|
|
601
|
-
useFactory: (firestore) => {
|
|
602
|
-
return new OrderFirestoreRepository(firestore.firestore);
|
|
603
|
-
},
|
|
604
|
-
deps: [AngularFirestore],
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
provide: 'PaymentRepository',
|
|
608
|
-
useFactory: (firestore) => {
|
|
609
|
-
return new PaymentFirestoreRepository(firestore.firestore);
|
|
610
|
-
},
|
|
611
|
-
deps: [AngularFirestore],
|
|
612
|
-
},
|
|
613
|
-
{
|
|
614
|
-
provide: 'ProductRepository',
|
|
615
|
-
useFactory: (firestore) => {
|
|
616
|
-
return new ProductFirestoreRepository(firestore.firestore);
|
|
617
|
-
},
|
|
618
|
-
deps: [AngularFirestore],
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
provide: 'SubscriptionPaymentRepository',
|
|
622
|
-
useFactory: (firestore, subscriptionRepository) => {
|
|
623
|
-
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
624
|
-
},
|
|
625
|
-
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
626
|
-
},
|
|
627
|
-
{
|
|
628
|
-
provide: 'SubscriptionPlanRepository',
|
|
629
|
-
useFactory: (firestore) => {
|
|
630
|
-
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
631
|
-
},
|
|
632
|
-
deps: [AngularFirestore],
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
provide: 'SubscriptionRepository',
|
|
636
|
-
useFactory: (firestore) => {
|
|
637
|
-
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
638
|
-
},
|
|
639
|
-
deps: [AngularFirestore],
|
|
640
|
-
},
|
|
641
|
-
{
|
|
642
|
-
provide: 'UserRepository',
|
|
643
|
-
useFactory: (firestore) => {
|
|
644
|
-
return new UserFirestoreRepository(firestore.firestore);
|
|
645
|
-
},
|
|
646
|
-
deps: [AngularFirestore],
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
provide: 'UserAddressRepository',
|
|
650
|
-
useFactory: (firestore, userRepository) => {
|
|
651
|
-
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
652
|
-
},
|
|
653
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
provide: 'UserPaymentMethodRepository',
|
|
657
|
-
useFactory: (firestore, userRepository) => {
|
|
658
|
-
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
659
|
-
},
|
|
660
|
-
deps: [AngularFirestore, 'UserRepository'],
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
provide: 'VariantRepository',
|
|
664
|
-
useFactory: (firestore, productRepository) => {
|
|
665
|
-
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
666
|
-
},
|
|
667
|
-
deps: [AngularFirestore, 'ProductRepository'],
|
|
668
|
-
},
|
|
669
|
-
],
|
|
670
|
-
}]
|
|
364
|
+
class AngularFirestoreModule {
|
|
365
|
+
static initializeApp(options, nameOrConfig) {
|
|
366
|
+
return {
|
|
367
|
+
ngModule: AngularFirestoreModule,
|
|
368
|
+
providers: [
|
|
369
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
370
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
371
|
+
],
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
376
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, imports: [AngularFireModule] });
|
|
377
|
+
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
378
|
+
{
|
|
379
|
+
provide: 'BeautyProfileRepository',
|
|
380
|
+
useFactory: (firestore, userRepository) => {
|
|
381
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
382
|
+
},
|
|
383
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
provide: 'Buy2WinRepository',
|
|
387
|
+
useFactory: (firestore) => {
|
|
388
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
389
|
+
},
|
|
390
|
+
deps: [AngularFirestore],
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
provide: 'CategoryRepository',
|
|
394
|
+
useFactory: (firestore) => {
|
|
395
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
396
|
+
},
|
|
397
|
+
deps: [AngularFirestore],
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
provide: 'CheckoutRepository',
|
|
401
|
+
useFactory: (firestore) => {
|
|
402
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
403
|
+
},
|
|
404
|
+
deps: [AngularFirestore],
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
408
|
+
useFactory: (firestore) => {
|
|
409
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
410
|
+
},
|
|
411
|
+
deps: [AngularFirestore],
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
provide: 'CouponRepository',
|
|
415
|
+
useFactory: (firestore) => {
|
|
416
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
417
|
+
},
|
|
418
|
+
deps: [AngularFirestore],
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
provide: 'EditionRepository',
|
|
422
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
423
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
424
|
+
},
|
|
425
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
provide: 'HomeRepository',
|
|
429
|
+
useFactory: (firestore) => {
|
|
430
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
431
|
+
},
|
|
432
|
+
deps: [AngularFirestore],
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
provide: 'LeadRepository',
|
|
436
|
+
useFactory: (firestore) => {
|
|
437
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
438
|
+
},
|
|
439
|
+
deps: [AngularFirestore],
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
provide: 'LegacyOrderRepository',
|
|
443
|
+
useFactory: (firestore) => {
|
|
444
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
445
|
+
},
|
|
446
|
+
deps: [AngularFirestore],
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
provide: 'ShopMenuRepository',
|
|
450
|
+
useFactory: (firestore) => {
|
|
451
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
452
|
+
},
|
|
453
|
+
deps: [AngularFirestore],
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
provide: 'OrderRepository',
|
|
457
|
+
useFactory: (firestore) => {
|
|
458
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
459
|
+
},
|
|
460
|
+
deps: [AngularFirestore],
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
provide: 'PaymentRepository',
|
|
464
|
+
useFactory: (firestore) => {
|
|
465
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
466
|
+
},
|
|
467
|
+
deps: [AngularFirestore],
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
provide: 'ProductRepository',
|
|
471
|
+
useFactory: (firestore) => {
|
|
472
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
473
|
+
},
|
|
474
|
+
deps: [AngularFirestore],
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
provide: 'SubscriptionPaymentRepository',
|
|
478
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
479
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
480
|
+
},
|
|
481
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
provide: 'SubscriptionPlanRepository',
|
|
485
|
+
useFactory: (firestore) => {
|
|
486
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
487
|
+
},
|
|
488
|
+
deps: [AngularFirestore],
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
provide: 'SubscriptionRepository',
|
|
492
|
+
useFactory: (firestore) => {
|
|
493
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
494
|
+
},
|
|
495
|
+
deps: [AngularFirestore],
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
provide: 'UserRepository',
|
|
499
|
+
useFactory: (firestore) => {
|
|
500
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
501
|
+
},
|
|
502
|
+
deps: [AngularFirestore],
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
provide: 'UserAddressRepository',
|
|
506
|
+
useFactory: (firestore, userRepository) => {
|
|
507
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
508
|
+
},
|
|
509
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
provide: 'UserPaymentMethodRepository',
|
|
513
|
+
useFactory: (firestore, userRepository) => {
|
|
514
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
515
|
+
},
|
|
516
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
provide: 'VariantRepository',
|
|
520
|
+
useFactory: (firestore, productRepository) => {
|
|
521
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
522
|
+
},
|
|
523
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
524
|
+
},
|
|
525
|
+
], imports: [[AngularFireModule]] });
|
|
526
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
527
|
+
type: NgModule,
|
|
528
|
+
args: [{
|
|
529
|
+
imports: [AngularFireModule],
|
|
530
|
+
providers: [
|
|
531
|
+
{
|
|
532
|
+
provide: 'BeautyProfileRepository',
|
|
533
|
+
useFactory: (firestore, userRepository) => {
|
|
534
|
+
return new UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
535
|
+
},
|
|
536
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
provide: 'Buy2WinRepository',
|
|
540
|
+
useFactory: (firestore) => {
|
|
541
|
+
return new Buy2WinFirestoreRepository(firestore.firestore);
|
|
542
|
+
},
|
|
543
|
+
deps: [AngularFirestore],
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
provide: 'CategoryRepository',
|
|
547
|
+
useFactory: (firestore) => {
|
|
548
|
+
return new CategoryFirestoreRepository(firestore.firestore);
|
|
549
|
+
},
|
|
550
|
+
deps: [AngularFirestore],
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
provide: 'CheckoutRepository',
|
|
554
|
+
useFactory: (firestore) => {
|
|
555
|
+
return new CheckoutFirestoreRepository(firestore.firestore);
|
|
556
|
+
},
|
|
557
|
+
deps: [AngularFirestore],
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
561
|
+
useFactory: (firestore) => {
|
|
562
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
563
|
+
},
|
|
564
|
+
deps: [AngularFirestore],
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
provide: 'CouponRepository',
|
|
568
|
+
useFactory: (firestore) => {
|
|
569
|
+
return new CouponFirestoreRepository(firestore.firestore);
|
|
570
|
+
},
|
|
571
|
+
deps: [AngularFirestore],
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
provide: 'EditionRepository',
|
|
575
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
576
|
+
return new SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
577
|
+
},
|
|
578
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
provide: 'HomeRepository',
|
|
582
|
+
useFactory: (firestore) => {
|
|
583
|
+
return new HomeFirestoreRepository(firestore.firestore);
|
|
584
|
+
},
|
|
585
|
+
deps: [AngularFirestore],
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
provide: 'LeadRepository',
|
|
589
|
+
useFactory: (firestore) => {
|
|
590
|
+
return new LeadFirestoreRepository(firestore.firestore);
|
|
591
|
+
},
|
|
592
|
+
deps: [AngularFirestore],
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
provide: 'LegacyOrderRepository',
|
|
596
|
+
useFactory: (firestore) => {
|
|
597
|
+
return new LegacyOrderFirestoreRepository(firestore.firestore);
|
|
598
|
+
},
|
|
599
|
+
deps: [AngularFirestore],
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
provide: 'ShopMenuRepository',
|
|
603
|
+
useFactory: (firestore) => {
|
|
604
|
+
return new ShopMenuFirestoreRepository(firestore.firestore);
|
|
605
|
+
},
|
|
606
|
+
deps: [AngularFirestore],
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
provide: 'OrderRepository',
|
|
610
|
+
useFactory: (firestore) => {
|
|
611
|
+
return new OrderFirestoreRepository(firestore.firestore);
|
|
612
|
+
},
|
|
613
|
+
deps: [AngularFirestore],
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
provide: 'PaymentRepository',
|
|
617
|
+
useFactory: (firestore) => {
|
|
618
|
+
return new PaymentFirestoreRepository(firestore.firestore);
|
|
619
|
+
},
|
|
620
|
+
deps: [AngularFirestore],
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
provide: 'ProductRepository',
|
|
624
|
+
useFactory: (firestore) => {
|
|
625
|
+
return new ProductFirestoreRepository(firestore.firestore);
|
|
626
|
+
},
|
|
627
|
+
deps: [AngularFirestore],
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
provide: 'SubscriptionPaymentRepository',
|
|
631
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
632
|
+
return new SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
633
|
+
},
|
|
634
|
+
deps: [AngularFirestore, 'SubscriptionRepository'],
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
provide: 'SubscriptionPlanRepository',
|
|
638
|
+
useFactory: (firestore) => {
|
|
639
|
+
return new SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
640
|
+
},
|
|
641
|
+
deps: [AngularFirestore],
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
provide: 'SubscriptionRepository',
|
|
645
|
+
useFactory: (firestore) => {
|
|
646
|
+
return new SubscriptionFirestoreRepository(firestore.firestore);
|
|
647
|
+
},
|
|
648
|
+
deps: [AngularFirestore],
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
provide: 'UserRepository',
|
|
652
|
+
useFactory: (firestore) => {
|
|
653
|
+
return new UserFirestoreRepository(firestore.firestore);
|
|
654
|
+
},
|
|
655
|
+
deps: [AngularFirestore],
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
provide: 'UserAddressRepository',
|
|
659
|
+
useFactory: (firestore, userRepository) => {
|
|
660
|
+
return new UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
661
|
+
},
|
|
662
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
provide: 'UserPaymentMethodRepository',
|
|
666
|
+
useFactory: (firestore, userRepository) => {
|
|
667
|
+
return new UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
668
|
+
},
|
|
669
|
+
deps: [AngularFirestore, 'UserRepository'],
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
provide: 'VariantRepository',
|
|
673
|
+
useFactory: (firestore, productRepository) => {
|
|
674
|
+
return new ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
675
|
+
},
|
|
676
|
+
deps: [AngularFirestore, 'ProductRepository'],
|
|
677
|
+
},
|
|
678
|
+
],
|
|
679
|
+
}]
|
|
671
680
|
}] });
|
|
672
681
|
|
|
673
|
-
class AngularConnectModule {
|
|
674
|
-
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
675
|
-
return {
|
|
676
|
-
ngModule: AngularConnectModule,
|
|
677
|
-
providers: [
|
|
678
|
-
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
679
|
-
...(isNil(options) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options }]),
|
|
680
|
-
...(isNil(options) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
681
|
-
],
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
686
|
-
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
|
|
687
|
-
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService], imports: [[AngularFireModule, AngularFirestoreModule]] });
|
|
688
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
689
|
-
type: NgModule,
|
|
690
|
-
args: [{
|
|
691
|
-
imports: [AngularFireModule, AngularFirestoreModule],
|
|
692
|
-
providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService],
|
|
693
|
-
}]
|
|
682
|
+
class AngularConnectModule {
|
|
683
|
+
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
684
|
+
return {
|
|
685
|
+
ngModule: AngularConnectModule,
|
|
686
|
+
providers: [
|
|
687
|
+
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
688
|
+
...(isNil(options) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options }]),
|
|
689
|
+
...(isNil(options) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
690
|
+
],
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
695
|
+
AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, imports: [AngularFireModule, AngularFirestoreModule] });
|
|
696
|
+
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService], imports: [[AngularFireModule, AngularFirestoreModule]] });
|
|
697
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
698
|
+
type: NgModule,
|
|
699
|
+
args: [{
|
|
700
|
+
imports: [AngularFireModule, AngularFirestoreModule],
|
|
701
|
+
providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService],
|
|
702
|
+
}]
|
|
694
703
|
}] });
|
|
695
704
|
|
|
696
|
-
/**
|
|
697
|
-
* Generated bundle index. Do not edit.
|
|
705
|
+
/**
|
|
706
|
+
* Generated bundle index. Do not edit.
|
|
698
707
|
*/
|
|
699
708
|
|
|
700
709
|
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, OrderService };
|