@infrab4a/connect-angular 4.0.0-beta.48 → 4.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular-connect.module.d.ts +0 -2
- package/angular-firestore.module.d.ts +1 -2
- package/consts/index.d.ts +0 -2
- package/esm2020/angular-connect.module.mjs +3 -19
- package/esm2020/angular-elastic-search.module.mjs +7 -3
- package/esm2020/angular-firestore.module.mjs +139 -240
- package/esm2020/angular-hasura-graphql.module.mjs +23 -108
- package/esm2020/consts/index.mjs +1 -3
- package/esm2020/index.mjs +3 -3
- package/esm2020/services/auth.service.mjs +3 -3
- package/esm2020/services/cart.service.mjs +23 -161
- package/esm2020/services/checkout-subscription.service.mjs +3 -5
- package/esm2020/services/checkout.service.mjs +5 -3
- package/esm2020/services/coupon.service.mjs +140 -132
- package/esm2020/services/errors/group-invalid-coupon.error.mjs +8 -0
- package/esm2020/services/errors/index.mjs +3 -0
- package/esm2020/services/errors/invalid-coupon.error.mjs +7 -0
- package/esm2020/services/index.mjs +3 -6
- package/fesm2015/infrab4a-connect-angular.mjs +1023 -1793
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +887 -1635
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +3 -2
- package/services/cart.service.d.ts +2 -9
- package/services/coupon.service.d.ts +10 -13
- package/services/errors/group-invalid-coupon.error.d.ts +6 -0
- package/services/errors/index.d.ts +2 -0
- package/services/errors/invalid-coupon.error.d.ts +4 -0
- package/services/index.d.ts +2 -5
- package/consts/backend-url.const.d.ts +0 -1
- package/consts/category-structure.d.ts +0 -1
- package/esm2020/consts/backend-url.const.mjs +0 -2
- package/esm2020/consts/category-structure.mjs +0 -2
- package/esm2020/helpers/index.mjs +0 -2
- package/esm2020/helpers/mobile-operation-system-checker.helper.mjs +0 -7
- package/esm2020/services/catalog/adapters/category-structure.adapter.mjs +0 -2
- package/esm2020/services/catalog/adapters/index.mjs +0 -4
- package/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +0 -42
- package/esm2020/services/catalog/adapters/old-category-structure.adapter.mjs +0 -23
- package/esm2020/services/catalog/catalog.service.mjs +0 -98
- package/esm2020/services/catalog/category.service.mjs +0 -51
- package/esm2020/services/catalog/enums/index.mjs +0 -2
- package/esm2020/services/catalog/enums/product-sorts.enum.mjs +0 -11
- package/esm2020/services/catalog/index.mjs +0 -7
- package/esm2020/services/catalog/models/category-with-tree.model.mjs +0 -10
- package/esm2020/services/catalog/models/index.mjs +0 -2
- package/esm2020/services/catalog/types/index.mjs +0 -2
- package/esm2020/services/catalog/types/product-sort.type.mjs +0 -2
- package/esm2020/services/catalog/wishlist.service.mjs +0 -103
- package/esm2020/services/helpers/index.mjs +0 -2
- package/esm2020/services/helpers/util.service.mjs +0 -29
- package/esm2020/services/shipping.service.mjs +0 -96
- package/esm2020/services/types/shipping-methods.type.mjs +0 -2
- package/helpers/index.d.ts +0 -1
- package/helpers/mobile-operation-system-checker.helper.d.ts +0 -3
- package/services/catalog/adapters/category-structure.adapter.d.ts +0 -4
- package/services/catalog/adapters/index.d.ts +0 -3
- package/services/catalog/adapters/new-category-structure.adapter.d.ts +0 -14
- package/services/catalog/adapters/old-category-structure.adapter.d.ts +0 -10
- package/services/catalog/catalog.service.d.ts +0 -54
- package/services/catalog/category.service.d.ts +0 -15
- package/services/catalog/enums/index.d.ts +0 -1
- package/services/catalog/enums/product-sorts.enum.d.ts +0 -9
- package/services/catalog/index.d.ts +0 -6
- package/services/catalog/models/category-with-tree.model.d.ts +0 -4
- package/services/catalog/models/index.d.ts +0 -1
- package/services/catalog/types/index.d.ts +0 -1
- package/services/catalog/types/product-sort.type.d.ts +0 -2
- package/services/catalog/wishlist.service.d.ts +0 -25
- package/services/helpers/index.d.ts +0 -1
- package/services/helpers/util.service.d.ts +0 -7
- package/services/shipping.service.d.ts +0 -19
- package/services/types/shipping-methods.type.d.ts +0 -12
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as i1
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { provideFirebaseApp, initializeApp, FirebaseApp } from '@angular/fire/app';
|
|
7
|
-
import * as i1$1 from '@angular/fire/auth';
|
|
8
|
-
import { Auth, provideAuth, getAuth, getIdToken, authState } from '@angular/fire/auth';
|
|
9
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
10
|
-
import * as i1$2 from '@angular/fire/firestore';
|
|
11
|
-
import { Firestore, provideFirestore, getFirestore, initializeFirestore, enableIndexedDbPersistence, docSnapshots, doc } from '@angular/fire/firestore';
|
|
12
|
-
import { initializeApp as initializeApp$1 } from 'firebase/app';
|
|
13
|
-
import { combineLatest, from, of, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
2
|
+
import { Injectable, Inject, InjectionToken, NgModule, PLATFORM_ID } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/fire/auth';
|
|
4
|
+
import { getIdToken, authState, Auth, provideAuth, getAuth } from '@angular/fire/auth';
|
|
5
|
+
import { combineLatest, of, from, throwError, Subject, iif, forkJoin } from 'rxjs';
|
|
14
6
|
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
7
|
+
import * as i2 from '@infrab4a/connect';
|
|
8
|
+
import { Where, Shops, CheckoutTypes, CouponTypes, Exclusivities, Status, isNil, NotFoundError, Checkout, pick, LineItem, CheckoutSubscription, Order, Category, Product, RequiredArgumentError, add, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ProductsIndex, AxiosAdapter, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, SubscriptionEditionFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ProductFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, ProductVariantFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, VariantHasuraGraphQLRepository } from '@infrab4a/connect';
|
|
15
9
|
import cookie from 'js-cookie';
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
import { CustomError } from 'ts-custom-error';
|
|
11
|
+
import * as i1$1 from '@angular/fire/firestore';
|
|
12
|
+
import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
|
|
13
|
+
import * as i1$2 from '@angular/fire/app';
|
|
14
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
15
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
class AuthService {
|
|
18
|
+
constructor(angularFireAuth, userRepository) {
|
|
19
|
+
this.angularFireAuth = angularFireAuth;
|
|
20
|
+
this.userRepository = userRepository;
|
|
21
|
+
}
|
|
22
|
+
getAuthstate() {
|
|
23
|
+
const observables = [this.getFireUser(), this.getUser()];
|
|
24
|
+
return combineLatest(observables).pipe(map(([fireUser, user]) => ({
|
|
25
|
+
user,
|
|
26
|
+
isAnonymous: fireUser?.isAnonymous,
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
getUser() {
|
|
30
|
+
return this.getFireUser().pipe(map((user) => user?.uid), mergeMap((id) => (id ? this.userRepository.get({ id }) : of(null))), catchError(() => of(null)));
|
|
31
|
+
}
|
|
32
|
+
getTokenId() {
|
|
33
|
+
return from(getIdToken(this.angularFireAuth.currentUser));
|
|
34
|
+
}
|
|
35
|
+
getFireUser() {
|
|
36
|
+
return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, deps: [{ token: i1.Auth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
40
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
|
|
42
|
+
type: Injectable
|
|
43
|
+
}], ctorParameters: function () { return [{ type: i1.Auth }, { type: undefined, decorators: [{
|
|
44
|
+
type: Inject,
|
|
45
|
+
args: ['UserRepository']
|
|
46
|
+
}] }]; } });
|
|
23
47
|
|
|
24
48
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
25
49
|
|
|
@@ -30,961 +54,152 @@ const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
|
|
|
30
54
|
|
|
31
55
|
const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
32
56
|
|
|
33
|
-
class
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ngModule: AngularFirebaseAuthModule,
|
|
37
|
-
providers: [
|
|
38
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
39
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
40
|
-
],
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
45
|
-
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1.FirebaseAppModule, i1$1.AuthModule] });
|
|
46
|
-
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
47
|
-
{
|
|
48
|
-
provide: 'Authentication',
|
|
49
|
-
useFactory: (authenticationService, userRepository) => {
|
|
50
|
-
return new Authentication(authenticationService, userRepository);
|
|
51
|
-
},
|
|
52
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
provide: 'AuthenticationService',
|
|
56
|
-
useFactory: (angularFireAuth) => {
|
|
57
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
58
|
-
},
|
|
59
|
-
deps: [Auth],
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
provide: 'Register',
|
|
63
|
-
useFactory: (registerService, userRepository) => {
|
|
64
|
-
return new Register(registerService, userRepository);
|
|
65
|
-
},
|
|
66
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
provide: 'RegisterService',
|
|
70
|
-
useFactory: (angularFireAuth) => {
|
|
71
|
-
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
72
|
-
},
|
|
73
|
-
deps: [Auth],
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
provide: 'SignOut',
|
|
77
|
-
useFactory: (authenticationService) => {
|
|
78
|
-
return new SignOut(authenticationService);
|
|
79
|
-
},
|
|
80
|
-
deps: ['AuthenticationService'],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
provide: 'RecoveryPassword',
|
|
84
|
-
useFactory: (authenticationService) => {
|
|
85
|
-
return new RecoveryPassword(authenticationService);
|
|
86
|
-
},
|
|
87
|
-
deps: ['AuthenticationService'],
|
|
88
|
-
},
|
|
89
|
-
], imports: [provideFirebaseApp((injector) => {
|
|
90
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
91
|
-
return appName
|
|
92
|
-
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
93
|
-
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
94
|
-
}),
|
|
95
|
-
provideAuth(() => getAuth())] });
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
97
|
-
type: NgModule,
|
|
98
|
-
args: [{
|
|
99
|
-
imports: [
|
|
100
|
-
provideFirebaseApp((injector) => {
|
|
101
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
102
|
-
return appName
|
|
103
|
-
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
104
|
-
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
105
|
-
}),
|
|
106
|
-
provideAuth(() => getAuth()),
|
|
107
|
-
],
|
|
108
|
-
providers: [
|
|
109
|
-
{
|
|
110
|
-
provide: 'Authentication',
|
|
111
|
-
useFactory: (authenticationService, userRepository) => {
|
|
112
|
-
return new Authentication(authenticationService, userRepository);
|
|
113
|
-
},
|
|
114
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
provide: 'AuthenticationService',
|
|
118
|
-
useFactory: (angularFireAuth) => {
|
|
119
|
-
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
120
|
-
},
|
|
121
|
-
deps: [Auth],
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
provide: 'Register',
|
|
125
|
-
useFactory: (registerService, userRepository) => {
|
|
126
|
-
return new Register(registerService, userRepository);
|
|
127
|
-
},
|
|
128
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
provide: 'RegisterService',
|
|
132
|
-
useFactory: (angularFireAuth) => {
|
|
133
|
-
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
134
|
-
},
|
|
135
|
-
deps: [Auth],
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
provide: 'SignOut',
|
|
139
|
-
useFactory: (authenticationService) => {
|
|
140
|
-
return new SignOut(authenticationService);
|
|
141
|
-
},
|
|
142
|
-
deps: ['AuthenticationService'],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
provide: 'RecoveryPassword',
|
|
146
|
-
useFactory: (authenticationService) => {
|
|
147
|
-
return new RecoveryPassword(authenticationService);
|
|
148
|
-
},
|
|
149
|
-
deps: ['AuthenticationService'],
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
}]
|
|
153
|
-
}] });
|
|
154
|
-
|
|
155
|
-
class AngularElasticSeachModule {
|
|
156
|
-
static initializeApp(options) {
|
|
157
|
-
return {
|
|
158
|
-
ngModule: AngularElasticSeachModule,
|
|
159
|
-
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
160
|
-
};
|
|
57
|
+
class InvalidCouponError extends CustomError {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
161
60
|
}
|
|
162
61
|
}
|
|
163
|
-
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
164
|
-
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
|
|
165
|
-
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
166
|
-
{
|
|
167
|
-
provide: ProductsIndex,
|
|
168
|
-
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
169
|
-
deps: [ES_CONFIG],
|
|
170
|
-
},
|
|
171
|
-
] });
|
|
172
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
173
|
-
type: NgModule,
|
|
174
|
-
args: [{
|
|
175
|
-
providers: [
|
|
176
|
-
{
|
|
177
|
-
provide: ProductsIndex,
|
|
178
|
-
useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
|
|
179
|
-
deps: [ES_CONFIG],
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
}]
|
|
183
|
-
}] });
|
|
184
62
|
|
|
185
|
-
class
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
63
|
+
class GroupInvalidCouponError extends CustomError {
|
|
64
|
+
constructor(errors) {
|
|
65
|
+
super('Many coupon errors throw');
|
|
66
|
+
this.errors = errors;
|
|
189
67
|
}
|
|
190
68
|
}
|
|
191
69
|
|
|
192
|
-
class
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
],
|
|
201
|
-
};
|
|
70
|
+
class CouponService {
|
|
71
|
+
constructor(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
|
|
72
|
+
this.couponRepository = couponRepository;
|
|
73
|
+
this.defaultShop = defaultShop;
|
|
74
|
+
this.orderRepository = orderRepository;
|
|
75
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
76
|
+
this.categoryRepository = categoryRepository;
|
|
77
|
+
this.emailIsFromCollaborator = (userEmail) => !!userEmail?.match(/@b4a.com.br/g);
|
|
202
78
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
provide: 'FirestoreOptions',
|
|
209
|
-
useFactory: (firestore, platformId) => ({
|
|
210
|
-
firestore,
|
|
211
|
-
interceptors: {
|
|
212
|
-
request: (request) => {
|
|
213
|
-
if (isPlatformBrowser(platformId))
|
|
214
|
-
return request;
|
|
215
|
-
const interval = setInterval(() => { }, 100);
|
|
216
|
-
request.interval = interval;
|
|
217
|
-
return request;
|
|
218
|
-
},
|
|
219
|
-
response: (response, request) => {
|
|
220
|
-
if (isPlatformBrowser(platformId))
|
|
221
|
-
return response;
|
|
222
|
-
clearInterval(request.interval);
|
|
223
|
-
return response;
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
}),
|
|
227
|
-
deps: [Firestore, PLATFORM_ID],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
provide: 'BeautyProfileRepository',
|
|
231
|
-
useFactory: (config, userRepository) => {
|
|
232
|
-
return new UserBeautyProfileFirestoreRepository(config, userRepository);
|
|
233
|
-
},
|
|
234
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
provide: 'Buy2WinRepository',
|
|
238
|
-
useFactory: (options) => {
|
|
239
|
-
return new Buy2WinFirestoreRepository(options);
|
|
240
|
-
},
|
|
241
|
-
deps: ['FirestoreOptions'],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
provide: CategoryFirestoreRepository,
|
|
245
|
-
useFactory: (options) => {
|
|
246
|
-
return new CategoryFirestoreRepository(options);
|
|
247
|
-
},
|
|
248
|
-
deps: ['FirestoreOptions'],
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
provide: 'CheckoutRepository',
|
|
252
|
-
useFactory: (options) => {
|
|
253
|
-
return new CheckoutFirestoreRepository(options);
|
|
254
|
-
},
|
|
255
|
-
deps: ['FirestoreOptions'],
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
259
|
-
useFactory: (options) => {
|
|
260
|
-
return new CheckoutSubscriptionFirestoreRepository(options);
|
|
261
|
-
},
|
|
262
|
-
deps: ['FirestoreOptions'],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
provide: 'CouponRepository',
|
|
266
|
-
useFactory: (options) => {
|
|
267
|
-
return new CouponFirestoreRepository(options);
|
|
268
|
-
},
|
|
269
|
-
deps: ['FirestoreOptions'],
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
provide: 'CampaignHashtagRepository',
|
|
273
|
-
useFactory: (options) => {
|
|
274
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
79
|
+
checkCoupon(nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
|
|
80
|
+
return from(this.couponRepository.find({
|
|
81
|
+
filters: {
|
|
82
|
+
nickname: { operator: Where.EQUALS, value: nickname },
|
|
83
|
+
active: { operator: Where.EQUALS, value: true },
|
|
275
84
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
85
|
+
})).pipe(concatMap((coupons) => this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription)), concatMap((coupon) => this.checkCouponUseAndLimit(coupon, userEmail, checkout)), map((coupon) => this.isValidCoupon(coupon, userEmail)), map((coupon) => coupon));
|
|
86
|
+
}
|
|
87
|
+
checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription) {
|
|
88
|
+
// Caso não ache nenhum cupom, retorna erro
|
|
89
|
+
if (coupons.count < 1) {
|
|
90
|
+
return throwError('Cupom inválido.');
|
|
91
|
+
}
|
|
92
|
+
// Get Primeiro Cupom (o find do repository retorna um array)
|
|
93
|
+
const coupon = coupons.data.shift();
|
|
94
|
+
// Verifica se o cupom é aplicavel na loja
|
|
95
|
+
const isInShop = coupon.shopAvailability === Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
96
|
+
// Cupon não aplicavel a loja retorna erro
|
|
97
|
+
if (!isInShop)
|
|
98
|
+
return throwError('Cupom inválido para loja.');
|
|
99
|
+
// Verifica se o coupon é aplicado no checkout que está sendo realizado
|
|
100
|
+
const isCheckoutType = coupon.checkoutType === CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
|
|
101
|
+
// Cupon não aplicavel ao checkout retorna erro
|
|
102
|
+
if (!isCheckoutType)
|
|
103
|
+
return throwError('Cupom inválido. Erro de checkout.');
|
|
104
|
+
// Verifica se o cupom é ou pode ser aplicado para subscription
|
|
105
|
+
if (checkoutType === CheckoutTypes.ALL || checkoutType === CheckoutTypes.SUBSCRIPTION) {
|
|
106
|
+
// Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
|
|
107
|
+
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
|
|
108
|
+
return throwError('Cupom inválido para sua assinatura.');
|
|
109
|
+
}
|
|
110
|
+
if (isSubscription)
|
|
111
|
+
return of(coupon);
|
|
112
|
+
// Verifica se possui o valor minimo de compra para utilização do cupom
|
|
113
|
+
const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
114
|
+
// Se não tem valor mínimo atingido, retorna erro
|
|
115
|
+
if (!hasMinSubTotal)
|
|
116
|
+
return throwError('Valor mínimo não atingido');
|
|
117
|
+
return of(coupon);
|
|
118
|
+
}
|
|
119
|
+
isValidCoupon(coupon, userEmail) {
|
|
120
|
+
// Verifica a data de inicio de validade do cupom
|
|
121
|
+
if (coupon?.beginAt > new Date())
|
|
122
|
+
throw new InvalidCouponError('Cupom ainda não liberado.');
|
|
123
|
+
// Verifica a data de validade do cupom
|
|
124
|
+
if (coupon?.expiresIn < new Date())
|
|
125
|
+
throw new InvalidCouponError('Cupom expirado.');
|
|
126
|
+
return coupon;
|
|
127
|
+
}
|
|
128
|
+
async checkCouponUseAndLimit(coupon, userEmail, checkout) {
|
|
129
|
+
const orders = await this.orderRepository.find({
|
|
130
|
+
filters: {
|
|
131
|
+
coupon: { id: coupon.id },
|
|
132
|
+
payment: { status: 'paid' },
|
|
282
133
|
},
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
provide: 'HomeRepository',
|
|
294
|
-
useFactory: (options) => {
|
|
295
|
-
return new HomeFirestoreRepository(options);
|
|
296
|
-
},
|
|
297
|
-
deps: ['FirestoreOptions'],
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
provide: 'LeadRepository',
|
|
301
|
-
useFactory: (options) => {
|
|
302
|
-
return new LeadFirestoreRepository(options);
|
|
303
|
-
},
|
|
304
|
-
deps: ['FirestoreOptions'],
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
provide: 'LegacyOrderRepository',
|
|
308
|
-
useFactory: (options) => {
|
|
309
|
-
return new LegacyOrderFirestoreRepository(options);
|
|
310
|
-
},
|
|
311
|
-
deps: ['FirestoreOptions'],
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
provide: 'ShopMenuRepository',
|
|
315
|
-
useFactory: (options) => {
|
|
316
|
-
return new ShopMenuFirestoreRepository(options);
|
|
317
|
-
},
|
|
318
|
-
deps: ['FirestoreOptions'],
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
provide: 'OrderRepository',
|
|
322
|
-
useFactory: (options) => {
|
|
323
|
-
return new OrderFirestoreRepository(options);
|
|
324
|
-
},
|
|
325
|
-
deps: ['FirestoreOptions'],
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
provide: 'PaymentRepository',
|
|
329
|
-
useFactory: (options) => {
|
|
330
|
-
return new PaymentFirestoreRepository(options);
|
|
331
|
-
},
|
|
332
|
-
deps: ['FirestoreOptions'],
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
provide: ProductFirestoreRepository,
|
|
336
|
-
useFactory: (options) => {
|
|
337
|
-
return new ProductFirestoreRepository(options);
|
|
338
|
-
},
|
|
339
|
-
deps: ['FirestoreOptions'],
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
provide: 'ShopSettingsRepository',
|
|
343
|
-
useFactory: (options) => {
|
|
344
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
345
|
-
},
|
|
346
|
-
deps: ['FirestoreOptions'],
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
provide: 'SubscriptionPaymentRepository',
|
|
350
|
-
useFactory: (options, subscriptionRepository) => {
|
|
351
|
-
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
352
|
-
},
|
|
353
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
provide: 'SubscriptionPlanRepository',
|
|
357
|
-
useFactory: (options) => {
|
|
358
|
-
return new SubscriptionPlanFirestoreRepository(options);
|
|
359
|
-
},
|
|
360
|
-
deps: ['FirestoreOptions'],
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
provide: 'SubscriptionProductRepository',
|
|
364
|
-
useFactory: (options) => {
|
|
365
|
-
return new SubscriptionProductFirestoreRepository(options);
|
|
366
|
-
},
|
|
367
|
-
deps: ['FirestoreOptions'],
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
provide: 'SubscriptionRepository',
|
|
371
|
-
useFactory: (options) => {
|
|
372
|
-
return new SubscriptionFirestoreRepository(options);
|
|
373
|
-
},
|
|
374
|
-
deps: ['FirestoreOptions'],
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
provide: 'UserRepository',
|
|
378
|
-
useFactory: (options) => {
|
|
379
|
-
return new UserFirestoreRepository(options);
|
|
380
|
-
},
|
|
381
|
-
deps: ['FirestoreOptions'],
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
provide: 'UserAddressRepository',
|
|
385
|
-
useFactory: (options, userRepository) => {
|
|
386
|
-
return new UserAddressFirestoreRepository(options, userRepository);
|
|
387
|
-
},
|
|
388
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
provide: 'UserPaymentMethodRepository',
|
|
392
|
-
useFactory: (options, userRepository) => {
|
|
393
|
-
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
394
|
-
},
|
|
395
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
provide: ProductVariantFirestoreRepository,
|
|
399
|
-
useFactory: (options, productRepository) => {
|
|
400
|
-
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
401
|
-
},
|
|
402
|
-
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
403
|
-
},
|
|
404
|
-
], imports: [AngularElasticSeachModule,
|
|
405
|
-
provideFirebaseApp((injector) => {
|
|
406
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
407
|
-
return appName
|
|
408
|
-
? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
|
|
409
|
-
: initializeApp$1(injector.get(FIREBASE_OPTIONS));
|
|
410
|
-
}),
|
|
411
|
-
provideFirestore((injector) => {
|
|
412
|
-
if (!MobileOperationSystemCheckerHelper.isAppleDevice())
|
|
413
|
-
return getFirestore();
|
|
414
|
-
const firestore = initializeFirestore(injector.get(FirebaseApp), { experimentalForceLongPolling: true });
|
|
415
|
-
enableIndexedDbPersistence(firestore).catch(console.error);
|
|
416
|
-
return firestore;
|
|
417
|
-
})] });
|
|
418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
419
|
-
type: NgModule,
|
|
420
|
-
args: [{
|
|
421
|
-
imports: [
|
|
422
|
-
AngularElasticSeachModule,
|
|
423
|
-
provideFirebaseApp((injector) => {
|
|
424
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
425
|
-
return appName
|
|
426
|
-
? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
|
|
427
|
-
: initializeApp$1(injector.get(FIREBASE_OPTIONS));
|
|
428
|
-
}),
|
|
429
|
-
provideFirestore((injector) => {
|
|
430
|
-
if (!MobileOperationSystemCheckerHelper.isAppleDevice())
|
|
431
|
-
return getFirestore();
|
|
432
|
-
const firestore = initializeFirestore(injector.get(FirebaseApp), { experimentalForceLongPolling: true });
|
|
433
|
-
enableIndexedDbPersistence(firestore).catch(console.error);
|
|
434
|
-
return firestore;
|
|
435
|
-
}),
|
|
436
|
-
],
|
|
437
|
-
providers: [
|
|
438
|
-
{
|
|
439
|
-
provide: 'FirestoreOptions',
|
|
440
|
-
useFactory: (firestore, platformId) => ({
|
|
441
|
-
firestore,
|
|
442
|
-
interceptors: {
|
|
443
|
-
request: (request) => {
|
|
444
|
-
if (isPlatformBrowser(platformId))
|
|
445
|
-
return request;
|
|
446
|
-
const interval = setInterval(() => { }, 100);
|
|
447
|
-
request.interval = interval;
|
|
448
|
-
return request;
|
|
449
|
-
},
|
|
450
|
-
response: (response, request) => {
|
|
451
|
-
if (isPlatformBrowser(platformId))
|
|
452
|
-
return response;
|
|
453
|
-
clearInterval(request.interval);
|
|
454
|
-
return response;
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
}),
|
|
458
|
-
deps: [Firestore, PLATFORM_ID],
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
provide: 'BeautyProfileRepository',
|
|
462
|
-
useFactory: (config, userRepository) => {
|
|
463
|
-
return new UserBeautyProfileFirestoreRepository(config, userRepository);
|
|
464
|
-
},
|
|
465
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
provide: 'Buy2WinRepository',
|
|
469
|
-
useFactory: (options) => {
|
|
470
|
-
return new Buy2WinFirestoreRepository(options);
|
|
471
|
-
},
|
|
472
|
-
deps: ['FirestoreOptions'],
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
provide: CategoryFirestoreRepository,
|
|
476
|
-
useFactory: (options) => {
|
|
477
|
-
return new CategoryFirestoreRepository(options);
|
|
478
|
-
},
|
|
479
|
-
deps: ['FirestoreOptions'],
|
|
480
|
-
},
|
|
481
|
-
{
|
|
482
|
-
provide: 'CheckoutRepository',
|
|
483
|
-
useFactory: (options) => {
|
|
484
|
-
return new CheckoutFirestoreRepository(options);
|
|
485
|
-
},
|
|
486
|
-
deps: ['FirestoreOptions'],
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
490
|
-
useFactory: (options) => {
|
|
491
|
-
return new CheckoutSubscriptionFirestoreRepository(options);
|
|
492
|
-
},
|
|
493
|
-
deps: ['FirestoreOptions'],
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
provide: 'CouponRepository',
|
|
497
|
-
useFactory: (options) => {
|
|
498
|
-
return new CouponFirestoreRepository(options);
|
|
499
|
-
},
|
|
500
|
-
deps: ['FirestoreOptions'],
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
provide: 'CampaignHashtagRepository',
|
|
504
|
-
useFactory: (options) => {
|
|
505
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
506
|
-
},
|
|
507
|
-
deps: ['FirestoreOptions'],
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
provide: 'CampaignDashboardRepository',
|
|
511
|
-
useFactory: (options) => {
|
|
512
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
513
|
-
},
|
|
514
|
-
deps: ['FirestoreOptions'],
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
provide: 'EditionRepository',
|
|
518
|
-
useFactory: (options, subscriptionRepository) => {
|
|
519
|
-
return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
520
|
-
},
|
|
521
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
provide: 'HomeRepository',
|
|
525
|
-
useFactory: (options) => {
|
|
526
|
-
return new HomeFirestoreRepository(options);
|
|
527
|
-
},
|
|
528
|
-
deps: ['FirestoreOptions'],
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
provide: 'LeadRepository',
|
|
532
|
-
useFactory: (options) => {
|
|
533
|
-
return new LeadFirestoreRepository(options);
|
|
534
|
-
},
|
|
535
|
-
deps: ['FirestoreOptions'],
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
provide: 'LegacyOrderRepository',
|
|
539
|
-
useFactory: (options) => {
|
|
540
|
-
return new LegacyOrderFirestoreRepository(options);
|
|
541
|
-
},
|
|
542
|
-
deps: ['FirestoreOptions'],
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
provide: 'ShopMenuRepository',
|
|
546
|
-
useFactory: (options) => {
|
|
547
|
-
return new ShopMenuFirestoreRepository(options);
|
|
548
|
-
},
|
|
549
|
-
deps: ['FirestoreOptions'],
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
provide: 'OrderRepository',
|
|
553
|
-
useFactory: (options) => {
|
|
554
|
-
return new OrderFirestoreRepository(options);
|
|
555
|
-
},
|
|
556
|
-
deps: ['FirestoreOptions'],
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
provide: 'PaymentRepository',
|
|
560
|
-
useFactory: (options) => {
|
|
561
|
-
return new PaymentFirestoreRepository(options);
|
|
562
|
-
},
|
|
563
|
-
deps: ['FirestoreOptions'],
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
provide: ProductFirestoreRepository,
|
|
567
|
-
useFactory: (options) => {
|
|
568
|
-
return new ProductFirestoreRepository(options);
|
|
569
|
-
},
|
|
570
|
-
deps: ['FirestoreOptions'],
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
provide: 'ShopSettingsRepository',
|
|
574
|
-
useFactory: (options) => {
|
|
575
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
576
|
-
},
|
|
577
|
-
deps: ['FirestoreOptions'],
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
provide: 'SubscriptionPaymentRepository',
|
|
581
|
-
useFactory: (options, subscriptionRepository) => {
|
|
582
|
-
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
583
|
-
},
|
|
584
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
provide: 'SubscriptionPlanRepository',
|
|
588
|
-
useFactory: (options) => {
|
|
589
|
-
return new SubscriptionPlanFirestoreRepository(options);
|
|
590
|
-
},
|
|
591
|
-
deps: ['FirestoreOptions'],
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
provide: 'SubscriptionProductRepository',
|
|
595
|
-
useFactory: (options) => {
|
|
596
|
-
return new SubscriptionProductFirestoreRepository(options);
|
|
597
|
-
},
|
|
598
|
-
deps: ['FirestoreOptions'],
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
provide: 'SubscriptionRepository',
|
|
602
|
-
useFactory: (options) => {
|
|
603
|
-
return new SubscriptionFirestoreRepository(options);
|
|
604
|
-
},
|
|
605
|
-
deps: ['FirestoreOptions'],
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
provide: 'UserRepository',
|
|
609
|
-
useFactory: (options) => {
|
|
610
|
-
return new UserFirestoreRepository(options);
|
|
611
|
-
},
|
|
612
|
-
deps: ['FirestoreOptions'],
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
provide: 'UserAddressRepository',
|
|
616
|
-
useFactory: (options, userRepository) => {
|
|
617
|
-
return new UserAddressFirestoreRepository(options, userRepository);
|
|
618
|
-
},
|
|
619
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
620
|
-
},
|
|
621
|
-
{
|
|
622
|
-
provide: 'UserPaymentMethodRepository',
|
|
623
|
-
useFactory: (options, userRepository) => {
|
|
624
|
-
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
625
|
-
},
|
|
626
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
provide: ProductVariantFirestoreRepository,
|
|
630
|
-
useFactory: (options, productRepository) => {
|
|
631
|
-
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
632
|
-
},
|
|
633
|
-
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
634
|
-
},
|
|
635
|
-
],
|
|
636
|
-
}]
|
|
637
|
-
}] });
|
|
638
|
-
|
|
639
|
-
class AngularHasuraGraphQLModule {
|
|
640
|
-
static initializeApp(options) {
|
|
641
|
-
return {
|
|
642
|
-
ngModule: AngularHasuraGraphQLModule,
|
|
643
|
-
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
648
|
-
AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
|
|
649
|
-
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
650
|
-
{
|
|
651
|
-
provide: 'HasuraConfig',
|
|
652
|
-
useFactory: (options, platformId) => ({
|
|
653
|
-
endpoint: options.endpoint,
|
|
654
|
-
authOptions: options.credentials,
|
|
655
|
-
interceptors: {
|
|
656
|
-
request: (request) => {
|
|
657
|
-
if (isPlatformBrowser(platformId))
|
|
658
|
-
return request;
|
|
659
|
-
const interval = setInterval(() => { }, 100);
|
|
660
|
-
request.interval = interval;
|
|
661
|
-
return request;
|
|
662
|
-
},
|
|
663
|
-
response: (response, request) => {
|
|
664
|
-
if (isPlatformBrowser(platformId))
|
|
665
|
-
return response;
|
|
666
|
-
clearInterval(request.interval);
|
|
667
|
-
return response;
|
|
668
|
-
},
|
|
669
|
-
},
|
|
670
|
-
}),
|
|
671
|
-
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
672
|
-
},
|
|
673
|
-
{
|
|
674
|
-
provide: 'CategoryRepository',
|
|
675
|
-
useExisting: CategoryHasuraGraphQLRepository,
|
|
676
|
-
},
|
|
677
|
-
{
|
|
678
|
-
provide: CategoryHasuraGraphQLRepository,
|
|
679
|
-
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
680
|
-
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
681
|
-
},
|
|
682
|
-
deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
683
|
-
},
|
|
684
|
-
{
|
|
685
|
-
provide: 'ProductRepository',
|
|
686
|
-
useExisting: ProductHasuraGraphQLRepository,
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
provide: ProductHasuraGraphQLRepository,
|
|
690
|
-
useFactory: (hasuraConfig) => {
|
|
691
|
-
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
692
|
-
},
|
|
693
|
-
deps: ['HasuraConfig'],
|
|
694
|
-
},
|
|
695
|
-
{
|
|
696
|
-
provide: 'VariantRepository',
|
|
697
|
-
useExisting: VariantHasuraGraphQLRepository,
|
|
698
|
-
},
|
|
699
|
-
{
|
|
700
|
-
provide: VariantHasuraGraphQLRepository,
|
|
701
|
-
useFactory: (hasuraConfig) => {
|
|
702
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
703
|
-
},
|
|
704
|
-
deps: ['HasuraConfig'],
|
|
705
|
-
},
|
|
706
|
-
{
|
|
707
|
-
provide: 'CategoryFilterRepository',
|
|
708
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
709
|
-
},
|
|
710
|
-
{
|
|
711
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
712
|
-
useFactory: (options) => {
|
|
713
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
714
|
-
},
|
|
715
|
-
deps: ['HasuraConfig'],
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
provide: 'FilterOptionRepository',
|
|
719
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
720
|
-
},
|
|
721
|
-
{
|
|
722
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
723
|
-
useFactory: (options) => {
|
|
724
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
725
|
-
},
|
|
726
|
-
deps: ['HasuraConfig'],
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
provide: 'FilterRepository',
|
|
730
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
731
|
-
},
|
|
732
|
-
{
|
|
733
|
-
provide: FilterHasuraGraphQLRepository,
|
|
734
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
735
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
736
|
-
},
|
|
737
|
-
deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
provide: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
741
|
-
useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials),
|
|
742
|
-
},
|
|
743
|
-
{
|
|
744
|
-
provide: 'CategoryCollectionChildrenRepository',
|
|
745
|
-
useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
provide: 'WishlistRepository',
|
|
749
|
-
useExisting: WishlistHasuraGraphQLRepository,
|
|
750
|
-
},
|
|
751
|
-
] });
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
753
|
-
type: NgModule,
|
|
754
|
-
args: [{
|
|
755
|
-
providers: [
|
|
756
|
-
{
|
|
757
|
-
provide: 'HasuraConfig',
|
|
758
|
-
useFactory: (options, platformId) => ({
|
|
759
|
-
endpoint: options.endpoint,
|
|
760
|
-
authOptions: options.credentials,
|
|
761
|
-
interceptors: {
|
|
762
|
-
request: (request) => {
|
|
763
|
-
if (isPlatformBrowser(platformId))
|
|
764
|
-
return request;
|
|
765
|
-
const interval = setInterval(() => { }, 100);
|
|
766
|
-
request.interval = interval;
|
|
767
|
-
return request;
|
|
768
|
-
},
|
|
769
|
-
response: (response, request) => {
|
|
770
|
-
if (isPlatformBrowser(platformId))
|
|
771
|
-
return response;
|
|
772
|
-
clearInterval(request.interval);
|
|
773
|
-
return response;
|
|
774
|
-
},
|
|
775
|
-
},
|
|
776
|
-
}),
|
|
777
|
-
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
778
|
-
},
|
|
779
|
-
{
|
|
780
|
-
provide: 'CategoryRepository',
|
|
781
|
-
useExisting: CategoryHasuraGraphQLRepository,
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
provide: CategoryHasuraGraphQLRepository,
|
|
785
|
-
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
786
|
-
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
787
|
-
},
|
|
788
|
-
deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
provide: 'ProductRepository',
|
|
792
|
-
useExisting: ProductHasuraGraphQLRepository,
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
provide: ProductHasuraGraphQLRepository,
|
|
796
|
-
useFactory: (hasuraConfig) => {
|
|
797
|
-
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
798
|
-
},
|
|
799
|
-
deps: ['HasuraConfig'],
|
|
800
|
-
},
|
|
801
|
-
{
|
|
802
|
-
provide: 'VariantRepository',
|
|
803
|
-
useExisting: VariantHasuraGraphQLRepository,
|
|
804
|
-
},
|
|
805
|
-
{
|
|
806
|
-
provide: VariantHasuraGraphQLRepository,
|
|
807
|
-
useFactory: (hasuraConfig) => {
|
|
808
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
809
|
-
},
|
|
810
|
-
deps: ['HasuraConfig'],
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
provide: 'CategoryFilterRepository',
|
|
814
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
815
|
-
},
|
|
816
|
-
{
|
|
817
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
818
|
-
useFactory: (options) => {
|
|
819
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
820
|
-
},
|
|
821
|
-
deps: ['HasuraConfig'],
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
provide: 'FilterOptionRepository',
|
|
825
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
826
|
-
},
|
|
827
|
-
{
|
|
828
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
829
|
-
useFactory: (options) => {
|
|
830
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
831
|
-
},
|
|
832
|
-
deps: ['HasuraConfig'],
|
|
833
|
-
},
|
|
834
|
-
{
|
|
835
|
-
provide: 'FilterRepository',
|
|
836
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
837
|
-
},
|
|
838
|
-
{
|
|
839
|
-
provide: FilterHasuraGraphQLRepository,
|
|
840
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
841
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
842
|
-
},
|
|
843
|
-
deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
844
|
-
},
|
|
845
|
-
{
|
|
846
|
-
provide: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
847
|
-
useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials),
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
provide: 'CategoryCollectionChildrenRepository',
|
|
851
|
-
useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
852
|
-
},
|
|
853
|
-
{
|
|
854
|
-
provide: 'WishlistRepository',
|
|
855
|
-
useExisting: WishlistHasuraGraphQLRepository,
|
|
856
|
-
},
|
|
857
|
-
],
|
|
858
|
-
}]
|
|
859
|
-
}] });
|
|
860
|
-
|
|
861
|
-
class AuthService {
|
|
862
|
-
constructor(angularFireAuth, userRepository) {
|
|
863
|
-
this.angularFireAuth = angularFireAuth;
|
|
864
|
-
this.userRepository = userRepository;
|
|
865
|
-
}
|
|
866
|
-
getAuthstate() {
|
|
867
|
-
const observables = [this.getFireUser(), this.getUser()];
|
|
868
|
-
return combineLatest(observables).pipe(map(([fireUser, user]) => ({
|
|
869
|
-
user,
|
|
870
|
-
isAnonymous: fireUser?.isAnonymous,
|
|
871
|
-
})));
|
|
872
|
-
}
|
|
873
|
-
getUser() {
|
|
874
|
-
return this.getFireUser().pipe(map((user) => user?.uid), mergeMap((id) => (id ? from(this.userRepository.get({ id })).pipe(catchError(() => of(null))) : of(null))));
|
|
875
|
-
}
|
|
876
|
-
getTokenId() {
|
|
877
|
-
return from(getIdToken(this.angularFireAuth.currentUser));
|
|
878
|
-
}
|
|
879
|
-
getFireUser() {
|
|
880
|
-
return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, deps: [{ token: i1$1.Auth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
884
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
|
|
885
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
|
|
886
|
-
type: Injectable
|
|
887
|
-
}], ctorParameters: function () { return [{ type: i1$1.Auth }, { type: undefined, decorators: [{
|
|
888
|
-
type: Inject,
|
|
889
|
-
args: ['UserRepository']
|
|
890
|
-
}] }]; } });
|
|
891
|
-
|
|
892
|
-
class CouponService {
|
|
893
|
-
constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
894
|
-
this.couponRepository = couponRepository;
|
|
895
|
-
this.defaultShop = defaultShop;
|
|
896
|
-
this.orderRepository = orderRepository;
|
|
897
|
-
this.categoryRepository = categoryRepository;
|
|
898
|
-
this.emailIsFromCollaborator = (userEmail) => !!userEmail?.match(/@b4a.com.br/g);
|
|
899
|
-
}
|
|
900
|
-
checkCoupon(nickname, checkoutType, checkout, plan) {
|
|
901
|
-
return from(this.couponRepository
|
|
902
|
-
.find({
|
|
903
|
-
filters: {
|
|
904
|
-
nickname: { operator: Where.EQUALS, value: nickname },
|
|
905
|
-
active: { operator: Where.EQUALS, value: true },
|
|
906
|
-
},
|
|
907
|
-
})
|
|
908
|
-
.then((result) => result.data[0])).pipe(concatMap((coupon) => this.couponValidation(coupon, checkoutType)), concatMap((couponValid) => this.couponRulesValidation(couponValid, checkoutType, checkout, plan)), map((couponValidated) => couponValidated));
|
|
909
|
-
}
|
|
910
|
-
async couponValidation(coupon, checkoutType) {
|
|
911
|
-
if (!coupon)
|
|
912
|
-
throw 'Cupom inválido.';
|
|
913
|
-
if (coupon?.beginAt && coupon?.beginAt.getTime() > new Date().getTime())
|
|
914
|
-
throw 'Cupom inválido.';
|
|
915
|
-
if (coupon?.expiresIn && coupon?.expiresIn.getTime() < new Date().getTime())
|
|
916
|
-
throw 'Cupom expirado.';
|
|
917
|
-
const isInShop = coupon.shopAvailability === Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
918
|
-
if (!isInShop)
|
|
919
|
-
throw 'Cupom inválido para loja.';
|
|
920
|
-
const isCheckoutType = coupon.checkoutType === CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
|
|
921
|
-
if (!isCheckoutType)
|
|
922
|
-
throw 'Cupom inválido. Erro de checkout.';
|
|
923
|
-
return coupon;
|
|
924
|
-
}
|
|
925
|
-
async couponRulesValidation(coupon, checkoutType, checkout, plan) {
|
|
926
|
-
if (checkoutType == CheckoutTypes.SUBSCRIPTION) {
|
|
927
|
-
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
|
|
928
|
-
throw 'Cupom inválido para sua assinatura.';
|
|
929
|
-
return coupon;
|
|
930
|
-
}
|
|
931
|
-
const validUser = this.coupomUserValidation(coupon, checkout?.user);
|
|
134
|
+
});
|
|
135
|
+
// orders que usuario ja fez com o cupom
|
|
136
|
+
const ordersUserCoupon = orders.data.filter((o) => o.user.email == userEmail);
|
|
137
|
+
// Verifica o limite de uso de cupom por usuario
|
|
138
|
+
if (coupon.useLimitPerUser && ordersUserCoupon.length)
|
|
139
|
+
throw new InvalidCouponError('Limite de uso por usuário atingido.');
|
|
140
|
+
// Verifica o limite de uso geral por usuario
|
|
141
|
+
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
142
|
+
throw new InvalidCouponError('Limite de uso atingido.');
|
|
143
|
+
const validUser = await this.userValidationAndSubscriptionStatus(coupon, userEmail);
|
|
932
144
|
if (!validUser)
|
|
933
|
-
throw 'Usuário não elegível.';
|
|
934
|
-
const couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
|
|
935
|
-
if (!couponUseLimits.unlimited || couponUseLimits.limitedPerUser) {
|
|
936
|
-
const orders = await this.getOrdersWithCoupon(coupon);
|
|
937
|
-
if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
|
|
938
|
-
throw 'Limite de uso atingido.';
|
|
939
|
-
if (couponUseLimits.limitedPerUser) {
|
|
940
|
-
const ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
|
|
941
|
-
if (ordersWithUser > 0)
|
|
942
|
-
throw 'Limite de uso por usuário atingido.';
|
|
943
|
-
}
|
|
944
|
-
}
|
|
145
|
+
throw new InvalidCouponError('Usuário não elegível.');
|
|
945
146
|
const hasProductCategories = await this.hasProductCategories(coupon, checkout);
|
|
946
147
|
if (!hasProductCategories)
|
|
947
148
|
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
948
|
-
const hasMinSubTotal = await this.hasMinSubTotal(coupon, checkout);
|
|
949
|
-
if (!hasMinSubTotal)
|
|
950
|
-
throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`;
|
|
951
149
|
return coupon;
|
|
952
150
|
}
|
|
953
151
|
calcDiscountSubscription(coupon, checkout) {
|
|
152
|
+
//
|
|
954
153
|
let discount = 0;
|
|
955
|
-
if (coupon.
|
|
956
|
-
discount = coupon.discount
|
|
957
|
-
else
|
|
958
|
-
discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount
|
|
154
|
+
if (coupon.type === CouponTypes.ABSOLUTE)
|
|
155
|
+
discount = coupon.discount;
|
|
156
|
+
else if (coupon.type === CouponTypes.PERCENTAGE)
|
|
157
|
+
discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount / 100);
|
|
959
158
|
return of(discount);
|
|
960
159
|
}
|
|
961
160
|
async calcDiscountShopping(coupon, checkout) {
|
|
962
161
|
let discount = 0;
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
162
|
+
switch (coupon.type) {
|
|
163
|
+
case CouponTypes.ABSOLUTE: {
|
|
164
|
+
discount = coupon.discount;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case CouponTypes.PERCENTAGE: {
|
|
168
|
+
discount = await this.calcShoppingPercentageDiscount(coupon, checkout);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
968
171
|
}
|
|
969
172
|
return discount;
|
|
970
173
|
}
|
|
971
|
-
async
|
|
174
|
+
async calcShoppingPercentageDiscount(coupon, checkout) {
|
|
972
175
|
let discount = 0;
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
176
|
+
const shop = checkout.shop;
|
|
177
|
+
let lineItensDiscount = [];
|
|
178
|
+
const couponCategories = await this.getCouponCategoriesId(coupon);
|
|
179
|
+
if (coupon.productsCategories && coupon.productsCategories.length) {
|
|
180
|
+
lineItensDiscount = checkout.lineItems?.filter((i) => {
|
|
181
|
+
if (i.categories?.length) {
|
|
182
|
+
return i.categories.some((c) => couponCategories.some((cat) => cat.id == c || cat.firestoreId == c));
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
});
|
|
977
186
|
}
|
|
978
187
|
else {
|
|
979
|
-
|
|
188
|
+
lineItensDiscount = checkout.lineItems;
|
|
980
189
|
}
|
|
190
|
+
const subTotal = lineItensDiscount.reduce((acc, curr) => checkout.user?.isSubscriber && curr.price?.subscriberPrice
|
|
191
|
+
? acc + curr.price?.subscriberPrice * curr.quantity
|
|
192
|
+
: acc + curr.pricePaid * curr.quantity, 0) || 0;
|
|
193
|
+
discount = subTotal * (coupon.discount / 100);
|
|
981
194
|
return discount;
|
|
982
195
|
}
|
|
983
|
-
|
|
196
|
+
hasMinSubTotal(coupon, checkout) {
|
|
984
197
|
if (!coupon.minSubTotalValue)
|
|
985
198
|
return true;
|
|
986
|
-
|
|
987
|
-
|
|
199
|
+
const shop = checkout.shop;
|
|
200
|
+
let subTotal = checkout.lineItems?.reduce((acc, curr) => checkout.user?.isSubscriber && curr.price?.subscriberPrice
|
|
201
|
+
? acc + curr.price?.subscriberPrice * curr.quantity
|
|
202
|
+
: acc + curr.pricePaid * curr.quantity, 0) || 0;
|
|
988
203
|
if (coupon.minSubTotalValue <= subTotal)
|
|
989
204
|
return true;
|
|
990
205
|
return false;
|
|
@@ -993,93 +208,60 @@ class CouponService {
|
|
|
993
208
|
if (!coupon.productsCategories || !coupon.productsCategories.length) {
|
|
994
209
|
return true;
|
|
995
210
|
}
|
|
996
|
-
const couponCategories = await this.getCouponCategoriesId(coupon
|
|
211
|
+
const couponCategories = await this.getCouponCategoriesId(coupon);
|
|
997
212
|
const hasCategories = checkout.lineItems?.filter((i) => {
|
|
998
213
|
if (!i.categories || !i.categories?.length)
|
|
999
214
|
return true;
|
|
1000
|
-
return i.categories.some((c) => couponCategories.some((cat) => cat == c));
|
|
215
|
+
return i.categories.some((c) => couponCategories.some((cat) => cat.id == c || cat.firestoreId == c));
|
|
1001
216
|
});
|
|
1002
217
|
return hasCategories.length ? true : false;
|
|
1003
218
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
219
|
+
async userValidationAndSubscriptionStatus(coupon, userEmail) {
|
|
220
|
+
// Verifica se o email do usuário é coorporativo
|
|
221
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
222
|
+
throw new InvalidCouponError('Você não é colaborador.');
|
|
223
|
+
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
224
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
|
|
225
|
+
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
226
|
+
const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
|
|
227
|
+
coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
|
|
228
|
+
coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
|
|
229
|
+
if (couponRuleSubscription && userEmail) {
|
|
230
|
+
const sub = await this.subscriptionRepository
|
|
231
|
+
.find({
|
|
232
|
+
filters: {
|
|
233
|
+
user: {
|
|
234
|
+
email: { operator: Where.EQUALS, value: userEmail },
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
})
|
|
238
|
+
.then((sub) => sub.data);
|
|
239
|
+
const activeSubs = sub?.filter((s) => s.status === Status.ACTIVE);
|
|
240
|
+
switch (coupon.exclusivityType) {
|
|
241
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
242
|
+
return activeSubs.length > 0;
|
|
243
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
244
|
+
return activeSubs.length === 0;
|
|
245
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
246
|
+
return sub.length === 0;
|
|
247
|
+
default:
|
|
248
|
+
return false;
|
|
1033
249
|
}
|
|
1034
250
|
}
|
|
1035
|
-
return
|
|
251
|
+
return true;
|
|
1036
252
|
}
|
|
1037
|
-
async
|
|
1038
|
-
let
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
if (i.categories?.length) {
|
|
1043
|
-
return i.categories.some((c) => couponCategories.some((cat) => cat == c));
|
|
1044
|
-
}
|
|
1045
|
-
return true;
|
|
253
|
+
async getCouponCategoriesId(coupon) {
|
|
254
|
+
let couponCategories = [];
|
|
255
|
+
for (let index = 0; index < coupon.productsCategories.length; index++) {
|
|
256
|
+
let c = await this.categoryRepository.get({
|
|
257
|
+
id: coupon.productsCategories[index],
|
|
1046
258
|
});
|
|
259
|
+
couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
|
|
1047
260
|
}
|
|
1048
|
-
|
|
1049
|
-
lineItensDiscount = checkout.lineItems;
|
|
1050
|
-
}
|
|
1051
|
-
return lineItensDiscount;
|
|
1052
|
-
}
|
|
1053
|
-
calcCheckoutSubtotal(lineItens, user, shop) {
|
|
1054
|
-
return (lineItens?.reduce((acc, curr) => user?.isSubscriber && curr.price.subscriberPrice
|
|
1055
|
-
? acc + curr.price?.subscriberPrice * curr.quantity
|
|
1056
|
-
: acc + curr.pricePaid * curr.quantity, 0) || 0);
|
|
1057
|
-
}
|
|
1058
|
-
async getOrdersWithCoupon(coupon) {
|
|
1059
|
-
return await this.orderRepository
|
|
1060
|
-
.find({
|
|
1061
|
-
filters: {
|
|
1062
|
-
coupon: { id: coupon.id },
|
|
1063
|
-
payment: { status: 'paid' },
|
|
1064
|
-
},
|
|
1065
|
-
})
|
|
1066
|
-
.then((result) => result.data);
|
|
1067
|
-
}
|
|
1068
|
-
countOrdersWithUser(orders, email) {
|
|
1069
|
-
return orders.filter((o) => o.user.email == email).length;
|
|
1070
|
-
}
|
|
1071
|
-
getCouponUseLimits(coupon, checkoutType, user) {
|
|
1072
|
-
let couponUseLimits;
|
|
1073
|
-
if (checkoutType == CheckoutTypes.ECOMMERCE || checkoutType == CheckoutTypes.ALL) {
|
|
1074
|
-
couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
|
|
1075
|
-
}
|
|
1076
|
-
else {
|
|
1077
|
-
couponUseLimits = coupon.useLimits.subscription;
|
|
1078
|
-
}
|
|
1079
|
-
return couponUseLimits;
|
|
261
|
+
return couponCategories;
|
|
1080
262
|
}
|
|
1081
263
|
}
|
|
1082
|
-
CouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
264
|
+
CouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'SubscriptionRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1083
265
|
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
1084
266
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
|
|
1085
267
|
type: Injectable,
|
|
@@ -1089,12 +271,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1089
271
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1090
272
|
type: Inject,
|
|
1091
273
|
args: ['CouponRepository']
|
|
1092
|
-
}] }, { type:
|
|
274
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1093
275
|
type: Inject,
|
|
1094
276
|
args: [DEFAULT_SHOP]
|
|
1095
277
|
}] }, { type: undefined, decorators: [{
|
|
1096
278
|
type: Inject,
|
|
1097
279
|
args: ['OrderRepository']
|
|
280
|
+
}] }, { type: undefined, decorators: [{
|
|
281
|
+
type: Inject,
|
|
282
|
+
args: ['SubscriptionRepository']
|
|
1098
283
|
}] }, { type: undefined, decorators: [{
|
|
1099
284
|
type: Inject,
|
|
1100
285
|
args: ['CategoryRepository']
|
|
@@ -1131,7 +316,9 @@ class CheckoutService {
|
|
|
1131
316
|
return this.getCheckout().pipe(concatMap(async (checkout) => await this.couponService.calcDiscountShopping(coupon, checkout)));
|
|
1132
317
|
}
|
|
1133
318
|
checkCoupon(nickname, checkoutType) {
|
|
1134
|
-
return this.getCheckout().pipe(concatMap((checkout) => this.couponService
|
|
319
|
+
return this.getCheckout().pipe(concatMap((checkout) => this.couponService
|
|
320
|
+
.checkCoupon(nickname, checkout.user?.email, CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
|
|
321
|
+
.pipe()));
|
|
1135
322
|
}
|
|
1136
323
|
async createCheckout(checkoutData) {
|
|
1137
324
|
const checkout = await this.checkoutRepository.create({
|
|
@@ -1156,24 +343,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1156
343
|
}] }, { type: undefined, decorators: [{
|
|
1157
344
|
type: Inject,
|
|
1158
345
|
args: ['UserRepository']
|
|
1159
|
-
}] }, { type:
|
|
346
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1160
347
|
type: Inject,
|
|
1161
348
|
args: [DEFAULT_SHOP]
|
|
1162
349
|
}] }]; } });
|
|
1163
350
|
|
|
1164
351
|
class CartService {
|
|
1165
|
-
constructor(authService, checkoutService, defaultShop, productRepository
|
|
352
|
+
constructor(authService, checkoutService, defaultShop, productRepository) {
|
|
1166
353
|
this.authService = authService;
|
|
1167
354
|
this.checkoutService = checkoutService;
|
|
1168
355
|
this.defaultShop = defaultShop;
|
|
1169
356
|
this.productRepository = productRepository;
|
|
1170
|
-
this.categoryRepository = categoryRepository;
|
|
1171
|
-
this.variantRepository = variantRepository;
|
|
1172
|
-
this.buy2WinRepository = buy2WinRepository;
|
|
1173
357
|
this.cartSubject = new Subject();
|
|
1174
358
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
1175
359
|
const items = [];
|
|
1176
|
-
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.
|
|
360
|
+
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
1177
361
|
if (index > -1) {
|
|
1178
362
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
1179
363
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
@@ -1184,27 +368,27 @@ class CartService {
|
|
|
1184
368
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
1185
369
|
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
1186
370
|
}));
|
|
1187
|
-
this.generateCartObject = (items) =>
|
|
1188
|
-
|
|
1189
|
-
[item.
|
|
1190
|
-
...(cart[item.
|
|
1191
|
-
quantity: (cart[item.
|
|
1192
|
-
})
|
|
1193
|
-
|
|
371
|
+
this.generateCartObject = (items) => {
|
|
372
|
+
const cart = {};
|
|
373
|
+
items?.forEach((item) => (cart[item.sku] = LineItem.toInstance({
|
|
374
|
+
...(cart[item.sku] || item),
|
|
375
|
+
quantity: (cart[item.sku]?.quantity || 0) + (item.quantity ? item.quantity : 1),
|
|
376
|
+
})));
|
|
377
|
+
return cart;
|
|
378
|
+
};
|
|
1194
379
|
this.buildLineItem = async ({ checkout, item, quantity, }) => {
|
|
1195
|
-
const product = await this.
|
|
1196
|
-
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.
|
|
380
|
+
const product = await this.productRepository.get({ id: item.id });
|
|
381
|
+
item.quantity = item?.quantity || checkout?.lineItems?.find((lineItem) => lineItem.sku === item.sku)?.quantity || 0;
|
|
1197
382
|
if (this.checkMaxStock(item, quantity || 0))
|
|
1198
383
|
throw new Error('Desculpe! Temos apenas ' + item.stock?.quantity + ' em estoque.');
|
|
1199
384
|
const image = item.image || item.images?.shift();
|
|
1200
|
-
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
385
|
+
const { id, name, EAN, brand, slug, stock, price, weight, categories, sku, type } = item;
|
|
1201
386
|
const isGift = item.isGift || null;
|
|
1202
387
|
const pricePaid = this.getProductPrice({
|
|
1203
388
|
product: item,
|
|
1204
389
|
shop: checkout.shop || this.defaultShop,
|
|
1205
390
|
isSubscriber: checkout.user?.isSubscriber,
|
|
1206
391
|
});
|
|
1207
|
-
RoundProductPricesHelper.roundProductPrices(item);
|
|
1208
392
|
return {
|
|
1209
393
|
checkout,
|
|
1210
394
|
lineItem: LineItem.toInstance({
|
|
@@ -1215,7 +399,7 @@ class CartService {
|
|
|
1215
399
|
slug: slug ?? product.slug,
|
|
1216
400
|
sku: sku ?? product.sku,
|
|
1217
401
|
stock,
|
|
1218
|
-
price
|
|
402
|
+
price,
|
|
1219
403
|
image,
|
|
1220
404
|
weight: weight ?? product.weight,
|
|
1221
405
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
@@ -1231,9 +415,7 @@ class CartService {
|
|
|
1231
415
|
const info = product.price;
|
|
1232
416
|
if (product.isGift)
|
|
1233
417
|
return 0;
|
|
1234
|
-
return isSubscriber && info.subscriberPrice > 0
|
|
1235
|
-
? Number(info.subscriberPrice.toFixed(2))
|
|
1236
|
-
: Number(info.price.toFixed(2));
|
|
418
|
+
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
1237
419
|
};
|
|
1238
420
|
this.checkMaxStock = (item, quantity) => {
|
|
1239
421
|
const maxStock = item.stock?.quantity || 0;
|
|
@@ -1246,7 +428,7 @@ class CartService {
|
|
|
1246
428
|
}
|
|
1247
429
|
decreaseItem(item) {
|
|
1248
430
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
1249
|
-
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.
|
|
431
|
+
const checkoutItem = checkout.lineItems?.find((lineItem) => lineItem.sku === item.sku);
|
|
1250
432
|
if (!isNil(checkoutItem))
|
|
1251
433
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
1252
434
|
return checkout;
|
|
@@ -1264,21 +446,17 @@ class CartService {
|
|
|
1264
446
|
}
|
|
1265
447
|
removeItem(item) {
|
|
1266
448
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
1267
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.
|
|
449
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
1268
450
|
if (index >= 0)
|
|
1269
451
|
checkout.lineItems.splice(index, 1);
|
|
1270
452
|
return checkout;
|
|
1271
453
|
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
1272
454
|
}
|
|
1273
455
|
updateUserCart(user) {
|
|
1274
|
-
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService
|
|
1275
|
-
.updateCheckoutLineItems(Checkout.toInstance({
|
|
456
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance({ ...checkout.toPlain(), user }))), concatMap(async (checkout) => this.checkoutService.updateCheckoutLineItems(Checkout.toInstance({
|
|
1276
457
|
...checkout.toPlain(),
|
|
1277
|
-
lineItems: checkout.lineItems?.length
|
|
1278
|
-
|
|
1279
|
-
: [],
|
|
1280
|
-
}))
|
|
1281
|
-
.toPromise()), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
458
|
+
lineItems: checkout.lineItems?.length ? await Promise.all(checkout.lineItems?.map(async (item) => (await this.buildLineItem({ checkout, item })).lineItem)) : [],
|
|
459
|
+
})).toPromise()), map(checkout => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
1282
460
|
}
|
|
1283
461
|
clearCart() {
|
|
1284
462
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
@@ -1289,484 +467,19 @@ class CartService {
|
|
|
1289
467
|
buildCartFromCheckout(checkoutData) {
|
|
1290
468
|
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
1291
469
|
}
|
|
1292
|
-
roundPrice(productPrice) {
|
|
1293
|
-
const { price, fullPrice, subscriberPrice } = productPrice;
|
|
1294
|
-
return {
|
|
1295
|
-
...productPrice,
|
|
1296
|
-
price: Number(price.toFixed(2)),
|
|
1297
|
-
fullPrice: Number(fullPrice.toFixed(2)),
|
|
1298
|
-
...(subscriberPrice && { subscriberPrice: Number(subscriberPrice.toFixed(2)) }),
|
|
1299
|
-
};
|
|
1300
|
-
}
|
|
1301
|
-
async getProductData(productId) {
|
|
1302
|
-
let product;
|
|
1303
|
-
let variant;
|
|
1304
|
-
try {
|
|
1305
|
-
product = await this.productRepository.get({ id: productId });
|
|
1306
|
-
}
|
|
1307
|
-
catch (error) {
|
|
1308
|
-
if (!(error instanceof NotFoundError))
|
|
1309
|
-
throw error;
|
|
1310
|
-
const { data: variants } = await this.variantRepository.find({ filters: { id: productId } });
|
|
1311
|
-
variant = variants.shift();
|
|
1312
|
-
if (!variant)
|
|
1313
|
-
throw error;
|
|
1314
|
-
product = await this.productRepository.get({ id: variant.productId });
|
|
1315
|
-
}
|
|
1316
|
-
return {
|
|
1317
|
-
...product.toPlain(),
|
|
1318
|
-
...(variant && { ...variant.toPlain() }),
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
getGifts() {
|
|
1322
|
-
return this.checkoutService.getCheckout().pipe(mergeMap(async (checkout) => {
|
|
1323
|
-
const notGiftItems = checkout.lineItems ? checkout.lineItems.filter((item) => !item.isGift) : [];
|
|
1324
|
-
if (!notGiftItems.length)
|
|
1325
|
-
return { ...checkout, lineItems: [] };
|
|
1326
|
-
const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
1327
|
-
const campaigns = await this.buy2WinRepository
|
|
1328
|
-
.find({
|
|
1329
|
-
filters: {
|
|
1330
|
-
active: { operator: Where.EQUALS, value: true },
|
|
1331
|
-
shop: { operator: Where.EQUALS, value: this.defaultShop },
|
|
1332
|
-
},
|
|
1333
|
-
})
|
|
1334
|
-
.then((data) => data.data);
|
|
1335
|
-
if (!campaigns.length)
|
|
1336
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
1337
|
-
const elegibleCampaigns = [];
|
|
1338
|
-
for (const campaign of campaigns) {
|
|
1339
|
-
const today = new Date().getDate();
|
|
1340
|
-
if (!(campaign.startDate.getDate() <= today) && !(campaign.endDate.getDate() >= today))
|
|
1341
|
-
continue;
|
|
1342
|
-
if (campaign.activeCategory) {
|
|
1343
|
-
const categoriesCampaing = campaign.categories.map((c) => c.id.toString());
|
|
1344
|
-
const categoriesCampaingFullTree = [];
|
|
1345
|
-
for (const id of categoriesCampaing) {
|
|
1346
|
-
const children = await this.categoryRepository.getChildren(parseInt(id));
|
|
1347
|
-
categoriesCampaingFullTree.push(id, ...children.map((c) => c.id.toString()));
|
|
1348
|
-
}
|
|
1349
|
-
const categoriesCampaingTree = [...new Set(categoriesCampaingFullTree)];
|
|
1350
|
-
const filterProductsCategories = checkout.lineItems.filter((l) => {
|
|
1351
|
-
if (!l.categories || !l.categories?.length)
|
|
1352
|
-
return true;
|
|
1353
|
-
return l.categories.some((c) => categoriesCampaingTree.some((cat) => cat == c));
|
|
1354
|
-
});
|
|
1355
|
-
if (filterProductsCategories.length) {
|
|
1356
|
-
const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
1357
|
-
if (cartTotalCategories >= campaign.cartValueMin)
|
|
1358
|
-
elegibleCampaigns.push(campaign);
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
else {
|
|
1362
|
-
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
1363
|
-
if (campaign.cartValue <= cartTotal)
|
|
1364
|
-
elegibleCampaigns.push(campaign);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
if (!elegibleCampaigns.length)
|
|
1369
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
1370
|
-
const campaingnProducts = [];
|
|
1371
|
-
for (const campaign of elegibleCampaigns) {
|
|
1372
|
-
let elegibleProducts = [];
|
|
1373
|
-
for (const product of campaign.products) {
|
|
1374
|
-
const { data: productData } = await this.productRepository.find({ filters: { sku: product } });
|
|
1375
|
-
if (!productData.length)
|
|
1376
|
-
continue;
|
|
1377
|
-
const gift = productData.shift();
|
|
1378
|
-
if (gift.stock.quantity < 1)
|
|
1379
|
-
continue;
|
|
1380
|
-
elegibleProducts.push(gift);
|
|
1381
|
-
}
|
|
1382
|
-
campaingnProducts.push(elegibleProducts);
|
|
1383
|
-
}
|
|
1384
|
-
if (!campaingnProducts.length)
|
|
1385
|
-
return { ...checkout, lineItems: notGiftItems };
|
|
1386
|
-
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
1387
|
-
return { ...checkout, lineItems: notGiftItems.concat(gifts) };
|
|
1388
|
-
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
1389
|
-
}
|
|
1390
|
-
giftToLineItems(items) {
|
|
1391
|
-
return items.map((item) => {
|
|
1392
|
-
const { brand, categories, id, name, price, sku, slug, stock, weight, EAN } = item;
|
|
1393
|
-
const image = item?.miniatures?.length ? item.miniatures[0] : item.images[0];
|
|
1394
|
-
return LineItem.toInstance({
|
|
1395
|
-
brand,
|
|
1396
|
-
categories,
|
|
1397
|
-
id: id.toString(),
|
|
1398
|
-
name,
|
|
1399
|
-
price,
|
|
1400
|
-
sku,
|
|
1401
|
-
slug,
|
|
1402
|
-
stock,
|
|
1403
|
-
weight,
|
|
1404
|
-
EAN,
|
|
1405
|
-
image,
|
|
1406
|
-
pricePaid: 0,
|
|
1407
|
-
quantity: 1,
|
|
1408
|
-
isGift: true,
|
|
1409
|
-
});
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
470
|
}
|
|
1413
|
-
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }
|
|
471
|
+
CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1414
472
|
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
|
|
1415
473
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
|
|
1416
474
|
type: Injectable
|
|
1417
|
-
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type:
|
|
475
|
+
}], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
1418
476
|
type: Inject,
|
|
1419
477
|
args: [DEFAULT_SHOP]
|
|
1420
478
|
}] }, { type: undefined, decorators: [{
|
|
1421
479
|
type: Inject,
|
|
1422
480
|
args: ['ProductRepository']
|
|
1423
|
-
}] }, { type: undefined, decorators: [{
|
|
1424
|
-
type: Inject,
|
|
1425
|
-
args: ['CategoryRepository']
|
|
1426
|
-
}] }, { type: undefined, decorators: [{
|
|
1427
|
-
type: Inject,
|
|
1428
|
-
args: ['VariantRepository']
|
|
1429
|
-
}] }, { type: i1$3.Buy2WinFirestoreRepository, decorators: [{
|
|
1430
|
-
type: Inject,
|
|
1431
|
-
args: ['Buy2WinRepository']
|
|
1432
|
-
}] }]; } });
|
|
1433
|
-
|
|
1434
|
-
class CatalogService {
|
|
1435
|
-
constructor(productRepository, categoryStructureAdapter, shop) {
|
|
1436
|
-
this.productRepository = productRepository;
|
|
1437
|
-
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1438
|
-
this.shop = shop;
|
|
1439
|
-
this.buildFilterQuery = ({ clubDiscount, brands, prices, gender, tags, rate, customOptions, }) => {
|
|
1440
|
-
const filters = {};
|
|
1441
|
-
if (clubDiscount?.length)
|
|
1442
|
-
set(filters, 'price.subscriberDiscountPercentage', { operator: Where.IN, value: clubDiscount });
|
|
1443
|
-
if (brands?.length)
|
|
1444
|
-
filters.brand = { operator: Where.IN, value: brands };
|
|
1445
|
-
if (gender?.length)
|
|
1446
|
-
filters.tags = {
|
|
1447
|
-
operator: Where.IN,
|
|
1448
|
-
value: gender
|
|
1449
|
-
.map((genderOptions) => genderOptions === 'female' ? 'feminino' : genderOptions === 'male' ? 'masculino' : null)
|
|
1450
|
-
.filter(Boolean),
|
|
1451
|
-
};
|
|
1452
|
-
if (prices?.min || prices?.max)
|
|
1453
|
-
set(filters, prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price', [
|
|
1454
|
-
...(prices.min ? [{ operator: Where.GTE, value: Math.round(prices.min) }] : []),
|
|
1455
|
-
...(prices.max ? [{ operator: Where.LTE, value: Math.ceil(prices.max) }] : []),
|
|
1456
|
-
]);
|
|
1457
|
-
if (rate)
|
|
1458
|
-
filters.rate = { operator: Where.GTE, value: rate };
|
|
1459
|
-
if (tags?.length)
|
|
1460
|
-
filters.tags = { operator: Where.LIKE, value: tags };
|
|
1461
|
-
if (customOptions?.length)
|
|
1462
|
-
filters.filters = { operator: Where.LIKE, value: customOptions };
|
|
1463
|
-
return filters;
|
|
1464
|
-
};
|
|
1465
|
-
this.buildSortQuery = (sort) => {
|
|
1466
|
-
if (!sort || sort === 'most-relevant')
|
|
1467
|
-
return {};
|
|
1468
|
-
if (sort === 'best-sellers')
|
|
1469
|
-
return { shoppingCount: 'desc' };
|
|
1470
|
-
if (sort === 'biggest-price')
|
|
1471
|
-
return { price: 'desc' };
|
|
1472
|
-
if (sort === 'lowest-price')
|
|
1473
|
-
return { price: 'asc' };
|
|
1474
|
-
if (sort === 'best-rating')
|
|
1475
|
-
return { rate: 'desc' };
|
|
1476
|
-
if (sort === 'news')
|
|
1477
|
-
return { createdAt: 'desc' };
|
|
1478
|
-
};
|
|
1479
|
-
this.buildLimitQuery = (options) => {
|
|
1480
|
-
const limit = options?.perPage || 20;
|
|
1481
|
-
return {
|
|
1482
|
-
limit,
|
|
1483
|
-
offset: ((options?.page || 1) - 1) * limit,
|
|
1484
|
-
};
|
|
1485
|
-
};
|
|
1486
|
-
}
|
|
1487
|
-
async fetchProducts(category, options) {
|
|
1488
|
-
const limits = this.buildLimitQuery(options);
|
|
1489
|
-
return await this.productRepository
|
|
1490
|
-
.findCatalog({
|
|
1491
|
-
filters: {
|
|
1492
|
-
...(await this.categoryStructureAdapter.buildProductFilterByCategory(category)),
|
|
1493
|
-
...this.buildFilterQuery(options?.filters || {}),
|
|
1494
|
-
},
|
|
1495
|
-
...(options?.sort ? { orderBy: this.buildSortQuery(options?.sort) } : {}),
|
|
1496
|
-
limits,
|
|
1497
|
-
options: { minimal: ['price'], maximum: ['price'] },
|
|
1498
|
-
}, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female')
|
|
1499
|
-
.then(({ data, count: total, maximum, minimal }) => ({
|
|
1500
|
-
products: { data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)), total },
|
|
1501
|
-
pages: Math.ceil(total / limits.limit),
|
|
1502
|
-
prices: {
|
|
1503
|
-
price: { min: +minimal?.price?.price?.toFixed(2), max: +maximum?.price?.price?.toFixed(2) },
|
|
1504
|
-
subscriberPrice: {
|
|
1505
|
-
min: +minimal?.price?.subscriberPrice?.toFixed(2),
|
|
1506
|
-
max: +maximum?.price?.subscriberPrice?.toFixed(2),
|
|
1507
|
-
},
|
|
1508
|
-
},
|
|
1509
|
-
}));
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1513
|
-
CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
|
|
1514
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
|
|
1515
|
-
type: Injectable
|
|
1516
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1517
|
-
type: Inject,
|
|
1518
|
-
args: ['ProductRepository']
|
|
1519
|
-
}] }, { type: undefined, decorators: [{
|
|
1520
|
-
type: Inject,
|
|
1521
|
-
args: [CATEGORY_STRUCTURE]
|
|
1522
|
-
}] }, { type: i1$3.Shops, decorators: [{
|
|
1523
|
-
type: Inject,
|
|
1524
|
-
args: [DEFAULT_SHOP]
|
|
1525
|
-
}] }]; } });
|
|
1526
|
-
|
|
1527
|
-
class CategoryService {
|
|
1528
|
-
constructor(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
|
|
1529
|
-
this.productRepository = productRepository;
|
|
1530
|
-
this.categoryRepository = categoryRepository;
|
|
1531
|
-
this.categoryFilterRepository = categoryFilterRepository;
|
|
1532
|
-
this.categoryStructureAdapter = categoryStructureAdapter;
|
|
1533
|
-
this.shop = shop;
|
|
1534
|
-
}
|
|
1535
|
-
async fetchBrands(category, mainGender) {
|
|
1536
|
-
const brands = await this.productRepository
|
|
1537
|
-
.findCatalog({
|
|
1538
|
-
filters: await this.categoryStructureAdapter.buildProductFilterByCategory(category),
|
|
1539
|
-
fields: ['brand'],
|
|
1540
|
-
}, mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female')
|
|
1541
|
-
.then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => ({ ...brands, [brand]: true }), {})));
|
|
1542
|
-
return this.categoryRepository
|
|
1543
|
-
.find({ filters: { brandCategory: true }, orderBy: { name: 'asc' } })
|
|
1544
|
-
.then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
|
|
1545
|
-
}
|
|
1546
|
-
async fetchFilterOptions(category, filters) {
|
|
1547
|
-
return await this.categoryFilterRepository
|
|
1548
|
-
.find({ filters: { categoryId: +category.id } })
|
|
1549
|
-
.then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
CategoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1553
|
-
CategoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService });
|
|
1554
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, decorators: [{
|
|
1555
|
-
type: Injectable
|
|
1556
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1557
|
-
type: Inject,
|
|
1558
|
-
args: ['ProductRepository']
|
|
1559
|
-
}] }, { type: undefined, decorators: [{
|
|
1560
|
-
type: Inject,
|
|
1561
|
-
args: ['CategoryRepository']
|
|
1562
|
-
}] }, { type: undefined, decorators: [{
|
|
1563
|
-
type: Inject,
|
|
1564
|
-
args: ['CategoryFilterRepository']
|
|
1565
|
-
}] }, { type: undefined, decorators: [{
|
|
1566
|
-
type: Inject,
|
|
1567
|
-
args: [CATEGORY_STRUCTURE]
|
|
1568
|
-
}] }, { type: i1$3.Shops, decorators: [{
|
|
1569
|
-
type: Inject,
|
|
1570
|
-
args: [DEFAULT_SHOP]
|
|
1571
|
-
}] }]; } });
|
|
1572
|
-
|
|
1573
|
-
var ProductSorts;
|
|
1574
|
-
(function (ProductSorts) {
|
|
1575
|
-
ProductSorts["MOST_RELEVANT"] = "most-relevant";
|
|
1576
|
-
ProductSorts["BEST_SELLER"] = "best-sellers";
|
|
1577
|
-
ProductSorts["BIGGEST_PRICE"] = "biggest-price";
|
|
1578
|
-
ProductSorts["LOWEST_PRICE"] = "lowest-price";
|
|
1579
|
-
ProductSorts["BIGGEST_DISCOUNT"] = "biggest-discount";
|
|
1580
|
-
ProductSorts["BEST_RATING"] = "best-rating";
|
|
1581
|
-
ProductSorts["NEWS"] = "news";
|
|
1582
|
-
})(ProductSorts || (ProductSorts = {}));
|
|
1583
|
-
|
|
1584
|
-
class CategoryWithTree extends Category {
|
|
1585
|
-
}
|
|
1586
|
-
__decorate([
|
|
1587
|
-
Type(() => CategoryWithTree),
|
|
1588
|
-
__metadata("design:type", Array)
|
|
1589
|
-
], CategoryWithTree.prototype, "children", void 0);
|
|
1590
|
-
|
|
1591
|
-
class UtilService {
|
|
1592
|
-
constructor() { }
|
|
1593
|
-
createSlug(name) {
|
|
1594
|
-
return name
|
|
1595
|
-
.toLowerCase()
|
|
1596
|
-
.replace(/\s+/g, '-') // Replace spaces with -
|
|
1597
|
-
.replace(/[ãàáäâ]/g, 'a') // Replace spaces with -
|
|
1598
|
-
.replace(/[ẽèéëê]/g, 'e') // Replace spaces with -
|
|
1599
|
-
.replace(/[ìíïî]/g, 'i') // Replace spaces with -
|
|
1600
|
-
.replace(/[õòóöô]/g, 'o') // Replace spaces with -
|
|
1601
|
-
.replace(/[ùúüû]/g, 'u') // Replace spaces with -
|
|
1602
|
-
.replace(/[ñ]/g, 'n') // Replace spaces with -
|
|
1603
|
-
.replace(/[ç]/g, 'c') // Replace spaces with -
|
|
1604
|
-
.replace(/[&]/g, 'and') // Replace spaces with -
|
|
1605
|
-
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
|
|
1606
|
-
.replace(/\-\-+/g, '-'); // Replace multiple - with single -
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
UtilService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: UtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1610
|
-
UtilService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: UtilService, providedIn: 'root' });
|
|
1611
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: UtilService, decorators: [{
|
|
1612
|
-
type: Injectable,
|
|
1613
|
-
args: [{
|
|
1614
|
-
providedIn: 'root',
|
|
1615
|
-
}]
|
|
1616
|
-
}], ctorParameters: function () { return []; } });
|
|
1617
|
-
|
|
1618
|
-
class NewCategoryStructureAdapter {
|
|
1619
|
-
constructor(categoryRepository, categoryCollectionChildrenRepository) {
|
|
1620
|
-
this.categoryRepository = categoryRepository;
|
|
1621
|
-
this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
|
|
1622
|
-
}
|
|
1623
|
-
async buildProductFilterByCategory(category) {
|
|
1624
|
-
const categoriesIds = (await this.isCollection(category))
|
|
1625
|
-
? await this.getAllCategoriesIdFromCollection(category)
|
|
1626
|
-
: [...(await this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
|
|
1627
|
-
return { category: { id: { operator: Where.IN, value: categoriesIds } } };
|
|
1628
|
-
}
|
|
1629
|
-
async getAllCategoriesIdFromCategory(category) {
|
|
1630
|
-
return this.categoryRepository
|
|
1631
|
-
.getChildren(+category.id)
|
|
1632
|
-
.then((categories) => categories.map((category) => category.id.toString()));
|
|
1633
|
-
}
|
|
1634
|
-
async getAllCategoriesIdFromCollection(category) {
|
|
1635
|
-
return this.categoryCollectionChildrenRepository
|
|
1636
|
-
.find({ filters: { collectionId: +category.id } })
|
|
1637
|
-
.then(({ data }) => data.map((categoryCollection) => categoryCollection.categoryId.toString()));
|
|
1638
|
-
}
|
|
1639
|
-
async isCollection(category) {
|
|
1640
|
-
return !isNil(category.isCollection)
|
|
1641
|
-
? category.isCollection
|
|
1642
|
-
: this.categoryRepository.get({ id: category.id }).then((category) => category.isCollection);
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1646
|
-
NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
|
|
1647
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
|
|
1648
|
-
type: Injectable
|
|
1649
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1650
|
-
type: Inject,
|
|
1651
|
-
args: ['CategoryRepository']
|
|
1652
|
-
}] }, { type: undefined, decorators: [{
|
|
1653
|
-
type: Inject,
|
|
1654
|
-
args: ['CategoryCollectionChildrenRepository']
|
|
1655
|
-
}] }]; } });
|
|
1656
|
-
|
|
1657
|
-
class OldCategoryStructureAdapter {
|
|
1658
|
-
constructor(categoryRepository) {
|
|
1659
|
-
this.categoryRepository = categoryRepository;
|
|
1660
|
-
}
|
|
1661
|
-
async buildProductFilterByCategory(category) {
|
|
1662
|
-
const productsIds = category.products?.length
|
|
1663
|
-
? category.products
|
|
1664
|
-
: await this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
|
|
1665
|
-
return { id: { operator: Where.IN, value: productsIds } };
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1669
|
-
OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter });
|
|
1670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
|
|
1671
|
-
type: Injectable
|
|
1672
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1673
|
-
type: Inject,
|
|
1674
|
-
args: ['CategoryRepository']
|
|
1675
481
|
}] }]; } });
|
|
1676
482
|
|
|
1677
|
-
class WishlistService {
|
|
1678
|
-
constructor(wishlistRepository, productRepository, categoryFilterRepository, categoryCollectionChildrenRepository, categoryStructureAdapter = new NewCategoryStructureAdapter(wishlistRepository, categoryCollectionChildrenRepository), shop, catalogService = new CatalogService(productRepository, categoryStructureAdapter, shop), categoryService = new CategoryService(productRepository, wishlistRepository, categoryFilterRepository, categoryStructureAdapter, shop), utilService) {
|
|
1679
|
-
this.wishlistRepository = wishlistRepository;
|
|
1680
|
-
this.shop = shop;
|
|
1681
|
-
this.catalogService = catalogService;
|
|
1682
|
-
this.categoryService = categoryService;
|
|
1683
|
-
this.utilService = utilService;
|
|
1684
|
-
}
|
|
1685
|
-
getCatalogService() {
|
|
1686
|
-
return this.catalogService;
|
|
1687
|
-
}
|
|
1688
|
-
getCategoryService() {
|
|
1689
|
-
return this.categoryService;
|
|
1690
|
-
}
|
|
1691
|
-
async create(personId, title, description, userFullName) {
|
|
1692
|
-
const data = {
|
|
1693
|
-
slug: this.utilService.createSlug(`favoritos ${userFullName} ${title}`),
|
|
1694
|
-
name: title,
|
|
1695
|
-
description,
|
|
1696
|
-
metadata: {
|
|
1697
|
-
title: `${userFullName} - ${title}`,
|
|
1698
|
-
description: `${userFullName} - ${description}`,
|
|
1699
|
-
},
|
|
1700
|
-
shop: this.shop,
|
|
1701
|
-
shops: [this.shop],
|
|
1702
|
-
personId,
|
|
1703
|
-
brandCategory: false,
|
|
1704
|
-
published: true,
|
|
1705
|
-
};
|
|
1706
|
-
const newWishlist = await this.wishlistRepository.create(data);
|
|
1707
|
-
return this.wishlistRepository.update({ id: newWishlist.id, slug: `${newWishlist.id}-${newWishlist.slug}` });
|
|
1708
|
-
}
|
|
1709
|
-
update(id, title, description, userFullName) {
|
|
1710
|
-
const data = {
|
|
1711
|
-
id,
|
|
1712
|
-
slug: this.utilService.createSlug(`${id}-favoritos ${userFullName} ${title}`),
|
|
1713
|
-
name: title,
|
|
1714
|
-
description,
|
|
1715
|
-
metadata: {
|
|
1716
|
-
title: `${userFullName} - ${title}`,
|
|
1717
|
-
description: `${userFullName} - ${description}`,
|
|
1718
|
-
},
|
|
1719
|
-
};
|
|
1720
|
-
return this.wishlistRepository.update(data);
|
|
1721
|
-
}
|
|
1722
|
-
delete(wishlistId) {
|
|
1723
|
-
return this.wishlistRepository.delete({ id: wishlistId });
|
|
1724
|
-
}
|
|
1725
|
-
getWishlistBySlug(slug) {
|
|
1726
|
-
return this.wishlistRepository.getWishlistBySlug(slug);
|
|
1727
|
-
}
|
|
1728
|
-
getWishlistsByPerson(personId) {
|
|
1729
|
-
return this.wishlistRepository.getWishlistByPerson(personId);
|
|
1730
|
-
}
|
|
1731
|
-
async addProduct(wishlistId, productId) {
|
|
1732
|
-
const wishlist = await this.wishlistRepository.get({ id: wishlistId });
|
|
1733
|
-
const hasProduct = wishlist.products.some((p) => p == productId);
|
|
1734
|
-
if (!hasProduct) {
|
|
1735
|
-
wishlist.products = [...wishlist.products, productId];
|
|
1736
|
-
return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
|
|
1737
|
-
}
|
|
1738
|
-
return wishlist;
|
|
1739
|
-
}
|
|
1740
|
-
async removeProduct(wishlistId, productId) {
|
|
1741
|
-
const wishlist = await this.wishlistRepository.get({ id: wishlistId });
|
|
1742
|
-
const productIndex = wishlist.products.findIndex((p) => p == productId);
|
|
1743
|
-
if (productIndex != -1) {
|
|
1744
|
-
wishlist.products.splice(productIndex, 1);
|
|
1745
|
-
if (!wishlist.products.length)
|
|
1746
|
-
return this.wishlistRepository.update({ id: wishlistId, products: { action: 'remove' } });
|
|
1747
|
-
return this.wishlistRepository.update({ id: wishlistId, products: wishlist.products });
|
|
1748
|
-
}
|
|
1749
|
-
return wishlist;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
|
|
1753
|
-
WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
|
|
1754
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
|
|
1755
|
-
type: Injectable
|
|
1756
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
1757
|
-
type: Inject,
|
|
1758
|
-
args: ['WishlistRepository']
|
|
1759
|
-
}] }, { type: undefined, decorators: [{
|
|
1760
|
-
type: Inject,
|
|
1761
|
-
args: ['ProductRepository']
|
|
1762
|
-
}] }, { type: undefined, decorators: [{
|
|
1763
|
-
type: Inject,
|
|
1764
|
-
args: ['CategoryFilterRepository']
|
|
1765
|
-
}] }, { type: undefined }, { type: undefined }, { type: i1$3.Shops, decorators: [{
|
|
1766
|
-
type: Inject,
|
|
1767
|
-
args: [DEFAULT_SHOP]
|
|
1768
|
-
}] }, { type: undefined }, { type: undefined }, { type: UtilService }]; } });
|
|
1769
|
-
|
|
1770
483
|
class CheckoutSubscriptionService {
|
|
1771
484
|
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
1772
485
|
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
@@ -1792,9 +505,7 @@ class CheckoutSubscriptionService {
|
|
|
1792
505
|
return of();
|
|
1793
506
|
}
|
|
1794
507
|
checkCoupon(nickname, userEmail) {
|
|
1795
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
1796
|
-
.checkCoupon(nickname, CheckoutTypes.SUBSCRIPTION, checkout, checkout.subscriptionPlan.name)
|
|
1797
|
-
.pipe()));
|
|
508
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe()));
|
|
1798
509
|
}
|
|
1799
510
|
calcDiscountSubscription(coupon) {
|
|
1800
511
|
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
@@ -1812,6 +523,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1812
523
|
args: ['SubscriptionRepository']
|
|
1813
524
|
}] }, { type: CouponService }]; } });
|
|
1814
525
|
|
|
526
|
+
class OrderService {
|
|
527
|
+
constructor(angularFirestore, orderRepository) {
|
|
528
|
+
this.angularFirestore = angularFirestore;
|
|
529
|
+
this.orderRepository = orderRepository;
|
|
530
|
+
this.orderSubject = new Subject();
|
|
531
|
+
}
|
|
532
|
+
getOrder(id) {
|
|
533
|
+
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
534
|
+
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
535
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
536
|
+
return this.orderSubject;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
540
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
542
|
+
type: Injectable
|
|
543
|
+
}], ctorParameters: function () { return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
544
|
+
type: Inject,
|
|
545
|
+
args: ['OrderRepository']
|
|
546
|
+
}] }]; } });
|
|
547
|
+
|
|
1815
548
|
class HomeShopService {
|
|
1816
549
|
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
1817
550
|
this.categoryRepository = categoryRepository;
|
|
@@ -1914,136 +647,663 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1914
647
|
}] }, { type: undefined, decorators: [{
|
|
1915
648
|
type: Inject,
|
|
1916
649
|
args: ['ProductRepository']
|
|
1917
|
-
}] }, { type:
|
|
650
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1918
651
|
type: Inject,
|
|
1919
652
|
args: [DEFAULT_SHOP]
|
|
1920
653
|
}] }]; } });
|
|
1921
654
|
|
|
1922
|
-
class
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
655
|
+
class AngularFirebaseAuthModule {
|
|
656
|
+
static initializeApp(options, nameOrConfig) {
|
|
657
|
+
return {
|
|
658
|
+
ngModule: AngularFirebaseAuthModule,
|
|
659
|
+
providers: [
|
|
660
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
661
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
662
|
+
],
|
|
663
|
+
};
|
|
1927
664
|
}
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
665
|
+
}
|
|
666
|
+
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
667
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
|
|
668
|
+
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
669
|
+
{
|
|
670
|
+
provide: 'Authentication',
|
|
671
|
+
useFactory: (authenticationService, userRepository) => {
|
|
672
|
+
return new Authentication(authenticationService, userRepository);
|
|
673
|
+
},
|
|
674
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
provide: 'AuthenticationService',
|
|
678
|
+
useFactory: (angularFireAuth) => {
|
|
679
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
680
|
+
},
|
|
681
|
+
deps: [Auth],
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
provide: 'Register',
|
|
685
|
+
useFactory: (registerService, userRepository) => {
|
|
686
|
+
return new Register(registerService, userRepository);
|
|
687
|
+
},
|
|
688
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
provide: 'RegisterService',
|
|
692
|
+
useFactory: (angularFireAuth) => {
|
|
693
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
694
|
+
},
|
|
695
|
+
deps: [Auth],
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
provide: 'SignOut',
|
|
699
|
+
useFactory: (authenticationService) => {
|
|
700
|
+
return new SignOut(authenticationService);
|
|
701
|
+
},
|
|
702
|
+
deps: ['AuthenticationService'],
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
provide: 'RecoveryPassword',
|
|
706
|
+
useFactory: (authenticationService) => {
|
|
707
|
+
return new RecoveryPassword(authenticationService);
|
|
708
|
+
},
|
|
709
|
+
deps: ['AuthenticationService'],
|
|
710
|
+
},
|
|
711
|
+
], imports: [provideFirebaseApp((injector) => {
|
|
712
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
713
|
+
return appName
|
|
714
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
715
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
716
|
+
}),
|
|
717
|
+
provideAuth(() => getAuth())] });
|
|
718
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
719
|
+
type: NgModule,
|
|
720
|
+
args: [{
|
|
721
|
+
imports: [
|
|
722
|
+
provideFirebaseApp((injector) => {
|
|
723
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
724
|
+
return appName
|
|
725
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
726
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
727
|
+
}),
|
|
728
|
+
provideAuth(() => getAuth()),
|
|
729
|
+
],
|
|
730
|
+
providers: [
|
|
731
|
+
{
|
|
732
|
+
provide: 'Authentication',
|
|
733
|
+
useFactory: (authenticationService, userRepository) => {
|
|
734
|
+
return new Authentication(authenticationService, userRepository);
|
|
735
|
+
},
|
|
736
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
provide: 'AuthenticationService',
|
|
740
|
+
useFactory: (angularFireAuth) => {
|
|
741
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
742
|
+
},
|
|
743
|
+
deps: [Auth],
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
provide: 'Register',
|
|
747
|
+
useFactory: (registerService, userRepository) => {
|
|
748
|
+
return new Register(registerService, userRepository);
|
|
749
|
+
},
|
|
750
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
provide: 'RegisterService',
|
|
754
|
+
useFactory: (angularFireAuth) => {
|
|
755
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
756
|
+
},
|
|
757
|
+
deps: [Auth],
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
provide: 'SignOut',
|
|
761
|
+
useFactory: (authenticationService) => {
|
|
762
|
+
return new SignOut(authenticationService);
|
|
763
|
+
},
|
|
764
|
+
deps: ['AuthenticationService'],
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
provide: 'RecoveryPassword',
|
|
768
|
+
useFactory: (authenticationService) => {
|
|
769
|
+
return new RecoveryPassword(authenticationService);
|
|
770
|
+
},
|
|
771
|
+
deps: ['AuthenticationService'],
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
}]
|
|
775
|
+
}] });
|
|
776
|
+
|
|
777
|
+
class AngularElasticSeachModule {
|
|
778
|
+
static initializeApp(options) {
|
|
779
|
+
return {
|
|
780
|
+
ngModule: AngularElasticSeachModule,
|
|
781
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
782
|
+
};
|
|
1933
783
|
}
|
|
1934
784
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
i0.ɵɵ
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
785
|
+
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
786
|
+
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
|
|
787
|
+
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
788
|
+
{
|
|
789
|
+
provide: ProductsIndex,
|
|
790
|
+
useFactory: (configuration) => {
|
|
791
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
792
|
+
},
|
|
793
|
+
deps: [ES_CONFIG],
|
|
794
|
+
},
|
|
795
|
+
] });
|
|
796
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
797
|
+
type: NgModule,
|
|
798
|
+
args: [{
|
|
799
|
+
providers: [
|
|
800
|
+
{
|
|
801
|
+
provide: ProductsIndex,
|
|
802
|
+
useFactory: (configuration) => {
|
|
803
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
804
|
+
},
|
|
805
|
+
deps: [ES_CONFIG],
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
}]
|
|
809
|
+
}] });
|
|
810
|
+
|
|
811
|
+
class AngularFirestoreModule {
|
|
812
|
+
static initializeApp(options, nameOrConfig) {
|
|
813
|
+
return {
|
|
814
|
+
ngModule: AngularFirestoreModule,
|
|
815
|
+
providers: [
|
|
816
|
+
{ provide: FIREBASE_OPTIONS, useValue: options.firebase },
|
|
817
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
818
|
+
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
819
|
+
],
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
824
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
|
|
825
|
+
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
826
|
+
{
|
|
827
|
+
provide: 'BeautyProfileRepository',
|
|
828
|
+
useFactory: (firestore, userRepository) => {
|
|
829
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
830
|
+
},
|
|
831
|
+
deps: [Firestore, 'UserRepository'],
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
provide: 'Buy2WinRepository',
|
|
835
|
+
useFactory: (firestore) => {
|
|
836
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
837
|
+
},
|
|
838
|
+
deps: [Firestore],
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
provide: CategoryFirestoreRepository,
|
|
842
|
+
useFactory: (firestore) => {
|
|
843
|
+
return new CategoryFirestoreRepository(firestore);
|
|
844
|
+
},
|
|
845
|
+
deps: [Firestore],
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
provide: 'CheckoutRepository',
|
|
849
|
+
useFactory: (firestore) => {
|
|
850
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
851
|
+
},
|
|
852
|
+
deps: [Firestore],
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
856
|
+
useFactory: (firestore) => {
|
|
857
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
858
|
+
},
|
|
859
|
+
deps: [Firestore],
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
provide: 'CouponRepository',
|
|
863
|
+
useFactory: (firestore) => {
|
|
864
|
+
return new CouponFirestoreRepository(firestore);
|
|
865
|
+
},
|
|
866
|
+
deps: [Firestore],
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
provide: 'EditionRepository',
|
|
870
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
871
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
872
|
+
},
|
|
873
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
provide: 'HomeRepository',
|
|
877
|
+
useFactory: (firestore) => {
|
|
878
|
+
return new HomeFirestoreRepository(firestore);
|
|
879
|
+
},
|
|
880
|
+
deps: [Firestore],
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
provide: 'LeadRepository',
|
|
884
|
+
useFactory: (firestore) => {
|
|
885
|
+
return new LeadFirestoreRepository(firestore);
|
|
886
|
+
},
|
|
887
|
+
deps: [Firestore],
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
provide: 'LegacyOrderRepository',
|
|
891
|
+
useFactory: (firestore) => {
|
|
892
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
893
|
+
},
|
|
894
|
+
deps: [Firestore],
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
provide: 'ShopMenuRepository',
|
|
898
|
+
useFactory: (firestore) => {
|
|
899
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
900
|
+
},
|
|
901
|
+
deps: [Firestore],
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
provide: 'OrderRepository',
|
|
905
|
+
useFactory: (firestore) => {
|
|
906
|
+
return new OrderFirestoreRepository(firestore);
|
|
907
|
+
},
|
|
908
|
+
deps: [Firestore],
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
provide: 'PaymentRepository',
|
|
912
|
+
useFactory: (firestore) => {
|
|
913
|
+
return new PaymentFirestoreRepository(firestore);
|
|
914
|
+
},
|
|
915
|
+
deps: [Firestore],
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
provide: ProductFirestoreRepository,
|
|
919
|
+
useFactory: (firestore) => {
|
|
920
|
+
return new ProductFirestoreRepository(firestore);
|
|
921
|
+
},
|
|
922
|
+
deps: [Firestore],
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
provide: 'SubscriptionPaymentRepository',
|
|
926
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
927
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
928
|
+
},
|
|
929
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
provide: 'SubscriptionPlanRepository',
|
|
933
|
+
useFactory: (firestore) => {
|
|
934
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
935
|
+
},
|
|
936
|
+
deps: [Firestore],
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
provide: 'SubscriptionProductRepository',
|
|
940
|
+
useFactory: (firestore) => {
|
|
941
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
942
|
+
},
|
|
943
|
+
deps: [Firestore],
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
provide: 'SubscriptionRepository',
|
|
947
|
+
useFactory: (firestore) => {
|
|
948
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
949
|
+
},
|
|
950
|
+
deps: [Firestore],
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
provide: 'UserRepository',
|
|
954
|
+
useFactory: (firestore) => {
|
|
955
|
+
return new UserFirestoreRepository(firestore);
|
|
956
|
+
},
|
|
957
|
+
deps: [Firestore],
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
provide: 'UserAddressRepository',
|
|
961
|
+
useFactory: (firestore, userRepository) => {
|
|
962
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
963
|
+
},
|
|
964
|
+
deps: [Firestore, 'UserRepository'],
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
provide: 'UserPaymentMethodRepository',
|
|
968
|
+
useFactory: (firestore, userRepository) => {
|
|
969
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
970
|
+
},
|
|
971
|
+
deps: [Firestore, 'UserRepository'],
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
provide: ProductVariantFirestoreRepository,
|
|
975
|
+
useFactory: (firestore, productRepository) => {
|
|
976
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
977
|
+
},
|
|
978
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
979
|
+
},
|
|
980
|
+
], imports: [AngularElasticSeachModule,
|
|
981
|
+
provideFirebaseApp((injector) => {
|
|
982
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
983
|
+
return appName
|
|
984
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
985
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
986
|
+
}),
|
|
987
|
+
provideFirestore(() => getFirestore())] });
|
|
988
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
989
|
+
type: NgModule,
|
|
990
|
+
args: [{
|
|
991
|
+
imports: [
|
|
992
|
+
AngularElasticSeachModule,
|
|
993
|
+
provideFirebaseApp((injector) => {
|
|
994
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
995
|
+
return appName
|
|
996
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
997
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
998
|
+
}),
|
|
999
|
+
provideFirestore(() => getFirestore()),
|
|
1000
|
+
],
|
|
1001
|
+
providers: [
|
|
1002
|
+
{
|
|
1003
|
+
provide: 'BeautyProfileRepository',
|
|
1004
|
+
useFactory: (firestore, userRepository) => {
|
|
1005
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1006
|
+
},
|
|
1007
|
+
deps: [Firestore, 'UserRepository'],
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
provide: 'Buy2WinRepository',
|
|
1011
|
+
useFactory: (firestore) => {
|
|
1012
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1013
|
+
},
|
|
1014
|
+
deps: [Firestore],
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
provide: CategoryFirestoreRepository,
|
|
1018
|
+
useFactory: (firestore) => {
|
|
1019
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1020
|
+
},
|
|
1021
|
+
deps: [Firestore],
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
provide: 'CheckoutRepository',
|
|
1025
|
+
useFactory: (firestore) => {
|
|
1026
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1027
|
+
},
|
|
1028
|
+
deps: [Firestore],
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
1032
|
+
useFactory: (firestore) => {
|
|
1033
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1034
|
+
},
|
|
1035
|
+
deps: [Firestore],
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
provide: 'CouponRepository',
|
|
1039
|
+
useFactory: (firestore) => {
|
|
1040
|
+
return new CouponFirestoreRepository(firestore);
|
|
1041
|
+
},
|
|
1042
|
+
deps: [Firestore],
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
provide: 'EditionRepository',
|
|
1046
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1047
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1048
|
+
},
|
|
1049
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
provide: 'HomeRepository',
|
|
1053
|
+
useFactory: (firestore) => {
|
|
1054
|
+
return new HomeFirestoreRepository(firestore);
|
|
1055
|
+
},
|
|
1056
|
+
deps: [Firestore],
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
provide: 'LeadRepository',
|
|
1060
|
+
useFactory: (firestore) => {
|
|
1061
|
+
return new LeadFirestoreRepository(firestore);
|
|
1062
|
+
},
|
|
1063
|
+
deps: [Firestore],
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
provide: 'LegacyOrderRepository',
|
|
1067
|
+
useFactory: (firestore) => {
|
|
1068
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1069
|
+
},
|
|
1070
|
+
deps: [Firestore],
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
provide: 'ShopMenuRepository',
|
|
1074
|
+
useFactory: (firestore) => {
|
|
1075
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1076
|
+
},
|
|
1077
|
+
deps: [Firestore],
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
provide: 'OrderRepository',
|
|
1081
|
+
useFactory: (firestore) => {
|
|
1082
|
+
return new OrderFirestoreRepository(firestore);
|
|
1083
|
+
},
|
|
1084
|
+
deps: [Firestore],
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
provide: 'PaymentRepository',
|
|
1088
|
+
useFactory: (firestore) => {
|
|
1089
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1090
|
+
},
|
|
1091
|
+
deps: [Firestore],
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
provide: ProductFirestoreRepository,
|
|
1095
|
+
useFactory: (firestore) => {
|
|
1096
|
+
return new ProductFirestoreRepository(firestore);
|
|
1097
|
+
},
|
|
1098
|
+
deps: [Firestore],
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
provide: 'SubscriptionPaymentRepository',
|
|
1102
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1103
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1104
|
+
},
|
|
1105
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
provide: 'SubscriptionPlanRepository',
|
|
1109
|
+
useFactory: (firestore) => {
|
|
1110
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1111
|
+
},
|
|
1112
|
+
deps: [Firestore],
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
provide: 'SubscriptionProductRepository',
|
|
1116
|
+
useFactory: (firestore) => {
|
|
1117
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1118
|
+
},
|
|
1119
|
+
deps: [Firestore],
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
provide: 'SubscriptionRepository',
|
|
1123
|
+
useFactory: (firestore) => {
|
|
1124
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1125
|
+
},
|
|
1126
|
+
deps: [Firestore],
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
provide: 'UserRepository',
|
|
1130
|
+
useFactory: (firestore) => {
|
|
1131
|
+
return new UserFirestoreRepository(firestore);
|
|
1132
|
+
},
|
|
1133
|
+
deps: [Firestore],
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
provide: 'UserAddressRepository',
|
|
1137
|
+
useFactory: (firestore, userRepository) => {
|
|
1138
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1139
|
+
},
|
|
1140
|
+
deps: [Firestore, 'UserRepository'],
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
provide: 'UserPaymentMethodRepository',
|
|
1144
|
+
useFactory: (firestore, userRepository) => {
|
|
1145
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1146
|
+
},
|
|
1147
|
+
deps: [Firestore, 'UserRepository'],
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
provide: ProductVariantFirestoreRepository,
|
|
1151
|
+
useFactory: (firestore, productRepository) => {
|
|
1152
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1153
|
+
},
|
|
1154
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1155
|
+
},
|
|
1156
|
+
],
|
|
1157
|
+
}]
|
|
1158
|
+
}] });
|
|
1943
1159
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
return combineLatest([
|
|
1952
|
-
this.homeService.getHomeData(),
|
|
1953
|
-
this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
|
|
1954
|
-
]).pipe(map(([datas, shippingMethodsResponse]) => {
|
|
1955
|
-
let shippingMethods = shippingMethodsResponse.result;
|
|
1956
|
-
if (!shippingMethods.length)
|
|
1957
|
-
return [];
|
|
1958
|
-
shippingMethods = shippingMethods.map((shippingMethod) => {
|
|
1959
|
-
if (shippingMethod.ShippingCompanyName == 'Same Day EG')
|
|
1960
|
-
shippingMethod.ShippingCompanyName = 'Same Day';
|
|
1961
|
-
return shippingMethod;
|
|
1962
|
-
});
|
|
1963
|
-
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
1964
|
-
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
1965
|
-
shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
|
|
1966
|
-
}
|
|
1967
|
-
if (totalPrice >= 200) {
|
|
1968
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1969
|
-
if (s.serviceName !== 'Same Day')
|
|
1970
|
-
return { ...s, totalPrice: 0 };
|
|
1971
|
-
else
|
|
1972
|
-
return s;
|
|
1973
|
-
});
|
|
1974
|
-
}
|
|
1975
|
-
if (shop == Shops.GLAMSHOP)
|
|
1976
|
-
return shippingMethods;
|
|
1977
|
-
if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
1978
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1979
|
-
if (s.serviceName == 'Same Day')
|
|
1980
|
-
return { ...s, totalPrice: s.totalPrice / 2 };
|
|
1981
|
-
else
|
|
1982
|
-
return { ...s, totalPrice: 0 };
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
1986
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1987
|
-
return { ...s, totalPrice: s.totalPrice / 2 };
|
|
1988
|
-
});
|
|
1989
|
-
}
|
|
1990
|
-
return shippingMethods;
|
|
1991
|
-
}));
|
|
1992
|
-
}
|
|
1993
|
-
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
1994
|
-
if (!subscriptionPlan)
|
|
1995
|
-
return false;
|
|
1996
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
1997
|
-
return true;
|
|
1998
|
-
return false;
|
|
1999
|
-
}
|
|
2000
|
-
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
2001
|
-
if (!subscriptionPlan)
|
|
2002
|
-
return false;
|
|
2003
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
2004
|
-
return true;
|
|
2005
|
-
}
|
|
2006
|
-
return false;
|
|
2007
|
-
}
|
|
2008
|
-
isHolidays(datas) {
|
|
2009
|
-
const today = new Date();
|
|
2010
|
-
for (const key in datas) {
|
|
2011
|
-
let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
|
|
2012
|
-
let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
|
|
2013
|
-
if (start > end)
|
|
2014
|
-
end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
|
|
2015
|
-
if (today >= start && today <= end)
|
|
2016
|
-
return true;
|
|
2017
|
-
}
|
|
2018
|
-
return false;
|
|
1160
|
+
const processes = {};
|
|
1161
|
+
class AngularHasuraGraphQLModule {
|
|
1162
|
+
static initializeApp(options) {
|
|
1163
|
+
return {
|
|
1164
|
+
ngModule: AngularHasuraGraphQLModule,
|
|
1165
|
+
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
1166
|
+
};
|
|
2019
1167
|
}
|
|
2020
1168
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
i0.ɵɵ
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
1169
|
+
AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1170
|
+
AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
|
|
1171
|
+
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
1172
|
+
{
|
|
1173
|
+
provide: 'HasuraConfig',
|
|
1174
|
+
useFactory: (options, platformId) => ({
|
|
1175
|
+
endpoint: options.endpoint,
|
|
1176
|
+
authOptions: options.credentials,
|
|
1177
|
+
interceptors: {
|
|
1178
|
+
request: (request) => {
|
|
1179
|
+
if (isPlatformBrowser(platformId))
|
|
1180
|
+
return request;
|
|
1181
|
+
const index = Date.now();
|
|
1182
|
+
processes[index] = true;
|
|
1183
|
+
request.proccess = index;
|
|
1184
|
+
console.log('request', request.proccess);
|
|
1185
|
+
return request;
|
|
1186
|
+
},
|
|
1187
|
+
response: (response) => {
|
|
1188
|
+
if (isPlatformBrowser(platformId))
|
|
1189
|
+
return response;
|
|
1190
|
+
console.log('response', response.proccess);
|
|
1191
|
+
delete processes[response.proccess];
|
|
1192
|
+
},
|
|
1193
|
+
},
|
|
1194
|
+
}),
|
|
1195
|
+
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
provide: 'CategoryRepository',
|
|
1199
|
+
useExisting: CategoryHasuraGraphQLRepository,
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
provide: CategoryHasuraGraphQLRepository,
|
|
1203
|
+
useFactory: (hasuraConfig, productRepository) => {
|
|
1204
|
+
return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
|
|
1205
|
+
},
|
|
1206
|
+
deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
provide: 'ProductRepository',
|
|
1210
|
+
useExisting: ProductHasuraGraphQLRepository,
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
provide: ProductHasuraGraphQLRepository,
|
|
1214
|
+
useFactory: (hasuraConfig) => {
|
|
1215
|
+
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
1216
|
+
},
|
|
1217
|
+
deps: ['HasuraConfig'],
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
provide: 'VariantRepository',
|
|
1221
|
+
useExisting: VariantHasuraGraphQLRepository,
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
provide: VariantHasuraGraphQLRepository,
|
|
1225
|
+
useFactory: (hasuraConfig) => {
|
|
1226
|
+
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1227
|
+
},
|
|
1228
|
+
deps: ['HasuraConfig'],
|
|
1229
|
+
},
|
|
1230
|
+
] });
|
|
1231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
1232
|
+
type: NgModule,
|
|
1233
|
+
args: [{
|
|
1234
|
+
providers: [
|
|
1235
|
+
{
|
|
1236
|
+
provide: 'HasuraConfig',
|
|
1237
|
+
useFactory: (options, platformId) => ({
|
|
1238
|
+
endpoint: options.endpoint,
|
|
1239
|
+
authOptions: options.credentials,
|
|
1240
|
+
interceptors: {
|
|
1241
|
+
request: (request) => {
|
|
1242
|
+
if (isPlatformBrowser(platformId))
|
|
1243
|
+
return request;
|
|
1244
|
+
const index = Date.now();
|
|
1245
|
+
processes[index] = true;
|
|
1246
|
+
request.proccess = index;
|
|
1247
|
+
console.log('request', request.proccess);
|
|
1248
|
+
return request;
|
|
1249
|
+
},
|
|
1250
|
+
response: (response) => {
|
|
1251
|
+
if (isPlatformBrowser(platformId))
|
|
1252
|
+
return response;
|
|
1253
|
+
console.log('response', response.proccess);
|
|
1254
|
+
delete processes[response.proccess];
|
|
1255
|
+
},
|
|
1256
|
+
},
|
|
1257
|
+
}),
|
|
1258
|
+
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
provide: 'CategoryRepository',
|
|
1262
|
+
useExisting: CategoryHasuraGraphQLRepository,
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
provide: CategoryHasuraGraphQLRepository,
|
|
1266
|
+
useFactory: (hasuraConfig, productRepository) => {
|
|
1267
|
+
return new CategoryHasuraGraphQLRepository(hasuraConfig, productRepository);
|
|
1268
|
+
},
|
|
1269
|
+
deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
provide: 'ProductRepository',
|
|
1273
|
+
useExisting: ProductHasuraGraphQLRepository,
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
provide: ProductHasuraGraphQLRepository,
|
|
1277
|
+
useFactory: (hasuraConfig) => {
|
|
1278
|
+
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
1279
|
+
},
|
|
1280
|
+
deps: ['HasuraConfig'],
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
provide: 'VariantRepository',
|
|
1284
|
+
useExisting: VariantHasuraGraphQLRepository,
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
provide: VariantHasuraGraphQLRepository,
|
|
1288
|
+
useFactory: (hasuraConfig) => {
|
|
1289
|
+
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1290
|
+
},
|
|
1291
|
+
deps: ['HasuraConfig'],
|
|
1292
|
+
},
|
|
1293
|
+
],
|
|
1294
|
+
}]
|
|
1295
|
+
}] });
|
|
2029
1296
|
|
|
2030
1297
|
class AngularConnectModule {
|
|
2031
1298
|
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
2032
1299
|
return {
|
|
2033
1300
|
ngModule: AngularConnectModule,
|
|
2034
1301
|
providers: [
|
|
2035
|
-
{
|
|
2036
|
-
provide: CATEGORY_STRUCTURE,
|
|
2037
|
-
useClass: isNil(options?.oldCategoryStructure) || options?.oldCategoryStructure
|
|
2038
|
-
? OldCategoryStructureAdapter
|
|
2039
|
-
: NewCategoryStructureAdapter,
|
|
2040
|
-
},
|
|
2041
1302
|
...(isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]),
|
|
2042
1303
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options?.firebase }]),
|
|
2043
1304
|
...(isNil(options?.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
2044
1305
|
...(isNil(options?.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
2045
1306
|
...(isNil(options?.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
2046
|
-
...(isNil(options?.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
2047
1307
|
],
|
|
2048
1308
|
};
|
|
2049
1309
|
}
|
|
@@ -2053,15 +1313,11 @@ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", ve
|
|
|
2053
1313
|
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, providers: [
|
|
2054
1314
|
AuthService,
|
|
2055
1315
|
CartService,
|
|
2056
|
-
CatalogService,
|
|
2057
|
-
CategoryService,
|
|
2058
1316
|
CheckoutService,
|
|
2059
1317
|
CheckoutSubscriptionService,
|
|
2060
1318
|
CouponService,
|
|
2061
1319
|
HomeShopService,
|
|
2062
1320
|
OrderService,
|
|
2063
|
-
ShippingService,
|
|
2064
|
-
WishlistService,
|
|
2065
1321
|
], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
2066
1322
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
2067
1323
|
type: NgModule,
|
|
@@ -2070,15 +1326,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2070
1326
|
providers: [
|
|
2071
1327
|
AuthService,
|
|
2072
1328
|
CartService,
|
|
2073
|
-
CatalogService,
|
|
2074
|
-
CategoryService,
|
|
2075
1329
|
CheckoutService,
|
|
2076
1330
|
CheckoutSubscriptionService,
|
|
2077
1331
|
CouponService,
|
|
2078
1332
|
HomeShopService,
|
|
2079
1333
|
OrderService,
|
|
2080
|
-
ShippingService,
|
|
2081
|
-
WishlistService,
|
|
2082
1334
|
],
|
|
2083
1335
|
}]
|
|
2084
1336
|
}] });
|
|
@@ -2087,5 +1339,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2087
1339
|
* Generated bundle index. Do not edit.
|
|
2088
1340
|
*/
|
|
2089
1341
|
|
|
2090
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService,
|
|
1342
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
2091
1343
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|