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