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