@infrab4a/connect-angular 4.0.0-beta.29 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular-connect.module.d.ts +0 -1
- package/angular-firestore.module.d.ts +1 -2
- package/consts/index.d.ts +0 -1
- package/esm2020/angular-connect.module.mjs +3 -10
- package/esm2020/angular-elastic-search.module.mjs +7 -3
- package/esm2020/angular-firestore.module.mjs +137 -226
- package/esm2020/angular-hasura-graphql.module.mjs +24 -105
- package/esm2020/consts/index.mjs +1 -2
- 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 +2 -2
- package/esm2020/services/coupon.service.mjs +37 -21
- package/esm2020/services/index.mjs +3 -5
- package/fesm2015/infrab4a-connect-angular.mjs +935 -1362
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +921 -1360
- 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 +3 -2
- package/services/index.d.ts +2 -4
- package/consts/backend-url.const.d.ts +0 -1
- package/esm2020/consts/backend-url.const.mjs +0 -2
- package/esm2020/services/catalog/catalog.service.mjs +0 -26
- package/esm2020/services/catalog/category.service.mjs +0 -9
- package/esm2020/services/catalog/enums/index.mjs +0 -2
- package/esm2020/services/catalog/enums/product-sorts.enum.mjs +0 -10
- package/esm2020/services/catalog/index.mjs +0 -6
- 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/shipping.service.mjs +0 -96
- package/esm2020/services/types/shipping-methods.type.mjs +0 -2
- package/services/catalog/catalog.service.d.ts +0 -16
- package/services/catalog/category.service.d.ts +0 -6
- package/services/catalog/enums/index.d.ts +0 -1
- package/services/catalog/enums/product-sorts.enum.d.ts +0 -8
- package/services/catalog/index.d.ts +0 -5
- 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/shipping.service.d.ts +0 -19
- package/services/types/shipping-methods.type.d.ts +0 -12
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { provideFirebaseApp, initializeApp } 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, docSnapshots, doc } from '@angular/fire/firestore';
|
|
12
|
-
import { initializeApp as initializeApp$1 } from 'firebase/app';
|
|
13
|
-
import { getFirestore } from 'firebase/firestore';
|
|
14
|
-
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';
|
|
15
6
|
import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
|
|
16
|
-
import { __awaiter
|
|
7
|
+
import { __awaiter } from 'tslib';
|
|
8
|
+
import * as i2 from '@infrab4a/connect';
|
|
9
|
+
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';
|
|
17
10
|
import cookie from 'js-cookie';
|
|
18
11
|
import { CustomError } from 'ts-custom-error';
|
|
19
|
-
import
|
|
20
|
-
import
|
|
12
|
+
import * as i1$1 from '@angular/fire/firestore';
|
|
13
|
+
import { docSnapshots, doc, Firestore, provideFirestore, getFirestore } from '@angular/fire/firestore';
|
|
14
|
+
import * as i1$2 from '@angular/fire/app';
|
|
15
|
+
import { provideFirebaseApp, initializeApp } from '@angular/fire/app';
|
|
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 === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
getUser() {
|
|
30
|
+
return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : 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 () {
|
|
44
|
+
return [{ type: i1.Auth }, { type: undefined, decorators: [{
|
|
45
|
+
type: Inject,
|
|
46
|
+
args: ['UserRepository']
|
|
47
|
+
}] }];
|
|
48
|
+
} });
|
|
23
49
|
|
|
24
50
|
const DEFAULT_SHOP = 'DEFAULT_SHOP';
|
|
25
51
|
|
|
@@ -30,850 +56,33 @@ const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
|
|
|
30
56
|
|
|
31
57
|
const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
32
58
|
|
|
33
|
-
class
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
ngModule: AngularFirebaseAuthModule,
|
|
37
|
-
providers: [
|
|
38
|
-
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
39
|
-
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
40
|
-
],
|
|
41
|
-
};
|
|
59
|
+
class InvalidCouponError extends CustomError {
|
|
60
|
+
constructor(message) {
|
|
61
|
+
super(message);
|
|
42
62
|
}
|
|
43
63
|
}
|
|
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
64
|
|
|
155
|
-
class
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
160
|
-
};
|
|
65
|
+
class GroupInvalidCouponError extends CustomError {
|
|
66
|
+
constructor(errors) {
|
|
67
|
+
super('Many coupon errors throw');
|
|
68
|
+
this.errors = errors;
|
|
161
69
|
}
|
|
162
70
|
}
|
|
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
71
|
|
|
185
|
-
class
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
],
|
|
194
|
-
};
|
|
72
|
+
class CouponService {
|
|
73
|
+
constructor(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
|
|
74
|
+
this.couponRepository = couponRepository;
|
|
75
|
+
this.defaultShop = defaultShop;
|
|
76
|
+
this.orderRepository = orderRepository;
|
|
77
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
78
|
+
this.categoryRepository = categoryRepository;
|
|
79
|
+
this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
|
|
195
80
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
provide: 'FirestoreOptions',
|
|
202
|
-
useFactory: (firestore, platformId) => ({
|
|
203
|
-
firestore,
|
|
204
|
-
interceptors: {
|
|
205
|
-
request: (request) => {
|
|
206
|
-
if (isPlatformBrowser(platformId))
|
|
207
|
-
return request;
|
|
208
|
-
const interval = setInterval(() => { }, 100);
|
|
209
|
-
request.interval = interval;
|
|
210
|
-
return request;
|
|
211
|
-
},
|
|
212
|
-
response: (response, request) => {
|
|
213
|
-
if (isPlatformBrowser(platformId))
|
|
214
|
-
return response;
|
|
215
|
-
clearInterval(request.interval);
|
|
216
|
-
return response;
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
}),
|
|
220
|
-
deps: [Firestore, PLATFORM_ID],
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
provide: 'BeautyProfileRepository',
|
|
224
|
-
useFactory: (config, userRepository) => {
|
|
225
|
-
return new UserBeautyProfileFirestoreRepository(config, userRepository);
|
|
226
|
-
},
|
|
227
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
provide: 'Buy2WinRepository',
|
|
231
|
-
useFactory: (options) => {
|
|
232
|
-
return new Buy2WinFirestoreRepository(options);
|
|
233
|
-
},
|
|
234
|
-
deps: ['FirestoreOptions'],
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
provide: CategoryFirestoreRepository,
|
|
238
|
-
useFactory: (options) => {
|
|
239
|
-
return new CategoryFirestoreRepository(options);
|
|
240
|
-
},
|
|
241
|
-
deps: ['FirestoreOptions'],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
provide: 'CheckoutRepository',
|
|
245
|
-
useFactory: (options) => {
|
|
246
|
-
return new CheckoutFirestoreRepository(options);
|
|
247
|
-
},
|
|
248
|
-
deps: ['FirestoreOptions'],
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
252
|
-
useFactory: (options) => {
|
|
253
|
-
return new CheckoutSubscriptionFirestoreRepository(options);
|
|
254
|
-
},
|
|
255
|
-
deps: ['FirestoreOptions'],
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
provide: 'CouponRepository',
|
|
259
|
-
useFactory: (options) => {
|
|
260
|
-
return new CouponFirestoreRepository(options);
|
|
261
|
-
},
|
|
262
|
-
deps: ['FirestoreOptions'],
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
provide: 'CampaignHashtagRepository',
|
|
266
|
-
useFactory: (options) => {
|
|
267
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
268
|
-
},
|
|
269
|
-
deps: ['FirestoreOptions'],
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
provide: 'CampaignDashboardRepository',
|
|
273
|
-
useFactory: (options) => {
|
|
274
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
275
|
-
},
|
|
276
|
-
deps: ['FirestoreOptions'],
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
provide: 'EditionRepository',
|
|
280
|
-
useFactory: (options, subscriptionRepository) => {
|
|
281
|
-
return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
282
|
-
},
|
|
283
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
provide: 'HomeRepository',
|
|
287
|
-
useFactory: (options) => {
|
|
288
|
-
return new HomeFirestoreRepository(options);
|
|
289
|
-
},
|
|
290
|
-
deps: ['FirestoreOptions'],
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
provide: 'LeadRepository',
|
|
294
|
-
useFactory: (options) => {
|
|
295
|
-
return new LeadFirestoreRepository(options);
|
|
296
|
-
},
|
|
297
|
-
deps: ['FirestoreOptions'],
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
provide: 'LegacyOrderRepository',
|
|
301
|
-
useFactory: (options) => {
|
|
302
|
-
return new LegacyOrderFirestoreRepository(options);
|
|
303
|
-
},
|
|
304
|
-
deps: ['FirestoreOptions'],
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
provide: 'ShopMenuRepository',
|
|
308
|
-
useFactory: (options) => {
|
|
309
|
-
return new ShopMenuFirestoreRepository(options);
|
|
310
|
-
},
|
|
311
|
-
deps: ['FirestoreOptions'],
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
provide: 'OrderRepository',
|
|
315
|
-
useFactory: (options) => {
|
|
316
|
-
return new OrderFirestoreRepository(options);
|
|
317
|
-
},
|
|
318
|
-
deps: ['FirestoreOptions'],
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
provide: 'PaymentRepository',
|
|
322
|
-
useFactory: (options) => {
|
|
323
|
-
return new PaymentFirestoreRepository(options);
|
|
324
|
-
},
|
|
325
|
-
deps: ['FirestoreOptions'],
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
provide: ProductFirestoreRepository,
|
|
329
|
-
useFactory: (options) => {
|
|
330
|
-
return new ProductFirestoreRepository(options);
|
|
331
|
-
},
|
|
332
|
-
deps: ['FirestoreOptions'],
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
provide: 'ShopSettingsRepository',
|
|
336
|
-
useFactory: (options) => {
|
|
337
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
338
|
-
},
|
|
339
|
-
deps: ['FirestoreOptions'],
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
provide: 'SubscriptionPaymentRepository',
|
|
343
|
-
useFactory: (options, subscriptionRepository) => {
|
|
344
|
-
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
345
|
-
},
|
|
346
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
provide: 'SubscriptionPlanRepository',
|
|
350
|
-
useFactory: (options) => {
|
|
351
|
-
return new SubscriptionPlanFirestoreRepository(options);
|
|
352
|
-
},
|
|
353
|
-
deps: ['FirestoreOptions'],
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
provide: 'SubscriptionProductRepository',
|
|
357
|
-
useFactory: (options) => {
|
|
358
|
-
return new SubscriptionProductFirestoreRepository(options);
|
|
359
|
-
},
|
|
360
|
-
deps: ['FirestoreOptions'],
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
provide: 'SubscriptionRepository',
|
|
364
|
-
useFactory: (options) => {
|
|
365
|
-
return new SubscriptionFirestoreRepository(options);
|
|
366
|
-
},
|
|
367
|
-
deps: ['FirestoreOptions'],
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
provide: 'UserRepository',
|
|
371
|
-
useFactory: (options) => {
|
|
372
|
-
return new UserFirestoreRepository(options);
|
|
373
|
-
},
|
|
374
|
-
deps: ['FirestoreOptions'],
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
provide: 'UserAddressRepository',
|
|
378
|
-
useFactory: (options, userRepository) => {
|
|
379
|
-
return new UserAddressFirestoreRepository(options, userRepository);
|
|
380
|
-
},
|
|
381
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
provide: 'UserPaymentMethodRepository',
|
|
385
|
-
useFactory: (options, userRepository) => {
|
|
386
|
-
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
387
|
-
},
|
|
388
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
provide: ProductVariantFirestoreRepository,
|
|
392
|
-
useFactory: (options, productRepository) => {
|
|
393
|
-
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
394
|
-
},
|
|
395
|
-
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
396
|
-
},
|
|
397
|
-
], imports: [AngularElasticSeachModule,
|
|
398
|
-
provideFirebaseApp((injector) => {
|
|
399
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
400
|
-
return appName
|
|
401
|
-
? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
|
|
402
|
-
: initializeApp$1(injector.get(FIREBASE_OPTIONS));
|
|
403
|
-
}),
|
|
404
|
-
provideFirestore(() => getFirestore())] });
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
406
|
-
type: NgModule,
|
|
407
|
-
args: [{
|
|
408
|
-
imports: [
|
|
409
|
-
AngularElasticSeachModule,
|
|
410
|
-
provideFirebaseApp((injector) => {
|
|
411
|
-
const appName = injector.get(FIREBASE_APP_NAME);
|
|
412
|
-
return appName
|
|
413
|
-
? initializeApp$1(injector.get(FIREBASE_OPTIONS), appName)
|
|
414
|
-
: initializeApp$1(injector.get(FIREBASE_OPTIONS));
|
|
415
|
-
}),
|
|
416
|
-
provideFirestore(() => getFirestore()),
|
|
417
|
-
],
|
|
418
|
-
providers: [
|
|
419
|
-
{
|
|
420
|
-
provide: 'FirestoreOptions',
|
|
421
|
-
useFactory: (firestore, platformId) => ({
|
|
422
|
-
firestore,
|
|
423
|
-
interceptors: {
|
|
424
|
-
request: (request) => {
|
|
425
|
-
if (isPlatformBrowser(platformId))
|
|
426
|
-
return request;
|
|
427
|
-
const interval = setInterval(() => { }, 100);
|
|
428
|
-
request.interval = interval;
|
|
429
|
-
return request;
|
|
430
|
-
},
|
|
431
|
-
response: (response, request) => {
|
|
432
|
-
if (isPlatformBrowser(platformId))
|
|
433
|
-
return response;
|
|
434
|
-
clearInterval(request.interval);
|
|
435
|
-
return response;
|
|
436
|
-
},
|
|
437
|
-
},
|
|
438
|
-
}),
|
|
439
|
-
deps: [Firestore, PLATFORM_ID],
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
provide: 'BeautyProfileRepository',
|
|
443
|
-
useFactory: (config, userRepository) => {
|
|
444
|
-
return new UserBeautyProfileFirestoreRepository(config, userRepository);
|
|
445
|
-
},
|
|
446
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
provide: 'Buy2WinRepository',
|
|
450
|
-
useFactory: (options) => {
|
|
451
|
-
return new Buy2WinFirestoreRepository(options);
|
|
452
|
-
},
|
|
453
|
-
deps: ['FirestoreOptions'],
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
provide: CategoryFirestoreRepository,
|
|
457
|
-
useFactory: (options) => {
|
|
458
|
-
return new CategoryFirestoreRepository(options);
|
|
459
|
-
},
|
|
460
|
-
deps: ['FirestoreOptions'],
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
provide: 'CheckoutRepository',
|
|
464
|
-
useFactory: (options) => {
|
|
465
|
-
return new CheckoutFirestoreRepository(options);
|
|
466
|
-
},
|
|
467
|
-
deps: ['FirestoreOptions'],
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
471
|
-
useFactory: (options) => {
|
|
472
|
-
return new CheckoutSubscriptionFirestoreRepository(options);
|
|
473
|
-
},
|
|
474
|
-
deps: ['FirestoreOptions'],
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
provide: 'CouponRepository',
|
|
478
|
-
useFactory: (options) => {
|
|
479
|
-
return new CouponFirestoreRepository(options);
|
|
480
|
-
},
|
|
481
|
-
deps: ['FirestoreOptions'],
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
provide: 'CampaignHashtagRepository',
|
|
485
|
-
useFactory: (options) => {
|
|
486
|
-
return new CampaignHashtagFirestoreRepository(options);
|
|
487
|
-
},
|
|
488
|
-
deps: ['FirestoreOptions'],
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
provide: 'CampaignDashboardRepository',
|
|
492
|
-
useFactory: (options) => {
|
|
493
|
-
return new CampaignDashboardFirestoreRepository(options);
|
|
494
|
-
},
|
|
495
|
-
deps: ['FirestoreOptions'],
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
provide: 'EditionRepository',
|
|
499
|
-
useFactory: (options, subscriptionRepository) => {
|
|
500
|
-
return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
501
|
-
},
|
|
502
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
provide: 'HomeRepository',
|
|
506
|
-
useFactory: (options) => {
|
|
507
|
-
return new HomeFirestoreRepository(options);
|
|
508
|
-
},
|
|
509
|
-
deps: ['FirestoreOptions'],
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
provide: 'LeadRepository',
|
|
513
|
-
useFactory: (options) => {
|
|
514
|
-
return new LeadFirestoreRepository(options);
|
|
515
|
-
},
|
|
516
|
-
deps: ['FirestoreOptions'],
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
provide: 'LegacyOrderRepository',
|
|
520
|
-
useFactory: (options) => {
|
|
521
|
-
return new LegacyOrderFirestoreRepository(options);
|
|
522
|
-
},
|
|
523
|
-
deps: ['FirestoreOptions'],
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
provide: 'ShopMenuRepository',
|
|
527
|
-
useFactory: (options) => {
|
|
528
|
-
return new ShopMenuFirestoreRepository(options);
|
|
529
|
-
},
|
|
530
|
-
deps: ['FirestoreOptions'],
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
provide: 'OrderRepository',
|
|
534
|
-
useFactory: (options) => {
|
|
535
|
-
return new OrderFirestoreRepository(options);
|
|
536
|
-
},
|
|
537
|
-
deps: ['FirestoreOptions'],
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
provide: 'PaymentRepository',
|
|
541
|
-
useFactory: (options) => {
|
|
542
|
-
return new PaymentFirestoreRepository(options);
|
|
543
|
-
},
|
|
544
|
-
deps: ['FirestoreOptions'],
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
provide: ProductFirestoreRepository,
|
|
548
|
-
useFactory: (options) => {
|
|
549
|
-
return new ProductFirestoreRepository(options);
|
|
550
|
-
},
|
|
551
|
-
deps: ['FirestoreOptions'],
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
provide: 'ShopSettingsRepository',
|
|
555
|
-
useFactory: (options) => {
|
|
556
|
-
return new ShopSettingsFirestoreRepository(options);
|
|
557
|
-
},
|
|
558
|
-
deps: ['FirestoreOptions'],
|
|
559
|
-
},
|
|
560
|
-
{
|
|
561
|
-
provide: 'SubscriptionPaymentRepository',
|
|
562
|
-
useFactory: (options, subscriptionRepository) => {
|
|
563
|
-
return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
564
|
-
},
|
|
565
|
-
deps: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
566
|
-
},
|
|
567
|
-
{
|
|
568
|
-
provide: 'SubscriptionPlanRepository',
|
|
569
|
-
useFactory: (options) => {
|
|
570
|
-
return new SubscriptionPlanFirestoreRepository(options);
|
|
571
|
-
},
|
|
572
|
-
deps: ['FirestoreOptions'],
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
provide: 'SubscriptionProductRepository',
|
|
576
|
-
useFactory: (options) => {
|
|
577
|
-
return new SubscriptionProductFirestoreRepository(options);
|
|
578
|
-
},
|
|
579
|
-
deps: ['FirestoreOptions'],
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
provide: 'SubscriptionRepository',
|
|
583
|
-
useFactory: (options) => {
|
|
584
|
-
return new SubscriptionFirestoreRepository(options);
|
|
585
|
-
},
|
|
586
|
-
deps: ['FirestoreOptions'],
|
|
587
|
-
},
|
|
588
|
-
{
|
|
589
|
-
provide: 'UserRepository',
|
|
590
|
-
useFactory: (options) => {
|
|
591
|
-
return new UserFirestoreRepository(options);
|
|
592
|
-
},
|
|
593
|
-
deps: ['FirestoreOptions'],
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
provide: 'UserAddressRepository',
|
|
597
|
-
useFactory: (options, userRepository) => {
|
|
598
|
-
return new UserAddressFirestoreRepository(options, userRepository);
|
|
599
|
-
},
|
|
600
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
provide: 'UserPaymentMethodRepository',
|
|
604
|
-
useFactory: (options, userRepository) => {
|
|
605
|
-
return new UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
606
|
-
},
|
|
607
|
-
deps: ['FirestoreOptions', 'UserRepository'],
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
provide: ProductVariantFirestoreRepository,
|
|
611
|
-
useFactory: (options, productRepository) => {
|
|
612
|
-
return new ProductVariantFirestoreRepository(options, productRepository);
|
|
613
|
-
},
|
|
614
|
-
deps: ['FirestoreOptions', ProductFirestoreRepository],
|
|
615
|
-
},
|
|
616
|
-
],
|
|
617
|
-
}]
|
|
618
|
-
}] });
|
|
619
|
-
|
|
620
|
-
class AngularHasuraGraphQLModule {
|
|
621
|
-
static initializeApp(options) {
|
|
622
|
-
return {
|
|
623
|
-
ngModule: AngularHasuraGraphQLModule,
|
|
624
|
-
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
629
|
-
AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
|
|
630
|
-
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
631
|
-
{
|
|
632
|
-
provide: 'HasuraConfig',
|
|
633
|
-
useFactory: (options, platformId) => ({
|
|
634
|
-
endpoint: options.endpoint,
|
|
635
|
-
authOptions: options.credentials,
|
|
636
|
-
interceptors: {
|
|
637
|
-
request: (request) => {
|
|
638
|
-
if (isPlatformBrowser(platformId))
|
|
639
|
-
return request;
|
|
640
|
-
const interval = setInterval(() => { }, 100);
|
|
641
|
-
request.interval = interval;
|
|
642
|
-
return request;
|
|
643
|
-
},
|
|
644
|
-
response: (response, request) => {
|
|
645
|
-
if (isPlatformBrowser(platformId))
|
|
646
|
-
return response;
|
|
647
|
-
clearInterval(request.interval);
|
|
648
|
-
return response;
|
|
649
|
-
},
|
|
650
|
-
},
|
|
651
|
-
}),
|
|
652
|
-
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
provide: 'CategoryRepository',
|
|
656
|
-
useExisting: CategoryHasuraGraphQLRepository,
|
|
657
|
-
},
|
|
658
|
-
{
|
|
659
|
-
provide: CategoryHasuraGraphQLRepository,
|
|
660
|
-
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
661
|
-
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
662
|
-
},
|
|
663
|
-
deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
provide: 'ProductRepository',
|
|
667
|
-
useExisting: ProductHasuraGraphQLRepository,
|
|
668
|
-
},
|
|
669
|
-
{
|
|
670
|
-
provide: ProductHasuraGraphQLRepository,
|
|
671
|
-
useFactory: (hasuraConfig) => {
|
|
672
|
-
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
673
|
-
},
|
|
674
|
-
deps: ['HasuraConfig'],
|
|
675
|
-
},
|
|
676
|
-
{
|
|
677
|
-
provide: 'VariantRepository',
|
|
678
|
-
useExisting: VariantHasuraGraphQLRepository,
|
|
679
|
-
},
|
|
680
|
-
{
|
|
681
|
-
provide: VariantHasuraGraphQLRepository,
|
|
682
|
-
useFactory: (hasuraConfig) => {
|
|
683
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
684
|
-
},
|
|
685
|
-
deps: ['HasuraConfig'],
|
|
686
|
-
},
|
|
687
|
-
{
|
|
688
|
-
provide: 'CategoryFilterRepository',
|
|
689
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
693
|
-
useFactory: (options) => {
|
|
694
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
695
|
-
},
|
|
696
|
-
deps: ['HasuraConfig'],
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
provide: 'FilterOptionRepository',
|
|
700
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
704
|
-
useFactory: (options) => {
|
|
705
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
706
|
-
},
|
|
707
|
-
deps: ['HasuraConfig'],
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
provide: 'FilterRepository',
|
|
711
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
712
|
-
},
|
|
713
|
-
{
|
|
714
|
-
provide: FilterHasuraGraphQLRepository,
|
|
715
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
716
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
717
|
-
},
|
|
718
|
-
deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
719
|
-
},
|
|
720
|
-
] });
|
|
721
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
722
|
-
type: NgModule,
|
|
723
|
-
args: [{
|
|
724
|
-
providers: [
|
|
725
|
-
{
|
|
726
|
-
provide: 'HasuraConfig',
|
|
727
|
-
useFactory: (options, platformId) => ({
|
|
728
|
-
endpoint: options.endpoint,
|
|
729
|
-
authOptions: options.credentials,
|
|
730
|
-
interceptors: {
|
|
731
|
-
request: (request) => {
|
|
732
|
-
if (isPlatformBrowser(platformId))
|
|
733
|
-
return request;
|
|
734
|
-
const interval = setInterval(() => { }, 100);
|
|
735
|
-
request.interval = interval;
|
|
736
|
-
return request;
|
|
737
|
-
},
|
|
738
|
-
response: (response, request) => {
|
|
739
|
-
if (isPlatformBrowser(platformId))
|
|
740
|
-
return response;
|
|
741
|
-
clearInterval(request.interval);
|
|
742
|
-
return response;
|
|
743
|
-
},
|
|
744
|
-
},
|
|
745
|
-
}),
|
|
746
|
-
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
provide: 'CategoryRepository',
|
|
750
|
-
useExisting: CategoryHasuraGraphQLRepository,
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
provide: CategoryHasuraGraphQLRepository,
|
|
754
|
-
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
755
|
-
return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
756
|
-
},
|
|
757
|
-
deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
758
|
-
},
|
|
759
|
-
{
|
|
760
|
-
provide: 'ProductRepository',
|
|
761
|
-
useExisting: ProductHasuraGraphQLRepository,
|
|
762
|
-
},
|
|
763
|
-
{
|
|
764
|
-
provide: ProductHasuraGraphQLRepository,
|
|
765
|
-
useFactory: (hasuraConfig) => {
|
|
766
|
-
return new ProductHasuraGraphQLRepository(hasuraConfig);
|
|
767
|
-
},
|
|
768
|
-
deps: ['HasuraConfig'],
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
provide: 'VariantRepository',
|
|
772
|
-
useExisting: VariantHasuraGraphQLRepository,
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
provide: VariantHasuraGraphQLRepository,
|
|
776
|
-
useFactory: (hasuraConfig) => {
|
|
777
|
-
return new VariantHasuraGraphQLRepository(hasuraConfig);
|
|
778
|
-
},
|
|
779
|
-
deps: ['HasuraConfig'],
|
|
780
|
-
},
|
|
781
|
-
{
|
|
782
|
-
provide: 'CategoryFilterRepository',
|
|
783
|
-
useExisting: CategoryFilterHasuraGraphQLRepository,
|
|
784
|
-
},
|
|
785
|
-
{
|
|
786
|
-
provide: CategoryFilterHasuraGraphQLRepository,
|
|
787
|
-
useFactory: (options) => {
|
|
788
|
-
return new CategoryFilterHasuraGraphQLRepository(options);
|
|
789
|
-
},
|
|
790
|
-
deps: ['HasuraConfig'],
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
provide: 'FilterOptionRepository',
|
|
794
|
-
useExisting: FilterOptionHasuraGraphQLRepository,
|
|
795
|
-
},
|
|
796
|
-
{
|
|
797
|
-
provide: FilterOptionHasuraGraphQLRepository,
|
|
798
|
-
useFactory: (options) => {
|
|
799
|
-
return new FilterOptionHasuraGraphQLRepository(options);
|
|
800
|
-
},
|
|
801
|
-
deps: ['HasuraConfig'],
|
|
802
|
-
},
|
|
803
|
-
{
|
|
804
|
-
provide: 'FilterRepository',
|
|
805
|
-
useExisting: FilterHasuraGraphQLRepository,
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
provide: FilterHasuraGraphQLRepository,
|
|
809
|
-
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
810
|
-
return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
811
|
-
},
|
|
812
|
-
deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
|
|
813
|
-
},
|
|
814
|
-
],
|
|
815
|
-
}]
|
|
816
|
-
}] });
|
|
817
|
-
|
|
818
|
-
class AuthService {
|
|
819
|
-
constructor(angularFireAuth, userRepository) {
|
|
820
|
-
this.angularFireAuth = angularFireAuth;
|
|
821
|
-
this.userRepository = userRepository;
|
|
822
|
-
}
|
|
823
|
-
getAuthstate() {
|
|
824
|
-
const observables = [this.getFireUser(), this.getUser()];
|
|
825
|
-
return combineLatest(observables).pipe(map(([fireUser, user]) => ({
|
|
826
|
-
user,
|
|
827
|
-
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
828
|
-
})));
|
|
829
|
-
}
|
|
830
|
-
getUser() {
|
|
831
|
-
return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? from(this.userRepository.get({ id })).pipe(catchError(() => of(null))) : of(null))));
|
|
832
|
-
}
|
|
833
|
-
getTokenId() {
|
|
834
|
-
return from(getIdToken(this.angularFireAuth.currentUser));
|
|
835
|
-
}
|
|
836
|
-
getFireUser() {
|
|
837
|
-
return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
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 });
|
|
841
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
|
|
842
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
|
|
843
|
-
type: Injectable
|
|
844
|
-
}], ctorParameters: function () {
|
|
845
|
-
return [{ type: i1$1.Auth }, { type: undefined, decorators: [{
|
|
846
|
-
type: Inject,
|
|
847
|
-
args: ['UserRepository']
|
|
848
|
-
}] }];
|
|
849
|
-
} });
|
|
850
|
-
|
|
851
|
-
class InvalidCouponError extends CustomError {
|
|
852
|
-
constructor(message) {
|
|
853
|
-
super(message);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
class GroupInvalidCouponError extends CustomError {
|
|
858
|
-
constructor(errors) {
|
|
859
|
-
super('Many coupon errors throw');
|
|
860
|
-
this.errors = errors;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
class CouponService {
|
|
865
|
-
constructor(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
866
|
-
this.couponRepository = couponRepository;
|
|
867
|
-
this.defaultShop = defaultShop;
|
|
868
|
-
this.orderRepository = orderRepository;
|
|
869
|
-
this.categoryRepository = categoryRepository;
|
|
870
|
-
this.emailIsFromCollaborator = (userEmail) => !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g));
|
|
871
|
-
}
|
|
872
|
-
checkCoupon(nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
|
|
873
|
-
return from(this.couponRepository.find({
|
|
874
|
-
filters: {
|
|
875
|
-
nickname: { operator: Where.EQUALS, value: nickname },
|
|
876
|
-
active: { operator: Where.EQUALS, value: true },
|
|
81
|
+
checkCoupon(nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
|
|
82
|
+
return from(this.couponRepository.find({
|
|
83
|
+
filters: {
|
|
84
|
+
nickname: { operator: Where.EQUALS, value: nickname },
|
|
85
|
+
active: { operator: Where.EQUALS, value: true },
|
|
877
86
|
},
|
|
878
87
|
})).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));
|
|
879
88
|
}
|
|
@@ -906,7 +115,7 @@ class CouponService {
|
|
|
906
115
|
const hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
907
116
|
// Se não tem valor mínimo atingido, retorna erro
|
|
908
117
|
if (!hasMinSubTotal)
|
|
909
|
-
return throwError(
|
|
118
|
+
return throwError('Valor mínimo não atingido');
|
|
910
119
|
return of(coupon);
|
|
911
120
|
}
|
|
912
121
|
isValidCoupon(coupon, userEmail) {
|
|
@@ -921,7 +130,10 @@ class CouponService {
|
|
|
921
130
|
checkCouponUseAndLimit(coupon, userEmail, checkout) {
|
|
922
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
923
132
|
const orders = yield this.orderRepository.find({
|
|
924
|
-
filters:
|
|
133
|
+
filters: {
|
|
134
|
+
coupon: { id: coupon.id },
|
|
135
|
+
payment: { status: 'paid' },
|
|
136
|
+
},
|
|
925
137
|
});
|
|
926
138
|
// orders que usuario ja fez com o cupom
|
|
927
139
|
const ordersUserCoupon = orders.data.filter((o) => o.user.email == userEmail);
|
|
@@ -931,7 +143,7 @@ class CouponService {
|
|
|
931
143
|
// Verifica o limite de uso geral por usuario
|
|
932
144
|
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
933
145
|
throw new InvalidCouponError('Limite de uso atingido.');
|
|
934
|
-
const validUser = this.userValidationAndSubscriptionStatus(coupon,
|
|
146
|
+
const validUser = yield this.userValidationAndSubscriptionStatus(coupon, userEmail);
|
|
935
147
|
if (!validUser)
|
|
936
148
|
throw new InvalidCouponError('Usuário não elegível.');
|
|
937
149
|
const hasProductCategories = yield this.hasProductCategories(coupon, checkout);
|
|
@@ -1025,26 +237,41 @@ class CouponService {
|
|
|
1025
237
|
return hasCategories.length ? true : false;
|
|
1026
238
|
});
|
|
1027
239
|
}
|
|
1028
|
-
userValidationAndSubscriptionStatus(coupon,
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
240
|
+
userValidationAndSubscriptionStatus(coupon, userEmail) {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
// Verifica se o email do usuário é coorporativo
|
|
243
|
+
if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
244
|
+
throw new InvalidCouponError('Você não é colaborador.');
|
|
245
|
+
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
246
|
+
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
|
|
247
|
+
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
248
|
+
const couponRuleSubscription = coupon.exclusivityType === Exclusivities.ACTIVE_SUBSCRIBER ||
|
|
249
|
+
coupon.exclusivityType === Exclusivities.INACTIVE_SUBSCRIBER ||
|
|
250
|
+
coupon.exclusivityType === Exclusivities.NON_SUBSCRIBER;
|
|
251
|
+
if (couponRuleSubscription && userEmail) {
|
|
252
|
+
const sub = yield this.subscriptionRepository
|
|
253
|
+
.find({
|
|
254
|
+
filters: {
|
|
255
|
+
user: {
|
|
256
|
+
email: { operator: Where.EQUALS, value: userEmail },
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
})
|
|
260
|
+
.then((sub) => sub.data);
|
|
261
|
+
const activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter((s) => s.status === Status.ACTIVE);
|
|
262
|
+
switch (coupon.exclusivityType) {
|
|
263
|
+
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
264
|
+
return activeSubs.length > 0;
|
|
265
|
+
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
266
|
+
return activeSubs.length === 0;
|
|
267
|
+
case Exclusivities.NON_SUBSCRIBER:
|
|
268
|
+
return sub.length === 0;
|
|
269
|
+
default:
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
1032
273
|
return true;
|
|
1033
|
-
|
|
1034
|
-
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === Exclusivities.COLLABORATORS)
|
|
1035
|
-
throw new InvalidCouponError('Você não é colaborador.');
|
|
1036
|
-
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
1037
|
-
if (coupon.exclusivityType === Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
1038
|
-
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
1039
|
-
switch (coupon.exclusivityType) {
|
|
1040
|
-
case Exclusivities.ACTIVE_SUBSCRIBER:
|
|
1041
|
-
return user.isSubscriber ? true : false;
|
|
1042
|
-
case Exclusivities.INACTIVE_SUBSCRIBER:
|
|
1043
|
-
return user.isSubscriber ? false : true;
|
|
1044
|
-
case Exclusivities.NON_SUBSCRIBER:
|
|
1045
|
-
return user.isSubscriber ? false : true;
|
|
1046
|
-
}
|
|
1047
|
-
return true;
|
|
274
|
+
});
|
|
1048
275
|
}
|
|
1049
276
|
getCouponCategoriesId(coupon) {
|
|
1050
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1059,7 +286,7 @@ class CouponService {
|
|
|
1059
286
|
});
|
|
1060
287
|
}
|
|
1061
288
|
}
|
|
1062
|
-
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 });
|
|
289
|
+
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 });
|
|
1063
290
|
CouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, providedIn: 'root' });
|
|
1064
291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponService, decorators: [{
|
|
1065
292
|
type: Injectable,
|
|
@@ -1070,12 +297,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1070
297
|
return [{ type: undefined, decorators: [{
|
|
1071
298
|
type: Inject,
|
|
1072
299
|
args: ['CouponRepository']
|
|
1073
|
-
}] }, { type:
|
|
300
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1074
301
|
type: Inject,
|
|
1075
302
|
args: [DEFAULT_SHOP]
|
|
1076
303
|
}] }, { type: undefined, decorators: [{
|
|
1077
304
|
type: Inject,
|
|
1078
305
|
args: ['OrderRepository']
|
|
306
|
+
}] }, { type: undefined, decorators: [{
|
|
307
|
+
type: Inject,
|
|
308
|
+
args: ['SubscriptionRepository']
|
|
1079
309
|
}] }, { type: undefined, decorators: [{
|
|
1080
310
|
type: Inject,
|
|
1081
311
|
args: ['CategoryRepository']
|
|
@@ -1142,26 +372,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1142
372
|
}] }, { type: undefined, decorators: [{
|
|
1143
373
|
type: Inject,
|
|
1144
374
|
args: ['UserRepository']
|
|
1145
|
-
}] }, { type:
|
|
375
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1146
376
|
type: Inject,
|
|
1147
377
|
args: [DEFAULT_SHOP]
|
|
1148
378
|
}] }];
|
|
1149
379
|
} });
|
|
1150
380
|
|
|
1151
381
|
class CartService {
|
|
1152
|
-
constructor(authService, checkoutService, defaultShop, productRepository
|
|
382
|
+
constructor(authService, checkoutService, defaultShop, productRepository) {
|
|
1153
383
|
this.authService = authService;
|
|
1154
384
|
this.checkoutService = checkoutService;
|
|
1155
385
|
this.defaultShop = defaultShop;
|
|
1156
386
|
this.productRepository = productRepository;
|
|
1157
|
-
this.categoryRepository = categoryRepository;
|
|
1158
|
-
this.variantRepository = variantRepository;
|
|
1159
|
-
this.buy2WinRepository = buy2WinRepository;
|
|
1160
387
|
this.cartSubject = new Subject();
|
|
1161
388
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
1162
389
|
var _a;
|
|
1163
390
|
const items = [];
|
|
1164
|
-
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.
|
|
391
|
+
const index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map((checkoutItem) => checkoutItem.sku).indexOf(lineItem.sku);
|
|
1165
392
|
if (index > -1) {
|
|
1166
393
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
1167
394
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
@@ -1172,25 +399,28 @@ class CartService {
|
|
|
1172
399
|
.updateCheckoutLineItems(checkoutLoaded)
|
|
1173
400
|
.pipe(map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)));
|
|
1174
401
|
}));
|
|
1175
|
-
this.generateCartObject = (items) =>
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
402
|
+
this.generateCartObject = (items) => {
|
|
403
|
+
const cart = {};
|
|
404
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => {
|
|
405
|
+
var _a;
|
|
406
|
+
return (cart[item.sku] = LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
|
|
407
|
+
});
|
|
408
|
+
return cart;
|
|
409
|
+
};
|
|
1179
410
|
this.buildLineItem = ({ checkout, item, quantity, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1180
411
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1181
|
-
const product = yield this.
|
|
1182
|
-
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.
|
|
412
|
+
const product = yield this.productRepository.get({ id: item.id });
|
|
413
|
+
item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku)) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
|
|
1183
414
|
if (this.checkMaxStock(item, quantity || 0))
|
|
1184
415
|
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
1185
416
|
const image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
1186
|
-
const { id, name, EAN, slug, stock, price, weight, sku, type } = item;
|
|
417
|
+
const { id, name, EAN, brand, slug, stock, price, weight, categories, sku, type } = item;
|
|
1187
418
|
const isGift = item.isGift || null;
|
|
1188
419
|
const pricePaid = this.getProductPrice({
|
|
1189
420
|
product: item,
|
|
1190
421
|
shop: checkout.shop || this.defaultShop,
|
|
1191
422
|
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
1192
423
|
});
|
|
1193
|
-
RoundProductPricesHelper.roundProductPrices(item);
|
|
1194
424
|
return {
|
|
1195
425
|
checkout,
|
|
1196
426
|
lineItem: LineItem.toInstance({
|
|
@@ -1201,7 +431,7 @@ class CartService {
|
|
|
1201
431
|
slug: slug !== null && slug !== void 0 ? slug : product.slug,
|
|
1202
432
|
sku: sku !== null && sku !== void 0 ? sku : product.sku,
|
|
1203
433
|
stock,
|
|
1204
|
-
price
|
|
434
|
+
price,
|
|
1205
435
|
image,
|
|
1206
436
|
weight: weight !== null && weight !== void 0 ? weight : product.weight,
|
|
1207
437
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
@@ -1217,9 +447,7 @@ class CartService {
|
|
|
1217
447
|
const info = product.price;
|
|
1218
448
|
if (product.isGift)
|
|
1219
449
|
return 0;
|
|
1220
|
-
return isSubscriber && info.subscriberPrice > 0
|
|
1221
|
-
? Number(info.subscriberPrice.toFixed(2))
|
|
1222
|
-
: Number(info.price.toFixed(2));
|
|
450
|
+
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
1223
451
|
};
|
|
1224
452
|
this.checkMaxStock = (item, quantity) => {
|
|
1225
453
|
var _a;
|
|
@@ -1234,7 +462,7 @@ class CartService {
|
|
|
1234
462
|
decreaseItem(item) {
|
|
1235
463
|
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
1236
464
|
var _a;
|
|
1237
|
-
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.
|
|
465
|
+
const checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find((lineItem) => lineItem.sku === item.sku);
|
|
1238
466
|
if (!isNil(checkoutItem))
|
|
1239
467
|
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
1240
468
|
return checkout;
|
|
@@ -1250,494 +478,846 @@ class CartService {
|
|
|
1250
478
|
getVariantPriceDiscount(item) {
|
|
1251
479
|
return this.authService.getUser().pipe(concatMap((user) => iif(() => user.isSubscriber && !!item.price.subscriberPrice, of(item.price.subscriberPrice), of(item.price.price))), catchError(() => of(item.price.price)));
|
|
1252
480
|
}
|
|
1253
|
-
removeItem(item) {
|
|
1254
|
-
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
1255
|
-
const index = checkout.lineItems.findIndex((lineItem) => lineItem.
|
|
1256
|
-
if (index >= 0)
|
|
1257
|
-
checkout.lineItems.splice(index, 1);
|
|
1258
|
-
return checkout;
|
|
1259
|
-
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
481
|
+
removeItem(item) {
|
|
482
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
483
|
+
const index = checkout.lineItems.findIndex((lineItem) => lineItem.sku === item.sku);
|
|
484
|
+
if (index >= 0)
|
|
485
|
+
checkout.lineItems.splice(index, 1);
|
|
486
|
+
return checkout;
|
|
487
|
+
}), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
488
|
+
}
|
|
489
|
+
updateUserCart(user) {
|
|
490
|
+
return this.checkoutService.getCheckout().pipe(concatMap((checkout) => this.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => __awaiter(this, void 0, void 0, function* () {
|
|
491
|
+
var _a, _b;
|
|
492
|
+
return this.checkoutService.updateCheckoutLineItems(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length) ? yield Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map((item) => __awaiter(this, void 0, void 0, function* () { return (yield this.buildLineItem({ checkout, item })).lineItem; }))) : [] }))).toPromise();
|
|
493
|
+
})), map(checkout => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
494
|
+
}
|
|
495
|
+
clearCart() {
|
|
496
|
+
return this.checkoutService.getCheckout().pipe(map((checkout) => {
|
|
497
|
+
this.checkoutService.clearCheckoutFromSession();
|
|
498
|
+
return checkout;
|
|
499
|
+
}), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
|
|
500
|
+
}
|
|
501
|
+
buildCartFromCheckout(checkoutData) {
|
|
502
|
+
return this.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
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 });
|
|
506
|
+
CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
|
|
508
|
+
type: Injectable
|
|
509
|
+
}], ctorParameters: function () {
|
|
510
|
+
return [{ type: AuthService }, { type: CheckoutService }, { type: i2.Shops, decorators: [{
|
|
511
|
+
type: Inject,
|
|
512
|
+
args: [DEFAULT_SHOP]
|
|
513
|
+
}] }, { type: undefined, decorators: [{
|
|
514
|
+
type: Inject,
|
|
515
|
+
args: ['ProductRepository']
|
|
516
|
+
}] }];
|
|
517
|
+
} });
|
|
518
|
+
|
|
519
|
+
class CheckoutSubscriptionService {
|
|
520
|
+
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
521
|
+
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
522
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
523
|
+
this.couponService = couponService;
|
|
524
|
+
}
|
|
525
|
+
getCheckoutSubscription(checkoutData) {
|
|
526
|
+
const checkoutId = cookie.get('checkoutSubscriptionId');
|
|
527
|
+
if (!isNil(checkoutId))
|
|
528
|
+
return from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
529
|
+
return from(this.createCheckoutSubscription(checkoutData));
|
|
530
|
+
}
|
|
531
|
+
createCheckoutSubscription(checkoutData) {
|
|
532
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
533
|
+
const checkout = yield this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()));
|
|
534
|
+
cookie.set('checkoutSubscriptionId', checkout.id);
|
|
535
|
+
return checkout;
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
clearCheckoutSubscriptionFromSession() {
|
|
539
|
+
cookie.remove('checkoutSubscriptionId');
|
|
540
|
+
return of();
|
|
541
|
+
}
|
|
542
|
+
checkCoupon(nickname, userEmail) {
|
|
543
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe()));
|
|
544
|
+
}
|
|
545
|
+
calcDiscountSubscription(coupon) {
|
|
546
|
+
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
550
|
+
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService });
|
|
551
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
552
|
+
type: Injectable
|
|
553
|
+
}], ctorParameters: function () {
|
|
554
|
+
return [{ type: undefined, decorators: [{
|
|
555
|
+
type: Inject,
|
|
556
|
+
args: ['CheckoutSubscriptionRepository']
|
|
557
|
+
}] }, { type: undefined, decorators: [{
|
|
558
|
+
type: Inject,
|
|
559
|
+
args: ['SubscriptionRepository']
|
|
560
|
+
}] }, { type: CouponService }];
|
|
561
|
+
} });
|
|
562
|
+
|
|
563
|
+
class OrderService {
|
|
564
|
+
constructor(angularFirestore, orderRepository) {
|
|
565
|
+
this.angularFirestore = angularFirestore;
|
|
566
|
+
this.orderRepository = orderRepository;
|
|
567
|
+
this.orderSubject = new Subject();
|
|
568
|
+
}
|
|
569
|
+
getOrder(id) {
|
|
570
|
+
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
571
|
+
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
572
|
+
.subscribe((doc) => this.orderSubject.next(doc));
|
|
573
|
+
return this.orderSubject;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
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 });
|
|
577
|
+
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
579
|
+
type: Injectable
|
|
580
|
+
}], ctorParameters: function () {
|
|
581
|
+
return [{ type: i1$1.Firestore }, { type: i2.OrderFirestoreRepository, decorators: [{
|
|
582
|
+
type: Inject,
|
|
583
|
+
args: ['OrderRepository']
|
|
584
|
+
}] }];
|
|
585
|
+
} });
|
|
586
|
+
|
|
587
|
+
class HomeShopService {
|
|
588
|
+
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
589
|
+
this.categoryRepository = categoryRepository;
|
|
590
|
+
this.homeRepository = homeRepository;
|
|
591
|
+
this.productRepository = productRepository;
|
|
592
|
+
this.defaultShop = defaultShop;
|
|
593
|
+
this.buildCategoryGroupWithRequiredData = (group) => {
|
|
594
|
+
var _a, _b;
|
|
595
|
+
return ({
|
|
596
|
+
category: Category.toInstance(pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
|
|
597
|
+
products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map((product) => Product.toInstance(pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
|
|
598
|
+
'id',
|
|
599
|
+
'price',
|
|
600
|
+
'reviews',
|
|
601
|
+
'hasVariants',
|
|
602
|
+
'slug',
|
|
603
|
+
'sku',
|
|
604
|
+
'stock',
|
|
605
|
+
'costPrice',
|
|
606
|
+
'images',
|
|
607
|
+
'miniatures',
|
|
608
|
+
'name',
|
|
609
|
+
'weight',
|
|
610
|
+
'rate',
|
|
611
|
+
'type',
|
|
612
|
+
])))) || [],
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
get homeId() {
|
|
617
|
+
if (this.defaultShop === Shops.GLAMSHOP)
|
|
618
|
+
return 'glamshop';
|
|
619
|
+
if (this.defaultShop === Shops.MENSMARKET)
|
|
620
|
+
return 'mens_market';
|
|
621
|
+
return null;
|
|
1260
622
|
}
|
|
1261
|
-
|
|
1262
|
-
return this.
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
})), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
623
|
+
getHomeData() {
|
|
624
|
+
return this.getHomeConfiguration().pipe(map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
|
|
625
|
+
? of(home)
|
|
626
|
+
: forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
|
|
627
|
+
discoverProducts,
|
|
628
|
+
featuredProducts,
|
|
629
|
+
verticalProducts,
|
|
630
|
+
})), concatMap((data) => this.saveHomeData(data)))));
|
|
1270
631
|
}
|
|
1271
|
-
|
|
1272
|
-
return this.
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
632
|
+
getBanners(type) {
|
|
633
|
+
return this.getHomeConfiguration().pipe(map((home) => {
|
|
634
|
+
if (type === 'brand')
|
|
635
|
+
return home.brandsCarousel;
|
|
636
|
+
if (type === 'buyToWin')
|
|
637
|
+
return [home.buyToWinBanner];
|
|
638
|
+
if (type === 'block')
|
|
639
|
+
return home.blockBanners;
|
|
640
|
+
if (type === 'blog')
|
|
641
|
+
return [home.blogBanner];
|
|
642
|
+
return [];
|
|
643
|
+
}));
|
|
1276
644
|
}
|
|
1277
|
-
|
|
1278
|
-
return this.
|
|
645
|
+
getMinValueForFreeShipping() {
|
|
646
|
+
return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
|
|
1279
647
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
return Object.assign(Object.assign(Object.assign({}, productPrice), { price: Number(price.toFixed(2)), fullPrice: Number(fullPrice.toFixed(2)) }), (subscriberPrice && { subscriberPrice: Number(subscriberPrice.toFixed(2)) }));
|
|
648
|
+
getDiscoverProducts() {
|
|
649
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
1283
650
|
}
|
|
1284
|
-
|
|
1285
|
-
return
|
|
1286
|
-
let product;
|
|
1287
|
-
let variant;
|
|
1288
|
-
try {
|
|
1289
|
-
product = yield this.productRepository.get({ id: productId });
|
|
1290
|
-
}
|
|
1291
|
-
catch (error) {
|
|
1292
|
-
if (!(error instanceof NotFoundError))
|
|
1293
|
-
throw error;
|
|
1294
|
-
const { data: variants } = yield this.variantRepository.find({ filters: { id: productId } });
|
|
1295
|
-
variant = variants.shift();
|
|
1296
|
-
if (!variant)
|
|
1297
|
-
throw error;
|
|
1298
|
-
product = yield this.productRepository.get({ id: variant.productId });
|
|
1299
|
-
}
|
|
1300
|
-
return Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())));
|
|
1301
|
-
});
|
|
651
|
+
getFeaturedProducts() {
|
|
652
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
1302
653
|
}
|
|
1303
|
-
|
|
1304
|
-
return this.
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
const cartTotal = notGiftItems.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
1309
|
-
const campaigns = yield this.buy2WinRepository
|
|
1310
|
-
.find({
|
|
1311
|
-
filters: {
|
|
1312
|
-
active: { operator: Where.EQUALS, value: true },
|
|
1313
|
-
shop: { operator: Where.EQUALS, value: this.defaultShop },
|
|
1314
|
-
},
|
|
1315
|
-
})
|
|
1316
|
-
.then((data) => data.data);
|
|
1317
|
-
if (!campaigns.length)
|
|
1318
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
1319
|
-
const elegibleCampaigns = [];
|
|
1320
|
-
for (const campaign of campaigns) {
|
|
1321
|
-
const today = new Date();
|
|
1322
|
-
if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
|
|
1323
|
-
continue;
|
|
1324
|
-
if (campaign.activeCategory) {
|
|
1325
|
-
const categoriesCampaing = campaign.categories.map((c) => c.id.toString());
|
|
1326
|
-
const categoriesCampaingFullTree = [];
|
|
1327
|
-
for (const id of categoriesCampaing) {
|
|
1328
|
-
const children = yield this.categoryRepository.getChildren(parseInt(id));
|
|
1329
|
-
categoriesCampaingFullTree.push(id, ...children.map((c) => c.id.toString()));
|
|
1330
|
-
}
|
|
1331
|
-
const categoriesCampaingTree = [...new Set(categoriesCampaingFullTree)];
|
|
1332
|
-
const filterProductsCategories = checkout.lineItems.filter((l) => {
|
|
1333
|
-
var _a;
|
|
1334
|
-
if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
1335
|
-
return true;
|
|
1336
|
-
return l.categories.some((c) => categoriesCampaingTree.some((cat) => cat == c));
|
|
1337
|
-
});
|
|
1338
|
-
if (filterProductsCategories.length) {
|
|
1339
|
-
const cartTotalCategories = filterProductsCategories.reduce((a, b) => a + b.pricePaid * b.quantity, 0);
|
|
1340
|
-
if (cartTotalCategories >= campaign.cartValueMin)
|
|
1341
|
-
elegibleCampaigns.push(campaign);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
else {
|
|
1345
|
-
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
1346
|
-
if (campaign.cartValue <= cartTotal)
|
|
1347
|
-
elegibleCampaigns.push(campaign);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
if (!elegibleCampaigns.length)
|
|
1352
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
1353
|
-
const campaingnProducts = [];
|
|
1354
|
-
for (const campaign of elegibleCampaigns) {
|
|
1355
|
-
let elegibleProducts = [];
|
|
1356
|
-
for (const product of campaign.products) {
|
|
1357
|
-
const { data: productData } = yield this.productRepository.find({ filters: { sku: product } });
|
|
1358
|
-
if (!productData.length)
|
|
1359
|
-
continue;
|
|
1360
|
-
const gift = productData.shift();
|
|
1361
|
-
if (gift.stock.quantity < 1)
|
|
1362
|
-
continue;
|
|
1363
|
-
elegibleProducts.push(gift);
|
|
1364
|
-
}
|
|
1365
|
-
campaingnProducts.push(elegibleProducts);
|
|
1366
|
-
}
|
|
1367
|
-
if (!campaingnProducts.length)
|
|
1368
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems });
|
|
1369
|
-
const gifts = this.giftToLineItems([].concat(...campaingnProducts));
|
|
1370
|
-
return Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) });
|
|
1371
|
-
})), concatMap((checkout) => this.checkoutService.updateCheckoutLineItems(checkout)), map((checkout) => this.generateCartObject(checkout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
|
|
654
|
+
getVerticalProducts() {
|
|
655
|
+
return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => from(this.categoryRepository.get({ id })).pipe(concatMap((category) => from(this.productRepository.find({
|
|
656
|
+
filters: { categories: { operator: Where.IN, value: [category.id] } },
|
|
657
|
+
limits: { limit: 12 },
|
|
658
|
+
})).pipe(map((products) => ({ category, products })))), map(({ category, products }) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
|
|
1372
659
|
}
|
|
1373
|
-
|
|
1374
|
-
return
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
pricePaid: 0,
|
|
1391
|
-
quantity: 1,
|
|
1392
|
-
isGift: true,
|
|
1393
|
-
});
|
|
1394
|
-
});
|
|
660
|
+
getHomeConfiguration() {
|
|
661
|
+
return of(this.homeConfiguration).pipe(concatMap((home) => home
|
|
662
|
+
? of(home)
|
|
663
|
+
: !this.homeId
|
|
664
|
+
? throwError(new RequiredArgumentError(['homeId']))
|
|
665
|
+
: from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
|
|
666
|
+
}
|
|
667
|
+
saveHomeData(homeData) {
|
|
668
|
+
const data = {
|
|
669
|
+
createdAt: new Date(),
|
|
670
|
+
expiresAt: add(new Date(), { hours: 1 }),
|
|
671
|
+
data: homeData,
|
|
672
|
+
};
|
|
673
|
+
return from(this.homeRepository.update({
|
|
674
|
+
id: this.homeId,
|
|
675
|
+
data,
|
|
676
|
+
})).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
|
|
1395
677
|
}
|
|
1396
678
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type:
|
|
679
|
+
HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
680
|
+
HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService });
|
|
681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, decorators: [{
|
|
1400
682
|
type: Injectable
|
|
1401
683
|
}], ctorParameters: function () {
|
|
1402
|
-
return [{ type:
|
|
1403
|
-
type: Inject,
|
|
1404
|
-
args: [DEFAULT_SHOP]
|
|
1405
|
-
}] }, { type: undefined, decorators: [{
|
|
684
|
+
return [{ type: undefined, decorators: [{
|
|
1406
685
|
type: Inject,
|
|
1407
|
-
args: ['
|
|
686
|
+
args: ['CategoryRepository']
|
|
1408
687
|
}] }, { type: undefined, decorators: [{
|
|
1409
688
|
type: Inject,
|
|
1410
|
-
args: ['
|
|
689
|
+
args: ['HomeRepository']
|
|
1411
690
|
}] }, { type: undefined, decorators: [{
|
|
1412
691
|
type: Inject,
|
|
1413
|
-
args: ['
|
|
1414
|
-
}] }, { type:
|
|
692
|
+
args: ['ProductRepository']
|
|
693
|
+
}] }, { type: i2.Shops, decorators: [{
|
|
1415
694
|
type: Inject,
|
|
1416
|
-
args: [
|
|
695
|
+
args: [DEFAULT_SHOP]
|
|
1417
696
|
}] }];
|
|
1418
697
|
} });
|
|
1419
698
|
|
|
1420
|
-
class
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
return query;
|
|
699
|
+
class AngularFirebaseAuthModule {
|
|
700
|
+
static initializeApp(options, nameOrConfig) {
|
|
701
|
+
return {
|
|
702
|
+
ngModule: AngularFirebaseAuthModule,
|
|
703
|
+
providers: [
|
|
704
|
+
{ provide: FIREBASE_OPTIONS, useValue: options },
|
|
705
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
706
|
+
],
|
|
1429
707
|
};
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
711
|
+
AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1$2.FirebaseAppModule, i1.AuthModule] });
|
|
712
|
+
AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
|
|
713
|
+
{
|
|
714
|
+
provide: 'Authentication',
|
|
715
|
+
useFactory: (authenticationService, userRepository) => {
|
|
716
|
+
return new Authentication(authenticationService, userRepository);
|
|
717
|
+
},
|
|
718
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
provide: 'AuthenticationService',
|
|
722
|
+
useFactory: (angularFireAuth) => {
|
|
723
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
724
|
+
},
|
|
725
|
+
deps: [Auth],
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
provide: 'Register',
|
|
729
|
+
useFactory: (registerService, userRepository) => {
|
|
730
|
+
return new Register(registerService, userRepository);
|
|
731
|
+
},
|
|
732
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
provide: 'RegisterService',
|
|
736
|
+
useFactory: (angularFireAuth) => {
|
|
737
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
738
|
+
},
|
|
739
|
+
deps: [Auth],
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
provide: 'SignOut',
|
|
743
|
+
useFactory: (authenticationService) => {
|
|
744
|
+
return new SignOut(authenticationService);
|
|
745
|
+
},
|
|
746
|
+
deps: ['AuthenticationService'],
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
provide: 'RecoveryPassword',
|
|
750
|
+
useFactory: (authenticationService) => {
|
|
751
|
+
return new RecoveryPassword(authenticationService);
|
|
752
|
+
},
|
|
753
|
+
deps: ['AuthenticationService'],
|
|
754
|
+
},
|
|
755
|
+
], imports: [provideFirebaseApp((injector) => {
|
|
756
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
757
|
+
return appName
|
|
758
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
759
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
760
|
+
}),
|
|
761
|
+
provideAuth(() => getAuth())] });
|
|
762
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
|
|
763
|
+
type: NgModule,
|
|
764
|
+
args: [{
|
|
765
|
+
imports: [
|
|
766
|
+
provideFirebaseApp((injector) => {
|
|
767
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
768
|
+
return appName
|
|
769
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
770
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
771
|
+
}),
|
|
772
|
+
provideAuth(() => getAuth()),
|
|
773
|
+
],
|
|
774
|
+
providers: [
|
|
775
|
+
{
|
|
776
|
+
provide: 'Authentication',
|
|
777
|
+
useFactory: (authenticationService, userRepository) => {
|
|
778
|
+
return new Authentication(authenticationService, userRepository);
|
|
779
|
+
},
|
|
780
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
provide: 'AuthenticationService',
|
|
784
|
+
useFactory: (angularFireAuth) => {
|
|
785
|
+
return new AuthenticationFirebaseAuthService(angularFireAuth);
|
|
786
|
+
},
|
|
787
|
+
deps: [Auth],
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
provide: 'Register',
|
|
791
|
+
useFactory: (registerService, userRepository) => {
|
|
792
|
+
return new Register(registerService, userRepository);
|
|
793
|
+
},
|
|
794
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
provide: 'RegisterService',
|
|
798
|
+
useFactory: (angularFireAuth) => {
|
|
799
|
+
return new RegisterFirebaseAuthService(angularFireAuth);
|
|
800
|
+
},
|
|
801
|
+
deps: [Auth],
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
provide: 'SignOut',
|
|
805
|
+
useFactory: (authenticationService) => {
|
|
806
|
+
return new SignOut(authenticationService);
|
|
807
|
+
},
|
|
808
|
+
deps: ['AuthenticationService'],
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
provide: 'RecoveryPassword',
|
|
812
|
+
useFactory: (authenticationService) => {
|
|
813
|
+
return new RecoveryPassword(authenticationService);
|
|
814
|
+
},
|
|
815
|
+
deps: ['AuthenticationService'],
|
|
816
|
+
},
|
|
817
|
+
],
|
|
818
|
+
}]
|
|
819
|
+
}] });
|
|
820
|
+
|
|
821
|
+
class AngularElasticSeachModule {
|
|
822
|
+
static initializeApp(options) {
|
|
823
|
+
return {
|
|
824
|
+
ngModule: AngularElasticSeachModule,
|
|
825
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
1436
826
|
};
|
|
1437
827
|
}
|
|
1438
|
-
|
|
828
|
+
}
|
|
829
|
+
AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
830
|
+
AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
|
|
831
|
+
AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
|
|
832
|
+
{
|
|
833
|
+
provide: ProductsIndex,
|
|
834
|
+
useFactory: (configuration) => {
|
|
835
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
836
|
+
},
|
|
837
|
+
deps: [ES_CONFIG],
|
|
838
|
+
},
|
|
839
|
+
] });
|
|
840
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
|
|
841
|
+
type: NgModule,
|
|
842
|
+
args: [{
|
|
843
|
+
providers: [
|
|
844
|
+
{
|
|
845
|
+
provide: ProductsIndex,
|
|
846
|
+
useFactory: (configuration) => {
|
|
847
|
+
return new ProductsIndex(new AxiosAdapter(configuration));
|
|
848
|
+
},
|
|
849
|
+
deps: [ES_CONFIG],
|
|
850
|
+
},
|
|
851
|
+
],
|
|
852
|
+
}]
|
|
853
|
+
}] });
|
|
854
|
+
|
|
855
|
+
class AngularFirestoreModule {
|
|
856
|
+
static initializeApp(options, nameOrConfig) {
|
|
1439
857
|
return {
|
|
1440
|
-
|
|
1441
|
-
|
|
858
|
+
ngModule: AngularFirestoreModule,
|
|
859
|
+
providers: [
|
|
860
|
+
{ provide: FIREBASE_OPTIONS, useValue: options.firebase },
|
|
861
|
+
{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
862
|
+
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
863
|
+
],
|
|
1442
864
|
};
|
|
1443
865
|
}
|
|
1444
866
|
}
|
|
867
|
+
AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
868
|
+
AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$2.FirebaseAppModule, i1$1.FirestoreModule] });
|
|
869
|
+
AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
|
|
870
|
+
{
|
|
871
|
+
provide: 'BeautyProfileRepository',
|
|
872
|
+
useFactory: (firestore, userRepository) => {
|
|
873
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
874
|
+
},
|
|
875
|
+
deps: [Firestore, 'UserRepository'],
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
provide: 'Buy2WinRepository',
|
|
879
|
+
useFactory: (firestore) => {
|
|
880
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
881
|
+
},
|
|
882
|
+
deps: [Firestore],
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
provide: CategoryFirestoreRepository,
|
|
886
|
+
useFactory: (firestore) => {
|
|
887
|
+
return new CategoryFirestoreRepository(firestore);
|
|
888
|
+
},
|
|
889
|
+
deps: [Firestore],
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
provide: 'CheckoutRepository',
|
|
893
|
+
useFactory: (firestore) => {
|
|
894
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
895
|
+
},
|
|
896
|
+
deps: [Firestore],
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
900
|
+
useFactory: (firestore) => {
|
|
901
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
902
|
+
},
|
|
903
|
+
deps: [Firestore],
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
provide: 'CouponRepository',
|
|
907
|
+
useFactory: (firestore) => {
|
|
908
|
+
return new CouponFirestoreRepository(firestore);
|
|
909
|
+
},
|
|
910
|
+
deps: [Firestore],
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
provide: 'EditionRepository',
|
|
914
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
915
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
916
|
+
},
|
|
917
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
provide: 'HomeRepository',
|
|
921
|
+
useFactory: (firestore) => {
|
|
922
|
+
return new HomeFirestoreRepository(firestore);
|
|
923
|
+
},
|
|
924
|
+
deps: [Firestore],
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
provide: 'LeadRepository',
|
|
928
|
+
useFactory: (firestore) => {
|
|
929
|
+
return new LeadFirestoreRepository(firestore);
|
|
930
|
+
},
|
|
931
|
+
deps: [Firestore],
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
provide: 'LegacyOrderRepository',
|
|
935
|
+
useFactory: (firestore) => {
|
|
936
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
937
|
+
},
|
|
938
|
+
deps: [Firestore],
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
provide: 'ShopMenuRepository',
|
|
942
|
+
useFactory: (firestore) => {
|
|
943
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
944
|
+
},
|
|
945
|
+
deps: [Firestore],
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
provide: 'OrderRepository',
|
|
949
|
+
useFactory: (firestore) => {
|
|
950
|
+
return new OrderFirestoreRepository(firestore);
|
|
951
|
+
},
|
|
952
|
+
deps: [Firestore],
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
provide: 'PaymentRepository',
|
|
956
|
+
useFactory: (firestore) => {
|
|
957
|
+
return new PaymentFirestoreRepository(firestore);
|
|
958
|
+
},
|
|
959
|
+
deps: [Firestore],
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
provide: ProductFirestoreRepository,
|
|
963
|
+
useFactory: (firestore) => {
|
|
964
|
+
return new ProductFirestoreRepository(firestore);
|
|
965
|
+
},
|
|
966
|
+
deps: [Firestore],
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
provide: 'SubscriptionPaymentRepository',
|
|
970
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
971
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
972
|
+
},
|
|
973
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
provide: 'SubscriptionPlanRepository',
|
|
977
|
+
useFactory: (firestore) => {
|
|
978
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
979
|
+
},
|
|
980
|
+
deps: [Firestore],
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
provide: 'SubscriptionProductRepository',
|
|
984
|
+
useFactory: (firestore) => {
|
|
985
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
986
|
+
},
|
|
987
|
+
deps: [Firestore],
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
provide: 'SubscriptionRepository',
|
|
991
|
+
useFactory: (firestore) => {
|
|
992
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
993
|
+
},
|
|
994
|
+
deps: [Firestore],
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
provide: 'UserRepository',
|
|
998
|
+
useFactory: (firestore) => {
|
|
999
|
+
return new UserFirestoreRepository(firestore);
|
|
1000
|
+
},
|
|
1001
|
+
deps: [Firestore],
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
provide: 'UserAddressRepository',
|
|
1005
|
+
useFactory: (firestore, userRepository) => {
|
|
1006
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1007
|
+
},
|
|
1008
|
+
deps: [Firestore, 'UserRepository'],
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
provide: 'UserPaymentMethodRepository',
|
|
1012
|
+
useFactory: (firestore, userRepository) => {
|
|
1013
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1014
|
+
},
|
|
1015
|
+
deps: [Firestore, 'UserRepository'],
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
provide: ProductVariantFirestoreRepository,
|
|
1019
|
+
useFactory: (firestore, productRepository) => {
|
|
1020
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1021
|
+
},
|
|
1022
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1023
|
+
},
|
|
1024
|
+
], imports: [AngularElasticSeachModule,
|
|
1025
|
+
provideFirebaseApp((injector) => {
|
|
1026
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1027
|
+
return appName
|
|
1028
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1029
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1030
|
+
}),
|
|
1031
|
+
provideFirestore(() => getFirestore())] });
|
|
1032
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
|
|
1033
|
+
type: NgModule,
|
|
1034
|
+
args: [{
|
|
1035
|
+
imports: [
|
|
1036
|
+
AngularElasticSeachModule,
|
|
1037
|
+
provideFirebaseApp((injector) => {
|
|
1038
|
+
const appName = injector.get(FIREBASE_APP_NAME);
|
|
1039
|
+
return appName
|
|
1040
|
+
? initializeApp(injector.get(FIREBASE_OPTIONS), appName)
|
|
1041
|
+
: initializeApp(injector.get(FIREBASE_OPTIONS));
|
|
1042
|
+
}),
|
|
1043
|
+
provideFirestore(() => getFirestore()),
|
|
1044
|
+
],
|
|
1045
|
+
providers: [
|
|
1046
|
+
{
|
|
1047
|
+
provide: 'BeautyProfileRepository',
|
|
1048
|
+
useFactory: (firestore, userRepository) => {
|
|
1049
|
+
return new UserBeautyProfileFirestoreRepository(firestore, userRepository);
|
|
1050
|
+
},
|
|
1051
|
+
deps: [Firestore, 'UserRepository'],
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
provide: 'Buy2WinRepository',
|
|
1055
|
+
useFactory: (firestore) => {
|
|
1056
|
+
return new Buy2WinFirestoreRepository(firestore);
|
|
1057
|
+
},
|
|
1058
|
+
deps: [Firestore],
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
provide: CategoryFirestoreRepository,
|
|
1062
|
+
useFactory: (firestore) => {
|
|
1063
|
+
return new CategoryFirestoreRepository(firestore);
|
|
1064
|
+
},
|
|
1065
|
+
deps: [Firestore],
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
provide: 'CheckoutRepository',
|
|
1069
|
+
useFactory: (firestore) => {
|
|
1070
|
+
return new CheckoutFirestoreRepository(firestore);
|
|
1071
|
+
},
|
|
1072
|
+
deps: [Firestore],
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
1076
|
+
useFactory: (firestore) => {
|
|
1077
|
+
return new CheckoutSubscriptionFirestoreRepository(firestore);
|
|
1078
|
+
},
|
|
1079
|
+
deps: [Firestore],
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
provide: 'CouponRepository',
|
|
1083
|
+
useFactory: (firestore) => {
|
|
1084
|
+
return new CouponFirestoreRepository(firestore);
|
|
1085
|
+
},
|
|
1086
|
+
deps: [Firestore],
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
provide: 'EditionRepository',
|
|
1090
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1091
|
+
return new SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
|
|
1092
|
+
},
|
|
1093
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
provide: 'HomeRepository',
|
|
1097
|
+
useFactory: (firestore) => {
|
|
1098
|
+
return new HomeFirestoreRepository(firestore);
|
|
1099
|
+
},
|
|
1100
|
+
deps: [Firestore],
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
provide: 'LeadRepository',
|
|
1104
|
+
useFactory: (firestore) => {
|
|
1105
|
+
return new LeadFirestoreRepository(firestore);
|
|
1106
|
+
},
|
|
1107
|
+
deps: [Firestore],
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
provide: 'LegacyOrderRepository',
|
|
1111
|
+
useFactory: (firestore) => {
|
|
1112
|
+
return new LegacyOrderFirestoreRepository(firestore);
|
|
1113
|
+
},
|
|
1114
|
+
deps: [Firestore],
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
provide: 'ShopMenuRepository',
|
|
1118
|
+
useFactory: (firestore) => {
|
|
1119
|
+
return new ShopMenuFirestoreRepository(firestore);
|
|
1120
|
+
},
|
|
1121
|
+
deps: [Firestore],
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
provide: 'OrderRepository',
|
|
1125
|
+
useFactory: (firestore) => {
|
|
1126
|
+
return new OrderFirestoreRepository(firestore);
|
|
1127
|
+
},
|
|
1128
|
+
deps: [Firestore],
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
provide: 'PaymentRepository',
|
|
1132
|
+
useFactory: (firestore) => {
|
|
1133
|
+
return new PaymentFirestoreRepository(firestore);
|
|
1134
|
+
},
|
|
1135
|
+
deps: [Firestore],
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
provide: ProductFirestoreRepository,
|
|
1139
|
+
useFactory: (firestore) => {
|
|
1140
|
+
return new ProductFirestoreRepository(firestore);
|
|
1141
|
+
},
|
|
1142
|
+
deps: [Firestore],
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
provide: 'SubscriptionPaymentRepository',
|
|
1146
|
+
useFactory: (firestore, subscriptionRepository) => {
|
|
1147
|
+
return new SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
|
|
1148
|
+
},
|
|
1149
|
+
deps: [Firestore, 'SubscriptionRepository'],
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
provide: 'SubscriptionPlanRepository',
|
|
1153
|
+
useFactory: (firestore) => {
|
|
1154
|
+
return new SubscriptionPlanFirestoreRepository(firestore);
|
|
1155
|
+
},
|
|
1156
|
+
deps: [Firestore],
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
provide: 'SubscriptionProductRepository',
|
|
1160
|
+
useFactory: (firestore) => {
|
|
1161
|
+
return new SubscriptionProductFirestoreRepository(firestore);
|
|
1162
|
+
},
|
|
1163
|
+
deps: [Firestore],
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
provide: 'SubscriptionRepository',
|
|
1167
|
+
useFactory: (firestore) => {
|
|
1168
|
+
return new SubscriptionFirestoreRepository(firestore);
|
|
1169
|
+
},
|
|
1170
|
+
deps: [Firestore],
|
|
1171
|
+
},
|
|
1172
|
+
{
|
|
1173
|
+
provide: 'UserRepository',
|
|
1174
|
+
useFactory: (firestore) => {
|
|
1175
|
+
return new UserFirestoreRepository(firestore);
|
|
1176
|
+
},
|
|
1177
|
+
deps: [Firestore],
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
provide: 'UserAddressRepository',
|
|
1181
|
+
useFactory: (firestore, userRepository) => {
|
|
1182
|
+
return new UserAddressFirestoreRepository(firestore, userRepository);
|
|
1183
|
+
},
|
|
1184
|
+
deps: [Firestore, 'UserRepository'],
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
provide: 'UserPaymentMethodRepository',
|
|
1188
|
+
useFactory: (firestore, userRepository) => {
|
|
1189
|
+
return new UserPaymentMethodFirestoreRepository(firestore, userRepository);
|
|
1190
|
+
},
|
|
1191
|
+
deps: [Firestore, 'UserRepository'],
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
provide: ProductVariantFirestoreRepository,
|
|
1195
|
+
useFactory: (firestore, productRepository) => {
|
|
1196
|
+
return new ProductVariantFirestoreRepository(firestore, productRepository);
|
|
1197
|
+
},
|
|
1198
|
+
deps: [Firestore, ProductFirestoreRepository],
|
|
1199
|
+
},
|
|
1200
|
+
],
|
|
1201
|
+
}]
|
|
1202
|
+
}] });
|
|
1445
1203
|
|
|
1446
|
-
class
|
|
1447
|
-
|
|
1448
|
-
return
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
return [];
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
var ProductSorts;
|
|
1456
|
-
(function (ProductSorts) {
|
|
1457
|
-
ProductSorts["MOST_RELEVANT"] = "most-relevant";
|
|
1458
|
-
ProductSorts["BEST_SELLER"] = "best-sellers";
|
|
1459
|
-
ProductSorts["BIGGEST_PRICE"] = "biggest-price";
|
|
1460
|
-
ProductSorts["LOWEST_PRICE"] = "lowest-price";
|
|
1461
|
-
ProductSorts["BIGGEST_DISCOUNT"] = "biggest-discount";
|
|
1462
|
-
ProductSorts["BEST_RATING"] = "best-rating";
|
|
1463
|
-
})(ProductSorts || (ProductSorts = {}));
|
|
1464
|
-
|
|
1465
|
-
class CategoryWithTree extends Category {
|
|
1466
|
-
}
|
|
1467
|
-
__decorate([
|
|
1468
|
-
Type(() => CategoryWithTree),
|
|
1469
|
-
__metadata("design:type", Array)
|
|
1470
|
-
], CategoryWithTree.prototype, "children", void 0);
|
|
1471
|
-
|
|
1472
|
-
class CheckoutSubscriptionService {
|
|
1473
|
-
constructor(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
1474
|
-
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
1475
|
-
this.subscriptionRepository = subscriptionRepository;
|
|
1476
|
-
this.couponService = couponService;
|
|
1477
|
-
}
|
|
1478
|
-
getCheckoutSubscription(checkoutData) {
|
|
1479
|
-
const checkoutId = cookie.get('checkoutSubscriptionId');
|
|
1480
|
-
if (!isNil(checkoutId))
|
|
1481
|
-
return from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
1482
|
-
return from(this.createCheckoutSubscription(checkoutData));
|
|
1483
|
-
}
|
|
1484
|
-
createCheckoutSubscription(checkoutData) {
|
|
1485
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1486
|
-
const checkout = yield this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, CheckoutSubscription.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()));
|
|
1487
|
-
cookie.set('checkoutSubscriptionId', checkout.id);
|
|
1488
|
-
return checkout;
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1491
|
-
clearCheckoutSubscriptionFromSession() {
|
|
1492
|
-
cookie.remove('checkoutSubscriptionId');
|
|
1493
|
-
return of();
|
|
1494
|
-
}
|
|
1495
|
-
checkCoupon(nickname, userEmail) {
|
|
1496
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService
|
|
1497
|
-
.checkCoupon(nickname, userEmail, CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
1498
|
-
.pipe()));
|
|
1499
|
-
}
|
|
1500
|
-
calcDiscountSubscription(coupon) {
|
|
1501
|
-
return this.getCheckoutSubscription().pipe(concatMap((checkout) => this.couponService.calcDiscountSubscription(coupon, checkout).pipe()));
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
CheckoutSubscriptionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1505
|
-
CheckoutSubscriptionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService });
|
|
1506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutSubscriptionService, decorators: [{
|
|
1507
|
-
type: Injectable
|
|
1508
|
-
}], ctorParameters: function () {
|
|
1509
|
-
return [{ type: undefined, decorators: [{
|
|
1510
|
-
type: Inject,
|
|
1511
|
-
args: ['CheckoutSubscriptionRepository']
|
|
1512
|
-
}] }, { type: undefined, decorators: [{
|
|
1513
|
-
type: Inject,
|
|
1514
|
-
args: ['SubscriptionRepository']
|
|
1515
|
-
}] }, { type: CouponService }];
|
|
1516
|
-
} });
|
|
1517
|
-
|
|
1518
|
-
class HomeShopService {
|
|
1519
|
-
constructor(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
1520
|
-
this.categoryRepository = categoryRepository;
|
|
1521
|
-
this.homeRepository = homeRepository;
|
|
1522
|
-
this.productRepository = productRepository;
|
|
1523
|
-
this.defaultShop = defaultShop;
|
|
1524
|
-
this.buildCategoryGroupWithRequiredData = (group) => {
|
|
1525
|
-
var _a, _b;
|
|
1526
|
-
return ({
|
|
1527
|
-
category: Category.toInstance(pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
|
|
1528
|
-
products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map((product) => Product.toInstance(pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
|
|
1529
|
-
'id',
|
|
1530
|
-
'price',
|
|
1531
|
-
'reviews',
|
|
1532
|
-
'hasVariants',
|
|
1533
|
-
'slug',
|
|
1534
|
-
'sku',
|
|
1535
|
-
'stock',
|
|
1536
|
-
'costPrice',
|
|
1537
|
-
'images',
|
|
1538
|
-
'miniatures',
|
|
1539
|
-
'name',
|
|
1540
|
-
'weight',
|
|
1541
|
-
'rate',
|
|
1542
|
-
'type',
|
|
1543
|
-
])))) || [],
|
|
1544
|
-
});
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
get homeId() {
|
|
1548
|
-
if (this.defaultShop === Shops.GLAMSHOP)
|
|
1549
|
-
return 'glamshop';
|
|
1550
|
-
if (this.defaultShop === Shops.MENSMARKET)
|
|
1551
|
-
return 'mens_market';
|
|
1552
|
-
return null;
|
|
1553
|
-
}
|
|
1554
|
-
getHomeData() {
|
|
1555
|
-
return this.getHomeConfiguration().pipe(map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
|
|
1556
|
-
? of(home)
|
|
1557
|
-
: forkJoin([this.getDiscoverProducts(), this.getFeaturedProducts(), this.getVerticalProducts()]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
|
|
1558
|
-
discoverProducts,
|
|
1559
|
-
featuredProducts,
|
|
1560
|
-
verticalProducts,
|
|
1561
|
-
})), concatMap((data) => this.saveHomeData(data)))));
|
|
1562
|
-
}
|
|
1563
|
-
getBanners(type) {
|
|
1564
|
-
return this.getHomeConfiguration().pipe(map((home) => {
|
|
1565
|
-
if (type === 'brand')
|
|
1566
|
-
return home.brandsCarousel;
|
|
1567
|
-
if (type === 'buyToWin')
|
|
1568
|
-
return [home.buyToWinBanner];
|
|
1569
|
-
if (type === 'block')
|
|
1570
|
-
return home.blockBanners;
|
|
1571
|
-
if (type === 'blog')
|
|
1572
|
-
return [home.blogBanner];
|
|
1573
|
-
return [];
|
|
1574
|
-
}));
|
|
1575
|
-
}
|
|
1576
|
-
getMinValueForFreeShipping() {
|
|
1577
|
-
return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
|
|
1578
|
-
}
|
|
1579
|
-
getDiscoverProducts() {
|
|
1580
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
1581
|
-
}
|
|
1582
|
-
getFeaturedProducts() {
|
|
1583
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => from(this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
|
|
1584
|
-
}
|
|
1585
|
-
getVerticalProducts() {
|
|
1586
|
-
return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => from(this.categoryRepository.get({ id })).pipe(concatMap((category) => from(this.productRepository.find({
|
|
1587
|
-
filters: { categories: { operator: Where.IN, value: [category.id] } },
|
|
1588
|
-
limits: { limit: 12 },
|
|
1589
|
-
})).pipe(map((products) => ({ category, products })))), map(({ category, products }) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
|
|
1590
|
-
}
|
|
1591
|
-
getHomeConfiguration() {
|
|
1592
|
-
return of(this.homeConfiguration).pipe(concatMap((home) => home
|
|
1593
|
-
? of(home)
|
|
1594
|
-
: !this.homeId
|
|
1595
|
-
? throwError(new RequiredArgumentError(['homeId']))
|
|
1596
|
-
: from(this.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
|
|
1597
|
-
}
|
|
1598
|
-
saveHomeData(homeData) {
|
|
1599
|
-
const data = {
|
|
1600
|
-
createdAt: new Date(),
|
|
1601
|
-
expiresAt: add(new Date(), { hours: 1 }),
|
|
1602
|
-
data: homeData,
|
|
1204
|
+
class AngularHasuraGraphQLModule {
|
|
1205
|
+
static initializeApp(options) {
|
|
1206
|
+
return {
|
|
1207
|
+
ngModule: AngularHasuraGraphQLModule,
|
|
1208
|
+
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
1603
1209
|
};
|
|
1604
|
-
return from(this.homeRepository.update({
|
|
1605
|
-
id: this.homeId,
|
|
1606
|
-
data,
|
|
1607
|
-
})).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1611
|
-
HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService });
|
|
1612
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, decorators: [{
|
|
1613
|
-
type: Injectable
|
|
1614
|
-
}], ctorParameters: function () {
|
|
1615
|
-
return [{ type: undefined, decorators: [{
|
|
1616
|
-
type: Inject,
|
|
1617
|
-
args: ['CategoryRepository']
|
|
1618
|
-
}] }, { type: undefined, decorators: [{
|
|
1619
|
-
type: Inject,
|
|
1620
|
-
args: ['HomeRepository']
|
|
1621
|
-
}] }, { type: undefined, decorators: [{
|
|
1622
|
-
type: Inject,
|
|
1623
|
-
args: ['ProductRepository']
|
|
1624
|
-
}] }, { type: i3.Shops, decorators: [{
|
|
1625
|
-
type: Inject,
|
|
1626
|
-
args: [DEFAULT_SHOP]
|
|
1627
|
-
}] }];
|
|
1628
|
-
} });
|
|
1629
|
-
|
|
1630
|
-
class OrderService {
|
|
1631
|
-
constructor(angularFirestore, orderRepository) {
|
|
1632
|
-
this.angularFirestore = angularFirestore;
|
|
1633
|
-
this.orderRepository = orderRepository;
|
|
1634
|
-
this.orderSubject = new Subject();
|
|
1635
|
-
}
|
|
1636
|
-
getOrder(id) {
|
|
1637
|
-
docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
|
|
1638
|
-
.pipe(map((doc) => Order.toInstance(doc.data())))
|
|
1639
|
-
.subscribe((doc) => this.orderSubject.next(doc));
|
|
1640
|
-
return this.orderSubject;
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$2.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1644
|
-
OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
|
|
1645
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
|
|
1646
|
-
type: Injectable
|
|
1647
|
-
}], ctorParameters: function () {
|
|
1648
|
-
return [{ type: i1$2.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
|
|
1649
|
-
type: Inject,
|
|
1650
|
-
args: ['OrderRepository']
|
|
1651
|
-
}] }];
|
|
1652
|
-
} });
|
|
1653
|
-
|
|
1654
|
-
class ShippingService {
|
|
1655
|
-
constructor(http, apiUrl, homeService) {
|
|
1656
|
-
this.http = http;
|
|
1657
|
-
this.apiUrl = apiUrl;
|
|
1658
|
-
this.homeService = homeService;
|
|
1659
|
-
}
|
|
1660
|
-
getShippingMethods(shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
1661
|
-
return combineLatest([
|
|
1662
|
-
this.homeService.getHomeData(),
|
|
1663
|
-
this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`),
|
|
1664
|
-
]).pipe(map(([datas, shippingMethodsResponse]) => {
|
|
1665
|
-
let shippingMethods = shippingMethodsResponse.result;
|
|
1666
|
-
if (!shippingMethods.length)
|
|
1667
|
-
return [];
|
|
1668
|
-
shippingMethods = shippingMethods.map((shippingMethod) => {
|
|
1669
|
-
if (shippingMethod.ShippingCompanyName == 'Same Day EG')
|
|
1670
|
-
shippingMethod.ShippingCompanyName = 'Same Day';
|
|
1671
|
-
return shippingMethod;
|
|
1672
|
-
});
|
|
1673
|
-
const datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
1674
|
-
if (this.isHolidays(datasSameDayNotAvaliable)) {
|
|
1675
|
-
shippingMethods = shippingMethods.filter((method) => method.serviceName !== 'Same Day');
|
|
1676
|
-
}
|
|
1677
|
-
if (totalPrice >= 200) {
|
|
1678
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1679
|
-
if (s.serviceName !== 'Same Day')
|
|
1680
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1681
|
-
else
|
|
1682
|
-
return s;
|
|
1683
|
-
});
|
|
1684
|
-
}
|
|
1685
|
-
if (shop == Shops.GLAMSHOP)
|
|
1686
|
-
return shippingMethods;
|
|
1687
|
-
if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
1688
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1689
|
-
if (s.serviceName == 'Same Day')
|
|
1690
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1691
|
-
else
|
|
1692
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
if (this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
1696
|
-
shippingMethods = shippingMethods.map((s) => {
|
|
1697
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
1700
|
-
return shippingMethods;
|
|
1701
|
-
}));
|
|
1702
|
-
}
|
|
1703
|
-
isFreeShippingBySubscription(shop, subscriptionPlan) {
|
|
1704
|
-
if (!subscriptionPlan)
|
|
1705
|
-
return false;
|
|
1706
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'SELECT')
|
|
1707
|
-
return true;
|
|
1708
|
-
return false;
|
|
1709
|
-
}
|
|
1710
|
-
isHalfShippingBySubscription(shop, subscriptionPlan) {
|
|
1711
|
-
if (!subscriptionPlan)
|
|
1712
|
-
return false;
|
|
1713
|
-
if (shop == Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
1714
|
-
return true;
|
|
1715
|
-
}
|
|
1716
|
-
return false;
|
|
1717
|
-
}
|
|
1718
|
-
isHolidays(datas) {
|
|
1719
|
-
const today = new Date();
|
|
1720
|
-
for (const key in datas) {
|
|
1721
|
-
let start = new Date(`${today.getFullYear()}-${datas[key].beginDate}`);
|
|
1722
|
-
let end = new Date(`${today.getFullYear()}-${datas[key].endDate}`);
|
|
1723
|
-
if (start > end)
|
|
1724
|
-
end = new Date(`${today.getFullYear() + 1}-${datas[key].endDate}`);
|
|
1725
|
-
if (today >= start && today <= end)
|
|
1726
|
-
return true;
|
|
1727
|
-
}
|
|
1728
|
-
return false;
|
|
1729
1210
|
}
|
|
1730
1211
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
i0.ɵɵ
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1212
|
+
AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1213
|
+
AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
|
|
1214
|
+
AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
|
|
1215
|
+
{
|
|
1216
|
+
provide: 'HasuraConfig',
|
|
1217
|
+
useFactory: (options, platformId) => ({
|
|
1218
|
+
endpoint: options.endpoint,
|
|
1219
|
+
authOptions: options.credentials,
|
|
1220
|
+
interceptors: {
|
|
1221
|
+
request: (request) => {
|
|
1222
|
+
console.log('request', request);
|
|
1223
|
+
},
|
|
1224
|
+
response: (response) => {
|
|
1225
|
+
console.log('response', response);
|
|
1226
|
+
},
|
|
1227
|
+
},
|
|
1228
|
+
}),
|
|
1229
|
+
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
provide: 'CategoryRepository',
|
|
1233
|
+
useExisting: CategoryHasuraGraphQLRepository,
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
provide: CategoryHasuraGraphQLRepository,
|
|
1237
|
+
useFactory: (options, productRepository) => {
|
|
1238
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1239
|
+
},
|
|
1240
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
provide: 'ProductRepository',
|
|
1244
|
+
useExisting: ProductHasuraGraphQLRepository,
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
provide: ProductHasuraGraphQLRepository,
|
|
1248
|
+
useFactory: (options) => {
|
|
1249
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1250
|
+
},
|
|
1251
|
+
deps: [HASURA_OPTIONS],
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
provide: 'VariantRepository',
|
|
1255
|
+
useExisting: VariantHasuraGraphQLRepository,
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
provide: VariantHasuraGraphQLRepository,
|
|
1259
|
+
useFactory: (options) => {
|
|
1260
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1261
|
+
},
|
|
1262
|
+
deps: [HASURA_OPTIONS],
|
|
1263
|
+
},
|
|
1264
|
+
] });
|
|
1265
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
|
|
1266
|
+
type: NgModule,
|
|
1267
|
+
args: [{
|
|
1268
|
+
providers: [
|
|
1269
|
+
{
|
|
1270
|
+
provide: 'HasuraConfig',
|
|
1271
|
+
useFactory: (options, platformId) => ({
|
|
1272
|
+
endpoint: options.endpoint,
|
|
1273
|
+
authOptions: options.credentials,
|
|
1274
|
+
interceptors: {
|
|
1275
|
+
request: (request) => {
|
|
1276
|
+
console.log('request', request);
|
|
1277
|
+
},
|
|
1278
|
+
response: (response) => {
|
|
1279
|
+
console.log('response', response);
|
|
1280
|
+
},
|
|
1281
|
+
},
|
|
1282
|
+
}),
|
|
1283
|
+
deps: [HASURA_OPTIONS, PLATFORM_ID],
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
provide: 'CategoryRepository',
|
|
1287
|
+
useExisting: CategoryHasuraGraphQLRepository,
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
provide: CategoryHasuraGraphQLRepository,
|
|
1291
|
+
useFactory: (options, productRepository) => {
|
|
1292
|
+
return new CategoryHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials }, productRepository);
|
|
1293
|
+
},
|
|
1294
|
+
deps: [HASURA_OPTIONS, ProductHasuraGraphQLRepository],
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
provide: 'ProductRepository',
|
|
1298
|
+
useExisting: ProductHasuraGraphQLRepository,
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
provide: ProductHasuraGraphQLRepository,
|
|
1302
|
+
useFactory: (options) => {
|
|
1303
|
+
return new ProductHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1304
|
+
},
|
|
1305
|
+
deps: [HASURA_OPTIONS],
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
provide: 'VariantRepository',
|
|
1309
|
+
useExisting: VariantHasuraGraphQLRepository,
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
provide: VariantHasuraGraphQLRepository,
|
|
1313
|
+
useFactory: (options) => {
|
|
1314
|
+
return new VariantHasuraGraphQLRepository({ endpoint: options.endpoint, authOptions: options.credentials });
|
|
1315
|
+
},
|
|
1316
|
+
deps: [HASURA_OPTIONS],
|
|
1317
|
+
},
|
|
1318
|
+
],
|
|
1319
|
+
}]
|
|
1320
|
+
}] });
|
|
1741
1321
|
|
|
1742
1322
|
class AngularConnectModule {
|
|
1743
1323
|
static initializeApp(defaultShop, options, nameOrConfig) {
|
|
@@ -1749,7 +1329,6 @@ class AngularConnectModule {
|
|
|
1749
1329
|
...(isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]),
|
|
1750
1330
|
...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]),
|
|
1751
1331
|
...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]),
|
|
1752
|
-
...(isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]),
|
|
1753
1332
|
],
|
|
1754
1333
|
};
|
|
1755
1334
|
}
|
|
@@ -1759,14 +1338,11 @@ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", ve
|
|
|
1759
1338
|
AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, providers: [
|
|
1760
1339
|
AuthService,
|
|
1761
1340
|
CartService,
|
|
1762
|
-
CatalogService,
|
|
1763
|
-
CategoryService,
|
|
1764
1341
|
CheckoutService,
|
|
1765
1342
|
CheckoutSubscriptionService,
|
|
1766
1343
|
CouponService,
|
|
1767
1344
|
HomeShopService,
|
|
1768
1345
|
OrderService,
|
|
1769
|
-
ShippingService,
|
|
1770
1346
|
], imports: [AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
1771
1347
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
|
|
1772
1348
|
type: NgModule,
|
|
@@ -1775,14 +1351,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1775
1351
|
providers: [
|
|
1776
1352
|
AuthService,
|
|
1777
1353
|
CartService,
|
|
1778
|
-
CatalogService,
|
|
1779
|
-
CategoryService,
|
|
1780
1354
|
CheckoutService,
|
|
1781
1355
|
CheckoutSubscriptionService,
|
|
1782
1356
|
CouponService,
|
|
1783
1357
|
HomeShopService,
|
|
1784
1358
|
OrderService,
|
|
1785
|
-
ShippingService,
|
|
1786
1359
|
],
|
|
1787
1360
|
}]
|
|
1788
1361
|
}] });
|
|
@@ -1791,5 +1364,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
1791
1364
|
* Generated bundle index. Do not edit.
|
|
1792
1365
|
*/
|
|
1793
1366
|
|
|
1794
|
-
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService,
|
|
1367
|
+
export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, HomeShopService, OrderService };
|
|
1795
1368
|
//# sourceMappingURL=infrab4a-connect-angular.mjs.map
|